From d8d6cff0230b7f6cccb5dc9126b7ad46075e48e6 Mon Sep 17 00:00:00 2001 From: BenoitConnan Date: Mon, 28 Feb 2022 15:43:00 +0100 Subject: [PATCH] Squashed commits publish_from_published_workfiles: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 9be0d40b712ca2c81509086f6357b8a660fe866e Author: Jérôme LORRAIN Date: Thu Dec 23 14:49:17 2021 +0100 Fix syntax commit 3e23455ddf10f921c1505e05d651964491203fa5 Author: Jérôme LORRAIN Date: Wed Dec 22 10:55:34 2021 +0100 Move setting from Global to Maya commit e4521558b9c4c988fc4e786e6da2dda59dc4659d Author: Jérôme LORRAIN Date: Mon Dec 20 11:58:49 2021 +0100 Add option to publish from published workfile commit 6f792511a47cee78fd89d0675369ec0da02c7b3c Merge: ecae9f623 646875117 Author: Petr Kalis Date: Mon Feb 7 10:05:55 2022 +0100 Merge pull request #2634 from Ellipsanime/fix-photoshop-environement-workfiles-on-launch Fix open workfile on launch in photoshop commit ecae9f6238c887e0abfeb7a27aaca468d9357b69 Merge: 4b3834ea5 3160199b0 Author: Milan Kolar Date: Mon Feb 7 09:52:39 2022 +0100 Merge pull request #2556 from pypeclub/feature/OP-2429_Publisher-Preparations-before-standalone-publisher commit 4b3834ea50de824dcdb653d5c4bad1afa797c48c Merge: ccea53538 604a590fe Author: pypebot <82967070+pypebot@users.noreply.github.com> Date: Mon Feb 7 09:38:20 2022 +0100 [Automated] Merged release main into develop commit ccea535384555e2eca0730da8d5a4f7a448d8aeb Merge: f2a954371 a11700e1e Author: pypebot <82967070+pypebot@users.noreply.github.com> Date: Sat Feb 5 04:34:51 2022 +0100 [Automated] Merged main into develop commit 6468751179d2fa1002efa5927acaf04549bb8d6e Author: clement.hector Date: Fri Feb 4 12:11:05 2022 +0100 use env_value_to_bool instead of ast.literal_eval + os.getenv commit fe46093ada0494b745b1e8e7263bd9489dd665bd Author: clement.hector Date: Wed Feb 2 19:36:49 2022 +0100 fix test on string to boolean commit 3160199b044d63ffbc4b4d8bb3c7a852578dd355 Author: Jakub Trllo Date: Tue Jan 25 14:15:19 2022 +0100 fix grammar commit d7393646a3a084e3502dec720abbf51aba1385ac Author: Jakub Trllo Date: Tue Jan 25 13:48:18 2022 +0100 handle default value of 'is_label_horizontal' commit 7ec4d501802135fd725e5f37682bc351ca38483f Author: Jakub Trllo Date: Tue Jan 25 13:48:03 2022 +0100 precreate widget is separated from create dialog completely commit f8be5763b57af0e94b85af74ae95ba1579578349 Author: iLLiCiTiT Date: Tue Jan 18 18:05:32 2022 +0100 renamed method 'get_attribute_defs' to 'get_instance_attr_defs' commit 20f5e8fc1b2263882adec624e1b961a0308a3fda Author: iLLiCiTiT Date: Tue Jan 18 17:51:25 2022 +0100 hound fixes commit 95176b6e345e8d70a6e24c78e9bd052382b35481 Author: iLLiCiTiT Date: Tue Jan 18 17:26:16 2022 +0100 modified example creator commit 23c3bc8d0a31875da642aee0ea1298ee34e73831 Author: iLLiCiTiT Date: Tue Jan 18 17:26:09 2022 +0100 style changes of header view nad checkbox commit 2d7521289a088e4bf3f15f573be42b78ee1dd81c Author: iLLiCiTiT Date: Tue Jan 18 17:25:51 2022 +0100 ui attribute definitions are skipped for storing data commit f0b7f72325ff51a9f7cf4681c2fa81c44562d18c Author: iLLiCiTiT Date: Tue Jan 18 17:25:34 2022 +0100 creator dialog has context widget and creator's attributes commit 9c6a57aa587fe7577d9214e55311029d36e34039 Author: iLLiCiTiT Date: Tue Jan 18 17:23:37 2022 +0100 creator can define precreate attribute definitions and allowing context change commit 3878c5262a5293ed250c85a15be6aa5531da1da2 Author: iLLiCiTiT Date: Tue Jan 18 17:22:57 2022 +0100 added widgett for pre create attributes commit fffdef5030f74cb0c0428cfb657234465d2d3a09 Author: iLLiCiTiT Date: Tue Jan 18 17:22:41 2022 +0100 added publisher specific asset and task widgets commit fbdd1d8ab5cc43c5bf00ff6122e68c5aaac5f739 Author: iLLiCiTiT Date: Tue Jan 18 17:22:08 2022 +0100 moved few widgets to tools/utils and modified asset/task widgets to easily change source model commit 396bdfde8a05d37be283f4ba411debc500ee4328 Author: iLLiCiTiT Date: Tue Jan 18 17:16:32 2022 +0100 added few new attribute definitions and their widgets --- .../publish/validate_scene_set_workspace.py | 41 +++++++++++++++++-- .../defaults/project_settings/maya.json | 3 ++ .../schemas/schema_maya_publish.json | 14 +++++++ 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/validate_scene_set_workspace.py b/openpype/hosts/maya/plugins/publish/validate_scene_set_workspace.py index 174bc44a6fd..1c9de6861eb 100644 --- a/openpype/hosts/maya/plugins/publish/validate_scene_set_workspace.py +++ b/openpype/hosts/maya/plugins/publish/validate_scene_set_workspace.py @@ -4,6 +4,7 @@ import pyblish.api import openpype.api +from openpype.lib.profiles_filtering import filter_profiles def is_subdir(path, root_dir): @@ -25,7 +26,7 @@ def is_subdir(path, root_dir): return True -class ValidateSceneSetWorkspace(pyblish.api.ContextPlugin): +class ValidateSceneSetWorkspace(pyblish.api.InstancePlugin): """Validate the scene is inside the currently set Maya workspace""" order = openpype.api.ValidatePipelineOrder @@ -34,8 +35,11 @@ class ValidateSceneSetWorkspace(pyblish.api.ContextPlugin): version = (0, 1, 0) label = 'Maya Workspace Set' - def process(self, context): + publish_from_published_workfiles = False + def process(self, instance): + + context = instance.context scene_name = cmds.file(query=True, sceneName=True) if not scene_name: raise RuntimeError("Scene hasn't been saved. Workspace can't be " @@ -44,4 +48,35 @@ def process(self, context): root_dir = cmds.workspace(query=True, rootDirectory=True) if not is_subdir(scene_name, root_dir): - raise RuntimeError("Maya workspace is not set correctly.") + + if not self.publish_from_published_workfiles: + raise RuntimeError("Maya workspace is not set correctly.") + else: + settings = context.data.get('project_settings') + template_name_profiles = settings.get('global') \ + .get('publish') \ + .get('IntegrateAssetNew') \ + .get('template_name_profiles') + task_name = context.data["anatomyData"]["task"]["name"] + task_type = context.data["anatomyData"]["task"]["type"] + key_values = { + "families": "workfile", + "tasks": task_name, + "hosts": context.data["hostName"], + "task_types": task_type + } + profile = filter_profiles( + template_name_profiles, + key_values, + logger=self.log + ) + anatomy = context.data.get('anatomy') + anatomy_filled = anatomy.format( + instance.data.get('anatomyData') + ) + pub_workfile_path = anatomy_filled.get( + profile["template_name"] + ).get("folder") + + if not is_subdir(scene_name, pub_workfile_path): + raise RuntimeError("Maya workspace is not set correctly.") diff --git a/openpype/settings/defaults/project_settings/maya.json b/openpype/settings/defaults/project_settings/maya.json index 52b8db058c5..1f188d45c59 100644 --- a/openpype/settings/defaults/project_settings/maya.json +++ b/openpype/settings/defaults/project_settings/maya.json @@ -206,6 +206,9 @@ "redshift_render_attributes": [], "renderman_render_attributes": [] }, + "ValidateSceneSetWorkspace": { + "publish_from_published_workfiles": false + }, "ValidateModelName": { "enabled": false, "database": true, diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json b/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json index 5a47d688b5e..71b7b2d8ea6 100644 --- a/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json +++ b/openpype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json @@ -229,6 +229,20 @@ } ] }, + { + "type": "dict", + "collapsible": true, + "key": "ValidateSceneSetWorkspace", + "label": "Validate Workspace", + "is_group": true, + "children": [ + { + "type": "boolean", + "key": "publish_from_published_workfiles", + "label": "Allow publishing form published workfiles" + } + ] + }, { "type": "collapsible-wrap", "label": "Model",