Asset Pipeline v2 #145
@ -57,17 +57,11 @@ def transfer_vertex_group(
|
|||||||
if not source_obj.vertex_groups.get(vertex_group_name):
|
if not source_obj.vertex_groups.get(vertex_group_name):
|
||||||
print(f"ERROR Vertex Group {vertex_group_name} not found in {source_obj.name}")
|
print(f"ERROR Vertex Group {vertex_group_name} not found in {source_obj.name}")
|
||||||
return
|
return
|
||||||
vgroups = source_obj.vertex_groups
|
|
||||||
|
|
||||||
kd_tree = build_kdtree(source_obj.data)
|
|
||||||
tgt_vg = target_obj.vertex_groups.get(vertex_group_name)
|
|
||||||
if tgt_vg:
|
|
||||||
target_obj.vertex_groups.remove(tgt_vg)
|
|
||||||
|
|
||||||
vert_influence_map = build_vert_influence_map(
|
# TODO DEBUG WHY THIS ISN'T WORKING
|
||||||
source_obj, target_obj, kd_tree, 2
|
precalc_and_transfer_single_group(
|
||||||
|
source_obj, target_obj, vertex_group_name, expand=2
|
||||||
)
|
)
|
||||||
transfer_vertex_groups(source_obj, target_obj, vert_influence_map, vgroups)
|
|
||||||
|
|
||||||
|
|
||||||
def precalc_and_transfer_single_group(source_obj, target_obj, vgroup_name, expand=2):
|
def precalc_and_transfer_single_group(source_obj, target_obj, vgroup_name, expand=2):
|
||||||
@ -92,7 +86,7 @@ def precalc_and_transfer_single_group(source_obj, target_obj, vgroup_name, expan
|
|||||||
source_obj,
|
source_obj,
|
||||||
target_obj,
|
target_obj,
|
||||||
vert_influence_map,
|
vert_influence_map,
|
||||||
vgroups=[source_obj.vertex_groups[vgroup_name]],
|
[source_obj.vertex_groups[vgroup_name]],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -209,6 +203,7 @@ def transfer_vertex_groups(obj_from, obj_to, vert_influence_map, src_vgroups):
|
|||||||
target_vg = obj_to.vertex_groups.new(name=vg_name)
|
target_vg = obj_to.vertex_groups.new(name=vg_name)
|
||||||
target_vg.add([dest_vert.index], vgroup_weights[vg_name], 'REPLACE')
|
target_vg.add([dest_vert.index], vgroup_weights[vg_name], 'REPLACE')
|
||||||
|
|
||||||
|
|
||||||
# MODIFIERS
|
# MODIFIERS
|
||||||
def modifiers_clean(obj):
|
def modifiers_clean(obj):
|
||||||
transfer_data_clean(
|
transfer_data_clean(
|
||||||
|
Loading…
Reference in New Issue
Block a user