Asset Pipeline v2 #145
@ -58,7 +58,6 @@ def transfer_vertex_group(
|
|||||||
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
|
||||||
|
|
||||||
# TODO DEBUG WHY THIS ISN'T WORKING
|
|
||||||
precalc_and_transfer_single_group(
|
precalc_and_transfer_single_group(
|
||||||
source_obj, target_obj, vertex_group_name, expand=2
|
source_obj, target_obj, vertex_group_name, expand=2
|
||||||
)
|
)
|
||||||
@ -180,6 +179,11 @@ def other_vert_of_edge(
|
|||||||
def transfer_vertex_groups(obj_from, obj_to, vert_influence_map, src_vgroups):
|
def transfer_vertex_groups(obj_from, obj_to, vert_influence_map, src_vgroups):
|
||||||
"""Transfer src_vgroups in obj_from to obj_to using a pre-calculated vert_influence_map."""
|
"""Transfer src_vgroups in obj_from to obj_to using a pre-calculated vert_influence_map."""
|
||||||
|
|
||||||
|
for src_vg in src_vgroups:
|
||||||
|
target_vg = obj_to.vertex_groups.get(src_vg.name)
|
||||||
|
if target_vg == None:
|
||||||
|
target_vg = obj_to.vertex_groups.new(name=src_vg.name)
|
||||||
|
|
||||||
for i, dest_vert in enumerate(obj_to.data.vertices):
|
for i, dest_vert in enumerate(obj_to.data.vertices):
|
||||||
source_verts = vert_influence_map[i]
|
source_verts = vert_influence_map[i]
|
||||||
|
|
||||||
@ -190,7 +194,7 @@ def transfer_vertex_groups(obj_from, obj_to, vert_influence_map, src_vgroups):
|
|||||||
for group in obj_from.data.vertices[src_vert_idx].groups:
|
for group in obj_from.data.vertices[src_vert_idx].groups:
|
||||||
group_idx = group.group
|
group_idx = group.group
|
||||||
vg = obj_from.vertex_groups[group_idx]
|
vg = obj_from.vertex_groups[group_idx]
|
||||||
if vg.name not in src_vgroups:
|
if vg not in src_vgroups:
|
||||||
continue
|
continue
|
||||||
if vg.name not in vgroup_weights:
|
if vg.name not in vgroup_weights:
|
||||||
vgroup_weights[vg.name] = 0
|
vgroup_weights[vg.name] = 0
|
||||||
@ -199,8 +203,6 @@ def transfer_vertex_groups(obj_from, obj_to, vert_influence_map, src_vgroups):
|
|||||||
# Assign final weights of this vertex in the vertex groups.
|
# Assign final weights of this vertex in the vertex groups.
|
||||||
for vg_name in vgroup_weights.keys():
|
for vg_name in vgroup_weights.keys():
|
||||||
target_vg = obj_to.vertex_groups.get(vg_name)
|
target_vg = obj_to.vertex_groups.get(vg_name)
|
||||||
if target_vg == None:
|
|
||||||
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')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user