Blackbox otls by python?

   1729   2   0
User Avatar
Member
575 posts
Joined: Nov. 2005
Offline
Can we create Blackboxed HDAS with python?
Could not finde anything in the documentation.

thanks Martin
User Avatar
Member
159 posts
Joined: Feb. 2018
Offline
hou.HDADefinition.save(release_hda_path, template_node, compile_contents=True, black_box=True)
I don't know why it doesn't include in the document. And as my test, you must create a template_node for blackboxing with compile_contents set True.
Also, you can check the file in “Side Effects Software\Houdini 17.5.397\toolkit\include\HOM\HOM_HDADefinition.h”
by the line of 118.
SWIGOUT(%kwargs save;)
virtual void save(
	const std::string &file_name,
	HOM_Node *template_node = NULL,
	HOM_HDAOptions *options = NULL,
	bool compile_contents = false,
	bool black_box = false,
	bool create_backup = true) = 0;
Edited by EricSheng - Oct. 7, 2019 05:04:26
User Avatar
Member
1 posts
Joined: Sept. 2023
Offline
within this context, what is a template node?

I've been able to successfully save a regular HDA with "save" but trying to save a blackbox HDA has gotten me stumped.

Here is what I've been doing:

```
# trivial subnet
geo = hou.node("/obj").createNode("geo")
subnet = geo.createNode("subnet", "license")

sphere_node = subnet.createNode("sphere")
output_node = subnet.createNode("output")

output_node.setInput(0, sphere_node)

subnet.layoutChildren()

# create HDA node and HDADefinition
hda_node = subnet.createDigitalAsset(name="test", compress_contents=True, version="1.0", save_as_embedded=False, ignore_external_references=True, change_node_type=True, create_backup=False)
hda_def = hda_node.type().definition()

hda_def.save("/tmp/test.hda") # works

hda_def.save("/tmp/blackbox.hda", black_box=True) # creates regular HDA because no "template_node"
hda_def.save("/tmp/blackbox.hda", template_node=subnet, black_box=True) # crashes
```
  • Quick Links