Asset Pipeline v2 #145
@ -20,9 +20,9 @@ class ASSETPIPE_OT_update_ownership(bpy.types.Operator):
|
|||||||
bl_idname = "assetpipe.update_ownership"
|
bl_idname = "assetpipe.update_ownership"
|
||||||
bl_label = 'Update Ownership'
|
bl_label = 'Update Ownership'
|
||||||
|
|
||||||
def execute(self, context):
|
_new_transfer_data = {}
|
||||||
# TODO LOOP OVER ALl COllECTION OBJECTS
|
|
||||||
# TODO CREATE UI TO CONFIRM NEW OWNERSHIP ITEMS
|
def invoke(self, context: bpy.types.Context, event: bpy.types.Event):
|
||||||
local_col = bpy.data.collections.get(get_parent_col_name())
|
local_col = bpy.data.collections.get(get_parent_col_name())
|
||||||
if not local_col:
|
if not local_col:
|
||||||
self.report({'ERROR'}, "Top level collection could not be found")
|
self.report({'ERROR'}, "Top level collection could not be found")
|
||||||
@ -31,9 +31,38 @@ class ASSETPIPE_OT_update_ownership(bpy.types.Operator):
|
|||||||
if not task_layer_name:
|
if not task_layer_name:
|
||||||
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
self._new_transfer_data = core.get_ownership(local_col, task_layer_name)
|
||||||
|
return context.window_manager.invoke_props_dialog(self, width=400)
|
||||||
|
|
||||||
new_data = core.get_ownership(local_col, task_layer_name)
|
def get_transfer_data(self, name):
|
||||||
core.set_ownership(new_data)
|
return [
|
||||||
|
self._new_transfer_data[item]
|
||||||
|
for item in self._new_transfer_data
|
||||||
|
if self._new_transfer_data[item][2] == name
|
||||||
|
]
|
||||||
|
|
||||||
|
def draw_transfer_data_items(self, layout, name):
|
||||||
|
items = self.get_transfer_data(name)
|
||||||
|
if items:
|
||||||
|
box = layout.box()
|
||||||
|
box.label(text=name)
|
||||||
|
for item in items:
|
||||||
|
box.label(text=f"OBJ:{item[0].id_data.name} - {item[1]}")
|
||||||
|
|
||||||
|
def draw(self, context: bpy.types.Context):
|
||||||
|
layout = self.layout
|
||||||
|
|
||||||
|
if self._new_transfer_data:
|
||||||
|
layout.label(text="New Transfer Data will be Pushed to Publish")
|
||||||
|
else:
|
||||||
|
layout.label(text="No New Transfer Data found")
|
||||||
|
|
||||||
|
self.draw_transfer_data_items(layout, "VERTEX_GROUP")
|
||||||
|
self.draw_transfer_data_items(layout, "MODIFIER")
|
||||||
|
self.draw_transfer_data_items(layout, "MATERIAL_SLOT")
|
||||||
|
|
||||||
|
def execute(self, context: bpy.types.Context):
|
||||||
|
core.set_ownership(self._new_transfer_data)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +70,7 @@ class ASSETPIPE_OT_push_test(bpy.types.Operator):
|
|||||||
bl_idname = "assetpipe.push_test"
|
bl_idname = "assetpipe.push_test"
|
||||||
bl_label = 'Push to Publish'
|
bl_label = 'Push to Publish'
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context: bpy.types.Context):
|
||||||
# Find current task Layer
|
# Find current task Layer
|
||||||
current_file = Path(bpy.data.filepath)
|
current_file = Path(bpy.data.filepath)
|
||||||
task_layer_name = get_task_layer_name_from_file()
|
task_layer_name = get_task_layer_name_from_file()
|
||||||
@ -76,7 +105,7 @@ class ASSETPIPE_OT_pull_test(bpy.types.Operator):
|
|||||||
bl_idname = "assetpipe.pull_test"
|
bl_idname = "assetpipe.pull_test"
|
||||||
bl_label = 'Pull from Publish'
|
bl_label = 'Pull from Publish'
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context: bpy.types.Context):
|
||||||
task_layer_name = get_task_layer_name_from_file()
|
task_layer_name = get_task_layer_name_from_file()
|
||||||
if not task_layer_name:
|
if not task_layer_name:
|
||||||
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
self.report({'ERROR'}, "Current File Name doesn't contain valid task layer")
|
||||||
|
Loading…
Reference in New Issue
Block a user