From b4a12efecd0e65a3cd0d65e4427568a34219d4c0 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Fri, 10 Jul 2020 12:52:17 +0100 Subject: [PATCH 01/10] Fixed the crash for all loaders --- pype/plugins/blender/load/load_action.py | 16 ++-------------- pype/plugins/blender/load/load_animation.py | 4 +--- pype/plugins/blender/load/load_camera.py | 3 +-- pype/plugins/blender/load/load_layout.py | 2 +- pype/plugins/blender/load/load_model.py | 4 ++-- pype/plugins/blender/load/load_rig.py | 2 +- 6 files changed, 8 insertions(+), 23 deletions(-) diff --git a/pype/plugins/blender/load/load_action.py b/pype/plugins/blender/load/load_action.py index d94bd9aac6..1f2a870640 100644 --- a/pype/plugins/blender/load/load_action.py +++ b/pype/plugins/blender/load/load_action.py @@ -174,22 +174,16 @@ class BlendActionLoader(pype.hosts.blender.plugin.AssetLoader): strips = [] - for obj in collection_metadata["objects"]: - + for obj in list(collection_metadata["objects"]): # Get all the strips that use the action arm_objs = [ arm for arm in bpy.data.objects if arm.type == 'ARMATURE'] for armature_obj in arm_objs: - if armature_obj.animation_data is not None: - for track in armature_obj.animation_data.nla_tracks: - for strip in track.strips: - if strip.action == obj.animation_data.action: - strips.append(strip) bpy.data.actions.remove(obj.animation_data.action) @@ -277,22 +271,16 @@ class BlendActionLoader(pype.hosts.blender.plugin.AssetLoader): objects = collection_metadata["objects"] lib_container = collection_metadata["lib_container"] - for obj in objects: - + for obj in list(objects): # Get all the strips that use the action arm_objs = [ arm for arm in bpy.data.objects if arm.type == 'ARMATURE'] for armature_obj in arm_objs: - if armature_obj.animation_data is not None: - for track in armature_obj.animation_data.nla_tracks: - for strip in track.strips: - if strip.action == obj.animation_data.action: - track.strips.remove(strip) bpy.data.actions.remove(obj.animation_data.action) diff --git a/pype/plugins/blender/load/load_animation.py b/pype/plugins/blender/load/load_animation.py index 1c0e6e0906..32050eca99 100644 --- a/pype/plugins/blender/load/load_animation.py +++ b/pype/plugins/blender/load/load_animation.py @@ -30,9 +30,7 @@ class BlendAnimationLoader(pype.hosts.blender.plugin.AssetLoader): color = "orange" def _remove(self, objects, lib_container): - - for obj in objects: - + for obj in list(objects): if obj.type == 'ARMATURE': bpy.data.armatures.remove(obj.data) elif obj.type == 'MESH': diff --git a/pype/plugins/blender/load/load_camera.py b/pype/plugins/blender/load/load_camera.py index 7fd8f94b4e..9dd5c2bfd8 100644 --- a/pype/plugins/blender/load/load_camera.py +++ b/pype/plugins/blender/load/load_camera.py @@ -28,8 +28,7 @@ class BlendCameraLoader(pype.hosts.blender.plugin.AssetLoader): color = "orange" def _remove(self, objects, lib_container): - - for obj in objects: + for obj in list(objects): bpy.data.cameras.remove(obj.data) bpy.data.collections.remove(bpy.data.collections[lib_container]) diff --git a/pype/plugins/blender/load/load_layout.py b/pype/plugins/blender/load/load_layout.py index cfab5a207b..6a51d7cf16 100644 --- a/pype/plugins/blender/load/load_layout.py +++ b/pype/plugins/blender/load/load_layout.py @@ -21,7 +21,7 @@ class BlendLayoutLoader(plugin.AssetLoader): color = "orange" def _remove(self, objects, obj_container): - for obj in objects: + for obj in list(objects): if obj.type == 'ARMATURE': bpy.data.armatures.remove(obj.data) elif obj.type == 'MESH': diff --git a/pype/plugins/blender/load/load_model.py b/pype/plugins/blender/load/load_model.py index ad9137a15d..4ac86b3aef 100644 --- a/pype/plugins/blender/load/load_model.py +++ b/pype/plugins/blender/load/load_model.py @@ -25,8 +25,8 @@ class BlendModelLoader(plugin.AssetLoader): color = "orange" def _remove(self, objects, container): - for obj in objects: - for material_slot in obj.material_slots: + for obj in list(objects): + for material_slot in list(obj.material_slots): bpy.data.materials.remove(material_slot.material) bpy.data.meshes.remove(obj.data) diff --git a/pype/plugins/blender/load/load_rig.py b/pype/plugins/blender/load/load_rig.py index e09a9cb92f..6dc2273c6e 100644 --- a/pype/plugins/blender/load/load_rig.py +++ b/pype/plugins/blender/load/load_rig.py @@ -25,7 +25,7 @@ class BlendRigLoader(plugin.AssetLoader): color = "orange" def _remove(self, objects, obj_container): - for obj in objects: + for obj in list(objects): if obj.type == 'ARMATURE': bpy.data.armatures.remove(obj.data) elif obj.type == 'MESH': From 91786b5206edd810b77b3e7b5e0193b6d9106cb3 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 16 Jul 2020 14:45:51 +0100 Subject: [PATCH 02/10] fix(celaction): support for space in folder or file name --- pype/hooks/celaction/prelaunch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/hooks/celaction/prelaunch.py b/pype/hooks/celaction/prelaunch.py index df9da6cbbf..e1e86cc919 100644 --- a/pype/hooks/celaction/prelaunch.py +++ b/pype/hooks/celaction/prelaunch.py @@ -106,7 +106,7 @@ class CelactionPrelaunchHook(PypeHook): f"--project {project}", f"--asset {asset}", f"--task {task}", - "--currentFile \"*SCENE*\"", + "--currentFile \\\"\"*SCENE*\"\\\"", "--chunk *CHUNK*", "--frameStart *START*", "--frameEnd *END*", From 027ac520045cc26d449dd29f65b014747477c1e9 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 16 Jul 2020 14:46:25 +0100 Subject: [PATCH 03/10] fix(celaction): correct host path --- pype/hosts/celaction/cli.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pype/hosts/celaction/cli.py b/pype/hosts/celaction/cli.py index 8cf2bcc791..42f7a1a385 100644 --- a/pype/hosts/celaction/cli.py +++ b/pype/hosts/celaction/cli.py @@ -46,9 +46,6 @@ def cli(): parser.add_argument("--resolutionHeight", help=("Height of resolution")) - # parser.add_argument("--programDir", - # help=("Directory with celaction program installation")) - celaction.kwargs = parser.parse_args(sys.argv[1:]).__dict__ @@ -78,7 +75,7 @@ def _prepare_publish_environments(): env["AVALON_WORKDIR"] = os.getenv("AVALON_WORKDIR") env["AVALON_HIERARCHY"] = hierarchy env["AVALON_PROJECTCODE"] = project_doc["data"].get("code", "") - env["AVALON_APP"] = publish_host + env["AVALON_APP"] = f"hosts.{publish_host}" env["AVALON_APP_NAME"] = "celaction_local" env["PYBLISH_HOSTS"] = publish_host From 59608daac1017a602ce2791e95d091592b1e9dda Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 17 Jul 2020 11:50:07 +0100 Subject: [PATCH 04/10] fix(global): remove duplicate code for copy files --- pype/plugins/global/publish/integrate_new.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index 9f20999f55..d151cfc608 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -514,12 +514,6 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): instance: the instance to integrate """ transfers = instance.data.get("transfers", list()) - - for src, dest in transfers: - if os.path.normpath(src) != os.path.normpath(dest): - self.copy_file(src, dest) - - transfers = instance.data.get("transfers", list()) for src, dest in transfers: self.copy_file(src, dest) From ab9e1637fe4ee07eea5ba590c2000866e61a61a9 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 17 Jul 2020 16:14:30 +0200 Subject: [PATCH 05/10] use constant from ftrack.lib for custom attribute name --- pype/plugins/premiere/publish/validate_auto_sync_off.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pype/plugins/premiere/publish/validate_auto_sync_off.py b/pype/plugins/premiere/publish/validate_auto_sync_off.py index 1f3f0b58a5..ca75a4d14e 100644 --- a/pype/plugins/premiere/publish/validate_auto_sync_off.py +++ b/pype/plugins/premiere/publish/validate_auto_sync_off.py @@ -2,7 +2,11 @@ import sys import pyblish.api import pype.api import avalon.api -import six + +try: + from pype.modules.ftrack.lib.avalon_sync import CUST_ATTR_AUTO_SYNC +except Exception: + CUST_ATTR_AUTO_SYNC = "avalon_auto_sync" class ValidateAutoSyncOff(pyblish.api.ContextPlugin): From f7304ba26d6127410a7dab1b9577135ac8593ff9 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 17 Jul 2020 16:14:48 +0200 Subject: [PATCH 06/10] do not query project in process part (not used) --- pype/plugins/premiere/publish/validate_auto_sync_off.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pype/plugins/premiere/publish/validate_auto_sync_off.py b/pype/plugins/premiere/publish/validate_auto_sync_off.py index ca75a4d14e..53042fef6a 100644 --- a/pype/plugins/premiere/publish/validate_auto_sync_off.py +++ b/pype/plugins/premiere/publish/validate_auto_sync_off.py @@ -23,12 +23,7 @@ class ValidateAutoSyncOff(pyblish.api.ContextPlugin): actions = [pype.api.RepairAction] def process(self, context): - session = context.data["ftrackSession"] - project_name = avalon.api.Session["AVALON_PROJECT"] - query = 'Project where full_name is "{}"'.format(project_name) - project = session.query(query).one() invalid = self.get_invalid(context) - assert not invalid, ( "Ftrack Project has 'Auto sync' set to On." " That may cause issues during integration." From 00acee01ce3c5b62d545ed4c58168fe94045aa13 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 17 Jul 2020 16:15:10 +0200 Subject: [PATCH 07/10] get_invalid returns project only if auto sync is turned on --- pype/plugins/premiere/publish/validate_auto_sync_off.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pype/plugins/premiere/publish/validate_auto_sync_off.py b/pype/plugins/premiere/publish/validate_auto_sync_off.py index 53042fef6a..3b7937bbec 100644 --- a/pype/plugins/premiere/publish/validate_auto_sync_off.py +++ b/pype/plugins/premiere/publish/validate_auto_sync_off.py @@ -35,8 +35,8 @@ class ValidateAutoSyncOff(pyblish.api.ContextPlugin): project_name = avalon.api.Session["AVALON_PROJECT"] query = 'Project where full_name is "{}"'.format(project_name) project = session.query(query).one() - - return project + if project["custom_attributes"][CUST_ATTR_AUTO_SYNC]: + return project @classmethod def repair(cls, context): From 7f2d6a7d8518c5205f33fb5d10c98dce3093ef3d Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 17 Jul 2020 16:15:52 +0200 Subject: [PATCH 08/10] one more place where constant for custom attribute key is used --- pype/plugins/premiere/publish/validate_auto_sync_off.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/plugins/premiere/publish/validate_auto_sync_off.py b/pype/plugins/premiere/publish/validate_auto_sync_off.py index 3b7937bbec..dc4420a9f7 100644 --- a/pype/plugins/premiere/publish/validate_auto_sync_off.py +++ b/pype/plugins/premiere/publish/validate_auto_sync_off.py @@ -42,7 +42,7 @@ class ValidateAutoSyncOff(pyblish.api.ContextPlugin): def repair(cls, context): session = context.data["ftrackSession"] invalid = cls.get_invalid(context) - invalid['custom_attributes']['avalon_auto_sync'] = False + invalid["custom_attributes"][CUST_ATTR_AUTO_SYNC] = False try: session.commit() except Exception: From fdaf486ef5ddbe01862373312878a76b9b92d377 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 17 Jul 2020 16:21:11 +0200 Subject: [PATCH 09/10] added additional check to repair for sure --- pype/plugins/premiere/publish/validate_auto_sync_off.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pype/plugins/premiere/publish/validate_auto_sync_off.py b/pype/plugins/premiere/publish/validate_auto_sync_off.py index dc4420a9f7..7a5d78795a 100644 --- a/pype/plugins/premiere/publish/validate_auto_sync_off.py +++ b/pype/plugins/premiere/publish/validate_auto_sync_off.py @@ -42,6 +42,10 @@ class ValidateAutoSyncOff(pyblish.api.ContextPlugin): def repair(cls, context): session = context.data["ftrackSession"] invalid = cls.get_invalid(context) + if not invalid: + cls.log.info("Project 'Auto sync' already fixed.") + return + invalid["custom_attributes"][CUST_ATTR_AUTO_SYNC] = False try: session.commit() From e879fe78958be659fadf8315745e3a7da3459a31 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 17 Jul 2020 16:21:25 +0200 Subject: [PATCH 10/10] changed ReparAction to RepairContextAction --- pype/plugins/premiere/publish/validate_auto_sync_off.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/plugins/premiere/publish/validate_auto_sync_off.py b/pype/plugins/premiere/publish/validate_auto_sync_off.py index 7a5d78795a..cd6fef29c8 100644 --- a/pype/plugins/premiere/publish/validate_auto_sync_off.py +++ b/pype/plugins/premiere/publish/validate_auto_sync_off.py @@ -20,7 +20,7 @@ class ValidateAutoSyncOff(pyblish.api.ContextPlugin): order = pyblish.api.ValidatorOrder families = ['clip'] label = 'Ftrack project\'s auto sync off' - actions = [pype.api.RepairAction] + actions = [pype.api.RepairContextAction] def process(self, context): invalid = self.get_invalid(context)