From 64c4e5f2bbae767e6f2e126c884853a1fab39eaf Mon Sep 17 00:00:00 2001 From: "clement.hector" Date: Wed, 1 Dec 2021 16:42:18 +0100 Subject: [PATCH 01/13] Add static and allView option in imagePlaneLoader --- .../maya/plugins/load/load_image_plane.py | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/openpype/hosts/maya/plugins/load/load_image_plane.py b/openpype/hosts/maya/plugins/load/load_image_plane.py index f2640dc2eb..f7a5a7ea18 100644 --- a/openpype/hosts/maya/plugins/load/load_image_plane.py +++ b/openpype/hosts/maya/plugins/load/load_image_plane.py @@ -13,10 +13,14 @@ class CameraWindow(QtWidgets.QDialog): self.setWindowFlags(self.windowFlags() | QtCore.Qt.FramelessWindowHint) self.camera = None + self.static_image_plane = False + self.show_in_all_views = False self.widgets = { "label": QtWidgets.QLabel("Select camera for image plane."), "list": QtWidgets.QListWidget(), + "staticImagePlane": QtWidgets.QCheckBox(), + "showInAllViews": QtWidgets.QCheckBox(), "warning": QtWidgets.QLabel("No cameras selected!"), "buttons": QtWidgets.QWidget(), "okButton": QtWidgets.QPushButton("Ok"), @@ -31,6 +35,9 @@ class CameraWindow(QtWidgets.QDialog): for camera in cameras: self.widgets["list"].addItem(camera) + self.widgets["staticImagePlane"].setText("Make Image Plane Static") + self.widgets["showInAllViews"].setText("Show Image Plane in All Views") + # Build buttons. layout = QtWidgets.QHBoxLayout(self.widgets["buttons"]) layout.addWidget(self.widgets["okButton"]) @@ -40,6 +47,8 @@ class CameraWindow(QtWidgets.QDialog): layout = QtWidgets.QVBoxLayout(self) layout.addWidget(self.widgets["label"]) layout.addWidget(self.widgets["list"]) + layout.addWidget(self.widgets["staticImagePlane"]) + layout.addWidget(self.widgets["showInAllViews"]) layout.addWidget(self.widgets["buttons"]) layout.addWidget(self.widgets["warning"]) @@ -54,6 +63,8 @@ class CameraWindow(QtWidgets.QDialog): if self.camera is None: self.widgets["warning"].setVisible(True) return + self.show_in_all_views = self.widgets["showInAllViews"].isChecked() + self.static_image_plane = self.widgets["staticImagePlane"].isChecked() self.close() @@ -65,15 +76,15 @@ class CameraWindow(QtWidgets.QDialog): class ImagePlaneLoader(api.Loader): """Specific loader of plate for image planes on selected camera.""" - families = ["plate", "render"] + families = ["image", "plate", "render"] label = "Load imagePlane." representations = ["mov", "exr", "preview", "png"] icon = "image" color = "orange" - def load(self, context, name, namespace, data): + def load(self, context, name, namespace, data, option=None): import pymel.core as pm - + new_nodes = [] image_plane_depth = 1000 asset = context['asset']['name'] @@ -85,18 +96,16 @@ class ImagePlaneLoader(api.Loader): # Get camera from user selection. camera = None - default_cameras = [ - "frontShape", "perspShape", "sideShape", "topShape" - ] - cameras = [ - x for x in pm.ls(type="camera") if x.name() not in default_cameras - ] + cameras = pm.ls(type="camera") camera_names = {x.getParent().name(): x for x in cameras} camera_names["Create new camera."] = "create_camera" window = CameraWindow(camera_names.keys()) window.exec_() camera = camera_names[window.camera] + is_static_image_plane = window.static_image_plane + is_in_all_views = window.show_in_all_views + if camera == "create_camera": camera = pm.createNode("camera") @@ -111,7 +120,7 @@ class ImagePlaneLoader(api.Loader): # Create image plane image_plane_transform, image_plane_shape = pm.imagePlane( - camera=camera, showInAllViews=False + camera=camera, showInAllViews=is_in_all_views ) image_plane_shape.depth.set(image_plane_depth) @@ -119,6 +128,9 @@ class ImagePlaneLoader(api.Loader): context["representation"]["data"]["path"] ) + if is_static_image_plane: + image_plane_shape.detach() + start_frame = pm.playbackOptions(q=True, min=True) end_frame = pm.playbackOptions(q=True, max=True) From 3d6bf6e8c5eb5e8774a231fa6ff77e1422cf26af Mon Sep 17 00:00:00 2001 From: "clement.hector" Date: Wed, 1 Dec 2021 18:56:38 +0100 Subject: [PATCH 02/13] change option by options --- openpype/hosts/maya/plugins/load/load_image_plane.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/maya/plugins/load/load_image_plane.py b/openpype/hosts/maya/plugins/load/load_image_plane.py index f7a5a7ea18..d7e61b9c64 100644 --- a/openpype/hosts/maya/plugins/load/load_image_plane.py +++ b/openpype/hosts/maya/plugins/load/load_image_plane.py @@ -82,7 +82,7 @@ class ImagePlaneLoader(api.Loader): icon = "image" color = "orange" - def load(self, context, name, namespace, data, option=None): + def load(self, context, name, namespace, data, options=None): import pymel.core as pm new_nodes = [] From 3c7b622b6e3bf56deb28b12138f980b73a4ef6d6 Mon Sep 17 00:00:00 2001 From: "clement.hector" Date: Thu, 2 Dec 2021 11:53:32 +0100 Subject: [PATCH 03/13] fix rotation after detach --- .../maya/plugins/load/load_image_plane.py | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/openpype/hosts/maya/plugins/load/load_image_plane.py b/openpype/hosts/maya/plugins/load/load_image_plane.py index d7e61b9c64..ecfa8d7bc0 100644 --- a/openpype/hosts/maya/plugins/load/load_image_plane.py +++ b/openpype/hosts/maya/plugins/load/load_image_plane.py @@ -96,15 +96,23 @@ class ImagePlaneLoader(api.Loader): # Get camera from user selection. camera = None - cameras = pm.ls(type="camera") - camera_names = {x.getParent().name(): x for x in cameras} - camera_names["Create new camera."] = "create_camera" - window = CameraWindow(camera_names.keys()) - window.exec_() - camera = camera_names[window.camera] + is_static_image_plane = None + is_in_all_views = None + if data: + camera = pm.PyNode(data.get("camera")) + is_static_image_plane = data.get("static_image_plane") + is_in_all_views = data.get("in_all_views") - is_static_image_plane = window.static_image_plane - is_in_all_views = window.show_in_all_views + if not camera: + cameras = pm.ls(type="camera") + camera_names = {x.getParent().name(): x for x in cameras} + camera_names["Create new camera."] = "create_camera" + window = CameraWindow(camera_names.keys()) + window.exec_() + camera = camera_names[window.camera] + + is_static_image_plane = window.static_image_plane + is_in_all_views = window.show_in_all_views if camera == "create_camera": camera = pm.createNode("camera") @@ -129,7 +137,9 @@ class ImagePlaneLoader(api.Loader): ) if is_static_image_plane: + image_plane_shape.setMaintainRatio(True) image_plane_shape.detach() + image_plane_transform.setRotation(camera.getRotation()) start_frame = pm.playbackOptions(q=True, min=True) end_frame = pm.playbackOptions(q=True, max=True) From 931896519c05a423f4630001372bdb72d47da847 Mon Sep 17 00:00:00 2001 From: "clement.hector" Date: Thu, 2 Dec 2021 12:34:34 +0100 Subject: [PATCH 04/13] add fileName in imagePlane cmd --- openpype/hosts/maya/plugins/load/load_image_plane.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/openpype/hosts/maya/plugins/load/load_image_plane.py b/openpype/hosts/maya/plugins/load/load_image_plane.py index ecfa8d7bc0..eea5844e8b 100644 --- a/openpype/hosts/maya/plugins/load/load_image_plane.py +++ b/openpype/hosts/maya/plugins/load/load_image_plane.py @@ -128,16 +128,12 @@ class ImagePlaneLoader(api.Loader): # Create image plane image_plane_transform, image_plane_shape = pm.imagePlane( + fileName=context["representation"]["data"]["path"], camera=camera, showInAllViews=is_in_all_views ) image_plane_shape.depth.set(image_plane_depth) - image_plane_shape.imageName.set( - context["representation"]["data"]["path"] - ) - if is_static_image_plane: - image_plane_shape.setMaintainRatio(True) image_plane_shape.detach() image_plane_transform.setRotation(camera.getRotation()) From 89490f4b14815d402c12ab8680e69c3241760da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LORRAIN?= Date: Fri, 3 Dec 2021 17:22:27 +0100 Subject: [PATCH 05/13] add maya default render folder path to settings --- .../maya/plugins/publish/validate_render_image_rule.py | 8 +++++++- .../deadline/plugins/publish/submit_maya_deadline.py | 7 ++++++- openpype/settings/defaults/project_settings/maya.json | 3 ++- .../projects_schema/schemas/schema_maya_create.json | 5 +++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py b/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py index dad1691149..e892b239cc 100644 --- a/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py +++ b/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py @@ -23,7 +23,13 @@ class ValidateRenderImageRule(pyblish.api.InstancePlugin): def process(self, instance): - assert get_file_rule("images") == "renders", ( + default_render_file = instance.context.data.get('project_settings')\ + .get('maya') \ + .get('create') \ + .get('CreateRender') \ + .get('default_render_image_folder') + + assert get_file_rule("images") == default_render_file, ( "Workspace's `images` file rule must be set to: renders" ) diff --git a/openpype/modules/default_modules/deadline/plugins/publish/submit_maya_deadline.py b/openpype/modules/default_modules/deadline/plugins/publish/submit_maya_deadline.py index e6c42374ca..51a19e2aad 100644 --- a/openpype/modules/default_modules/deadline/plugins/publish/submit_maya_deadline.py +++ b/openpype/modules/default_modules/deadline/plugins/publish/submit_maya_deadline.py @@ -394,9 +394,14 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin): self.log.debug(filepath) # Gather needed data ------------------------------------------------ + default_render_file = instance.context.data.get('project_settings')\ + .get('maya')\ + .get('create')\ + .get('CreateRender')\ + .get('default_render_image_folder') filename = os.path.basename(filepath) comment = context.data.get("comment", "") - dirname = os.path.join(workspace, "renders") + dirname = os.path.join(workspace, default_render_file) renderlayer = instance.data['setMembers'] # rs_beauty deadline_user = context.data.get("user", getpass.getuser()) jobname = "%s - %s" % (filename, instance.name) diff --git a/openpype/settings/defaults/project_settings/maya.json b/openpype/settings/defaults/project_settings/maya.json index 73c75ef3ee..cbcf8cd600 100644 --- a/openpype/settings/defaults/project_settings/maya.json +++ b/openpype/settings/defaults/project_settings/maya.json @@ -43,7 +43,8 @@ "defaults": [ "Main" ], - "aov_separator": "underscore" + "aov_separator": "underscore", + "default_render_image_folder": "renders" }, "CreateAnimation": { "enabled": true, diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_create.json b/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_create.json index e50357cc40..088d5d1f96 100644 --- a/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_create.json +++ b/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_create.json @@ -58,6 +58,11 @@ {"underscore": "_ (underscore)"}, {"dot": ". (dot)"} ] + }, + { + "type": "text", + "key": "default_render_image_folder", + "label": "Default render image folder" } ] }, From b3ec2fe524dfd05ab60ef88649f40aa4b29ce3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LORRAIN?= Date: Mon, 6 Dec 2021 10:28:56 +0100 Subject: [PATCH 06/13] Use the setting in CollectRender --- openpype/hosts/maya/plugins/publish/collect_render.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/collect_render.py b/openpype/hosts/maya/plugins/publish/collect_render.py index 580d459a90..e26859ad93 100644 --- a/openpype/hosts/maya/plugins/publish/collect_render.py +++ b/openpype/hosts/maya/plugins/publish/collect_render.py @@ -221,14 +221,18 @@ class CollectMayaRender(pyblish.api.ContextPlugin): # append full path full_exp_files = [] aov_dict = {} - + default_render_file = context.data.get('project_settings')\ + .get('maya')\ + .get('create')\ + .get('CreateRender')\ + .get('default_render_image_folder') # replace relative paths with absolute. Render products are # returned as list of dictionaries. publish_meta_path = None for aov in exp_files: full_paths = [] for file in aov[aov.keys()[0]]: - full_path = os.path.join(workspace, "renders", file) + full_path = os.path.join(workspace, default_render_file, file) full_path = full_path.replace("\\", "/") full_paths.append(full_path) publish_meta_path = os.path.dirname(full_path) From ca1516fa13b03409c160f3c0f97785143d59fd4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LORRAIN?= Date: Mon, 6 Dec 2021 10:45:22 +0100 Subject: [PATCH 07/13] Fix syntax --- openpype/hosts/maya/plugins/publish/collect_render.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/collect_render.py b/openpype/hosts/maya/plugins/publish/collect_render.py index e26859ad93..788ed12b41 100644 --- a/openpype/hosts/maya/plugins/publish/collect_render.py +++ b/openpype/hosts/maya/plugins/publish/collect_render.py @@ -222,17 +222,18 @@ class CollectMayaRender(pyblish.api.ContextPlugin): full_exp_files = [] aov_dict = {} default_render_file = context.data.get('project_settings')\ - .get('maya')\ - .get('create')\ - .get('CreateRender')\ - .get('default_render_image_folder') + .get('maya')\ + .get('create')\ + .get('CreateRender')\ + .get('default_render_image_folder') # replace relative paths with absolute. Render products are # returned as list of dictionaries. publish_meta_path = None for aov in exp_files: full_paths = [] for file in aov[aov.keys()[0]]: - full_path = os.path.join(workspace, default_render_file, file) + full_path = os.path.join(workspace, default_render_file, + file) full_path = full_path.replace("\\", "/") full_paths.append(full_path) publish_meta_path = os.path.dirname(full_path) From 7e04079151479548daf15ec81768c454935c71d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LORRAIN?= Date: Mon, 6 Dec 2021 14:07:01 +0100 Subject: [PATCH 08/13] Update error message --- .../hosts/maya/plugins/publish/validate_render_image_rule.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py b/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py index e892b239cc..a912431b55 100644 --- a/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py +++ b/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py @@ -30,7 +30,9 @@ class ValidateRenderImageRule(pyblish.api.InstancePlugin): .get('default_render_image_folder') assert get_file_rule("images") == default_render_file, ( - "Workspace's `images` file rule must be set to: renders" + "Workspace's `images` file rule must be set to: {}".format( + default_render_file + ) ) @classmethod From 6ed4db4da11ae598c8e7ebf3fbf94dc434cfcd47 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Wed, 8 Dec 2021 17:11:45 +0100 Subject: [PATCH 09/13] installand copy xcb libs to pyside2 inside openpype --- Dockerfile.centos7 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile.centos7 b/Dockerfile.centos7 index f3b257e66b..ce60ea7fb1 100644 --- a/Dockerfile.centos7 +++ b/Dockerfile.centos7 @@ -41,6 +41,8 @@ RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n ncurses \ ncurses-devel \ qt5-qtbase-devel \ + xcb-util-wm \ + xcb-util-renderutil && yum clean all # we need to build our own patchelf @@ -92,7 +94,8 @@ RUN source $HOME/.bashrc \ RUN cp /usr/lib64/libffi* ./build/exe.linux-x86_64-3.7/lib \ && cp /usr/lib64/libssl* ./build/exe.linux-x86_64-3.7/lib \ && cp /usr/lib64/libcrypto* ./build/exe.linux-x86_64-3.7/lib \ - && cp /root/.pyenv/versions/${OPENPYPE_PYTHON_VERSION}/lib/libpython* ./build/exe.linux-x86_64-3.7/lib + && cp /root/.pyenv/versions/${OPENPYPE_PYTHON_VERSION}/lib/libpython* ./build/exe.linux-x86_64-3.7/lib \ + && cp /usr/lib64/libxcb* ./build/exe.linux-x86_64-3.7/vendor/python/PySide2/Qt/lib RUN cd /opt/openpype \ rm -rf ./vendor/bin From 09bbebae18bca1da746229963bc45cf2f48f8d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LORRAIN?= Date: Fri, 10 Dec 2021 15:14:03 +0100 Subject: [PATCH 10/13] Add settings to repair --- .../publish/validate_render_image_rule.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py b/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py index a912431b55..642ca9e25d 100644 --- a/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py +++ b/openpype/hosts/maya/plugins/publish/validate_render_image_rule.py @@ -23,11 +23,7 @@ class ValidateRenderImageRule(pyblish.api.InstancePlugin): def process(self, instance): - default_render_file = instance.context.data.get('project_settings')\ - .get('maya') \ - .get('create') \ - .get('CreateRender') \ - .get('default_render_image_folder') + default_render_file = self.get_default_render_image_folder(instance) assert get_file_rule("images") == default_render_file, ( "Workspace's `images` file rule must be set to: {}".format( @@ -37,5 +33,14 @@ class ValidateRenderImageRule(pyblish.api.InstancePlugin): @classmethod def repair(cls, instance): - pm.workspace.fileRules["images"] = "renders" + default = cls.get_default_render_image_folder(instance) + pm.workspace.fileRules["images"] = default pm.system.Workspace.save() + + @staticmethod + def get_default_render_image_folder(instance): + return instance.context.data.get('project_settings')\ + .get('maya') \ + .get('create') \ + .get('CreateRender') \ + .get('default_render_image_folder') From c78d4d89a4a36b7987b0ba7d7fc175a282cf0593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LORRAIN?= Date: Mon, 13 Dec 2021 10:45:30 +0100 Subject: [PATCH 11/13] Handle message type attribute --- openpype/hosts/maya/plugins/publish/collect_look.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openpype/hosts/maya/plugins/publish/collect_look.py b/openpype/hosts/maya/plugins/publish/collect_look.py index 20a9d4ca12..0ab278772e 100644 --- a/openpype/hosts/maya/plugins/publish/collect_look.py +++ b/openpype/hosts/maya/plugins/publish/collect_look.py @@ -489,6 +489,8 @@ class CollectLook(pyblish.api.InstancePlugin): if not cmds.attributeQuery(attr, node=node, exists=True): continue attribute = "{}.{}".format(node, attr) + if cmds.getAttr(attribute, type=True) == "message": + continue node_attributes[attr] = cmds.getAttr(attribute) attributes.append({"name": node, From ebbd43bd5fd6d587f6e88558df5512d8c9e971d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= <33513211+antirotor@users.noreply.github.com> Date: Tue, 14 Dec 2021 13:46:34 +0100 Subject: [PATCH 12/13] Update Dockerfile.centos7 Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- Dockerfile.centos7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.centos7 b/Dockerfile.centos7 index ce60ea7fb1..736a42663c 100644 --- a/Dockerfile.centos7 +++ b/Dockerfile.centos7 @@ -42,7 +42,7 @@ RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n ncurses-devel \ qt5-qtbase-devel \ xcb-util-wm \ - xcb-util-renderutil + xcb-util-renderutil \ && yum clean all # we need to build our own patchelf From b57a09b430a8dd1e09db2fa97cf37685b0ca9aa8 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 14 Dec 2021 15:16:48 +0100 Subject: [PATCH 13/13] OP-2019 - revert unwanted commit --- openpype/hooks/pre_foundry_apps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hooks/pre_foundry_apps.py b/openpype/hooks/pre_foundry_apps.py index 70554cbedb..85f68c6b60 100644 --- a/openpype/hooks/pre_foundry_apps.py +++ b/openpype/hooks/pre_foundry_apps.py @@ -13,7 +13,7 @@ class LaunchFoundryAppsWindows(PreLaunchHook): # Should be as last hook because must change launch arguments to string order = 1000 - app_groups = ["nuke", "nukex", "hiero", "nukestudio", "aftereffects"] + app_groups = ["nuke", "nukex", "hiero", "nukestudio"] platforms = ["windows"] def execute(self):