Asset Pipeline v2 #145
@ -1,7 +1,6 @@
|
||||
# TODO Tie this into props and generate based on JSON file instead
|
||||
|
||||
# Information about configured task layers.
|
||||
# Task Layers are not much more than a name in this dict;
|
||||
# Information about the list of task layers.
|
||||
# There is no behaviour that is specific to a particular task layer.
|
||||
# You could even choose to name your task layers after artists in your team.
|
||||
# {Task Layer Key: Collection/UI name}
|
||||
@ -9,15 +8,19 @@ TASK_LAYER_TYPES = {
|
||||
"NONE": "None",
|
||||
"MODEL": "Modeling",
|
||||
"RIG": "Rigging",
|
||||
"SHADE": "Shading",
|
||||
"SHADE": "Shading"
|
||||
}
|
||||
|
||||
# When creating a new asset, start in this task layer's file.
|
||||
STARTING_FILE = 'MODEL'
|
||||
|
||||
# Convert it to the format that EnumProperty.items wants:
|
||||
# List of 3-tuples, re-use name as description at 3rd element.
|
||||
TASK_LAYER_TYPES_ENUM_ITEMS = [
|
||||
(key, value, value) for key, value in TASK_LAYER_TYPES.items()
|
||||
]
|
||||
|
||||
NONE_KEY = "NONE"
|
||||
VERTEX_GROUP_KEY = "GROUP_VERTEX"
|
||||
VERTEX_COLOR_KEY = "COLOR_ATTRIBUTE"
|
||||
MODIFIER_KEY = "MODIFIER"
|
||||
@ -30,7 +33,7 @@ ATTRIBUTE_KEY = "ATTRIBUTE"
|
||||
# Information about supported transferable data.
|
||||
# {Key string : ("UI Name", 'ICON')}
|
||||
TRANSFER_DATA_TYPES = {
|
||||
"NONE": ("None", "BLANK1"),
|
||||
NONE_KEY: ("None", "BLANK1"),
|
||||
VERTEX_GROUP_KEY: ("Vertex Group", 'GROUP_VERTEX'),
|
||||
VERTEX_COLOR_KEY: ("Color Attribute", 'GROUP_VCOL'),
|
||||
MODIFIER_KEY: ("Modifier", 'MODIFIER'),
|
||||
|
@ -64,6 +64,7 @@ class ASSETPIPE_OT_create_new_asset(bpy.types.Operator):
|
||||
asset_pipe.name = self._name
|
||||
asset_pipe.prefix = self._prefix
|
||||
|
||||
# Create the collections for each task layer.
|
||||
for task_layer_key in constants.TASK_LAYER_TYPES.keys():
|
||||
if task_layer_key == "NONE":
|
||||
continue
|
||||
@ -71,12 +72,16 @@ class ASSETPIPE_OT_create_new_asset(bpy.types.Operator):
|
||||
bpy.data.collections.new(col_name)
|
||||
asset_col.children.link(bpy.data.collections.get(col_name))
|
||||
|
||||
starting_file = ""
|
||||
# Create the file for each task layer.
|
||||
for task_layer_key in constants.TASK_LAYER_TYPES.keys():
|
||||
if task_layer_key == "NONE":
|
||||
continue
|
||||
name = self._name + "." + task_layer_key + ".blend"
|
||||
task_layer_file = os.path.join(asset_path, name)
|
||||
asset_pipe.task_layer_name = task_layer_key
|
||||
if task_layer_key == constants.STARTING_FILE:
|
||||
starting_file = task_layer_file
|
||||
bpy.ops.wm.save_as_mainfile(filepath=task_layer_file, copy=True)
|
||||
|
||||
# Create intial publish based on task layers.
|
||||
@ -85,7 +90,8 @@ class ASSETPIPE_OT_create_new_asset(bpy.types.Operator):
|
||||
name = self._name + "." + "v001" + ".blend"
|
||||
publish_file = os.path.join(publish_path, name)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=publish_file, copy=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=task_layer_file)
|
||||
if starting_file:
|
||||
bpy.ops.wm.open_mainfile(filepath=starting_file)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user