Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Houdini: Remove broken unique name counter #2450

Merged
merged 1 commit into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions openpype/hosts/houdini/plugins/load/load_alembic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from avalon import api

from avalon.houdini import pipeline, lib
from avalon.houdini import pipeline


class AbcLoader(api.Loader):
Expand All @@ -25,16 +25,9 @@ def load(self, context, name=None, namespace=None, data=None):
# Get the root node
obj = hou.node("/obj")

# Create a unique name
counter = 1
# Define node name
namespace = namespace if namespace else context["asset"]["name"]
formatted = "{}_{}".format(namespace, name) if namespace else name
node_name = "{0}_{1:03d}".format(formatted, counter)

children = lib.children_as_string(hou.node("/obj"))
while node_name in children:
counter += 1
node_name = "{0}_{1:03d}".format(formatted, counter)
node_name = "{}_{}".format(namespace, name) if namespace else name

# Create a new geo node
container = obj.createNode("geo", node_name=node_name)
Expand Down
17 changes: 4 additions & 13 deletions openpype/hosts/houdini/plugins/load/load_camera.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from avalon import api
from avalon.houdini import pipeline, lib
from avalon.houdini import pipeline


ARCHIVE_EXPRESSION = ('__import__("_alembic_hom_extensions")'
Expand Down Expand Up @@ -97,18 +97,9 @@ def load(self, context, name=None, namespace=None, data=None):
# Get the root node
obj = hou.node("/obj")

# Create a unique name
counter = 1
asset_name = context["asset"]["name"]

namespace = namespace or asset_name
formatted = "{}_{}".format(namespace, name) if namespace else name
node_name = "{0}_{1:03d}".format(formatted, counter)

children = lib.children_as_string(hou.node("/obj"))
while node_name in children:
counter += 1
node_name = "{0}_{1:03d}".format(formatted, counter)
# Define node name
namespace = namespace if namespace else context["asset"]["name"]
node_name = "{}_{}".format(namespace, name) if namespace else name

# Create a archive node
container = self.create_and_connect(obj, "alembicarchive", node_name)
Expand Down