From 4d7d1773a96d2ab28f271460c067e10786457a42 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Fri, 27 Jan 2023 01:25:57 +0100 Subject: [PATCH 1/6] :bug: fix pointcache loader update --- openpype/hosts/max/api/pipeline.py | 24 +++++++++- .../hosts/max/plugins/load/load_pointcache.py | 45 ++++++++++++++++--- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/openpype/hosts/max/api/pipeline.py b/openpype/hosts/max/api/pipeline.py index f3cdf245fb..8a1483dc51 100644 --- a/openpype/hosts/max/api/pipeline.py +++ b/openpype/hosts/max/api/pipeline.py @@ -2,6 +2,7 @@ """Pipeline tools for OpenPype Houdini integration.""" import os import logging +from operator import attrgetter import json @@ -141,5 +142,26 @@ def ls() -> list: if rt.getUserProp(obj, "id") == AVALON_CONTAINER_ID ] - for container in sorted(containers, key=lambda name: container.name): + for container in sorted(containers, key=attrgetter("name")): yield lib.read(container) + + +def containerise(name: str, nodes: list, context, loader=None, suffix="_CON"): + data = { + "schema": "openpype:container-2.0", + "id": AVALON_CONTAINER_ID, + "name": name, + "namespace": "", + "loader": loader, + "representation": context["representation"]["_id"], + } + + container_name = f"{name}{suffix}" + container = rt.container(name=container_name) + print(nodes) + for node in nodes: + node.Parent = container + + if not lib.imprint(container_name, data): + print(f"imprinting of {container_name} failed.") + return container diff --git a/openpype/hosts/max/plugins/load/load_pointcache.py b/openpype/hosts/max/plugins/load/load_pointcache.py index 285d84b7b6..ca959715f7 100644 --- a/openpype/hosts/max/plugins/load/load_pointcache.py +++ b/openpype/hosts/max/plugins/load/load_pointcache.py @@ -6,8 +6,10 @@ Because of limited api, alembics can be only loaded, but not easily updated. """ import os from openpype.pipeline import ( - load + load, get_representation_path ) +from openpype.hosts.max.api.pipeline import containerise +from openpype.hosts.max.api import lib class AbcLoader(load.LoaderPlugin): @@ -52,14 +54,47 @@ importFile @"{file_path}" #noPrompt abc_container = abc_containers.pop() - container_name = f"{name}_CON" - container = rt.container(name=container_name) - abc_container.Parent = container + return containerise( + name, [abc_container], context, loader=self.__class__.__name__) - return container + def update(self, container, representation): + from pymxs import runtime as rt + + path = get_representation_path(representation) + node = rt.getNodeByName(container["instance_node"]) + + alembic_objects = self.get_container_children(node, "AlembicObject") + for alembic_object in alembic_objects: + alembic_object.source = path + + lib.imprint(container["instance_node"], { + "representation": str(representation["_id"]) + }) + + def switch(self, container, representation): + self.update(container, representation) def remove(self, container): from pymxs import runtime as rt node = container["node"] rt.delete(node) + + @staticmethod + def get_container_children(parent, type_name): + from pymxs import runtime as rt + + def list_children(node): + children = [] + for c in node.Children: + children.append(c) + children = children + list_children(c) + return children + + filtered = [] + for child in list_children(parent): + class_type = str(rt.classOf(child.baseObject)) + if class_type == type_name: + filtered.append(child) + + return filtered From 534c3d05212553597777733d5129a5b0a6ab5ca5 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Fri, 27 Jan 2023 01:26:25 +0100 Subject: [PATCH 2/6] :bug: fix scene inventory menu --- openpype/hosts/max/api/menu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/max/api/menu.py b/openpype/hosts/max/api/menu.py index 02d8315af6..5c273b49b4 100644 --- a/openpype/hosts/max/api/menu.py +++ b/openpype/hosts/max/api/menu.py @@ -119,7 +119,7 @@ class OpenPypeMenu(object): def manage_callback(self): """Callback to show Scene Manager/Inventory tool.""" - host_tools.show_subset_manager(parent=self.main_widget) + host_tools.show_scene_inventory(parent=self.main_widget) def library_callback(self): """Callback to show Library Loader tool.""" From 23a6e1bdafe65c4cae2f29b9813fbc80b6b23946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= <33513211+antirotor@users.noreply.github.com> Date: Fri, 27 Jan 2023 12:01:20 +0100 Subject: [PATCH 3/6] Update openpype/hosts/max/plugins/load/load_pointcache.py Co-authored-by: Roy Nieterau --- openpype/hosts/max/plugins/load/load_pointcache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/max/plugins/load/load_pointcache.py b/openpype/hosts/max/plugins/load/load_pointcache.py index ca959715f7..a2e567ed5d 100644 --- a/openpype/hosts/max/plugins/load/load_pointcache.py +++ b/openpype/hosts/max/plugins/load/load_pointcache.py @@ -88,7 +88,7 @@ importFile @"{file_path}" #noPrompt children = [] for c in node.Children: children.append(c) - children = children + list_children(c) + children += list_children(c) return children filtered = [] From 8b3f2891d4845fa8238475e7577e9343c8c9815d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= <33513211+antirotor@users.noreply.github.com> Date: Fri, 27 Jan 2023 12:01:26 +0100 Subject: [PATCH 4/6] Update openpype/hosts/max/api/pipeline.py Co-authored-by: Roy Nieterau --- openpype/hosts/max/api/pipeline.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openpype/hosts/max/api/pipeline.py b/openpype/hosts/max/api/pipeline.py index 8a1483dc51..f8a7b8ea5c 100644 --- a/openpype/hosts/max/api/pipeline.py +++ b/openpype/hosts/max/api/pipeline.py @@ -158,7 +158,6 @@ def containerise(name: str, nodes: list, context, loader=None, suffix="_CON"): container_name = f"{name}{suffix}" container = rt.container(name=container_name) - print(nodes) for node in nodes: node.Parent = container From 68959d426eb4b37d335f7194d73c12c6c84c2037 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Mon, 30 Jan 2023 10:24:17 +0100 Subject: [PATCH 5/6] Fix typo --- openpype/pipeline/create/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/pipeline/create/context.py b/openpype/pipeline/create/context.py index 9c468ae8fc..a0cdb7dfea 100644 --- a/openpype/pipeline/create/context.py +++ b/openpype/pipeline/create/context.py @@ -153,7 +153,7 @@ class CreatorsRemoveFailed(CreatorsOperationFailed): class CreatorsCreateFailed(CreatorsOperationFailed): def __init__(self, failed_info): - msg = "Faled to create instances" + msg = "Failed to create instances" super(CreatorsCreateFailed, self).__init__( msg, failed_info ) From 839445b7c9fd6bcaeb850b4d012066f1d4fa204e Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 30 Jan 2023 11:03:21 +0100 Subject: [PATCH 6/6] fix pyproject.toml OP version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ceab9eeff1..a872ed3609 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "OpenPype" -version = "3.15.1-nightly.1" # OpenPype +version = "3.15.0" # OpenPype description = "Open VFX and Animation pipeline with support." authors = ["OpenPype Team "] license = "MIT License"