Asset Pipeline: Improve Push Operator UI #199

Merged
Showing only changes of commit 0e7df04867 - Show all commits

View File

@ -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: