fix pointers

fix pointers in operators to point to class bl_idname property
This commit is contained in:
989onan
2025-04-02 20:35:59 -04:00
parent e4d3f676a2
commit 5cad28a41b
14 changed files with 103 additions and 63 deletions
+2 -15
View File
@@ -7,6 +7,7 @@ from ...core.translations import t
from ...core.common import (
get_all_meshes,
fix_zero_length_bones,
remove_unused_vertex_groups,
clear_unused_data_blocks,
join_mesh_objects,
remove_unused_shapekeys,
@@ -174,7 +175,7 @@ def merge_armatures(
merge_armature_data: bpy.types.Armature = merge_armature.data
for bone in merge_armature_data.bones:
original_parents[bone.name] = bone.parent.name if bone.parent else None
# Switch to edit mode on merge armature and rename bones
bpy.context.view_layer.objects.active = merge_armature
bpy.ops.object.mode_set(mode='EDIT')
@@ -377,20 +378,6 @@ def mix_vertex_groups(mesh: Object, vg_from_name: str, vg_to_name: str) -> None:
vg_to.add(range(num_vertices), weights_combined.tolist(), 'REPLACE')
mesh.vertex_groups.remove(vg_from)
def remove_unused_vertex_groups(mesh: Object) -> None:
"""Remove vertex groups with no weights"""
for vg in mesh.vertex_groups:
has_weights: bool = False
for vert in mesh.data.vertices:
for group in vert.groups:
if group.group == vg.index and group.weight > 0.001:
has_weights = True
break
if has_weights:
break
if not has_weights:
mesh.vertex_groups.remove(vg)
def apply_armature_to_mesh(armature: Object, mesh: Object) -> None:
"""Apply armature deformation to mesh"""
armature_mod: ArmatureModifier = mesh.modifiers.new('PoseToRest', 'ARMATURE')