保存在CSV中
import bpy import csv def get_bone_names(armature_name): bone_names = [] # 找到骨架对象 armature_obj = bpy.data.objects.get(armature_name) if not armature_obj or armature_obj.type != 'ARMATURE': print(f"Armature '{armature_name}' not found or is not an armature.") return bone_names # 遍历骨架中的所有骨骼 for bone in armature_obj.pose.bones: bone_names.append(bone.name) return bone_names def write_bone_names_to_csv(bone_names, csv_file_path): with open(csv_file_path, mode='w', newline='') as file: writer = csv.writer(file) writer.writerow(["Bone Name"]) # 写入标题 for bone_name in bone_names: writer.writerow([bone_name]) # 写入每个骨骼的名称 # 获取骨架中所有骨骼的名称 bone_names = get_bone_names('Armature') # 指定CSV文件的路径 csv_file_path = 'E:/guge/bone_names.csv' # 将骨骼名称写入CSV文件 write_bone_names_to_csv(bone_names, csv_file_path) print(f"Bone names have been written to {csv_file_path}")
2.保存在txt 中
import bpy def get_bone_names(armature_name): # 找到骨架对象 armature_obj = bpy.data.objects.get(armature_name) if armature_obj is None or armature_obj.type != 'ARMATURE': print(f"Armature '{armature_name}' not found or is not an armature.") return [] # 存储骨骼名称的列表 bone_names = [bone.name for bone in armature_obj.pose.bones] return bone_names def write_bone_names_to_txt(bone_names, file_path): # 写入骨骼名称到文本文件 with open(file_path, 'w') as file: for bone_name in bone_names: file.write(bone_name + '\n') # 每个名称后添加换行符 # 骨架名称 armature_name = 'Armature' # 骨骼名称列表 bone_names = get_bone_names(armature_name) # 指定txt文件的路径 txt_file_path = 'E:/guge/bone_names.txt' # 将骨骼名称写入txt文件,每个名字一行 write_bone_names_to_txt(bone_names, txt_file_path) print(f"Bone names have been written to {txt_file_path}")
3.对应骨骼
Biped_Root Skadi_SwimSuit_A_arma Armature Pelvis || Bip001-Pelvis || mixamorig:Hips Left_Thigh || Bip001-L-Thigh || mixamorig:LeftUpLeg Left_Calf || Bip001-L-Calf || mixamorig:LeftLeg Left_Foot || Bip001-L-Foot || mixamorig:LeftFoot Right_Thigh || Bip001-R-Thigh || mixamorig:RightUpLeg Right_Calf || Bip001-R-Calf || mixamorig:RightLeg Right_Foot || Bip001-R-Foot || mixamorig:RightFoot Spine || Bip001-Spine || mixamorig:Spine Spine1 || Bip001-Spine1 || mixamorig:Spine1 Spine2 || Bip001-Spine2 || mixamorig:Spine2 Right_Clavicle || Bip001-R-Clavicle || mixamorig:RightShoulder Right_UpperArm || Bip001-R-UpperArm || mixamorig:RightArm Right_Forearm || Bip001-R-Forearm || mixamorig:RightForeArm Right_Hand || Bip001-R-Hand || mixamorig:RightHand Neck || Bip001-Neck ||mixamorig:Neck Head || Bip001-Head || mixamorig:Head Left_Clavicle || Bip001-L-Clavicle || mixamorig:LeftShoulder Left_UpperArm || Bip001-L-UpperArm ||mixamorig:LeftArm Left_Forearm || Bip001-L-Forearm || mixamorig:LeftForeArm Left_Hand || Bip001-L-Hand || mixamorig:LeftHand
标签:读取,表格,mixamorig,name,names,Bip001,armature,bone,blender4.1 From: https://www.cnblogs.com/jingzaixin/p/18242521