无事水,但要好好|

Nolca

园龄:6年9个月粉丝:12关注:9

blender 面捕优化

删除空顶点组

import bpy
def make_group_list():
obj = []
temp_list = []
group_list = []
so = bpy.context.selected_objects
for i in so:
obj.append(i)
for i in obj:
#I've used .extend here (with square brackets) to add every item to the list
temp_list.extend([group[0] for group in i.vertex_groups.items()])
for group_name in temp_list:
if group_name not in group_list:
group_list.append(group_name)
return group_list
#2. CHECK THE AVERAGE WEIGHT OF EACH VERTEX POINT
def average_weight(vertex_group_names, obj):
mesh = obj.data
for vertex in mesh.vertices:
for group in vertex.groups:
if group.group in vertex_group_names and group.weight > 0.1:
return False
return True
#3. DELETE THE GROUP
def delete_group(obj, vertex_group):
obj.vertex_groups.remove(vertex_group)
# GROUP_LIST DEFINED
group_list = make_group_list()
#4. MAIN FOR LOOP
for obj in bpy.context.selected_objects:
for vertex_group_name in group_list:
vertex_group = obj.vertex_groups.get(vertex_group_name)
if vertex_group is not None:
if average_weight([vertex_group.index], obj):
delete_group(obj,vertex_group)

复制shapeKey

import bpy
l=[]
obj = bpy.data.objects['Neutral.001']
#obj = bpy.context.active_object
#for i in obj.vertex_groups:
# print(i.name)
for i in obj.data.shape_keys.key_blocks:
print(i.name)
if ('brow' in i.name):
l.append(i.name)
obj = bpy.context.active_object
for i in l:
obj.shape_key_add(name=i, from_mix=False)

自带

import bpy
childrenList = bpy.data.objects['ShapeKeyModelGrp'].children
for child in childrenList:
bpy.ops.object.select_all(action='DESELECT')
child.select_set(True)
objectToSelect = bpy.data.objects["Neutral"]
objectToSelect.select_set(True)
bpy.context.view_layer.objects.active = objectToSelect
bpy.ops.object.join_shapes()

本文作者:Nolca

本文链接:https://www.cnblogs.com/nolca/p/17476567.html

版权声明:本作品采用 收益分享revenue sharing 许可协议进行许可。

posted @   Nolca  阅读(26)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起
  1. 1 ⏩intro 山姆精
  2. 2 🎸吉他 马叉
  3. 3 ☁升调 山姆精
  4. 4 🐦Flutter Virtual Riot/Madi
  5. 5 🎶纯律 山姆精
  6. 6 👻yeah~Color Bass! VR
🎸吉他 - 马叉
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.