PDA

View Full Version : little controller / ListBox Problem


Martin Andersen
01-02-2005, 04:31 AM
Hi I'm building a little Controller Assigner for eatch X, Y, Z axis in Position and Rotation.


-----------------------------

listBox lbxTransType "Select Transform Type" pos:[8,8] width:117 height:6 items:#("X_Position", "Y_Position", "Z_Position", "X_Rotation", "Y_Rotation", "Z_Rotation")

listBox lbxCtrlType "Assign Controller" pos:[8,112] width:117 height:9 items:#("bezier_float", "Float_Expression", "Float_Motion_Capture", "Float_Reactor", "float_script", "linear_float", "Noise_float", "SlaveFloat", "Waveform_Float") selection:1

---

on lbxCtrlType doubleClicked sel do (
maTransType = lbxTransType.selected
maCtrlType = llbxCtrlType.selected

if lbxTransType.selection == 0 then ( MessageBox "Select a Transform type" )

else if lbxTransType.selection >= 1 and lbxTransType.selection <= 3 then (
$.position.controller.maTransType.controller.value = maCtrlType () )


-------------------------------------------------------

in maTransType it says Undefined, I guess its because all items in listBox lbxTransType.. have these " " around there names.

Is this correct, and if so how do I remove them?

Here is just the task that I'm trying to improve:
$.pos.controller.X_Position.controller = Float_Reactor ()

Both "X_Position.controller" and "Float_Reactor" should be driven from the selections in the List boxs.

Damn simple thing, but I'm a little stucked on this problem. Anyone who can help ?

Bobo
01-02-2005, 08:55 AM
...
Damn simple thing, but I'm a little stucked on this problem. Anyone who can help ?
execute ( "$.position.controller."+maTransType+".controller = " + maCtrlType+"()" )

Basically, you take the strings from the listbox, add the rest as strings to build a whole command and call EXECUTE on the whole. Execute sends the string to the Parser as if it was read from a file and turns the text into a MAXScript expression which can be used as if it was typed without quotation marks in the line...

You should not assign to the .value which is the (nomen est omen!) value of the track, you should assign the controller class instance to the .controller property of the track.

Hope this helps.

CGTalk Moderation
01-20-2006, 07:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.