Asset Pipeline v2 #145
@ -641,12 +641,15 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
||||
]
|
||||
return transfer_data_items_to_update
|
||||
|
||||
def _get_object_to_update(self, context):
|
||||
objs = (
|
||||
context.selected_objects
|
||||
if self.data_source == "SELECT"
|
||||
else context.scene.objects
|
||||
)
|
||||
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
|
||||
]
|
||||
return asset_objs if self.data_source == "ALL" else selected_asset_objs
|
||||
|
||||
def _get_filtered_objects(self, context):
|
||||
objs = self._get_objects(context)
|
||||
if self.filter_owners == "LOCAL" and self.data_type == "OBJECT":
|
||||
return [
|
||||
item
|
||||
@ -709,14 +712,12 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
||||
if self.data_type == "TRANSFER_DATA":
|
||||
box.prop(self, "surrender_selection", expand=True)
|
||||
|
||||
objs = self._get_object_to_update(context)
|
||||
objs = self._get_filtered_objects(context)
|
||||
if self.data_type == "OBJECT":
|
||||
data_type_name = "Object(s)"
|
||||
length = len(objs) if objs else 0
|
||||
else:
|
||||
transfer_data_items_to_update = self._get_transfer_data_to_update(
|
||||
context, objs
|
||||
)
|
||||
transfer_data_items_to_update = self._get_transfer_data_to_update(context)
|
||||
data_type_name = "Transfer Data Item(s)"
|
||||
length = (
|
||||
len(transfer_data_items_to_update)
|
||||
@ -727,15 +728,13 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
||||
layout.label(text=f"Change Ownership on {length} {data_type_name}")
|
||||
|
||||
def execute(self, context: bpy.types.Context):
|
||||
objs = self._get_object_to_update(context)
|
||||
objs = self._get_filtered_objects(context)
|
||||
|
||||
if self.data_type == "OBJECT":
|
||||
for obj in objs:
|
||||
obj.asset_id_owner = self.owner_selection
|
||||
else:
|
||||
transfer_data_items_to_update = self._get_transfer_data_to_update(
|
||||
context, objs
|
||||
)
|
||||
transfer_data_items_to_update = self._get_transfer_data_to_update(context)
|
||||
|
||||
for transfer_data_item_to_update in transfer_data_items_to_update:
|
||||
if self.surrender_selection:
|
||||
|
Loading…
Reference in New Issue
Block a user