math ross

mapoga

About Me

Connect

LOCATION
Not Specified
ウェブサイト

Houdini Engine

Availability

Not Specified

Recent Forum Posts

Creating an HDA that Instantiates Multiple Nodes at Once 2024年5月9日23:20

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)

python: change node type 2024年5月9日22:36

Here is a possible solution.
Keep in mind that this is a naive approach since an hda file can contain multiple definitions.

I would be interested to know if someone has a better way.

import hou


def replace_type_instances(src_type, dst_type):
    for instance in src_type.instances():
        if instance.isEditableInsideLockedHDA():
            keep_network_contents = not instance.matchesCurrentDefinition()
            new_node = instance.changeNodeType(
                dst_type.name(),
                keep_parms=True,
                keep_network_contents=keep_network_contents
            )


def get_hda_first_type(hda_filepath):
    definitions = hou.hda.definitionsInFile(hda_filepath)
    for definition in definitions:
        return definition.nodeType()


def main():
    src_type = get_hda_first_type('/path/to/src.hda')
    dst_type = get_hda_first_type('/path/to/dst.hda')
    if src_type and dst_type:
        dst_type.definition().setIsPreferred(True)
        with hou.undos.group('Replace type instances'):
            replace_type_instances(src_type, dst_type)


main()

How to build nodes from a Geometry Graph? 2024年5月7日10:35

Is there a convenient way of building the nodes represented by a Geometry Graph?


Currently if i want to edit a graph, i have to start from the nodes that were used to generate the graph in the first place.
It would be nice if we could convert both ways. aka: nodes <-> graph
It might already be possible, but i have not found information related to this yet.

Thank you!