Asset Pipeline v2 #145
@ -357,6 +357,47 @@ class ASSETPIPE_OT_reset_ownership(bpy.types.Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class ASSETPIPE_OT_update_local_task_layers(bpy.types.Operator):
|
||||
bl_idname = "assetpipe.update_local_task_layers"
|
||||
bl_label = "Update Local Task Layers"
|
||||
bl_description = """Change the Task Layers that are Local to your file"""
|
||||
|
||||
# box
|
||||
|
||||
@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
|
||||
]
|
||||
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")
|
||||
return False
|
||||
return True
|
||||
|
||||
def invoke(self, context: bpy.types.Context, event: bpy.types.Event):
|
||||
return context.window_manager.invoke_props_dialog(self, width=400)
|
||||
|
||||
def draw(self, context: bpy.types.Context):
|
||||
layout = self.layout
|
||||
layout.alert = True
|
||||
layout.label(
|
||||
text="Caution, this only affects current file.",
|
||||
icon="ERROR",
|
||||
) # TODO Improve warning
|
||||
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
|
||||
all_task_layers = asset_pipe.all_task_layers
|
||||
local_tl = [tl.name for tl in all_task_layers if tl.is_local == True]
|
||||
set_local_task_layers(local_tl)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
classes = (
|
||||
ASSETPIPE_OT_update_ownership,
|
||||
ASSETPIPE_OT_sync_push,
|
||||
@ -364,6 +405,7 @@ classes = (
|
||||
ASSETPIPE_OT_publish_new_version,
|
||||
ASSETPIPE_OT_create_new_asset,
|
||||
ASSETPIPE_OT_reset_ownership,
|
||||
ASSETPIPE_OT_update_local_task_layers,
|
||||
)
|
||||
|
||||
|
||||
|
@ -66,7 +66,19 @@ class ASSETPIPE_PT_sync_advanced(bpy.types.Panel):
|
||||
|
||||
def draw(self, context: bpy.types.Context) -> None:
|
||||
layout = self.layout
|
||||
layout.operator("assetpipe.reset_ownership")
|
||||
box = layout.box()
|
||||
box.operator("assetpipe.reset_ownership")
|
||||
|
||||
# Task Layer Updater
|
||||
box = layout.box()
|
||||
box.label(text="Change Local Task Layers")
|
||||
|
||||
row = box.row()
|
||||
asset_pipe = context.scene.asset_pipeline
|
||||
all_task_layers = asset_pipe.all_task_layers
|
||||
for task_layer in all_task_layers:
|
||||
row.prop(task_layer, "is_local", text=task_layer.name)
|
||||
box.operator("assetpipe.update_local_task_layers")
|
||||
|
||||
|
||||
class ASSETPIPE_PT_ownership_inspector(bpy.types.Panel):
|
||||
|
Loading…
Reference in New Issue
Block a user