move get_avalon_container to ayon_houdini.api.pipeline

This commit is contained in:
MustafaJafar 2024-06-19 20:56:36 +03:00
parent 928115f25a
commit 336d38b218
2 changed files with 20 additions and 23 deletions

View file

@ -221,12 +221,8 @@ def containerise(name,
"""
# Ensure AVALON_CONTAINERS subnet exists
subnet = hou.node(AVALON_CONTAINERS)
if subnet is None:
obj_network = hou.node("/obj")
subnet = obj_network.createNode("subnet",
node_name="AVALON_CONTAINERS")
# Get AVALON_CONTAINERS subnet
subnet = get_avalon_container()
# Create proper container name
container_name = "{}_{}".format(name, suffix or "CON")
@ -401,6 +397,23 @@ def on_new():
_enforce_start_frame()
def get_avalon_container():
path = AVALON_CONTAINERS
avalon_container = hou.node(path)
if not avalon_container:
# Let's create avalon container secretly
# but make sure the pipeline still is built the
# way we anticipate it was built, asserting it.
assert path == "/obj/AVALON_CONTAINERS"
parent = hou.node("/obj")
avalon_container = parent.createNode(
"subnet", node_name="AVALON_CONTAINERS"
)
return avalon_container
def _set_context_settings():
"""Apply the project settings from the project definition

View file

@ -12,22 +12,6 @@ from ayon_houdini.api import (
plugin
)
def get_avalon_container():
path = pipeline.AVALON_CONTAINERS
avalon_container = hou.node(path)
if not avalon_container:
# Let's create avalon container secretly
# but make sure the pipeline still is built the
# way we anticipate it was built, asserting it.
assert path == "/obj/AVALON_CONTAINERS"
parent = hou.node("/obj")
avalon_container = parent.createNode(
"subnet", node_name="AVALON_CONTAINERS"
)
return avalon_container
class HdaLoader(plugin.HoudiniLoader):
"""Load Houdini Digital Asset file."""
@ -106,7 +90,7 @@ class HdaLoader(plugin.HoudiniLoader):
def _create_dedicated_parent_node(self, hda_def):
# Get the root node
parent_node = get_avalon_container()
parent_node = pipeline.get_avalon_container()
node = None
node_type = None
if hda_def.nodeTypeCategory() == hou.objNodeTypeCategory():