Asset Pipeline v2 #145

Closed
Nick Alberelli wants to merge 431 commits from (deleted):feature/asset-pipeline-v2 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 6aead7150f - Show all commits

View File

@ -533,7 +533,11 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
data_type: bpy.props.EnumProperty( data_type: bpy.props.EnumProperty(
name="Type", name="Type",
items=( items=(
('OBJECT', "Object", "Update Owner of Objects"), (
'OBJECT',
"Object",
"Update Owner of Objects",
),
( (
'TRANSFER_DATA', 'TRANSFER_DATA',
"Transfer Data", "Transfer Data",
@ -567,7 +571,11 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
name="Type Filter", items=constants.TRANSFER_DATA_TYPES_ENUM_ITEMS name="Type Filter", items=constants.TRANSFER_DATA_TYPES_ENUM_ITEMS
) )
owner_selection: bpy.props.StringProperty(name="Set Owner") owner_selection: bpy.props.StringProperty(name="Set Owner")
surrender_selection: bpy.props.BoolProperty(name="Set Surrender", default=False) surrender_selection: bpy.props.BoolProperty(
name="Set Surrender",
default=False,
description="Surrender can only be set on objects/transfer data that are locally owned. Ownership cannot be changed while surrendering",
)
def _filter_by_name(self, context, unfiltered_list: []): def _filter_by_name(self, context, unfiltered_list: []):
if self.name_filter == "": if self.name_filter == "":
@ -616,22 +624,24 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
return self._filter_by_name(context, objs) return self._filter_by_name(context, objs)
def invoke(self, context: bpy.types.Context, event: bpy.types.Event): def invoke(self, context: bpy.types.Context, event: bpy.types.Event):
# if self.owner_selection == "NONE":
# self.owner_selection = get_local_task_layers()[0]
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):
layout = self.layout grey_out = True
split = layout.split(align=True) if self.surrender_selection and self.data_type == "TRANSFER_DATA":
layout.row(align=True).prop(self, "data_source", expand=True) grey_out = False
self.filter_owners = "LOCAL"
# TODO SET HIGHER LEVEL ENUM IF USER WANTS TO UPDATE ONLY LOCALLY OWNED OR ALL OBJECTS layout = self.layout
layout.row(align=True).prop(self, "data_source", expand=True)
layout.prop(self, "data_type", text="Update Owner of") layout.prop(self, "data_type", text="Update Owner of")
box = layout.box() box = layout.box()
box.prop(self, "filter_owners") filter_owner_row = box.row()
filter_owner_row.enabled = grey_out
filter_owner_row.prop(self, "filter_owners")
if self.data_type == "TRANSFER_DATA": if self.data_type == "TRANSFER_DATA":
box.prop(self, "transfer_data_type") box.prop(self, "transfer_data_type")
@ -643,10 +653,11 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
else: else:
show_local = False show_local = False
show_all_task_layers = True show_all_task_layers = True
row = box.row(align=True) owner_row = box.row(align=True)
owner_row.enabled = grey_out
draw_task_layer_selection( draw_task_layer_selection(
row, owner_row,
context.scene, context.scene,
self, self,
self.owner_selection, self.owner_selection,
@ -655,10 +666,10 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
show_local=show_local, show_local=show_local,
text="Owner", text="Owner",
) )
row.prop(self, "avaliable_owners", text="") owner_row.prop(self, "avaliable_owners", text="")
# TODO Logically this can't be assigned to all objects, only ones I Own?
# if self.data_type == "TRANSFER_DATA": if self.data_type == "TRANSFER_DATA":
# box.prop(self, "surrender_selection", expand=True) box.prop(self, "surrender_selection", expand=True)
objs = self._get_object_to_update(context) objs = self._get_object_to_update(context)
if self.data_type == "OBJECT": if self.data_type == "OBJECT":
@ -689,9 +700,12 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
) )
for transfer_data_item_to_update in transfer_data_items_to_update: for transfer_data_item_to_update in transfer_data_items_to_update:
if self.surrender_selection:
if transfer_data_item_to_update.owner in get_local_task_layers():
transfer_data_item_to_update.surrender = True
continue
# TODO Update Prefixes when setting new ownership
transfer_data_item_to_update.owner = self.owner_selection transfer_data_item_to_update.owner = self.owner_selection
# if self.surrender_selection:
# transfer_data_item_to_update.surrender = True
return {'FINISHED'} return {'FINISHED'}