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.
2 changed files with 46 additions and 10 deletions
Showing only changes of commit 89cd17787b - Show all commits

View File

@ -182,3 +182,9 @@ def get_task_layer_name_from_file():
task_layer_name = file_name.split(".")[-2]
if task_layer_name in constants.TASK_LAYER_KEYS:
return task_layer_name
def get_enum_item(enum, key):
for item in enum:
if item[0] == key:
return item

View File

@ -3,13 +3,12 @@ import bpy
from . import core, constants
class ASSETPIPE_PT_TestUI(bpy.types.Panel):
class ASSETPIPE_sync(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = 'Asset Pipe 2'
bl_label = "Test UI"
bl_label = "Sync"
# TODO Move UI for inspecting Object Ownership to seperate panel
def draw(self, context: bpy.types.Context) -> None:
layout = self.layout
layout.label(
@ -25,17 +24,45 @@ class ASSETPIPE_PT_TestUI(bpy.types.Panel):
"assetpipe.sync_with_publish", text="Pull from Publish", icon="TRIA_DOWN"
).pull = True
class ASSETPIPE_ownership_inspector(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = 'Asset Pipe 2'
bl_label = "Ownership Inspector"
def draw_transfer_data_type(self, layout, items):
name = core.get_enum_item(constants.TRANSFER_DATA_TYPES, items[0].type)[1]
box = layout.box()
box.label(text=name, icon=items[0].type)
for item in items:
owner = core.get_enum_item(constants.TASK_LAYER_ITEMS, item.owner)[1]
box.label(text=f"{item.name}: '{owner}'")
def draw_transfer_data(self, ownership, layout) -> None:
vertex_groups = [
item for item in ownership if item.type == constants.VERTEX_GROUP_KEY
]
material_slots = [
item for item in ownership if item.type == constants.MATERIAL_SLOT_KEY
]
modifiers = [item for item in ownership if item.type == constants.MODIFIER_KEY]
self.draw_transfer_data_type(layout, vertex_groups)
self.draw_transfer_data_type(layout, modifiers)
self.draw_transfer_data_type(layout, material_slots)
def draw(self, context: bpy.types.Context) -> None:
layout = self.layout
if not context.active_object:
layout.label(text="Set an Active Object to Inspect")
return
obj = context.active_object
ownership = obj.transfer_data_ownership
layout.prop(obj, "asset_id_owner")
for my_item in ownership:
layout.label(
text=f"{my_item.name} : {my_item.owner} : {my_item.id_data.name}"
)
layout = layout.box()
owner = core.get_enum_item(constants.TASK_LAYER_ITEMS, obj.asset_id_owner)[1]
layout.label(text=f"{obj.name}: '{owner}'", icon="OBJECT_DATA")
self.draw_transfer_data(ownership, layout)
# UI ONLY FOR PUBLISHED FILES
task_layer_name = core.get_task_layer_name_from_file()
if task_layer_name not in constants.TASK_LAYER_KEYS:
status = context.scene.asset_status
@ -44,7 +71,10 @@ class ASSETPIPE_PT_TestUI(bpy.types.Panel):
box.prop(status, "is_depreciated")
classes = (ASSETPIPE_PT_TestUI,)
classes = (
ASSETPIPE_sync,
ASSETPIPE_ownership_inspector,
)
def register():