merge only if node has active display tag

   1003   5   2
User Avatar
Member
36 posts
Joined: Feb. 2016
Online
Hello,
I'm merging a bunch of objects, this is the sop path in my object merge node:

/obj/ManualTrees/Tree_A_rndr*/OUT_instances_A

I would like to only merge in the node(s) (Tree_A_rndr*) if the display tag on that geo node is set to active, is this possible?
In the object merge node documentation I saw a tip that states:

"You can use __display_sop__ or __render_sop__ in the path instead of the name of a real surface node name to have Houdini use whatever node has the display flag or render flag."

I don't understand this tip, is it saying you can only use __display_sop__ by itself, so it will consider everything in the entire scene?
User Avatar
Member
393 posts
Joined: Nov. 2016
Offline
No, it's saying you can enter

/obj/ManualTrees/Tree_A_rndr*/__display_sop__

to import whichever node has the display tag in that object. As to what you want to achieve, one way would be having a switch with expression

ch("../tdisplay")

before your OUT null, switching to nothing if your display is off. There are probably cleaner options.
Edited by Tanto - April 18, 2023 11:45:51
User Avatar
Member
36 posts
Joined: Feb. 2016
Online
Tanto
No, it's saying you can enter

/obj/ManualTrees/Tree_A_rndr*/__display_sop__

to import whichever node has the display tag in that object.

Thank you for the clarification! That's really good to know.

Tanto
As to what you want to achieve, one way would be having a switch with expression

ch("../tdisplay")

before your OUT null, switching to nothing if your display is off. There are probably cleaner options.


That's exactly what I was curious about, how to access the display flag as a parameter, since I couldn't find it anywhere except in the network view.
I tried the switch setup you suggested, but it doesn't seem to work:
https://www.dropbox.com/s/i3fnpzdf0hvnrhq/displayFlag.gif?raw=1 [www.dropbox.com]
User Avatar
Member
393 posts
Joined: Nov. 2016
Offline
My mistake, the parameter was actually ch("../display"), and even then it's not affected by the display flag.
User Avatar
Member
36 posts
Joined: Feb. 2016
Online
Tanto
My mistake, the parameter was actually ch("../display"), and even then it's not affected by the display flag.
Aw yeah, I tried that one too strange
User Avatar
Member
6 posts
Joined: Nov. 2016
Offline
I was also interested in doing this for a project and ended up writing a Python node for it which worked decently enough.
A bit hacky but works alright. Only caveat is sometimes it doesn't update properly when toggling visibility.

You have to turn on "create per primitive-path" and "pack geometry before merging" in the objectmerge sop so that it treats OBJ nodes as a whole and create a visibility attribute on the geometry stream before the Python node.

node = hou.pwd()
geo = node.geometry()

for point in geo.points():
    path = point.attribValue("objname")
    node = hou.node(path)
    parent = node.parent()
    isOn = parent.isDisplayFlagSet()
    point.setAttribValue("isOn", isOn)
    

Attachments:
merge_visible.hiplc (811.5 KB)

  • Quick Links