From b4700e65eaebdfc598a1bb67e99ae79101534569 Mon Sep 17 00:00:00 2001 From: Nick Alberelli Date: Wed, 10 Jan 2024 10:01:23 -0500 Subject: [PATCH 1/8] Asset Pipeline: Remove Save Bool on Push --- scripts-blender/addons/asset_pipeline/ops.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts-blender/addons/asset_pipeline/ops.py b/scripts-blender/addons/asset_pipeline/ops.py index e04ec0cd..66c051fd 100644 --- a/scripts-blender/addons/asset_pipeline/ops.py +++ b/scripts-blender/addons/asset_pipeline/ops.py @@ -371,13 +371,11 @@ class ASSETPIPE_OT_sync_push(bpy.types.Operator): prefs = get_addon_prefs() if prefs.is_advanced_mode: self.layout.prop(self, "pull") - self.layout.prop(self, "save") sync_draw(self, context) def execute(self, context: bpy.types.Context): - if self.save: - save_images() - bpy.ops.wm.save_mainfile() + save_images() + bpy.ops.wm.save_mainfile() # Find current task Layer sync_execute_update_ownership(self, context) -- 2.30.2 From 0e7df048674451433f8b8a9955dde930ce41a9e0 Mon Sep 17 00:00:00 2001 From: Nick Alberelli Date: Wed, 10 Jan 2024 10:01:49 -0500 Subject: [PATCH 2/8] Asset Pipeline: Enforce Black Formatting on `ops.py` --- scripts-blender/addons/asset_pipeline/ops.py | 53 +++++--------------- 1 file changed, 13 insertions(+), 40 deletions(-) diff --git a/scripts-blender/addons/asset_pipeline/ops.py b/scripts-blender/addons/asset_pipeline/ops.py index 66c051fd..f69e95ec 100644 --- a/scripts-blender/addons/asset_pipeline/ops.py +++ b/scripts-blender/addons/asset_pipeline/ops.py @@ -168,17 +168,13 @@ class ASSETPIPE_OT_create_new_asset(bpy.types.Operator): for obj in bpy.data.objects: bpy.data.objects.remove(obj) - bpy.ops.outliner.orphans_purge( - do_local_ids=True, do_linked_ids=False, do_recursive=True - ) + bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=False, do_recursive=True) def _task_layer_collections_set(self, context, asset_col, local_tls): for task_layer_key in config.TASK_LAYER_TYPES: if task_layer_key not in local_tls: continue - col_name = ( - f"{self._name}{constants.NAME_DELIMITER}{task_layer_key}" - ).lower() + col_name = (f"{self._name}{constants.NAME_DELIMITER}{task_layer_key}").lower() bpy.data.collections.new(col_name) task_layer_col = bpy.data.collections.get(col_name) task_layer_col.asset_id_owner = task_layer_key @@ -464,9 +460,7 @@ class ASSETPIPE_OT_publish_staged_as_active(bpy.types.Operator): def execute(self, context: bpy.types.Context): current_file = Path(bpy.data.filepath) - staged_file = find_latest_publish( - current_file, publish_type=constants.STAGED_PUBLISH_KEY - ) + staged_file = find_latest_publish(current_file, publish_type=constants.STAGED_PUBLISH_KEY) # Delete Staged File staged_file.unlink() catalog_id = context.scene.asset_pipeline.asset_catalog_id @@ -477,9 +471,7 @@ class ASSETPIPE_OT_publish_staged_as_active(bpy.types.Operator): class ASSETPIPE_OT_reset_ownership(bpy.types.Operator): bl_idname = "assetpipe.reset_ownership" bl_label = "Reset Ownership" - bl_description = ( - """Reset the Object owner and Transferable Data on selected object(s)""" - ) + bl_description = """Reset the Object owner and Transferable Data on selected object(s)""" @classmethod def poll(cls, context: bpy.types.Context) -> bool: @@ -508,9 +500,7 @@ class ASSETPIPE_OT_update_local_task_layers(bpy.types.Operator): @classmethod def poll(cls, context: bpy.types.Context) -> bool: asset_pipe = context.scene.asset_pipeline - new_local_tl = [ - tl.name for tl in asset_pipe.all_task_layers if tl.is_local == True - ] + new_local_tl = [tl.name for tl in asset_pipe.all_task_layers if tl.is_local == True] local_tl = [tl.name for tl in asset_pipe.local_task_layers] if new_local_tl == local_tl: cls.poll_message_set("Local Task Layers already match current selection") @@ -527,9 +517,7 @@ class ASSETPIPE_OT_update_local_task_layers(bpy.types.Operator): text="Caution, this only affects current file.", icon="ERROR", ) - layout.label( - text="Two files owning the same task layer can break merge process." - ) + layout.label(text="Two files owning the same task layer can break merge process.") def execute(self, context: bpy.types.Context): asset_pipe = context.scene.asset_pipeline @@ -542,9 +530,7 @@ class ASSETPIPE_OT_update_local_task_layers(bpy.types.Operator): class ASSETPIPE_OT_revert_file(bpy.types.Operator): bl_idname = "assetpipe.revert_file" bl_label = "Revert File" - bl_description = ( - """Revert File to Pre-Sync State. Revert will not affect Published files""" - ) + bl_description = """Revert File to Pre-Sync State. Revert will not affect Published files""" _temp_file = "" _source_file = "" @@ -643,9 +629,7 @@ class ASSETPIPE_OT_update_surrendered_transfer_data(bpy.types.Operator): bl_label = "Claim Surrendered" bl_description = """Claim Surrended Transferable Data Owner""" - transfer_data_item_name: bpy.props.StringProperty( - name="Transferable Data Item Name" - ) + transfer_data_item_name: bpy.props.StringProperty(name="Transferable Data Item Name") _surrendered_transfer_data = None _old_onwer = "" @@ -774,9 +758,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator): transfer_data_items_to_update = [] if self.data_type == "TRANSFER_DATA": for obj in objs: - filtered_transfer_data = self._filter_by_name( - context, obj.transfer_data_ownership - ) + filtered_transfer_data = self._filter_by_name(context, obj.transfer_data_ownership) for transfer_data_item in filtered_transfer_data: if self.transfer_data_type != "NONE": if transfer_data_item.type == self.transfer_data_type: @@ -788,8 +770,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator): return [ item for item in transfer_data_items_to_update - if item.surrender - and item.owner not in asset_pipe.get_local_task_layers() + if item.surrender and item.owner not in asset_pipe.get_local_task_layers() ] if self.filter_owners == "LOCAL": @@ -799,17 +780,13 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator): if item.owner in asset_pipe.get_local_task_layers() ] if self.set_surrender: - return [ - item for item in transfer_data_items_to_update if not item.surrender - ] + return [item for item in transfer_data_items_to_update if not item.surrender] return transfer_data_items_to_update def _get_objects(self, context): asset_objs = context.scene.asset_pipeline.asset_collection.all_objects - selected_asset_objs = [ - obj for obj in asset_objs if obj in context.selected_objects - ] + selected_asset_objs = [obj for obj in asset_objs if obj in context.selected_objects] return asset_objs if self.data_source == "ALL" else selected_asset_objs def _get_filtered_objects(self, context): @@ -838,11 +815,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator): transfer_data_items_to_update = self._get_transfer_data_to_update(context) data_type_name = "Transferable Data Item(s)" - length = ( - len(transfer_data_items_to_update) - if transfer_data_items_to_update - else 0 - ) + length = len(transfer_data_items_to_update) if transfer_data_items_to_update else 0 if self.claim_surrender: action = "Claim Surrendered on" if self.set_surrender: -- 2.30.2 From 5b4872445c21eb4d937ac17a35c8196f470f0666 Mon Sep 17 00:00:00 2001 From: Nick Alberelli Date: Wed, 10 Jan 2024 10:02:37 -0500 Subject: [PATCH 3/8] Asset Pipeline: Expose Pull Before Push Option in non-advanced Mode --- scripts-blender/addons/asset_pipeline/ops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts-blender/addons/asset_pipeline/ops.py b/scripts-blender/addons/asset_pipeline/ops.py index f69e95ec..e03049ec 100644 --- a/scripts-blender/addons/asset_pipeline/ops.py +++ b/scripts-blender/addons/asset_pipeline/ops.py @@ -365,8 +365,8 @@ class ASSETPIPE_OT_sync_push(bpy.types.Operator): def draw(self, context: bpy.types.Context): prefs = get_addon_prefs() - if prefs.is_advanced_mode: - self.layout.prop(self, "pull") + + self.layout.prop(self, "pull") sync_draw(self, context) def execute(self, context: bpy.types.Context): -- 2.30.2 From 6f7f8ea582e61a8cc8fd6ac52744fd0c0199c229 Mon Sep 17 00:00:00 2001 From: Nick Alberelli Date: Wed, 10 Jan 2024 10:03:55 -0500 Subject: [PATCH 4/8] Asset Pipeline: Rename Push Operator to Push & Pull --- scripts-blender/addons/asset_pipeline/ops.py | 2 +- scripts-blender/addons/asset_pipeline/ui.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts-blender/addons/asset_pipeline/ops.py b/scripts-blender/addons/asset_pipeline/ops.py index e03049ec..70be2afe 100644 --- a/scripts-blender/addons/asset_pipeline/ops.py +++ b/scripts-blender/addons/asset_pipeline/ops.py @@ -324,7 +324,7 @@ class ASSETPIPE_OT_sync_pull(bpy.types.Operator): class ASSETPIPE_OT_sync_push(bpy.types.Operator): bl_idname = "assetpipe.sync_push" - bl_label = "Push from Publish" + bl_label = "Push & Pull from Publish" bl_description = """Push the current Task Layer to the published sync target""" _temp_transfer_data = None diff --git a/scripts-blender/addons/asset_pipeline/ui.py b/scripts-blender/addons/asset_pipeline/ui.py index 7add9864..e9d871e4 100644 --- a/scripts-blender/addons/asset_pipeline/ui.py +++ b/scripts-blender/addons/asset_pipeline/ui.py @@ -59,7 +59,9 @@ class ASSETPIPE_PT_sync(bpy.types.Panel): staged = is_staged_publish(Path(bpy.data.filepath)) sync_target_name = "Staged" if staged else "Active" - layout.operator("assetpipe.sync_push", text=f"Push to {sync_target_name}", icon="TRIA_UP") + layout.operator( + "assetpipe.sync_push", text=f"Push & Pull from {sync_target_name}", icon="TRIA_UP" + ) layout.operator( "assetpipe.sync_pull", text=f"Pull from {sync_target_name}", -- 2.30.2 From 9b8a3c39298af7210f8f46b09c8672df40b17bad Mon Sep 17 00:00:00 2001 From: Nick Alberelli Date: Wed, 10 Jan 2024 10:07:18 -0500 Subject: [PATCH 5/8] Asset Pipeline: Update Push & Pull Operator Tooltip --- scripts-blender/addons/asset_pipeline/ops.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts-blender/addons/asset_pipeline/ops.py b/scripts-blender/addons/asset_pipeline/ops.py index 70be2afe..2a0ae5a9 100644 --- a/scripts-blender/addons/asset_pipeline/ops.py +++ b/scripts-blender/addons/asset_pipeline/ops.py @@ -325,7 +325,8 @@ class ASSETPIPE_OT_sync_pull(bpy.types.Operator): class ASSETPIPE_OT_sync_push(bpy.types.Operator): bl_idname = "assetpipe.sync_push" bl_label = "Push & Pull from Publish" - bl_description = """Push the current Task Layer to the published sync target""" + bl_description = """Push & Pull the current Task Layer to the published sync target. + File will be saved as part of the Push process""" _temp_transfer_data = None _invalid_objs = [] -- 2.30.2 From c3e0ef190ac2e42ac26434fb176a317fb2d5b491 Mon Sep 17 00:00:00 2001 From: Nick Alberelli Date: Wed, 10 Jan 2024 10:09:10 -0500 Subject: [PATCH 6/8] Asset Pipeline: Fix Line Break in Push & Pull Tooltip --- scripts-blender/addons/asset_pipeline/ops.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts-blender/addons/asset_pipeline/ops.py b/scripts-blender/addons/asset_pipeline/ops.py index 2a0ae5a9..7ebd1948 100644 --- a/scripts-blender/addons/asset_pipeline/ops.py +++ b/scripts-blender/addons/asset_pipeline/ops.py @@ -325,8 +325,7 @@ class ASSETPIPE_OT_sync_pull(bpy.types.Operator): class ASSETPIPE_OT_sync_push(bpy.types.Operator): bl_idname = "assetpipe.sync_push" bl_label = "Push & Pull from Publish" - bl_description = """Push & Pull the current Task Layer to the published sync target. - File will be saved as part of the Push process""" + bl_description = """Push & Pull the current Task Layer to the published sync target. File will be saved as part of the Push process""" _temp_transfer_data = None _invalid_objs = [] -- 2.30.2 From a02eacb2fec65abaa0e3db1988a848ef20f428c5 Mon Sep 17 00:00:00 2001 From: Nick Alberelli Date: Fri, 12 Jan 2024 16:08:54 -0500 Subject: [PATCH 7/8] Asset Pipeline: Add Force Push Button to UI --- scripts-blender/addons/asset_pipeline/ops.py | 19 +++++++------------ scripts-blender/addons/asset_pipeline/ui.py | 7 +++++-- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/scripts-blender/addons/asset_pipeline/ops.py b/scripts-blender/addons/asset_pipeline/ops.py index 7ebd1948..6011bfa8 100644 --- a/scripts-blender/addons/asset_pipeline/ops.py +++ b/scripts-blender/addons/asset_pipeline/ops.py @@ -274,7 +274,7 @@ class ASSETPIPE_OT_update_ownership(bpy.types.Operator): class ASSETPIPE_OT_sync_pull(bpy.types.Operator): bl_idname = "assetpipe.sync_pull" - bl_label = "Pull from Publish" + bl_label = "Pull Asset" bl_description = """Pull Task Layers from the published sync target""" _temp_transfer_data = None @@ -324,8 +324,8 @@ class ASSETPIPE_OT_sync_pull(bpy.types.Operator): class ASSETPIPE_OT_sync_push(bpy.types.Operator): bl_idname = "assetpipe.sync_push" - bl_label = "Push & Pull from Publish" - bl_description = """Push & Pull the current Task Layer to the published sync target. File will be saved as part of the Push process""" + bl_label = "Sync Asset" + bl_description = """Sync the current Task Layer to the published sync target. File will be saved as part of the Push process""" _temp_transfer_data = None _invalid_objs = [] @@ -346,12 +346,6 @@ class ASSETPIPE_OT_sync_push(bpy.types.Operator): description="Pull in any new data from the Published file before Pushing", ) - save: bpy.props.BoolProperty( - name="Save File & Images", - default=True, - description="Save Current File and Images before Push", - ) - @classmethod def poll(cls, context: bpy.types.Context) -> bool: if context.mode == 'OBJECT': @@ -364,9 +358,10 @@ class ASSETPIPE_OT_sync_push(bpy.types.Operator): return context.window_manager.invoke_props_dialog(self, width=400) def draw(self, context: bpy.types.Context): - prefs = get_addon_prefs() - - self.layout.prop(self, "pull") + if not self.pull: + col = self.layout.column() + col.label(text="Force Pushing without pulling can cause data loss", icon="ERROR") + col.separator() sync_draw(self, context) def execute(self, context: bpy.types.Context): diff --git a/scripts-blender/addons/asset_pipeline/ui.py b/scripts-blender/addons/asset_pipeline/ui.py index e9d871e4..00133a7b 100644 --- a/scripts-blender/addons/asset_pipeline/ui.py +++ b/scripts-blender/addons/asset_pipeline/ui.py @@ -60,8 +60,11 @@ class ASSETPIPE_PT_sync(bpy.types.Panel): staged = is_staged_publish(Path(bpy.data.filepath)) sync_target_name = "Staged" if staged else "Active" layout.operator( - "assetpipe.sync_push", text=f"Push & Pull from {sync_target_name}", icon="TRIA_UP" - ) + "assetpipe.sync_push", text=f"Force Push to {sync_target_name}", icon="TRIA_UP" + ).pull = False + layout.operator( + "assetpipe.sync_push", text=f"Sync from {sync_target_name}", icon="FILE_REFRESH" + ).pull = True layout.operator( "assetpipe.sync_pull", text=f"Pull from {sync_target_name}", -- 2.30.2 From 860f707fb19af8d7989d87f5118c5feaa7e83f64 Mon Sep 17 00:00:00 2001 From: Nick Alberelli Date: Tue, 16 Jan 2024 11:44:11 -0500 Subject: [PATCH 8/8] Asset Pipeline: Reveres Sync Button Order --- scripts-blender/addons/asset_pipeline/ui.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts-blender/addons/asset_pipeline/ui.py b/scripts-blender/addons/asset_pipeline/ui.py index 00133a7b..1ae2beb0 100644 --- a/scripts-blender/addons/asset_pipeline/ui.py +++ b/scripts-blender/addons/asset_pipeline/ui.py @@ -59,17 +59,17 @@ class ASSETPIPE_PT_sync(bpy.types.Panel): staged = is_staged_publish(Path(bpy.data.filepath)) sync_target_name = "Staged" if staged else "Active" - layout.operator( - "assetpipe.sync_push", text=f"Force Push to {sync_target_name}", icon="TRIA_UP" - ).pull = False - layout.operator( - "assetpipe.sync_push", text=f"Sync from {sync_target_name}", icon="FILE_REFRESH" - ).pull = True layout.operator( "assetpipe.sync_pull", text=f"Pull from {sync_target_name}", icon="TRIA_DOWN", ) + layout.operator( + "assetpipe.sync_push", text=f"Sync from {sync_target_name}", icon="FILE_REFRESH" + ).pull = True + layout.operator( + "assetpipe.sync_push", text=f"Force Push to {sync_target_name}", icon="TRIA_UP" + ).pull = False layout.separator() if staged: -- 2.30.2