UE4.25 でコントロールリグの作業効率Python
以下のサイト様のPythonを使わせてもらいました!!
Mayaリガー向け!UE4.26 ControlRig &Python、コントロール階層を自動で作る!
https://tech-art.online/ue-controlrig-python/
ただ、UE4.25.3でうまくいかなかったので、勝手に更新してみた備忘録です。
改良途中ですが配布。(カスタムして再配布がNGならすぐ消しますのでm(__)m)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Auto Rig Script UE4.25.3 | |
# | |
#thanks https://tech-art.online/ue-controlrig-python/ | |
# | |
#使い方:コントロールリグブループリントのリグ階層のジョイントを選択して実行 | |
#結果:リグが作成される | |
# | |
# | |
# | |
gizmoName = "Circle_Thick" | |
rigColor = [0.015,0.7,0] | |
# coding: utf-8 | |
import unreal | |
# 開いているControlRigを取得する | |
rigs = unreal.ControlRigBlueprint.get_currently_open_rig_blueprints() | |
rig = rigs[0] | |
# ControlRigHierarchyModifierを取得する | |
h_mod = rig.get_hierarchy_modifier() | |
# 選択エレメントを取得する | |
elements = h_mod.get_selection() | |
"""------------------------------------------------ | |
スペース&コントロール作成&階層作成 | |
------------------------------------------------""" | |
parent=None | |
for element in elements: | |
# スペースを作成する | |
space = h_mod.add_space("{}_space".format(element.name), space_type=unreal.RigSpaceType.SPACE) | |
# コントロールを作成する | |
control = h_mod.add_control("{}_control".format(element.name), space_name=space.name, gizmo_name=gizmoName, gizmo_color=rigColor) | |
# スペースにボーンの初期トランスフォームを適用する | |
bone_initial_transform = h_mod.get_local_transform(element) | |
#print(str(bone_initial_transform)) | |
h_mod.set_initial_transform(space, bone_initial_transform) | |
#bone_local_transform = h_mod.get_local_transform(element) | |
#h_mod.set_local_transform(space, bone_local_transform) | |
# parent変数が空でない場合、ペアレントする(階層を作る部分) | |
if parent is not None: | |
h_mod.reparent_element(space, parent) | |
parent = control |
0 コメント:
コメントを投稿