kramer3d Posted January 30, 2019 Share Posted January 30, 2019 (edited) Hi all, I need to do some pipeline related processing of nodes in case their asset library goes missing. Is there any way to detect missing HDA definition programmatically in python? Some sort of callback on scene load would suffice, can someone please give me a hint? Alternatively, given a hou.Node instance, is there a reliable way to tell whether it's using complete definition? Edited January 30, 2019 by kramer3d Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted February 8, 2019 Share Posted February 8, 2019 Try to get a definition instance (node.type().definition()) and call some methods of it. I'm pretty sure you'll get an exception somewhere and so try-except would be your answer. As for auto detect, see 456.py startup file, where you could iterate over all node types and check their definitions (see hou.hda.loadedFiles() example in the docs). Quote Link to comment Share on other sites More sharing options...
graham Posted February 10, 2019 Share Posted February 10, 2019 Short of using some wrapped HDK code, I think the best bet to check for a dummy definition is to check that both the libraryFilePath() points to "Embedded" and that the definition has very little in the sections() list. For example, creating a HDA on disk from a SOP Subnet yields a definition with some expected sections: >>> asset = subnet.createDigitalAsset("dummyop", "/var/tmp/dummy.otl", "Dummy") >>> node_type = asset.type() >>> node_type.definition().sections() {'Contents.gz': <hou.HDASection Contents.gz in definition of Sop dummyop in /var/tmp/dummy.otl>, 'CreateScript': < hou.HDASection CreateScript in definition of Sop dummyop in /var/tmp/dummy.otl>, 'InternalFileOptions': <hou.HDASe ction InternalFileOptions in definition of Sop dummyop in /var/tmp/dummy.otl>, 'DialogScript': <hou.HDASection Dia logScript in definition of Sop dummyop in /var/tmp/dummy.otl>} >>> node_type.definition().libraryFilePath() '/var/tmp/dummy.otl' However, if you then destroy the definition (with an instance of the node in your scene) you'll see it now reports as "Embedded" and only has a DialogScript and Contents.gz section: >>> node_type.definition().destroy() >>> node_type.definition().sections() {'DialogScript': <hou.HDASection DialogScript in definition of Sop dummyop in Embedded>, 'Contents': <hou.HDASecti on Contents in definition of Sop dummyop in Embedded>} >>> node_type.definition().libraryFilePath() 'Embedded' 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.