Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project name as container data for loading and updating assets #23

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
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
7 changes: 4 additions & 3 deletions client/ayon_max/plugins/load/load_camera_fbx.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load
from ayon_core.pipeline import load


class FbxLoader(load.LoaderPlugin):
Expand Down Expand Up @@ -55,7 +55,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 Down 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
7 changes: 4 additions & 3 deletions client/ayon_max/plugins/load/load_max_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load
from ayon_core.pipeline import load


class MaterialDupOptionsWindow(QtWidgets.QDialog):
Expand Down Expand Up @@ -126,7 +126,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 Down 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
13 changes: 7 additions & 6 deletions client/ayon_max/plugins/load/load_model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from ayon_core.pipeline import load, get_representation_path
from ayon_core.pipeline import load
from ayon_max.api.pipeline import (
containerise,
get_previous_loaded_object,
Expand Down 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
8 changes: 5 additions & 3 deletions client/ayon_max/plugins/load/load_model_fbx.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from ayon_core.pipeline import load, get_representation_path
from ayon_core.pipeline import load
from ayon_max.api.pipeline import (
containerise, get_previous_loaded_object,
update_custom_attribute_data,
Expand Down 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
9 changes: 5 additions & 4 deletions client/ayon_max/plugins/load/load_model_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load
from ayon_core.pipeline import load


class ObjLoader(load.LoaderPlugin):
Expand Down 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
9 changes: 5 additions & 4 deletions client/ayon_max/plugins/load/load_model_usd.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load
from ayon_core.pipeline import load


class ModelUSDLoader(load.LoaderPlugin):
Expand Down Expand Up @@ -67,7 +67,7 @@ def load(self, context, name=None, namespace=None, data=None):

def update(self, container, context):
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, name = get_namespace(node_name)
Expand Down 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
13 changes: 7 additions & 6 deletions client/ayon_max/plugins/load/load_pointcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"""
import os
from ayon_core.pipeline import load, get_representation_path
from ayon_core.pipeline import load
from ayon_max.api import lib, maintained_selection
from ayon_max.api.lib import unique_namespace, reset_frame_range
from ayon_max.api.pipeline import (
Expand Down Expand Up @@ -83,7 +83,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"])
abc_container = [n for n in get_previous_loaded_object(node)
if rt.ClassOf(n) == rt.AlembicContainer]
Expand All @@ -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
12 changes: 6 additions & 6 deletions client/ayon_max/plugins/load/load_pointcache_ornatrix.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from ayon_core.pipeline import load, get_representation_path
from ayon_core.pipeline import load
from ayon_core.pipeline.load import LoadError
from ayon_max.api.pipeline import (
containerise,
Expand Down Expand Up @@ -64,7 +64,7 @@ def load(self, context, name=None, namespace=None, data=None):

def update(self, container, context):
repre_entity = context["representation"]
path = get_representation_path(repre_entity)
path = os.path.normpath(self.filepath_from_context(context))
node_name = container["instance_node"]
namespace, name = get_namespace(node_name)
node = rt.getNodeByName(node_name)
Expand Down 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
8 changes: 5 additions & 3 deletions client/ayon_max/plugins/load/load_pointcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load
from ayon_core.pipeline import load


class PointCloudLoader(load.LoaderPlugin):
Expand Down Expand Up @@ -46,7 +46,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 = get_previous_loaded_object(node)
update_custom_attribute_data(
Expand All @@ -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
10 changes: 4 additions & 6 deletions client/ayon_max/plugins/load/load_redshift_proxy.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import os
import clique

from ayon_core.pipeline import (
load,
get_representation_path
)
from ayon_core.pipeline import load
from ayon_core.pipeline.load import LoadError
from ayon_max.api.pipeline import (
containerise,
Expand Down Expand Up @@ -56,7 +53,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 = get_previous_loaded_object(node)
rt.Select(node_list)
Expand All @@ -66,7 +63,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
8 changes: 5 additions & 3 deletions client/ayon_max/plugins/load/load_tycache.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
update_custom_attribute_data,
remove_container_data
)
from ayon_core.pipeline import get_representation_path, load
from ayon_core.pipeline import load


class TyCacheLoader(load.LoaderPlugin):
Expand Down Expand Up @@ -44,15 +44,17 @@ 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 = get_previous_loaded_object(node)
update_custom_attribute_data(node, node_list)
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