Blender
评价数不足
Delete unweighted, unused vertex groups
由 _MaZ_TeR_ 制作
Only made this thread so I could easily find this trick in the future.

Credits to this thread:
https://blenderartists.org/t/batch-delete-vertex-groups-script/449881/22
   
奖励
收藏
已收藏
取消收藏
According to the comments in the thread, the plugin doesn't work by itself in Blender 3.0 anymore, but running the script in the text editor of Blender does work as confirmed by me.

Before you run the script, select the object from which you want the unweighted vertex groups removed.

Here is the code:


import bpy from bpy.types import Operator ob = bpy.context.object ob.update_from_editmode() vgroup_used = {i: False for i, k in enumerate(ob.vertex_groups)} for v in ob.data.vertices: for g in v.groups: if g.weight > 0.0: vgroup_used[g.group] = True for i, used in sorted(vgroup_used.items(), reverse=True): if not used: ob.vertex_groups.remove(ob.vertex_groups[letter i])


And here is it, but it works with multiple objects selected:

import bpy from bpy.types import Operator # Loop over all selected objects for ob in bpy.context.selected_objects: # Check if the object is a mesh if ob.type == 'MESH': ob.update_from_editmode() vgroup_used = {i: False for i, k in enumerate(ob.vertex_groups)} for v in ob.data.vertices: for g in v.groups: if g.weight > 0.0: vgroup_used[g.group] = True for i, used in sorted(vgroup_used.items(), reverse=True): if not used: ob.vertex_groups.remove(ob.vertex_groups[letter i])

Note that change the "letter i" sections to just i, I can't put the square brackets because it formats the text to italian and deletes the part of the code.
4 条留言
Artiko240 2023 年 9 月 6 日 上午 4:08 
True
_MaZ_TeR_  [作者] 2023 年 8 月 25 日 下午 12:24 
The better question is, why not?
Artiko240 2023 年 8 月 25 日 上午 10:40 
why the cat
N7Legion 2023 年 8 月 15 日 下午 11:32 
I have a different script, which is a lot easier to remove the unused vertex groups with a button. Can be easily located under Data > Vertex Groups > Special menu

https://cdn.discordapp.com/attachments/488722739922993152/1141257827520872488/Remove_unused_vertex_groups.py