Asset Pipeline: Improve Push Operator UI #199
@ -168,17 +168,13 @@ class ASSETPIPE_OT_create_new_asset(bpy.types.Operator):
|
|||||||
for obj in bpy.data.objects:
|
for obj in bpy.data.objects:
|
||||||
bpy.data.objects.remove(obj)
|
bpy.data.objects.remove(obj)
|
||||||
|
|
||||||
bpy.ops.outliner.orphans_purge(
|
bpy.ops.outliner.orphans_purge(do_local_ids=True, do_linked_ids=False, do_recursive=True)
|
||||||
do_local_ids=True, do_linked_ids=False, do_recursive=True
|
|
||||||
)
|
|
||||||
|
|
||||||
def _task_layer_collections_set(self, context, asset_col, local_tls):
|
def _task_layer_collections_set(self, context, asset_col, local_tls):
|
||||||
for task_layer_key in config.TASK_LAYER_TYPES:
|
for task_layer_key in config.TASK_LAYER_TYPES:
|
||||||
if task_layer_key not in local_tls:
|
if task_layer_key not in local_tls:
|
||||||
continue
|
continue
|
||||||
col_name = (
|
col_name = (f"{self._name}{constants.NAME_DELIMITER}{task_layer_key}").lower()
|
||||||
f"{self._name}{constants.NAME_DELIMITER}{task_layer_key}"
|
|
||||||
).lower()
|
|
||||||
bpy.data.collections.new(col_name)
|
bpy.data.collections.new(col_name)
|
||||||
task_layer_col = bpy.data.collections.get(col_name)
|
task_layer_col = bpy.data.collections.get(col_name)
|
||||||
task_layer_col.asset_id_owner = task_layer_key
|
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):
|
def execute(self, context: bpy.types.Context):
|
||||||
current_file = Path(bpy.data.filepath)
|
current_file = Path(bpy.data.filepath)
|
||||||
staged_file = find_latest_publish(
|
staged_file = find_latest_publish(current_file, publish_type=constants.STAGED_PUBLISH_KEY)
|
||||||
current_file, publish_type=constants.STAGED_PUBLISH_KEY
|
|
||||||
)
|
|
||||||
# Delete Staged File
|
# Delete Staged File
|
||||||
staged_file.unlink()
|
staged_file.unlink()
|
||||||
catalog_id = context.scene.asset_pipeline.asset_catalog_id
|
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):
|
class ASSETPIPE_OT_reset_ownership(bpy.types.Operator):
|
||||||
bl_idname = "assetpipe.reset_ownership"
|
bl_idname = "assetpipe.reset_ownership"
|
||||||
bl_label = "Reset Ownership"
|
bl_label = "Reset Ownership"
|
||||||
bl_description = (
|
bl_description = """Reset the Object owner and Transferable Data on selected object(s)"""
|
||||||
"""Reset the Object owner and Transferable Data on selected object(s)"""
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context: bpy.types.Context) -> bool:
|
def poll(cls, context: bpy.types.Context) -> bool:
|
||||||
@ -508,9 +500,7 @@ class ASSETPIPE_OT_update_local_task_layers(bpy.types.Operator):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context: bpy.types.Context) -> bool:
|
def poll(cls, context: bpy.types.Context) -> bool:
|
||||||
asset_pipe = context.scene.asset_pipeline
|
asset_pipe = context.scene.asset_pipeline
|
||||||
new_local_tl = [
|
new_local_tl = [tl.name for tl in asset_pipe.all_task_layers if tl.is_local == True]
|
||||||
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]
|
local_tl = [tl.name for tl in asset_pipe.local_task_layers]
|
||||||
if new_local_tl == local_tl:
|
if new_local_tl == local_tl:
|
||||||
cls.poll_message_set("Local Task Layers already match current selection")
|
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.",
|
text="Caution, this only affects current file.",
|
||||||
icon="ERROR",
|
icon="ERROR",
|
||||||
)
|
)
|
||||||
layout.label(
|
layout.label(text="Two files owning the same task layer can break merge process.")
|
||||||
text="Two files owning the same task layer can break merge process."
|
|
||||||
)
|
|
||||||
|
|
||||||
def execute(self, context: bpy.types.Context):
|
def execute(self, context: bpy.types.Context):
|
||||||
asset_pipe = context.scene.asset_pipeline
|
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):
|
class ASSETPIPE_OT_revert_file(bpy.types.Operator):
|
||||||
bl_idname = "assetpipe.revert_file"
|
bl_idname = "assetpipe.revert_file"
|
||||||
bl_label = "Revert File"
|
bl_label = "Revert File"
|
||||||
bl_description = (
|
bl_description = """Revert File to Pre-Sync State. Revert will not affect Published files"""
|
||||||
"""Revert File to Pre-Sync State. Revert will not affect Published files"""
|
|
||||||
)
|
|
||||||
|
|
||||||
_temp_file = ""
|
_temp_file = ""
|
||||||
_source_file = ""
|
_source_file = ""
|
||||||
@ -643,9 +629,7 @@ class ASSETPIPE_OT_update_surrendered_transfer_data(bpy.types.Operator):
|
|||||||
bl_label = "Claim Surrendered"
|
bl_label = "Claim Surrendered"
|
||||||
bl_description = """Claim Surrended Transferable Data Owner"""
|
bl_description = """Claim Surrended Transferable Data Owner"""
|
||||||
|
|
||||||
transfer_data_item_name: bpy.props.StringProperty(
|
transfer_data_item_name: bpy.props.StringProperty(name="Transferable Data Item Name")
|
||||||
name="Transferable Data Item Name"
|
|
||||||
)
|
|
||||||
|
|
||||||
_surrendered_transfer_data = None
|
_surrendered_transfer_data = None
|
||||||
_old_onwer = ""
|
_old_onwer = ""
|
||||||
@ -774,9 +758,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
transfer_data_items_to_update = []
|
transfer_data_items_to_update = []
|
||||||
if self.data_type == "TRANSFER_DATA":
|
if self.data_type == "TRANSFER_DATA":
|
||||||
for obj in objs:
|
for obj in objs:
|
||||||
filtered_transfer_data = self._filter_by_name(
|
filtered_transfer_data = self._filter_by_name(context, obj.transfer_data_ownership)
|
||||||
context, obj.transfer_data_ownership
|
|
||||||
)
|
|
||||||
for transfer_data_item in filtered_transfer_data:
|
for transfer_data_item in filtered_transfer_data:
|
||||||
if self.transfer_data_type != "NONE":
|
if self.transfer_data_type != "NONE":
|
||||||
if transfer_data_item.type == self.transfer_data_type:
|
if transfer_data_item.type == self.transfer_data_type:
|
||||||
@ -788,8 +770,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
return [
|
return [
|
||||||
item
|
item
|
||||||
for item in transfer_data_items_to_update
|
for item in transfer_data_items_to_update
|
||||||
if item.surrender
|
if item.surrender and item.owner not in asset_pipe.get_local_task_layers()
|
||||||
and item.owner not in asset_pipe.get_local_task_layers()
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if self.filter_owners == "LOCAL":
|
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 item.owner in asset_pipe.get_local_task_layers()
|
||||||
]
|
]
|
||||||
if self.set_surrender:
|
if self.set_surrender:
|
||||||
return [
|
return [item for item in transfer_data_items_to_update if not item.surrender]
|
||||||
item for item in transfer_data_items_to_update if not item.surrender
|
|
||||||
]
|
|
||||||
|
|
||||||
return transfer_data_items_to_update
|
return transfer_data_items_to_update
|
||||||
|
|
||||||
def _get_objects(self, context):
|
def _get_objects(self, context):
|
||||||
asset_objs = context.scene.asset_pipeline.asset_collection.all_objects
|
asset_objs = context.scene.asset_pipeline.asset_collection.all_objects
|
||||||
selected_asset_objs = [
|
selected_asset_objs = [obj for obj in asset_objs if obj in context.selected_objects]
|
||||||
obj for obj in asset_objs if obj in context.selected_objects
|
|
||||||
]
|
|
||||||
return asset_objs if self.data_source == "ALL" else selected_asset_objs
|
return asset_objs if self.data_source == "ALL" else selected_asset_objs
|
||||||
|
|
||||||
def _get_filtered_objects(self, context):
|
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)
|
transfer_data_items_to_update = self._get_transfer_data_to_update(context)
|
||||||
data_type_name = "Transferable Data Item(s)"
|
data_type_name = "Transferable Data Item(s)"
|
||||||
|
|
||||||
length = (
|
length = len(transfer_data_items_to_update) if transfer_data_items_to_update else 0
|
||||||
len(transfer_data_items_to_update)
|
|
||||||
if transfer_data_items_to_update
|
|
||||||
else 0
|
|
||||||
)
|
|
||||||
if self.claim_surrender:
|
if self.claim_surrender:
|
||||||
action = "Claim Surrendered on"
|
action = "Claim Surrendered on"
|
||||||
if self.set_surrender:
|
if self.set_surrender:
|
||||||
|
Loading…
Reference in New Issue
Block a user