Notifications
Clear all
[Closed] Catching Change Notifications
Aug 10, 2017 10:31 am
I’m working on a little script which creates an object for each light. I want to be able to catch the notification of say when the user changes the texmap of the light (VRay), or changes the type (from Plane to Dome for example). I’ve tried using the ‘when’ construct but it makes things impossible slow. Is there a way to monitor just one attribute?
1 Reply
Aug 10, 2017 10:31 am
no… there is no such callbacks.
i suggest you to look at node event callbacks. run the code below and check that all your looking for events are handled:
global processCallbacks
global callbackContainer = if callbackContainer != undefined do
(
callbackContainer.enabled = off
undefined
)
callbacks.removescripts id:#some_id
deleteAllChangeHandlers id:#some_id
gc light:on
(
fn processCallbacks event handles nodes: =
(
if nodes == unsupplied do nodes = for handle in handles where isvalidnode (node = GetAnimByHandle handle) collect node
format "> % %
" event handles
case event of
(
#callbackBegin: ()
#controllerStructured:
(
)
#selectionChanged:
(
format "node select event: %
" nodes
)
#selectionSetChanged:
(
format "general select event: %
" nodes
)
#whenSelect:
(
format "when select event: %
" nodes
)
#callbackEnd: ()
default: ()
)
)
::processCallbacks = processCallbacks
::callbackContainer = NodeEventCallback all:processCallbacks --mouseUp:on
--callbacks.addscript #selectionSetChanged "processCallbacks #selectionSetChanged #() nodes:(selection as array)" id:#some_id
--when select objects change id:#some_id node do processCallbacks #whenSelect #() nodes:#(node)
)
you say slow… what is actually slow?