Notifications
Clear all

[Closed] NodeEventCallback> what events + some questions

Hi!

[b]#1[/b]

Im writing some script that show state of Ignore backfacing and later ByAngle/Constraints).

    global licznik=0
    FN fn_TestUpg  ev nd =
    (
    	licznik +=1
    
    	mojNode = modPanel.getCurrentObject()
    	if (ClassOf mojNode == Edit_Poly) then (format"[%] Edit Poly, IgnoreBackfacing : %   Event:% Node:%
" licznik mojNode.ignoreBackfacing ev nd)
    	else if  (ClassOf mojNode == Editable_Poly) then (format"[%] Editable Poly, IgnoreBackfacing : %   Event:% Node:%
" licznik $.ignoreBackfacing ev nd)
    	else format"[%] -----   Event:% Node:%
" licznik ev nd
    )
    
Im using 3 events

[i]- extentionChannelChanged [/i]- it triggers when i change Ignore Backfacing state true/false (i think i can use also [i]displayPropertiesChanged[/i]).

[i]- displayOtherEvent [/i]-when i change modifier in selection stack, and curent modifier is Edit_poly or editable_poly
[i]- selectionChanged [/i]- when i change objects in scene.

Primary by using 2 last events from above i want to achive that when i switch models and the selected one will be editable poly or have last modifier in stack == edit poly then it will show backfacing state. For some cases displayOtherEvent works that way. Problem is when i switch form box model to editable model - event dont triggers. So i used 2 events, both triggers in some cases -[b] is there a way to  reduce events count? Or its not the big case?[/b]

#2 -> New Thread

6 Replies

#1
make a node event callback for ALL:

NodeEventCallback all:... 

and check which you need…

#2
it’s a subject of another thread. something like “Draw text in Viewport” or “Custom View Popup Interface”

2 Replies
(@drathir)
Joined: 11 months ago

Posts: 0

i made event ALL and checked. Thats why i asked, maybe there is way to “reduce events count or its not the big case?”

Maybe you have right. I did not want to litter the forum with too many my threads.

(@denist)
Joined: 11 months ago

Posts: 0

i don’t really know what you do on this callback. of course it’s better to not do the same things multiple times. but as i said because i don’t know what you do i can’t suggest how to avoid it.

It’s not really a good idea to combine two not related questions in one post:
#1 what is Quaternion?
#2 can anyone recommend a good Thai restaurant on East Cost?

from your post i just can guess that you are monitoring the case where an editable poly or an edit poly modifier as current modifier panel object change state of the Ignore Backfacing property.

it’s not a display property. it’s a selecting way option.

all these events are going though macroscript notification system. maybe it’s better to make a macroscript?

i don’t really know what you do on this callback. of course it’s better to not do the same things multiple times. but as i said because i don’t know what you do i can’t suggest how to avoid it.

mainly wanted to know if i can use the duplication of functions (1 function running through 2 events at the same time) and how it will affect performance. I used it in really simple case (checking status of ignore backfacing later + by angle, constraint type, axis constraint etc). Whether the use of such a solution is acceptable.

What i wanted to achive:
-Every change in ignore backfacing status will be detected by event (
extentionChannelChanged)
-If i select 1 object (selection.count == 1) and it will have edit_poly or editable_poly modifier it will check the status of backfacing of highest of this modifiers on the stack (event of selecting object)
-If i select specyfic modifier (if its classOf == edit_poly / editable_poly) it will check status. (event on changing modifiers)

For first event there was no problem. But last 2 events will trigger both in some cases. Ex: when i select box with edit_poly as last modifier – works, if i select box without modifier then i select editable poly object – trigger 1 event. Then (after this editable poly selected) i switch selection to edit poly 2 events will trigger.

if you want check


  global licznik=0
  FN fn_upg  ev nd =
  (
  	licznik +=1
  	--stanA = undefined
  	mojNode = modPanel.getCurrentObject()
  	if (ClassOf mojNode == Edit_Poly) then (format"[%] Edit Poly, IgnoreBackfacing : %   Event:% Node:%
" licznik mojNode.ignoreBackfacing ev nd)
  	else if  (ClassOf mojNode == Editable_Poly) then (format"[%] Editable Poly, IgnoreBackfacing : %   Event:% Node:%
" licznik $.ignoreBackfacing ev nd)
  	else format"[%] -----   Event:% Node:%
" licznik ev nd
  )
  
  callbackItem1 = NodeEventCallback mouseUp:true delay:1000 displayOtherEvent:fn_upg  extentionChannelChanged:fn_upg
  
  and then check
  callbackItem2 = NodeEventCallback mouseUp:true delay:1000 extentionChannelChanged:fn_upg displayOtherEvent:fn_upg  
  

Scene with 3 boxes
1st convert to edit poly
2nd add modifier Edit poly
3rd do nothing (leave box)
then when you switch objects not every case (edit_poly, editable poly objects) event will trigger. (callbackItem1)

Sorry for chaotic explanation, i hope you will get my thinking

   from your post i just can guess that you are  monitoring the case where an editable poly or an edit poly modifier as  current modifier panel object change state of the Ignore Backfacing  property.

it’s not a display property. it’s a selecting way option.

all these events are going though macroscript notification system. maybe it’s better to make a macroscript?

Script will be added to mine custom rollout (on/off/settings) and if on will be displaying constantly (if it possible (edit poly/editable poly)) status. I think ill abandon this script and write it with gw.* class.