Asset Pipeline: Improve Push Operator UI #199

Merged
2 changed files with 12 additions and 14 deletions
Showing only changes of commit a02eacb2fe - Show all commits

View File

@ -274,7 +274,7 @@ class ASSETPIPE_OT_update_ownership(bpy.types.Operator):
class ASSETPIPE_OT_sync_pull(bpy.types.Operator): class ASSETPIPE_OT_sync_pull(bpy.types.Operator):
bl_idname = "assetpipe.sync_pull" bl_idname = "assetpipe.sync_pull"
bl_label = "Pull from Publish" bl_label = "Pull Asset"
bl_description = """Pull Task Layers from the published sync target""" bl_description = """Pull Task Layers from the published sync target"""
_temp_transfer_data = None _temp_transfer_data = None
@ -324,8 +324,8 @@ class ASSETPIPE_OT_sync_pull(bpy.types.Operator):
class ASSETPIPE_OT_sync_push(bpy.types.Operator): class ASSETPIPE_OT_sync_push(bpy.types.Operator):
bl_idname = "assetpipe.sync_push" bl_idname = "assetpipe.sync_push"
bl_label = "Push & Pull from Publish" bl_label = "Sync Asset"
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 = """Sync the current Task Layer to the published sync target. File will be saved as part of the Push process"""
_temp_transfer_data = None _temp_transfer_data = None
_invalid_objs = [] _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", 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 @classmethod
def poll(cls, context: bpy.types.Context) -> bool: def poll(cls, context: bpy.types.Context) -> bool:
if context.mode == 'OBJECT': 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) return context.window_manager.invoke_props_dialog(self, width=400)
def draw(self, context: bpy.types.Context): def draw(self, context: bpy.types.Context):
prefs = get_addon_prefs() if not self.pull:
col = self.layout.column()
self.layout.prop(self, "pull") col.label(text="Force Pushing without pulling can cause data loss", icon="ERROR")
col.separator()
sync_draw(self, context) sync_draw(self, context)
def execute(self, context: bpy.types.Context): def execute(self, context: bpy.types.Context):

View File

@ -60,8 +60,11 @@ class ASSETPIPE_PT_sync(bpy.types.Panel):
staged = is_staged_publish(Path(bpy.data.filepath)) staged = is_staged_publish(Path(bpy.data.filepath))
sync_target_name = "Staged" if staged else "Active" sync_target_name = "Staged" if staged else "Active"
layout.operator( 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( layout.operator(
"assetpipe.sync_pull", "assetpipe.sync_pull",
text=f"Pull from {sync_target_name}", text=f"Pull from {sync_target_name}",