From 66d046721b5b7789a2ffc717f014cb09c94df9bf Mon Sep 17 00:00:00 2001 From: rBrenick Date: Mon, 21 Oct 2024 15:21:06 +0200 Subject: [PATCH] fixed crash on changing PasteGroups weight value --- skinning_suite.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/skinning_suite.py b/skinning_suite.py index ce8b867..7c5efd0 100644 --- a/skinning_suite.py +++ b/skinning_suite.py @@ -6,7 +6,7 @@ bl_info = { "name": "Skinning Suite", "author": "Richard Brenick", - "version": (1, 0), + "version": (1, 1), "blender": (2, 80, 0), "location": "Weight Paint - Select", "description": "", @@ -670,21 +670,21 @@ def store_selected_vert_data(self, context): # get weight data sel_weight_data = {} - for vtx in ob.data.vertices: + for vtx_index, vtx in enumerate(ob.data.vertices): if 0: vtx = vtx # type: bpy.types.MeshVertex if not vtx.select: continue - sel_weight_data[vtx] = {} + sel_weight_data[vtx_index] = {} for grp in vtx.groups: vg_name = ob.vertex_groups[grp.group].name - sel_weight_data[vtx][vg_name] = grp.weight + sel_weight_data[vtx_index][vg_name] = grp.weight # assign missing vertex groups - missing_bones = [b for b in json_bones if b not in sel_weight_data[vtx].keys()] + missing_bones = [b for b in json_bones if b not in sel_weight_data[vtx_index].keys()] for missing_bone in missing_bones: v_group = ob.vertex_groups.get(missing_bone) if v_group is None: @@ -705,7 +705,8 @@ def set_weights_on_selected(self, context, paste_weight=1.0): ob = context.active_object # type: bpy.types.Object # blend in weights - for vtx, weight_data in sel_weight_data.items(): + for vtx_index, weight_data in sel_weight_data.items(): + vtx = ob.data.vertices[vtx_index] if 0: vtx = vtx # type: bpy.types.MeshVertex