Asset Pipeline v2 #145
@ -182,3 +182,9 @@ def get_task_layer_name_from_file():
|
|||||||
task_layer_name = file_name.split(".")[-2]
|
task_layer_name = file_name.split(".")[-2]
|
||||||
if task_layer_name in constants.TASK_LAYER_KEYS:
|
if task_layer_name in constants.TASK_LAYER_KEYS:
|
||||||
return task_layer_name
|
return task_layer_name
|
||||||
|
|
||||||
|
|
||||||
|
def get_enum_item(enum, key):
|
||||||
|
for item in enum:
|
||||||
|
if item[0] == key:
|
||||||
|
return item
|
||||||
|
@ -3,13 +3,12 @@ import bpy
|
|||||||
from . import core, constants
|
from . import core, constants
|
||||||
|
|
||||||
|
|
||||||
class ASSETPIPE_PT_TestUI(bpy.types.Panel):
|
class ASSETPIPE_sync(bpy.types.Panel):
|
||||||
bl_space_type = 'VIEW_3D'
|
bl_space_type = 'VIEW_3D'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_category = 'Asset Pipe 2'
|
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:
|
def draw(self, context: bpy.types.Context) -> None:
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
layout.label(
|
layout.label(
|
||||||
@ -25,17 +24,45 @@ class ASSETPIPE_PT_TestUI(bpy.types.Panel):
|
|||||||
"assetpipe.sync_with_publish", text="Pull from Publish", icon="TRIA_DOWN"
|
"assetpipe.sync_with_publish", text="Pull from Publish", icon="TRIA_DOWN"
|
||||||
).pull = True
|
).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:
|
if not context.active_object:
|
||||||
|
layout.label(text="Set an Active Object to Inspect")
|
||||||
return
|
return
|
||||||
obj = context.active_object
|
obj = context.active_object
|
||||||
ownership = obj.transfer_data_ownership
|
ownership = obj.transfer_data_ownership
|
||||||
layout.prop(obj, "asset_id_owner")
|
layout = layout.box()
|
||||||
for my_item in ownership:
|
owner = core.get_enum_item(constants.TASK_LAYER_ITEMS, obj.asset_id_owner)[1]
|
||||||
layout.label(
|
layout.label(text=f"{obj.name}: '{owner}'", icon="OBJECT_DATA")
|
||||||
text=f"{my_item.name} : {my_item.owner} : {my_item.id_data.name}"
|
self.draw_transfer_data(ownership, layout)
|
||||||
)
|
|
||||||
|
|
||||||
# UI ONLY FOR PUBLISHED FILES
|
|
||||||
task_layer_name = core.get_task_layer_name_from_file()
|
task_layer_name = core.get_task_layer_name_from_file()
|
||||||
if task_layer_name not in constants.TASK_LAYER_KEYS:
|
if task_layer_name not in constants.TASK_LAYER_KEYS:
|
||||||
status = context.scene.asset_status
|
status = context.scene.asset_status
|
||||||
@ -44,7 +71,10 @@ class ASSETPIPE_PT_TestUI(bpy.types.Panel):
|
|||||||
box.prop(status, "is_depreciated")
|
box.prop(status, "is_depreciated")
|
||||||
|
|
||||||
|
|
||||||
classes = (ASSETPIPE_PT_TestUI,)
|
classes = (
|
||||||
|
ASSETPIPE_sync,
|
||||||
|
ASSETPIPE_ownership_inspector,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
Loading…
Reference in New Issue
Block a user