Jump to content

VEX - Create an array of all operators piped into a particular node.


Recommended Posts

Hello! I'd like to dynamically create an array in VEX that contains a list of all the node names that are piped into a merge.

Example:
image.png.4756fe2eaf0de0835cc21bc88b64aa86.png

I'd like to use some VEX inside the crowd transition node that can call on an array of string names that all come from the pink crowd state nodes that are piped into the merge.

Is this possible at all?

Link to comment
Share on other sites

I suspect this might be a task better suited for python versus VEX, and likely both easier and quicker that way- you might want to drop this question in the "Scripting" subforum here for better visibility from the coding gurus

Link to comment
Share on other sites

  • 2 weeks later...

Create a Python SOP, paste the following code:

nodeParm = hou.pwd().evalParm("spare_input0")
node = hou.node(nodeParm)

geo = hou.pwd().geometry()
nodeInputs = node.inputs()
geo.addAttrib(hou.attribType.Global, "inputs", [""])

inputs = []
for i in range(len(nodeInputs)):
    inputs.append(nodeInputs[i].type().name())
geo.setGlobalAttribValue("inputs", inputs)

Add a Spare Input on the Python SOP and drag the node you want to query into the field. The Python SOP will generate a Detail attribute with a list of node types that are connected to the specified SOP.

  • Like 2
Link to comment
Share on other sites

Thanks for the tips @Fenolis. Getting a little closer, but not quite what I was after. This method does show me some relevant info, but not an array list of node names.
image.png.c05cd81efc1bee9e7ec243a270b7f011.png

I'll leave this for now, as I was initially looking for a quick solution to something. I can see now it's a bit more complex than I initially thought. I can get by on this particular job by entering the node names manually.

Link to comment
Share on other sites

@GlennimusPrime The line you would want to modify is 

inputs.append(nodeInputs[i].type().name())

It pulls the type of the nodes, meaning the OTL definition. If you wanted the names as you see them in the Network Panel, modify it to:
 

inputs.append(nodeInputs[i].name())

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...