[Closed] Layer Visibility Changed – No Event Notification?
can you confirm that the changing of a layer visibility doesn’t fire any event?
in my max 2012/64 there is no any event notification for both scripted and manual ways of changing.
try
(
_eventCallback.enabled = off
_eventCallback = undefined
)
catch()
fn _callback event handles =
(
nodes = for n in handles collect (try((getanimbyhandle n).name) catch())
format "event:% nodes:%
" event nodes
)
_eventCallback = NodeEventCallback all:_callback
_eventCallback.enabled = on
callbacks.removescripts id:#hide_node
callbacks.addscript #nodeHide "format \"event:#hide node:%\
\" (callbacks.notificationParam())" id:#hide_node
callbacks.addscript #nodeUnhide "format \"event:#unhide node:%\
\" (callbacks.notificationParam())" id:#hide_node
d = with redraw off
(
resetmaxfile #noprompt
d = LayerManager.newLayerFromName "TheBox"
d.current = on
b = box()
d
)
/*
d.ishidden = on
d.ishidden = off
*/
(please tell about max version you tested). thanks!
But you’re doing a callback on a node being hidden not a layer, you can have a node hidden or unhidden within a layer so the two are different?
No callbacks firing on max 2013 here.
node inherits visibility from a layer. i’m expecting to get any node visibility change notification. i’m not sure but earlier versions of max (< 2010) were firing something…
Max 2011 (from the Layer Manager)
[b]If the Box is not selected:[/b]
Hide/unhide the Layer does not fire any events
Hide/unhide the Box fires:
event:#hide node:$Box:Box001 @ [0.000000,0.000000,0.000000]
event:#callbackBegin nodes:#()
event:#displayPropertiesChanged nodes:#("Box001")
event:#hideChanged nodes:#("Box001")
event:#callbackEnd nodes:#()
event:#unhide node:$Box:Box001 @ [0.000000,0.000000,0.000000]
event:#callbackBegin nodes:#()
event:#displayPropertiesChanged nodes:#(“Box001”)
event:#hideChanged nodes:#(“Box001”)
event:#callbackEnd nodes:#()
If the Box is selected:
Hidden the Layer fires:
event:#callbackBegin nodes:#()
event:#selectionChanged nodes:#(“Box001”)
event:#callbackEnd nodes:#()
Hidden the Box fires:
event:#hide node:$Box:Box001 @ [0.000000,0.000000,0.000000]
event:#callbackBegin nodes:#()
event:#displayPropertiesChanged nodes:#(“Box001”)
event:#selectionChanged nodes:#(“Box001”)
event:#hideChanged nodes:#(“Box001”)
event:#callbackEnd nodes:#()
Scripted Hide/Unhide both works:
$Box001.ishidden = true
[color=Gray]event:#hide node:$Box:Box001 @ [0.000000,0.000000,0.000000]
event:#callbackBegin nodes:#()
event:#displayPropertiesChanged nodes:#(“Box001”)
event:#hideChanged nodes:#(“Box001”)
event:#callbackEnd nodes:#()[/color]
$Box001.ishidden = false
event:#callbackBegin nodes:#()
event:#displayPropertiesChanged nodes:#(“Box001”)
event:#hideChanged nodes:#(“Box001”)
event:#callbackEnd nodes:#()
hide $Box001
event:#hide node:$Box:Box001 @ [0.000000,0.000000,0.000000]
event:#callbackBegin nodes:#()
event:#displayPropertiesChanged nodes:#(“Box001”)
event:#hideChanged nodes:#(“Box001”)
event:#callbackEnd nodes:#()
unhide $Box001
event:#callbackBegin nodes:#()
event:#displayPropertiesChanged nodes:#(“Box001”)
event:#hideChanged nodes:#(“Box001”)
event:#callbackEnd nodes:#()
PD: From the Layer Manager, none of the other properties (Freeze, Render, etc.) seems to work when changed at the Layer level, but they do for the node itself.
sure it works for node properties. where is an actual problem? check my sample… when you set layer’s visibility to off (ishidden = on) it changes all nodes ishidden property to ON as well. but this doesn’t fire any visibility change event. but when we set node’s ishidden property directly (including hide/unhide) the event fires.
it doesn’t really make sense for me.
I did not say the contrary?
Let me refrase the previous statement:
From the Layer Manager, changing the other properties (Freeze, Render, etc.) at the Layer Level do not fire any events either.
From the Layer Manager, changing the other properties (Freeze, Render, etc.) at the Node Level do fire the events.
Does it make sence now?
i see your point now… that’s true. manual changing on node level fires events. anyway the not firing change events on layer level looks for me as a wrong behavior.
I agree, it would be useful to have it included in the #nodeLayerChanged or having a separated Layer Changed notification.
It seems it was never implemented that way, at least not for Max 9 to 2014.
i’ve solved it by using when construct for Layer_Manager Reference Target… but… as i said i don’t understand why the system sends the update notification to all layer dependent nodes but doesn’t fire change events.
just curious… is it broken in last versions only or was always like that?
Because the ishidden property is a convoluted mess? From the Maxscript Help here:
<node>.isHidden Boolean default: false
Get or set whether the node is flagged as hidden in the viewports. A node may be hidden even if this property is false . If the node is flagged as frozen and Hide Frozen Objects is on in the Hide rollout in the Display panel, the node will be hidden regardless of this property’s value.
A node is hidden in the viewport if: 1. The node's hidden flag is set, 2. The node's layer hidden flag is set, 3. The node's category is hidden via Hide By Category, or 4. The node is frozen and Hide Frozen Objects is enabled The node's [i]isHidden[/i] property reflects a combination of conditions 1 and 2. The property returns [i]true[/i] if either condition 1 or 2 is [i] true[/i] . Setting the property to [i] true [/i] sets the node's hidden flag. Setting the property to [i]false [/i] clears both the node's and the node's layer's hidden flag.
-Eric
that’s exactly what confuses me. the changing of layer visibility changes #ishidden property of all dependent nodes. why does it not fire the node visibility change event?
It is a mess, recently I had a script which I needed to unhide an object on the layer but without unhiding the layer and had to use isnodehidden instead of ishidden.
<node>.isNodeHidden Boolean default: false
The node’s isNodeHidden property reflects only condition 1 listed above. The property returns true if the node’s hidden flag is set, false if not. Setting the property sets only the node’s hidden flag.
<node>.isHiddenInVpt Boolean default: false
This is a read-only property that returns true if any of the 4 conditions is true, that is, the node is hidden in the viewport for some reason.