Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Maxunderground news unavailable

maxscript: is NodeEventCallback evil?
show user profile  Mr_Stabby
I need a way to manage the list of nodes i'm storing in my script, some of them might get deleted or renamed which would mess things up. Instead of rechecking the list every time before doing something though, NodeEventCallback would allow for a very clean looking management.

Here's why I'm hesitant about it though: it triggers the callback on every single object in the scene. To me it seems like the equivalent of hooking all windows messages in order to get arrow key input, evil! What is you're experience with it though? Resource hog? no?

EDIT: Derp, seems irrelevant anyway since the callback handler cant access the plugin local variables while object associated is not active.

read 715 times
2/13/2015 3:26:37 AM (last edit: 2/13/2015 4:00:48 AM)
show user profile  Garp
As you said, clean 'looking' management. There is 'clean' and there is 'clean that hides a bad complexity'.
If performance is critical and the callback is implemented in a spinlock kind of way, it's going to be slow.
As usual in this kind of situation, the answer is: measure.

read 706 times
2/13/2015 4:04:58 AM (last edit: 2/13/2015 4:05:51 AM)
show user profile  Mr_Stabby
Its not usable anyways so I'm forced to recheck the list every time I the script object gets activated or I perform any operation on them.. which is tad excessive. Is there any kind of "on activated" type event that you know of? The only way I found was to piggyback a function on rollout object construction but its unreliable since it might not always be open nor does it shift focus if another script somewhere does stuff.

read 699 times
2/13/2015 4:18:20 AM (last edit: 2/13/2015 4:21:05 AM)
show user profile  Garp
There are lots of other event callbacks besides NodeEventCallback.
Also a change handler might work better.
It's hard to tell without knowing more about your setup.

read 695 times
2/13/2015 4:26:06 AM (last edit: 2/13/2015 4:26:06 AM)
show user profile  Mr_Stabby
Change handlers seem to be doing the trick

read 685 times
2/13/2015 5:21:12 AM (last edit: 2/13/2015 5:21:12 AM)
show user profile  Garp
Good :)
Lucky guesses, sometimes...

read 656 times
2/13/2015 5:34:38 PM (last edit: 2/13/2015 5:34:38 PM)
#Maxforums IRC
Open chat window