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.
2 changed files with 0 additions and 120 deletions
Showing only changes of commit e82295aaa7 - Show all commits

View File

@ -36,8 +36,6 @@ def copy_transfer_data_ownership(
def transfer_data_clean(obj):
transfer_functions.vertex_groups_clean(obj)
# transfer_functions.vertex_colors_clean(obj)
# transfer_functions.uv_layer_clean(obj)
transfer_functions.modifiers_clean(obj)
transfer_functions.constraints_clean(obj)
transfer_functions.material_slots_clean(obj)
@ -60,8 +58,6 @@ def transfer_data_is_missing(transfer_data_item) -> bool:
or transfer_functions.modifier_is_missing(transfer_data_item)
or transfer_functions.material_slots_is_missing(transfer_data_item)
or transfer_functions.constraint_is_missing(transfer_data_item)
# or transfer_functions.vertex_color_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.attribute_is_missing(transfer_data_item)
or transfer_functions.parent_is_missing(transfer_data_item)
@ -83,8 +79,6 @@ def init_transfer_data(
transfer_functions.init_material_slots(scene, obj)
transfer_functions.init_modifiers(scene, obj)
transfer_functions.init_constraints(scene, obj)
# transfer_functions.init_vertex_colors(scene, obj)
# transfer_functions.init_uv_layers(scene, obj)
transfer_functions.init_shape_keys(scene, obj)
transfer_functions.init_attributes(scene, obj)
transfer_functions.init_parent(scene, obj)
@ -124,12 +118,6 @@ def apply_transfer_data(context: bpy.types.Context, transfer_data_map) -> None:
target_obj=target_obj,
source_obj=source_obj,
)
# if transfer_data_item.type == constants.VERTEX_COLOR_KEY:
# transfer_functions.transfer_vertex_color(
# vertex_color_name=transfer_data_item.name,
# target_obj=target_obj,
# source_obj=source_obj,
# )
if transfer_data_item.type == constants.MODIFIER_KEY:
print(f"Transfering Data {constants.MODIFIER_KEY}: {name}")
transfer_functions.transfer_modifier(
@ -149,12 +137,6 @@ def apply_transfer_data(context: bpy.types.Context, transfer_data_map) -> None:
target_obj=target_obj,
source_obj=source_obj,
)
# if transfer_data_item.type == constants.UV_LAYERS_KEY:
# transfer_functions.transfer_uv_layer(
# target_obj=target_obj,
# source_obj=source_obj,
# uv_name=transfer_data_item.name,
# )
if transfer_data_item.type == constants.SHAPE_KEY_KEY:
transfer_functions.transfer_shape_key(
context=context,

View File

@ -80,108 +80,6 @@ def transfer_vertex_group(
return
# VERTEX COLORS
def vertex_colors_clean(obj):
if not obj.type == "MESH":
return
transfer_data_clean(
obj=obj,
data_list=obj.data.vertex_colors,
td_type_key=constants.VERTEX_COLOR_KEY,
)
def vertex_color_is_missing(transfer_data_item):
return transfer_data_item_is_missing(
transfer_data_item=transfer_data_item,
td_type_key=constants.VERTEX_COLOR_KEY,
data_list=transfer_data_item.id_data.vertex_colors,
)
def init_vertex_colors(scene, obj):
if not obj.type == "MESH":
return
transfer_data_item_init(
scene=scene,
obj=obj,
data_list=obj.data.vertex_colors,
td_type_key=constants.VERTEX_COLOR_KEY,
)
def transfer_vertex_color(
vertex_color_name: str,
target_obj: bpy.types.Object,
source_obj: bpy.types.Object,
):
old_color = target_obj.data.vertex_colors.get(vertex_color_name)
if old_color:
target_obj.data.vertex_colors.remove(old_color)
transfer_color = source_obj.data.vertex_colors.get(vertex_color_name)
new_color = target_obj.data.vertex_colors.new(
name=transfer_color.name, do_init=False
)
for loop in target_obj.data.loops:
new_color.data[loop.index].color = transfer_color.data[loop.index].color
# ABOVE FOR LOOP IS FOR TOPOLOGY THAT MATCHES
# BELOW COMMENTED OUT CODE IS FOR TOPOLOGY THAT DOESN'T MATCH
# else:
# for vcol_from in obj_source.data.vertex_colors:
# vcol_to = obj_target.data.vertex_colors.new(name=vcol_from.name, do_init=False)
# transfer_corner_data(obj_source, obj_target, vcol_from.data, vcol_to.data, data_suffix = 'color')
# UV LAYERS
def uv_layer_clean(obj):
if not obj.type == "MESH":
return
transfer_data_clean(
obj=obj, data_list=obj.data.uv_layers, td_type_key=constants.UV_LAYERS_KEY
)
def uv_layer_is_missing(transfer_data_item):
return transfer_data_item_is_missing(
transfer_data_item=transfer_data_item,
td_type_key=constants.UV_LAYERS_KEY,
data_list=transfer_data_item.id_data.data.uv_layers,
)
def init_uv_layers(scene, obj):
if not obj.type == "MESH":
return
transfer_data_item_init(
scene=scene,
obj=obj,
data_list=obj.data.uv_layers,
td_type_key=constants.UV_LAYERS_KEY,
)
def transfer_uv_layer(source_obj, target_obj, uv_name):
old_uv_layer = target_obj.data.uv_layers.get(uv_name)
if old_uv_layer:
target_obj.data.uv_layers.remove(old_uv_layer)
transfer_uv = source_obj.data.uv_layers.get(uv_name)
new_uv = target_obj.data.uv_layers.new(name=uv_name, do_init=False)
for loop in target_obj.data.loops:
new_uv.data[loop.index].uv = transfer_uv.data[loop.index].uv
# BELOW CODE IS FOR NON MATCHING TOPOLOGY
# else:
# for uv_from in obj_source.data.uv_layers:
# uv_to = obj_target.data.uv_layers.new(name=uv_from.name, do_init=False)
# transfer_corner_data(obj_source, obj_target, uv_from.data, uv_to.data, data_suffix = 'uv')
# Make sure correct layer is set to active
for uv_l in source_obj.data.uv_layers:
if uv_l.active_render:
target_obj.data.uv_layers[uv_l.name].active_render = True
break
# MODIFIERS
def modifiers_clean(obj):
transfer_data_clean(