Creating an HDA that Instantiates Multiple Nodes at Once

   1011   4   1
User Avatar
Member
3 posts
Joined: Aug. 2021
Offline
Hello everyone,

I'm currently facing a challenge with HDAs. I want to create an HDA such that when I instantiate it in Houdini, it automatically creates two or more nodes at once.


Does anyone have experience with creating multi-node HDAs, or could you point me to any resources or tutorials that might help with this? Your guidance and expertise would be greatly appreciated.

Thanks in advance for your help!

Attachments:
10-33-41.png (52.7 KB)
0-33-26.png (61.8 KB)

User Avatar
Member
10 posts
Joined: Feb. 2017
Offline
I believe you need to create a custom shelf script that instantiate the 2 nodes. This is separate from creating the HDA itself.

Here is the content of the shelf tool labeled Karma from this file: $HFS/houdini/toolbar/ExtraLopTools.shelf
import loptoolutils
node = loptoolutils.genericTool(kwargs, 'karmarenderproperties', 'karmarendersettings')
node.setCurrent(True)
nodename = node.name()
kwargs['inputnodename'] = nodename
kwargs['inputs'] = [(nodename, 0)]
kwargs['nodepositionx'] = str(node.position().x())
kwargs['nodepositiony'] = str(node.position().y() - 0.5)
rop = loptoolutils.genericTool(kwargs, 'usdrender_rop')
rop.parm("rendersettings").setExpression('chs("../%s/primpath")' % nodename)
rop.parm("husk_instantshutter").setExpression('1 - ch("../%s/enablemblur")' % nodename)
node.setCurrent(True)
node.setSelected(True)
User Avatar
Member
143 posts
Joined: Feb. 2012
Offline
you can do this in the onCreate script of the initial HDA too..
User Avatar
Member
3 posts
Joined: Aug. 2021
Offline
JordanWalsh
you can do this in the onCreate script of the initial HDA too..
I've used the onCreate script successfully — thanks for that!
User Avatar
Member
3 posts
Joined: Aug. 2021
Offline
mapoga
I believe you need to create a custom shelf script that instantiate the 2 nodes. This is separate from creating the HDA itself.

Here is the content of the shelf tool labeled Karma from this file: $HFS/houdini/toolbar/ExtraLopTools.shelf
import loptoolutils
node = loptoolutils.genericTool(kwargs, 'karmarenderproperties', 'karmarendersettings')
node.setCurrent(True)
nodename = node.name()
kwargs['inputnodename'] = nodename
kwargs['inputs'] = [(nodename, 0)]
kwargs['nodepositionx'] = str(node.position().x())
kwargs['nodepositiony'] = str(node.position().y() - 0.5)
rop = loptoolutils.genericTool(kwargs, 'usdrender_rop')
rop.parm("rendersettings").setExpression('chs("../%s/primpath")' % nodename)
rop.parm("husk_instantshutter").setExpression('1 - ch("../%s/enablemblur")' % nodename)
node.setCurrent(True)
node.setSelected(True)

Thank you very much for your help!! it has solved my problem.
I have a small question, though. The tool is being automatically sorted into the "More" category in the tab menu. How can I reassign it to a different category?
  • Quick Links