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 . import core
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from . import transferable_data, transfer_functions
|
from . import transferable_data, transfer_functions, constants
|
||||||
|
|
||||||
TASK_LAYER_TYPES = [
|
|
||||||
'RIG',
|
|
||||||
'MODEL',
|
|
||||||
] # TODO Tie this into props and generate based on JSON file instead
|
|
||||||
|
|
||||||
|
|
||||||
class ASSETPIPE_OT_update_ownership(bpy.types.Operator):
|
class ASSETPIPE_OT_update_ownership(bpy.types.Operator):
|
||||||
@ -17,6 +12,7 @@ class ASSETPIPE_OT_update_ownership(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
obj = context.active_object
|
obj = context.active_object
|
||||||
file_name = bpy.path.basename(bpy.context.blend_data.filepath)
|
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]
|
task_layer_name = file_name.split(".")[-2]
|
||||||
transferable_data.vertex_groups_update(obj, task_layer_name)
|
transferable_data.vertex_groups_update(obj, task_layer_name)
|
||||||
transferable_data.modifiers_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
|
# Find current task Layer
|
||||||
col_base_name = "CH-chr_test" # TODO replace hard coded value
|
col_base_name = "CH-chr_test" # TODO replace hard coded value
|
||||||
current_file = Path(bpy.data.filepath)
|
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 = core.find_published_file(current_file)
|
||||||
pub_file_path = pub_file.__str__()
|
pub_file_path = pub_file.__str__()
|
||||||
bpy.ops.wm.open_mainfile(filepath=pub_file_path)
|
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(
|
core.merge_task_layer(
|
||||||
context,
|
context,
|
||||||
@ -55,13 +55,14 @@ class ASSETPIPE_OT_pull_test(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
current_file = Path(bpy.data.filepath)
|
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 = core.find_published_file(current_file)
|
||||||
col_base_name = "CH-chr_test" # TODO replace hard coded value
|
col_base_name = "CH-chr_test" # TODO replace hard coded value
|
||||||
core.merge_task_layer(
|
core.merge_task_layer(
|
||||||
context,
|
context,
|
||||||
col_base_name=col_base_name,
|
col_base_name=col_base_name,
|
||||||
local_tls=[current_tl],
|
local_tls=[task_layer_name],
|
||||||
target_file=pub_file,
|
target_file=pub_file,
|
||||||
)
|
)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
@ -5,8 +5,7 @@ import bpy
|
|||||||
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.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from . import constants
|
||||||
# items=[("MODEL", "Rigging", ""), ("RIG", "Modeling", "")],
|
|
||||||
class ASSETOWNERSHIP(bpy.types.PropertyGroup):
|
class ASSETOWNERSHIP(bpy.types.PropertyGroup):
|
||||||
owner: bpy.props.StringProperty(name="Transfer Data Owner", default="")
|
owner: bpy.props.StringProperty(name="Transfer Data Owner", default="")
|
||||||
type: bpy.props.StringProperty(name="Transfer Data Type", 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(
|
bpy.types.Object.asset_id_owner = bpy.props.EnumProperty(
|
||||||
name="ID Owner",
|
name="ID Owner",
|
||||||
items=[("NONE", "None", ""), ("MODEL", "Modeling", ""), ("RIG", "Rigging", "")],
|
items=constants.TASK_LAYER_ITEMS,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user