Skip to content

Commit

Permalink
added the project name as being part of the container data for loadin…
Browse files Browse the repository at this point in the history
…g and updating assets
  • Loading branch information
moonyuet committed Nov 21, 2024
1 parent 7d92d59 commit 6278253
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 26 deletions.
1 change: 1 addition & 0 deletions client/ayon_max/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def containerise(name: str, nodes: list, context,
"namespace": namespace or "",
"loader": loader,
"representation": context["representation"]["id"],
"project_name": context["project"]["name"]
}
container_name = f"{namespace}:{name}{suffix}"
container = rt.container(name=container_name)
Expand Down
1 change: 0 additions & 1 deletion client/ayon_max/hooks/force_startup_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class ForceStartupScript(PreLaunchHook):
Hook `GlobalHostDataHook` must be executed before this hook.
"""
app_groups = {"3dsmax", "adsk_3dsmax"}
order = 11
launch_types = {LaunchTypes.local}

def execute(self):
Expand Down
3 changes: 2 additions & 1 deletion client/ayon_max/plugins/load/load_camera_fbx.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def update(self, container, context):

update_custom_attribute_data(node, fbx_objects)
lib.imprint(container["instance_node"], {
"representation": repre_entity["id"]
"representation": repre_entity["id"],
"project_name": context["project"]["name"]
})

def switch(self, container, context):
Expand Down
3 changes: 2 additions & 1 deletion client/ayon_max/plugins/load/load_max_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ def update(self, container, context):

update_custom_attribute_data(node, max_objects)
lib.imprint(container["instance_node"], {
"representation": repre_entity["id"]
"representation": repre_entity["id"],
"project_name": context["project"]["name"]
})

def switch(self, container, context):
Expand Down
11 changes: 6 additions & 5 deletions client/ayon_max/plugins/load/load_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def update(self, container, context):
from pymxs import runtime as rt

repre_entity = context["representation"]
path = get_representation_path(repre_entity)
path = os.path.normpath(self.filepath_from_context(context))
node = rt.GetNodeByName(container["instance_node"])
node_list = [n for n in get_previous_loaded_object(node)
if rt.ClassOf(n) == rt.AlembicContainer]
Expand All @@ -89,10 +89,11 @@ def update(self, container, context):
rt.Select(abc_con.Children)
for abc_obj in abc_con.Children:
abc_obj.source = path
lib.imprint(
container["instance_node"],
{"representation": repre_entity["id"]},
)

lib.imprint(container["instance_node"], {
"representation": repre_entity["id"],
"project_name": context["project"]["name"]
})

def switch(self, container, context):
self.update(container, context)
Expand Down
6 changes: 4 additions & 2 deletions client/ayon_max/plugins/load/load_model_fbx.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def update(self, container, context):
from pymxs import runtime as rt

repre_entity = context["representation"]
path = get_representation_path(repre_entity)
path = os.path.normpath(self.filepath_from_context(context))
node_name = container["instance_node"]
node = rt.getNodeByName(node_name)
if not node:
Expand Down Expand Up @@ -85,8 +85,10 @@ def update(self, container, context):
with maintained_selection():
rt.Select(node)
update_custom_attribute_data(node, fbx_objects)

lib.imprint(container["instance_node"], {
"representation": repre_entity["id"]
"representation": repre_entity["id"],
"project_name": context["project"]["name"]
})

def switch(self, container, context):
Expand Down
7 changes: 4 additions & 3 deletions client/ayon_max/plugins/load/load_model_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def update(self, container, context):
from pymxs import runtime as rt

repre_entity = context["representation"]
path = get_representation_path(repre_entity)
path = os.path.normpath(self.filepath_from_context(context))
node_name = container["instance_node"]
node = rt.getNodeByName(node_name)
namespace, _ = get_namespace(node_name)
Expand All @@ -76,8 +76,9 @@ def update(self, container, context):
with maintained_selection():
rt.Select(node)

lib.imprint(node_name, {
"representation": repre_entity["id"]
lib.imprint(container["instance_node"], {
"representation": repre_entity["id"],
"project_name": context["project"]["name"]
})

def switch(self, container, context):
Expand Down
5 changes: 3 additions & 2 deletions client/ayon_max/plugins/load/load_model_usd.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ def update(self, container, context):
with maintained_selection():
rt.Select(node)

lib.imprint(node_name, {
"representation": repre_entity["id"]
lib.imprint(container["instance_node"], {
"representation": repre_entity["id"],
"project_name": context["project"]["name"]
})

def switch(self, container, context):
Expand Down
9 changes: 5 additions & 4 deletions client/ayon_max/plugins/load/load_pointcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ def update(self, container, context):
rt.Select(abc_con.Children)
for abc_obj in abc_con.Children:
abc_obj.source = path
lib.imprint(
container["instance_node"],
{"representation": repre_entity["id"]},
)

lib.imprint(container["instance_node"], {
"representation": repre_entity["id"],
"project_name": context["project"]["name"]
})

def switch(self, container, context):
self.update(container, context)
Expand Down
8 changes: 4 additions & 4 deletions client/ayon_max/plugins/load/load_pointcache_ornatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ def update(self, container, context):
abc.pos = transform_data[ox_transform] or 0
abc.scale = transform_data[f"{abc}.scale"] or 0
update_custom_attribute_data(node, ox_abc_objects)
lib.imprint(
container["instance_node"],
{"representation": repre_entity["id"]},
)
lib.imprint(container["instance_node"], {
"representation": repre_entity["id"],
"project_name": context["project"]["name"]
})

def switch(self, container, context):
self.update(container, context)
Expand Down
4 changes: 3 additions & 1 deletion client/ayon_max/plugins/load/load_pointcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ def update(self, container, context):
rt.Select(node_list)
for prt in rt.Selection:
prt.filename = path

lib.imprint(container["instance_node"], {
"representation": repre_entity["id"]
"representation": repre_entity["id"],
"project_name": context["project"]["name"]
})

def switch(self, container, context):
Expand Down
3 changes: 2 additions & 1 deletion client/ayon_max/plugins/load/load_redshift_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def update(self, container, context):
proxy.file = path

lib.imprint(container["instance_node"], {
"representation": repre_entity["id"]
"representation": repre_entity["id"],
"project_name": context["project"]["name"]
})

def switch(self, container, context):
Expand Down
4 changes: 3 additions & 1 deletion client/ayon_max/plugins/load/load_tycache.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ def update(self, container, context):
with maintained_selection():
for tyc in node_list:
tyc.filename = path

lib.imprint(container["instance_node"], {
"representation": repre_entity["id"]
"representation": repre_entity["id"],
"project_name": context["project"]["name"]
})

def switch(self, container, context):
Expand Down

0 comments on commit 6278253

Please sign in to comment.