日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

blender script mmd_tool 自动重命名刚体到合适的名字

發(fā)布時間:2024/3/12 编程问答 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 blender script mmd_tool 自动重命名刚体到合适的名字 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

關(guān)聯(lián)文章,自動重命名Joint點:https://blog.csdn.net/ONE_SIX_MIX/article/details/125002920

改模的素材來自各個模型,手動改骨骼名還行,改剛體就要命了,實在太多了。

或許,未來有空的時候,單獨弄個mmd_tool擴展工具來更加便于使用

寫了個腳本來自動重命名剛體。

命名規(guī)則如下:
剛體對象名:剛體編號.rigid.引用骨骼名<.引用編號>
mmd剛體名:引用骨骼名<.引用編號>
其中,只有多個剛體同時引用同一個骨骼才會有<.引用編號>后綴,不然就沒有這個后綴

命名示例:

注意,使用此腳本時,必須先顯示剛體對象,這個腳本只會對非隱藏的剛體對象進行操作

import bpy# rb1->rb2->joint paired_joints = {}name_to_rb = {}for obj in bpy.context.visible_objects:if obj.rigid_body_constraint is not None and \hasattr(obj, 'mmd_joint') and obj.mmd_joint is not None and \obj.rigid_body_constraint.object1 is not None and obj.rigid_body_constraint.object2 is not None:rb1_name = obj.rigid_body_constraint.object1.namerb2_name = obj.rigid_body_constraint.object2.namename_to_rb[rb1_name] = obj.rigid_body_constraint.object1name_to_rb[rb2_name] = obj.rigid_body_constraint.object2paired_joints.setdefault(rb1_name, {})paired_joints[rb1_name].setdefault(rb2_name, [])paired_joints[rb1_name][rb2_name].append(obj)idx = 0for rb1_name in sorted(list(paired_joints.keys())):for rb2_name in sorted(list(paired_joints[rb1_name].keys())):is_append_joint_i = len(paired_joints[rb1_name][rb2_name]) > 1for joint_i, joint in enumerate(paired_joints[rb1_name][rb2_name]):old_obj_name = joint.nameold_joint_name = joint.mmd_joint.name_jrb1_name_2 = name_to_rb[rb1_name].mmd_rigid.name_jrb2_name_2 = name_to_rb[rb2_name].mmd_rigid.name_jnew_obj_name = f'{idx}.joint.{rb1_name_2}->{rb2_name_2}'if is_append_joint_i:new_obj_name += f'.{joint_i}'joint.name = new_obj_namenew_joint_name = f'{rb1_name_2}->{rb2_name_2}'if is_append_joint_i:new_joint_name += f'.{joint_i}'joint.mmd_joint.name_j = new_joint_nameprint(f'rename {old_obj_name}->{new_obj_name} | {old_joint_name}->{new_joint_name}')idx += 1print('Success')

總結(jié)

以上是生活随笔為你收集整理的blender script mmd_tool 自动重命名刚体到合适的名字的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。