Error running script first time "-- Type error : Call needs function or class, got: undefined"

Error running script first time "-- Type error : Call needs function or class, got: undefined"

jibijib
Collaborator Collaborator
659 Views
1 Reply
Message 1 of 2

Error running script first time "-- Type error : Call needs function or class, got: undefined"

jibijib
Collaborator
Collaborator

I run this script through the script editor - there's no problem with the script itself, but running a function through buttonpressed - there are five buttons. I run with ctrl + E, and the first time I press the button it comes up with this error:

 

jibijib_0-1646429891361.png

 

The process in question is simple, and should work, but produces an error the first time it is run:

Rollout MeshTools "Mesh Tools"

(
button resetTheXformButton "Reset Xform" pos: [2,0] width:250 height:40
button resetRotationButton "Reset Pivot Rotation" pos: [2,40] width:250 height:40
button setPivotToZeroButton "Set Pivot To Centre/Ground 0" pos: [2,80] width:250 height:40
button removeCustomAttributesButton "Remove Custom Attributes" pos: [2,120] width:250 height:40
button reposButton "Reposition Object at z:0" pos: [2,160] width:240 height:40

on resetTheXformButton pressed do
(
ResetTheXform()
)

on resetRotationButton pressed do
(
ResetThePivotRotation()
)
on setPivotToZeroButton pressed do
(
SetPivotToZero()
)

on removeCustomAttributesButton pressed do
(
RemoveCustomAttributes()
)

on reposButton pressed do
(
ReposObject()
)

)

 

If I re-run it, it works fine every time afterwards. What is the problem here - is it running through the editor the problem?

0 Likes
660 Views
1 Reply
Reply (1)
Message 2 of 2

denisT.MaxDoctor
Advisor
Advisor

ResetTheXform()
ResetThePivotRotation()
SetPivotToZero()

RemoveCustomAttributes()

ReposObject()

 

all of these functions you must define before defining the rollout 

 

0 Likes