fix hda creation on single object

This commit is contained in:
Ondrej Samohel 2021-12-01 11:29:12 +01:00
parent 85b7edf25f
commit 9576b823ca
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
2 changed files with 13 additions and 17 deletions

View file

@ -45,19 +45,14 @@ class CreateHDA(plugin.Creator):
if (self.options or {}).get("useSelection") and self.nodes:
# if we have `use selection` enabled and we have some
# selected nodes ...
to_hda = self.nodes[0]
if len(self.nodes) > 1:
# if there is more then one node, create subnet first
subnet = out.createNode(
"subnet", node_name="{}_subnet".format(self.name))
to_hda = subnet
else:
# in case of no selection, just create subnet node
subnet = out.createNode(
"subnet", node_name="{}_subnet".format(self.name))
subnet = out.collapseIntoSubnet(
self.nodes,
subnet_name="{}_subnet".format(self.name))
subnet.moveToGoodPosition()
to_hda = subnet
else:
to_hda = out.createNode(
"subnet", node_name="{}_subnet".format(self.name))
if not to_hda.type().definition():
# if node type has not its definition, it is not user
# created hda. We test if hda can be created from the node.
@ -69,13 +64,14 @@ class CreateHDA(plugin.Creator):
name=subset_name,
hda_file_name="$HIP/{}.hda".format(subset_name)
)
hou.moveNodesTo(self.nodes, hda_node)
# print("move to hda: {}".format(to_hda))
# hou.moveNodesTo([to_hda], hda_node)
hda_node.layoutChildren()
elif self._check_existing(subset_name):
raise plugin.OpenPypeCreatorError(
("subset {} is already published with different HDA"
"definition.").format(subset_name))
else:
if self._check_existing(subset_name):
raise plugin.OpenPypeCreatorError(
("subset {} is already published with different HDA"
"definition.").format(subset_name))
hda_node = to_hda
hda_node.setName(subset_name)

@ -1 +1 @@
Subproject commit 7e5efd6885330d84bb8495975bcab84df49bfa3d
Subproject commit 9499f6517a1ff2d3bf94c5d34c0aece146734760