Asset Pipeline v2 #145
@ -533,7 +533,11 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
||||
data_type: bpy.props.EnumProperty(
|
||||
name="Type",
|
||||
items=(
|
||||
('OBJECT', "Object", "Update Owner of Objects"),
|
||||
(
|
||||
'OBJECT',
|
||||
"Object",
|
||||
"Update Owner of Objects",
|
||||
),
|
||||
(
|
||||
'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
|
||||
)
|
||||
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: []):
|
||||
if self.name_filter == "":
|
||||
@ -616,22 +624,24 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
||||
return self._filter_by_name(context, objs)
|
||||
|
||||
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)
|
||||
|
||||
def draw(self, context: bpy.types.Context):
|
||||
layout = self.layout
|
||||
split = layout.split(align=True)
|
||||
layout.row(align=True).prop(self, "data_source", expand=True)
|
||||
grey_out = True
|
||||
if self.surrender_selection and self.data_type == "TRANSFER_DATA":
|
||||
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")
|
||||
|
||||
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":
|
||||
box.prop(self, "transfer_data_type")
|
||||
@ -643,10 +653,11 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
||||
else:
|
||||
show_local = False
|
||||
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(
|
||||
row,
|
||||
owner_row,
|
||||
context.scene,
|
||||
self,
|
||||
self.owner_selection,
|
||||
@ -655,10 +666,10 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
||||
show_local=show_local,
|
||||
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":
|
||||
# box.prop(self, "surrender_selection", expand=True)
|
||||
owner_row.prop(self, "avaliable_owners", text="")
|
||||
|
||||
if self.data_type == "TRANSFER_DATA":
|
||||
box.prop(self, "surrender_selection", expand=True)
|
||||
|
||||
objs = self._get_object_to_update(context)
|
||||
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:
|
||||
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
|
||||
# if self.surrender_selection:
|
||||
# transfer_data_item_to_update.surrender = True
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user