Asset Pipeline v2 #145

Closed
Nick Alberelli wants to merge 431 commits from (deleted):feature/asset-pipeline-v2 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
4 changed files with 41 additions and 0 deletions
Showing only changes of commit c235022a0d - Show all commits

View File

@ -20,6 +20,7 @@ TRANSFER_DATA_TYPES = [
("MATERIAL", "Material Slot", ""), ("MATERIAL", "Material Slot", ""),
("GROUP_UVS", "UV Maps", ""), ("GROUP_UVS", "UV Maps", ""),
("SHAPEKEY_DATA", "Shape Key", ""), ("SHAPEKEY_DATA", "Shape Key", ""),
("EVENT_A", "Attribute", ""),
] ]
TRANSFER_DATA_KEYS = [transfer_data[0] for transfer_data in TRANSFER_DATA_TYPES] TRANSFER_DATA_KEYS = [transfer_data[0] for transfer_data in TRANSFER_DATA_TYPES]
@ -31,6 +32,7 @@ CONSTRAINT_KEY = TRANSFER_DATA_KEYS[4]
MATERIAL_SLOT_KEY = TRANSFER_DATA_KEYS[5] MATERIAL_SLOT_KEY = TRANSFER_DATA_KEYS[5]
UV_LAYERS_KEY = TRANSFER_DATA_KEYS[6] UV_LAYERS_KEY = TRANSFER_DATA_KEYS[6]
SHAPE_KEY_KEY = TRANSFER_DATA_KEYS[7] SHAPE_KEY_KEY = TRANSFER_DATA_KEYS[7]
ATTRIBUTE_KEY = TRANSFER_DATA_KEYS[8]
PUBLISH_TYPES = [ PUBLISH_TYPES = [
( (

View File

@ -32,6 +32,7 @@ def transfer_data_clean(obj):
transfer_functions.constraints_clean(obj) transfer_functions.constraints_clean(obj)
transfer_functions.material_slot_clean(obj) transfer_functions.material_slot_clean(obj)
transfer_functions.shape_keys_clean(obj) transfer_functions.shape_keys_clean(obj)
transfer_functions.attribute_clean(obj)
def transfer_data_is_missing(transfer_data_item) -> bool: def transfer_data_is_missing(transfer_data_item) -> bool:
@ -50,6 +51,7 @@ def transfer_data_is_missing(transfer_data_item) -> bool:
or transfer_functions.constraint_is_missing(transfer_data_item) or transfer_functions.constraint_is_missing(transfer_data_item)
or transfer_functions.uv_layer_is_missing(transfer_data_item) or transfer_functions.uv_layer_is_missing(transfer_data_item)
or transfer_functions.shape_key_is_missing(transfer_data_item) or transfer_functions.shape_key_is_missing(transfer_data_item)
or transfer_functions.attribute_is_missing(transfer_data_item)
) )
@ -71,6 +73,7 @@ def init_transfer_data(
transfer_functions.init_vertex_colors(scene, obj) transfer_functions.init_vertex_colors(scene, obj)
transfer_functions.init_uv_layers(scene, obj) transfer_functions.init_uv_layers(scene, obj)
transfer_functions.init_shap_keys(scene, obj) transfer_functions.init_shap_keys(scene, obj)
transfer_functions.init_attributes(scene, obj)
def apply_transfer_data(context: bpy.types.Context, transfer_data_map) -> None: def apply_transfer_data(context: bpy.types.Context, transfer_data_map) -> None:

View File

@ -465,3 +465,35 @@ def transfer_shape_key(
] ]
val = mathutils.Vector(sum(np.array(vals_weighted))) val = mathutils.Vector(sum(np.array(vals_weighted)))
sk_target.data[i].co = vert.co + val sk_target.data[i].co = vert.co + val
# ATTRIBUTE
def attribute_clean(obj):
transfer_core.transfer_info_clean(obj, obj.data.attributes)
def attribute_is_missing(transfer_info):
return transfer_core.transfer_info_is_missing(
transfer_info, constants.ATTRIBUTE_KEY, transfer_info.id_data.data.attributes
)
def init_attributes(scene, obj):
transfer_data = obj.transfer_data_ownership
task_layer_name = scene.asset_pipeline.task_layer_name
type_key = constants.ATTRIBUTE_KEY
list = obj.data.attributes
for item in list:
if not item.is_required:
continue
# Only add new ownership transfer_info if vertex group doesn't have an owner
matches = transfer_core.check_transfer_data_entry(
transfer_data, item.name, type_key
)
if len(matches) == 0:
scene.asset_pipeline.add_temp_trasnfer_data(
name=item.name,
owner=task_layer_name,
type=type_key,
obj=obj,
)

View File

@ -31,6 +31,7 @@ def draw_transfer_data(
constraints = [] constraints = []
uv_layers = [] uv_layers = []
shape_keys = [] shape_keys = []
attributes = []
for transfer_info in transfer_data: for transfer_info in transfer_data:
if transfer_info.type == constants.VERTEX_GROUP_KEY: if transfer_info.type == constants.VERTEX_GROUP_KEY:
@ -47,6 +48,8 @@ def draw_transfer_data(
uv_layers.append(transfer_info) uv_layers.append(transfer_info)
if transfer_info.type == constants.SHAPE_KEY_KEY: if transfer_info.type == constants.SHAPE_KEY_KEY:
shape_keys.append(transfer_info) shape_keys.append(transfer_info)
if transfer_info.type == constants.ATTRIBUTE_KEY:
attributes.append(transfer_info)
draw_transfer_data_type(layout, vertex_groups) draw_transfer_data_type(layout, vertex_groups)
draw_transfer_data_type(layout, vertex_colors) draw_transfer_data_type(layout, vertex_colors)
@ -55,3 +58,4 @@ def draw_transfer_data(
draw_transfer_data_type(layout, constraints) draw_transfer_data_type(layout, constraints)
draw_transfer_data_type(layout, uv_layers) draw_transfer_data_type(layout, uv_layers)
draw_transfer_data_type(layout, shape_keys) draw_transfer_data_type(layout, shape_keys)
draw_transfer_data_type(layout, attributes)