View Full Version : Update values on selection
NAMETAG 03-26-2005, 05:48 PM Im trying to have a script update everytime a new object is selected.
My script works out the area of the selected object, but id like it to report the area of any object when the user selects a new object.
At the moment they have to hit an update button to refresh the area.
Is there anyway to do this dynamically?
ie something like:
on selection changed thestate do
(
)
Thanks
|
|
Light
03-26-2005, 06:04 PM
Hi,
Try using a callback:
when select selection[1] changes id:#selX64 do print "Selection Changed"
Don't forget to remove it when you no longer need it:
deleteAllChangeHandlers id:#selX64
Light
NAMETAG
03-26-2005, 06:15 PM
Thanks Light!
Just what i was looking for :thumbsup:
A WHEN construct is not a good idea, because it MONITORS specific objects.
You should use a general callback
callbacks.removeScripts id:#MySelectionCallback
callbacks.addScript #SelectionSetChanged "print \"Selection Changed!\"" id:#MySelectionCallback
instead.
The first line makes sure there are no older callbacks with that ID, the second registers the callback which is executed any time your scene selection changes, (both select or deselect).
To disable it, call the first line alone again...
CGTalk Moderation
03-26-2005, 06:20 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.