Asset Pipeline v2 #145
@ -551,7 +551,7 @@ def get_task_layer_types(self, context):
|
|||||||
|
|
||||||
class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
||||||
bl_idname = "assetpipe.batch_ownership_change"
|
bl_idname = "assetpipe.batch_ownership_change"
|
||||||
bl_label = "Batch Ownership"
|
bl_label = "Batch Set Ownership"
|
||||||
bl_description = """Re-Assign Ownership in a batch operation"""
|
bl_description = """Re-Assign Ownership in a batch operation"""
|
||||||
|
|
||||||
name_filter: bpy.props.StringProperty(
|
name_filter: bpy.props.StringProperty(
|
||||||
@ -561,7 +561,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
)
|
)
|
||||||
|
|
||||||
data_source: bpy.props.EnumProperty(
|
data_source: bpy.props.EnumProperty(
|
||||||
name="Source",
|
name="Objects",
|
||||||
items=(
|
items=(
|
||||||
('SELECT', "Selected", "Update Selected Objects Only"),
|
('SELECT', "Selected", "Update Selected Objects Only"),
|
||||||
('ALL', "All", "Update All Objects"),
|
('ALL', "All", "Update All Objects"),
|
||||||
@ -569,7 +569,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
)
|
)
|
||||||
|
|
||||||
data_type: bpy.props.EnumProperty(
|
data_type: bpy.props.EnumProperty(
|
||||||
name="Type",
|
name="Ownership Type",
|
||||||
items=(
|
items=(
|
||||||
(
|
(
|
||||||
'OBJECT',
|
'OBJECT',
|
||||||
@ -578,7 +578,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
'TRANSFER_DATA',
|
'TRANSFER_DATA',
|
||||||
"Transfer Data",
|
"Transferable Data",
|
||||||
"Update Owner of Transfer Data within Objects",
|
"Update Owner of Transfer Data within Objects",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -588,7 +588,7 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
name="Owner Filter",
|
name="Owner Filter",
|
||||||
items=(
|
items=(
|
||||||
('LOCAL', "If Locally Owned", "Only data that is owned locally"),
|
('LOCAL', "If Locally Owned", "Only data that is owned locally"),
|
||||||
('OWNED', "If Owned", "Only data that already have assignment"),
|
('OWNED', "If Owned By Any", "Only data that already have assignment"),
|
||||||
('ALL', "No Filter", "Set Ownership on any data, even without an owner"),
|
('ALL', "No Filter", "Set Ownership on any data, even without an owner"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -620,7 +620,8 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
return unfiltered_list
|
return unfiltered_list
|
||||||
return [item for item in unfiltered_list if self.name_filter in item.name]
|
return [item for item in unfiltered_list if self.name_filter in item.name]
|
||||||
|
|
||||||
def _get_transfer_data_to_update(self, context, objs):
|
def _get_transfer_data_to_update(self, context):
|
||||||
|
objs = self._get_objects(context)
|
||||||
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:
|
||||||
@ -665,7 +666,7 @@ 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):
|
||||||
return context.window_manager.invoke_props_dialog(self, width=400)
|
return context.window_manager.invoke_props_dialog(self, width=500)
|
||||||
|
|
||||||
def draw(self, context: bpy.types.Context):
|
def draw(self, context: bpy.types.Context):
|
||||||
grey_out = True
|
grey_out = True
|
||||||
@ -674,19 +675,18 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
self.filter_owners = "LOCAL"
|
self.filter_owners = "LOCAL"
|
||||||
|
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
layout.use_property_split = True
|
||||||
layout.row(align=True).prop(self, "data_source", expand=True)
|
layout.row(align=True).prop(self, "data_source", expand=True)
|
||||||
|
|
||||||
layout.prop(self, "data_type", expand=True)
|
layout.prop(self, "data_type", expand=True)
|
||||||
|
|
||||||
box = layout.box()
|
filter_owner_row = layout.row()
|
||||||
|
|
||||||
filter_owner_row = box.row()
|
|
||||||
filter_owner_row.enabled = grey_out
|
filter_owner_row.enabled = grey_out
|
||||||
filter_owner_row.prop(self, "filter_owners")
|
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")
|
layout.prop(self, "transfer_data_type")
|
||||||
box.prop(self, "name_filter", text="Name Filter")
|
layout.prop(self, "name_filter", text="Name Filter")
|
||||||
|
|
||||||
if self.avaliable_owners == "LOCAL":
|
if self.avaliable_owners == "LOCAL":
|
||||||
show_local = True
|
show_local = True
|
||||||
@ -694,7 +694,10 @@ 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
|
||||||
owner_row = box.row(align=True)
|
|
||||||
|
layout.separator()
|
||||||
|
|
||||||
|
owner_row = layout.row(align=True)
|
||||||
owner_row.enabled = grey_out
|
owner_row.enabled = grey_out
|
||||||
|
|
||||||
draw_task_layer_selection(
|
draw_task_layer_selection(
|
||||||
@ -705,12 +708,12 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
'owner_selection',
|
'owner_selection',
|
||||||
show_all_task_layers=show_all_task_layers,
|
show_all_task_layers=show_all_task_layers,
|
||||||
show_local=show_local,
|
show_local=show_local,
|
||||||
text="Owner",
|
text="Set To",
|
||||||
)
|
)
|
||||||
owner_row.prop(self, "avaliable_owners", text="")
|
owner_row.prop(self, "avaliable_owners", text="")
|
||||||
|
|
||||||
if self.data_type == "TRANSFER_DATA":
|
if self.data_type == "TRANSFER_DATA":
|
||||||
box.prop(self, "surrender_selection", expand=True)
|
layout.prop(self, "surrender_selection", expand=True)
|
||||||
|
|
||||||
objs = self._get_filtered_objects(context)
|
objs = self._get_filtered_objects(context)
|
||||||
if self.data_type == "OBJECT":
|
if self.data_type == "OBJECT":
|
||||||
@ -724,8 +727,10 @@ class ASSETPIPE_OT_batch_ownership_change(bpy.types.Operator):
|
|||||||
if transfer_data_items_to_update
|
if transfer_data_items_to_update
|
||||||
else 0
|
else 0
|
||||||
)
|
)
|
||||||
|
bottom_label = layout.row()
|
||||||
layout.label(text=f"Change Ownership on {length} {data_type_name}")
|
bottom_label_split = bottom_label.split(factor=0.4)
|
||||||
|
bottom_label_split.row()
|
||||||
|
bottom_label_split.label(text=f"Change Ownership on {length} {data_type_name}")
|
||||||
|
|
||||||
def execute(self, context: bpy.types.Context):
|
def execute(self, context: bpy.types.Context):
|
||||||
objs = self._get_filtered_objects(context)
|
objs = self._get_filtered_objects(context)
|
||||||
|
Loading…
Reference in New Issue
Block a user