搞 blender , python 就是重复劳动的救星!
使用方法和功能:
选中网格体对象
循环其每个材质槽
移除 名字的 后缀
举例:
原材质名:Mat1.001
新材质名:Mat1
import bpy
for obj in bpy.context.selected_objects:
for i in range(len(obj.material_slots)):
# 材质槽名字的不可修改的,必须使用名字获得真正的材质对象,要对真正的材质对象进行改名
mat = bpy.data.materials[obj.material_slots[i].name]
ori_name = mat.name
new_name = mat.name.rsplit('.', 1)[0]
print(f'rename {ori_name} -> {new_name}')
mat.name = new_name
print('Success')



