PDA

View Full Version : How to "update" pos when selecting new object?


Pixero
08-17-2006, 06:41 AM
Need some help with my first Maxscript.
I've tried to make a numeric transform box that gets the default value from the selected objects position. That works for the first object selected but I need help "updating" the value if another object is selected. How is that done?


try(destroydialog channelbox)catch()
rollout channelbox "JS_ChannelBox"
(
spinner xSpin "Translate X" type:#float range:[-1e+008,1e+007,$.pos.x]
spinner ySpin "Translate Y" type:#float range:[-1e+008,1e+007,$.pos.y]
spinner zSpin "Translate Z" type:#float range:[-1e+008,1e+007,$.pos.z]

on xSpin changed newV do ($.pos = [xSpin.value, ySpin.value, zSpin.value])
on ySpin changed newV do ($.pos = [xSpin.value, ySpin.value, zSpin.value])
on zSpin changed newV do ($.pos = [xSpin.value, ySpin.value, zSpin.value])

)
createdialog channelbox width:192 height:318

HalfVector
08-17-2006, 08:37 AM
You can use the callback mechanism of MAX to know when the selection changes. To do that, you have to register a callback function where you'll handle the selection change code.

You can see an example of this in the MAXScript reference under the How To section:

How To ... Develop a Selected Objects Inspector using ListView ActiveX Control - Part Two

Greets.

CGTalk Moderation
08-17-2006, 08:37 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.