samesami Posted November 1, 2022 Share Posted November 1, 2022 How do i create a digital asset in way that when i click on one node it will create two nodes similar to the Volume deform node? Quote Link to comment Share on other sites More sharing options...
Fenolis Posted November 2, 2022 Share Posted November 2, 2022 You can use the OnCreated script in the first HDA to create and link the second node. Quote Link to comment Share on other sites More sharing options...
samesami Posted November 2, 2022 Author Share Posted November 2, 2022 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 Quote Link to comment Share on other sites More sharing options...
Fenolis Posted November 3, 2022 Share Posted November 3, 2022 (edited) 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. # 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 November 3, 2022 by Fenolis extra space where there shouldn't be one Quote Link to comment Share on other sites More sharing options...
samesami Posted November 3, 2022 Author Share Posted November 3, 2022 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. # 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.