Jump to content

Digital Asset


Recommended Posts

6 hours ago, Fenolis said:

You can use the OnCreated script in the first HDA to create and link the second node.

Thank you for your reply. Unfortunately  i don't know much about python. So i check the volume deform hda to see if there's some sort of script which i can copy to use on my hda but i didn't see any script.

Can you please take a look at this sample file with an embedded hda:

Digital_Asset.hiplc

Link to comment
Share on other sites

In the Scripts tab of your second HDA, at the bottom left there is an Event Handler field. Select On Created and it will produce a script module. Paste this code and save. When you create the colour_Two HDA, the colour_one HDA will be created and connected automatically.

(HDA naming should be kept consistent, e.g. colour_Two, colour_one <-- mind the capitalization!)

Python documentation for the methods I used can be found here.

hou.pwd() is shorthand.

kwargs is a dictionary, I'm accessing the "node" item.

image.png.d7e1d30ba521487319f0247a7919672a.png

# Get context
node = hou.pwd()

# Get the newly created node (self), use kwargs
self = kwargs['node']

# Create input node
c1_node = node.createNode("colour_one")

# Connect input node
self.setInput(0, c1_node)

# Layout
c1_node.moveToGoodPosition()

 

Edited by Fenolis
extra space where there shouldn't be one
Link to comment
Share on other sites

2 hours ago, Fenolis said:

In the Scripts tab of your second HDA, at the bottom left there is an Event Handler field. Select On Created and it will produce a script module. Paste this code and save. When you create the colour_Two HDA, the colour_one HDA will be created and connected automatically.

(HDA naming should be kept consistent, e.g. colour_Two, colour_one <-- mind the capitalization!)

Python documentation for the methods I used can be found here.

hou.pwd() is shorthand.

kwargs is a dictionary, I'm accessing the "node" item.

image.png.d7e1d30ba521487319f0247a7919672a.png


# Get context
node = hou.pwd()

# Get the newly created node (self), use kwargs
self = kwargs['node']

# Create input node
c1_node = node.createNode("colour_one")

# Connect input node
self.setInput(0, c1_node)

# Layout
c1_node.moveToGoodPosition()

 

Thanks Jikian, it works now.

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...