Jump to content

Find all custom HDA's in current HIP File


pullpullson

Recommended Posts

Hey everyone, 

I am trying to write a script that finds all the nodes that are hda's and updates each hda to the the latest definition. 

I am having trouble to write a loop that returns me all the custom HDAs in my HIP file. 

If i open the asset manager under "current hip file" i see all the hda librarys that are relevant.

capture_asset_manager.PNG.de726f3abc64ebe6bfd296404b5721ec.PNG

My question is:

How would a function look that returns me all hda librarys under "current hip file"

and then all the nodes that come from any of the librarys.

Any other workflows to find the nodes are welcome!

Link to comment
Share on other sites

You can write a python function like this:

def getNonStandardHDAs():
    nsHDAs = []
    missingHDAs = []
    hfs = hou.expandString("$HFS")
    
    nodes = hou.node("/").allNodes()
    for node in nodes:
        hdadef = node.type().definition()
        if hdadef:
            hdapath = hdadef.libraryFilePath()
            if hfs not in hdapath:
                if hdapath == "Embedded":
                    typename = node.type().name()
                    if typename not in missingHDAs:
                        missingHDAs.append(typename)
                elif hdapath not in nsHDAs:
                    nsHDAs.append(hdapath)
            
    return nsHDAs, missingHDAs

To get all non standard and missing HDAs that are embedded in the scene.

  • Thanks 1
Link to comment
Share on other sites

2 hours ago, pusat said:

You can write a python function like this:


def getNonStandardHDAs():
    nsHDAs = []
    missingHDAs = []
    hfs = hou.expandString("$HFS")
    
    nodes = hou.node("/").allNodes()
    for node in nodes:
        hdadef = node.type().definition()
        if hdadef:
            hdapath = hdadef.libraryFilePath()
            if hfs not in hdapath:
                if hdapath == "Embedded":
                    typename = node.type().name()
                    if typename not in missingHDAs:
                        missingHDAs.append(typename)
                elif hdapath not in nsHDAs:
                    nsHDAs.append(hdapath)
            
    return nsHDAs, missingHDAs

To get all non standard and missing HDAs that are embedded in the scene.

hey @pusat this works just marvelously!

thank you very much for the quick response.

I'm going to figure out how to update the individual hdas to the latest definition from this point on and post it here when it is ready! 

Cheers!

Edited by pullpullson
  • Like 1
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...