Hello,
I'm trying to create a script that automatically makes a morph target react to a control object, I haven't finished yet, as I hit a wall, every time I execute the script(pressing the button) , I get an "unknown system exception".
the code creates a rollout that has a pick morph button with a field to input the channel name, another to pick the control object, and a "wire" button to make the morph react to the control object, every time i click the wire button i get the error.
global morphObjectchannel
global cont
global controlObject
rollout test "pick"
(
pickbutton mbutton "Pick morph" tooltip:"pick an object with a morph modifier"
pickbutton cbutton "pick controller object" tooltip:"pick the controller object"
edittext channelno "Channel number:"
button wire "Wire" tooltip:"wire a controller to the morph"
on mbutton picked obj do
(
-- check for a channel number
if channelno.text == "" then
(
-- if no channel number specified, ask the user to do so
messagebox "please specify the morpher channel"
)
--if there is a channel number
else
(
--collect the channel number
i = channelno.text as integer
--put the morph object channel into the global morphObject
try (morphObjectchannel = obj.morpher[i]) catch(messagebox "please pick an object with a morpher")
--assign a reaction conroller top the morph channel
morphObjectchannel.controller = float_reactor()
cont = morphObjectchannel.controller
)
)
on cbutton picked obj do
(
--TO DO: test for correct frozen object
controlObject = obj
Xlimit = obj.pos.controller[2].controller[1].controller.Limited_Controller__Bezier_Float.controller
Zlimit = obj.pos.controller[2].controller[3].controller.Limited_Controller__Bezier_Float.controller
)
on wire pressed do
(
--print morphObjectchannel
--print Xlimit
---print Zlimit
--print controlObject
reactto cont Xlimit
--move controlObject [25,0,0]
--createReaction cont
--move controlObject [-25,0,0]
)
)
createDialog test
please advice