Asset Pipeline v2 #145
@ -174,3 +174,10 @@ def import_data_from_lib(
|
|||||||
)
|
)
|
||||||
|
|
||||||
return eval(f"bpy.data.{data_category}['{data_name}']")
|
return eval(f"bpy.data.{data_category}['{data_name}']")
|
||||||
|
|
||||||
|
|
||||||
|
def get_task_layer_name_from_file():
|
||||||
|
file_name = bpy.path.basename(bpy.context.blend_data.filepath)
|
||||||
|
task_layer_name = file_name.split(".")[-2]
|
||||||
|
if task_layer_name in constants.TASK_LAYER_KEYS:
|
||||||
|
return task_layer_name
|
||||||
|
@ -9,13 +9,6 @@ def get_parent_col_name():
|
|||||||
return "CH-chr_test" # TODO Replace Hard Coded Value
|
return "CH-chr_test" # TODO Replace Hard Coded Value
|
||||||
|
|
||||||
|
|
||||||
def get_task_layer_name_from_file():
|
|
||||||
file_name = bpy.path.basename(bpy.context.blend_data.filepath)
|
|
||||||
task_layer_name = file_name.split(".")[-2]
|
|
||||||
if task_layer_name in constants.TASK_LAYER_KEYS:
|
|
||||||
return task_layer_name
|
|
||||||
|
|
||||||
|
|
||||||
class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
|
class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
|
||||||
bl_idname = "assetpipe.sync_with_publish"
|
bl_idname = "assetpipe.sync_with_publish"
|
||||||
bl_label = "Sync with Publish"
|
bl_label = "Sync with Publish"
|
||||||
@ -44,7 +37,7 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
|
|||||||
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")
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
task_layer_name = get_task_layer_name_from_file()
|
task_layer_name = core.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")
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
@ -90,7 +83,7 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
|
|||||||
# Find current task Layer
|
# Find current task Layer
|
||||||
core.set_ownership(self._new_transfer_data)
|
core.set_ownership(self._new_transfer_data)
|
||||||
current_file = Path(bpy.data.filepath)
|
current_file = Path(bpy.data.filepath)
|
||||||
task_layer_name = get_task_layer_name_from_file()
|
task_layer_name = core.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")
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
@ -122,6 +115,10 @@ class ASSETPIPE_OT_sync_with_publish(bpy.types.Operator):
|
|||||||
file_path = file.__str__()
|
file_path = file.__str__()
|
||||||
bpy.ops.wm.open_mainfile(filepath=file_path)
|
bpy.ops.wm.open_mainfile(filepath=file_path)
|
||||||
|
|
||||||
|
# SKIP DEPRECIATED FILES
|
||||||
|
if context.scene.asset_status.is_depreciated:
|
||||||
|
continue
|
||||||
|
|
||||||
local_tls = [
|
local_tls = [
|
||||||
item for item in constants.TASK_LAYER_KEYS if item != task_layer_name
|
item for item in constants.TASK_LAYER_KEYS if item != task_layer_name
|
||||||
]
|
]
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
import bpy
|
import bpy
|
||||||
|
from . import constants
|
||||||
|
|
||||||
""" NOTE Items in these properties groups should be generated by a function that finds the
|
""" NOTE Items in these properties groups should be generated by a function that finds the
|
||||||
avaliable task layers from the task_layer_defaults.json file that needs to be created.
|
avaliable task layers from the task_layer_defaults.json file that needs to be created.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class ASSET_STATUS(bpy.types.PropertyGroup):
|
||||||
|
is_depreciated: bpy.props.BoolProperty(
|
||||||
|
name="Depreciated",
|
||||||
|
description="Depreciated files do not recieve any updates when syncing from a task layer",
|
||||||
|
default=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
from . import constants
|
from . import constants
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +28,10 @@ class ASSETOWNERSHIP(bpy.types.PropertyGroup):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
classes = (ASSETOWNERSHIP,)
|
classes = (
|
||||||
|
ASSETOWNERSHIP,
|
||||||
|
ASSET_STATUS,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
@ -28,6 +40,7 @@ def register():
|
|||||||
bpy.types.Object.transfer_data_ownership = bpy.props.CollectionProperty(
|
bpy.types.Object.transfer_data_ownership = bpy.props.CollectionProperty(
|
||||||
type=ASSETOWNERSHIP
|
type=ASSETOWNERSHIP
|
||||||
)
|
)
|
||||||
|
bpy.types.Scene.asset_status = bpy.props.PointerProperty(type=ASSET_STATUS)
|
||||||
bpy.types.Object.asset_id_owner = bpy.props.EnumProperty(
|
bpy.types.Object.asset_id_owner = bpy.props.EnumProperty(
|
||||||
name="ID Owner",
|
name="ID Owner",
|
||||||
items=constants.TASK_LAYER_ITEMS,
|
items=constants.TASK_LAYER_ITEMS,
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
from . import core, constants
|
||||||
|
|
||||||
|
|
||||||
class ASSETPIPE_PT_TestUI(bpy.types.Panel):
|
class ASSETPIPE_PT_TestUI(bpy.types.Panel):
|
||||||
bl_space_type = 'VIEW_3D'
|
bl_space_type = 'VIEW_3D'
|
||||||
@ -8,6 +10,7 @@ class ASSETPIPE_PT_TestUI(bpy.types.Panel):
|
|||||||
bl_label = "Test UI"
|
bl_label = "Test UI"
|
||||||
|
|
||||||
def draw(self, context: bpy.types.Context) -> None:
|
def draw(self, context: bpy.types.Context) -> None:
|
||||||
|
layout = self.layout
|
||||||
self.layout.label(
|
self.layout.label(
|
||||||
text=f"Active Task Layer: {context.collection.name.split('.')[-1]}"
|
text=f"Active Task Layer: {context.collection.name.split('.')[-1]}"
|
||||||
)
|
)
|
||||||
@ -31,6 +34,14 @@ class ASSETPIPE_PT_TestUI(bpy.types.Panel):
|
|||||||
text=f"{my_item.name} : {my_item.owner} : {my_item.id_data.name}"
|
text=f"{my_item.name} : {my_item.owner} : {my_item.id_data.name}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# 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
|
||||||
|
box = layout.box()
|
||||||
|
box.label(text="Published File Settings")
|
||||||
|
box.prop(status, "is_depreciated")
|
||||||
|
|
||||||
|
|
||||||
classes = (ASSETPIPE_PT_TestUI,)
|
classes = (ASSETPIPE_PT_TestUI,)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user