Asset Pipeline v2 #145
7
scripts-blender/addons/asset_pipeline_2/constants.py
Normal file
7
scripts-blender/addons/asset_pipeline_2/constants.py
Normal file
@ -0,0 +1,7 @@
|
||||
# TODO Tie this into props and generate based on JSON file instead
|
||||
|
||||
TASK_LAYER_ITEMS = [
|
||||
("NONE", "None", ""),
|
||||
("MODEL", "Modeling", ""),
|
||||
("RIG", "Rigging", ""),
|
||||
]
|
@ -2,12 +2,7 @@ import bpy
|
||||
|
||||
from . import core
|
||||
from pathlib import Path
|
||||
from . import transferable_data, transfer_functions
|
||||
|
||||
TASK_LAYER_TYPES = [
|
||||
'RIG',
|
||||
'MODEL',
|
||||
] # TODO Tie this into props and generate based on JSON file instead
|
||||
from . import transferable_data, transfer_functions, constants
|
||||
|
||||
|
||||
class ASSETPIPE_OT_update_ownership(bpy.types.Operator):
|
||||
@ -17,6 +12,7 @@ class ASSETPIPE_OT_update_ownership(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
obj = context.active_object
|
||||
file_name = bpy.path.basename(bpy.context.blend_data.filepath)
|
||||
# TODO check if exists in task_layer_constants
|
||||
task_layer_name = file_name.split(".")[-2]
|
||||
transferable_data.vertex_groups_update(obj, task_layer_name)
|
||||
transferable_data.modifiers_update(obj, task_layer_name)
|
||||
@ -31,11 +27,15 @@ class ASSETPIPE_OT_push_test(bpy.types.Operator):
|
||||
# Find current task Layer
|
||||
col_base_name = "CH-chr_test" # TODO replace hard coded value
|
||||
current_file = Path(bpy.data.filepath)
|
||||
current_tl = current_file.name.split('.')[-2]
|
||||
# TODO check if exists in task_layer_constants
|
||||
task_layer_name = current_file.name.split('.')[-2]
|
||||
pub_file = core.find_published_file(current_file)
|
||||
pub_file_path = pub_file.__str__()
|
||||
bpy.ops.wm.open_mainfile(filepath=pub_file_path)
|
||||
local_tls = [tl for tl in TASK_LAYER_TYPES if tl != current_tl]
|
||||
|
||||
local_tls = [
|
||||
item[0] for item in constants.TASK_LAYER_ITEMS if item[0] != task_layer_name
|
||||
]
|
||||
|
||||
core.merge_task_layer(
|
||||
context,
|
||||
@ -55,13 +55,14 @@ class ASSETPIPE_OT_pull_test(bpy.types.Operator):
|
||||
|
||||
def execute(self, context):
|
||||
current_file = Path(bpy.data.filepath)
|
||||
current_tl = current_file.name.split('.')[-2]
|
||||
# TODO check if exists in task_layer_constants
|
||||
task_layer_name = current_file.name.split('.')[-2]
|
||||
pub_file = core.find_published_file(current_file)
|
||||
col_base_name = "CH-chr_test" # TODO replace hard coded value
|
||||
core.merge_task_layer(
|
||||
context,
|
||||
col_base_name=col_base_name,
|
||||
local_tls=[current_tl],
|
||||
local_tls=[task_layer_name],
|
||||
target_file=pub_file,
|
||||
)
|
||||
return {'FINISHED'}
|
||||
|
@ -5,8 +5,7 @@ import bpy
|
||||
avaliable task layers from the task_layer_defaults.json file that needs to be created.
|
||||
"""
|
||||
|
||||
|
||||
# items=[("MODEL", "Rigging", ""), ("RIG", "Modeling", "")],
|
||||
from . import constants
|
||||
class ASSETOWNERSHIP(bpy.types.PropertyGroup):
|
||||
owner: bpy.props.StringProperty(name="Transfer Data Owner", default="")
|
||||
type: bpy.props.StringProperty(name="Transfer Data Type", default="")
|
||||
@ -30,7 +29,7 @@ def register():
|
||||
)
|
||||
bpy.types.Object.asset_id_owner = bpy.props.EnumProperty(
|
||||
name="ID Owner",
|
||||
items=[("NONE", "None", ""), ("MODEL", "Modeling", ""), ("RIG", "Rigging", "")],
|
||||
items=constants.TASK_LAYER_ITEMS,
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user