CG・コンテンツ制作
SUITE USERS NOTES
Softimage と MotionBuilder用 ツール紹介
>> MotionTrail , Animation Manipulator & PlotCurve_from_Anim.py
Introducing Softimage & MotionBuilder Tools .
SUNdan_ml

プロローグ ;Prologue
普段、映像製作をしていて、ふと、”こんなツールあったら便利なのになー”
と思うことってありますよね。
そんな中、アニメーターさん向けにおお!と思われたツールのリリースがありました。
今回は、そのツールの製作者TAROさんの許可を頂いて、
MotionTrailAnimation Manipulator
を紹介したいと思います。

TAROさん素晴らしいツールの提供、ありがとうございます。

あわせて、MotionBuilderの移動値からカーブを作成するツール
PlotCurve_from_Anim.py も紹介します。
このスクリプトはユーザーの PythonStartup ディレクトリーに保存するもので、
起動時に勝手にPythonToolManagerにボタン登録されます。
ぜひ、PythonスクリプトでUIを作成してボタン起動するツール例として
参考にしてください。

アニメーション製作中でのツール使用事例です。
 < 自己責任でご利用くださいね。 >


In our usual work
we sometimes think , "wish there is a tool like ....."
Here I'm gona introduce a tool for animator ,
MotionTrail and Animation Manipulator ,
with the permission from the creator TARO_San.

TARO_San , thank you very much!! for your great tool .

Also , show a MotionBuilder tool PlotCurve_from_Anim.py,
which makes a curve from key points .
This will be a good sample of PythonScript to make a UI & Buttons
with in PythonToolManager which is saved inside PythonStartup
Directory .

So, here is a example how the tool was used in character animation.
 < Use tools with your own risk . > 
 > ツール;xsiaddon
 > 設定;Install
 > ツールの機能;Features
 > MotionTrail
 > Animation Manipulator
 > 参考データ作成;Example Data
 > PlotCurve_from_Anim.py
 > データ修正;Fixing Animation
 > 結果;Result
tool24_01_02
Windows7 Professional 64Bit、Intel Core i7-3930K(3.20GHz,6コア/12スレッド)
メモリ16GB、NVIDIA GeForce GTX560 Ti 2GB(メモリ2GB)



ツール;xsiaddon
最初にプラグインツールですが、紹介記事のあった si-community から入手してください。
また、ツールの更新、仕様変更もあるかも知れませんので、御了承ください。
現時点での各ツールのバージョンはMotionTrail v1.3Animation Manipulator V1.0 です。

MotionTrail
http://www.si-community.com/community/viewtopic.php?f=9&t=2774
Animation Manipulator
http://www.si-community.com/community/viewtopic.php?f=9&t=2731


Get those tools from where it was introduced, inside si-community .
Tools , may update or change features.
Now , the versions are MotionTrail v1.3Animation Manipulator V1.0

もし古いバージョンをインストールしたことがある場合、アンインストールした後、
ファイル > 設定 > Custom内にあるMotionTrailというノードを削除しておくことをお勧めします。
If you have installed older Version ,after uninstalled , delete MotionTrail node inside Flie > Preference > Custom .



設定;Install
ツール内のReadMeにも書かれている通り、32bit か 64bit の addon をインストールします。
ここでは Workgroup として64Bit版をインストールする方法を紹介しておきます。

ファイル > プラグインマネージャーでインストール先のワークグループが一番上にあることを確認し、
ツリータブ内でそのワークグループを選択して右マウスクリック > .xsiaddonのインストールを選択します。
各ツールのアドオンを選択してインストールします。
(このアドオンディレクトりーはSoftimage2013SP1 も参照していて、起動時に自動的にインストールされます)

As is explained in the readme file inside the tool , install the 32bit or 64bit addon file.
Here I will show how 64bit addon is installed in a workgroup .
Get the File > Plug-inManager... , and check the installing workgroup is at the top of the list in Workgroup Tab ,
then in the Tree Tab , select the workgroup > RMB > Install .xsiaddon .
tool24_03
すると、各ツールを動かすコマンドが登録されます。
確認は、表示 > ツールバーのカスタマイズで表示される画面で
左側グループ欄でCustomScriptCommandsを選択し、右側で各ツールの名前のコマンドが登録されています。

This will set a custom command .
To check this command , do View > Customize Toolbars... ,
you will see Animation Manipulator and MotionTrail in Custom Script Commands Group .
tool24_04
つまり、このコマンドを実行できればツールが起動します。
どこかのキーに設定することも、ボタンにしておくことも出来ます。ここでは後者にしておきます。
ScriptEditor にてMotionTrail と記述してアニメーションの付いたオブジェクトを選択して、実行してみます。
OKならMotionTrail 表示 > 既存のツールバー>新規カスタムツールバー上にドラッグ&ドロップします。
スクリプトボタンを作成し、ボタンのラベル名や大きさを設定して[ OK ] を押します。

Use these commands to get the tool working .
You can set these commands to Key Button or toolbar Button. Here will show as a Toolbar.
At ScriptEditor run MotionTrail , after selecting key animated object , to test if it works .
If it is OK , select the word MotionTrail , and Drag&Drop to a already existing Toolbar , or on a new one .
At popup , chose Script Button , rename the Button Label , change the Width and do [ OK ] .
Same to AnimationManipulator .
tool24_05
この作ったツールバーは保存しますが、保存先も先にインストール先として設定したワークグループ内の Toolbars ディレクトリーに保存すればワークグループ参照と同時にツールバーも設定されます。

This toolbar can also be saved in a workgroup .
tool24_06
ショートカットキーの変更;Changing Shotcut Key
このツールのキー割り当てで、昔からのSofitmageユーザーは回転キーとして使うOキーが使われていてうまく使えない
あるいは、MayaやMaxキー割り当てを使っていて他のキーに設定したい場合、変更することができます。
ファイル > キーボードマッピングで設定画面が出ます。デフォルトのものを変更しようとすると警告が表示されるので、はいでカスタムなものを作成します。

If your an old Softmage user , perhaps O key is using for Orbit , and MotionTrail tool in using O Key for "Break Key ".
Also Maya or Max user want other Key to use . For this , you can change using custom keymap.
From File > Keyboard mapping... , default Keymap setting will appear .
If you try to edit this , a warning will popup to make a custom one , so do so [YES] .
tool24_19
左欄から MotionTrail を選択し、例えばOキーのついている BreakKey を[クリア]ボタンを押して割り当てを解除します。
好きなキーに割り当てても良いです。
任意の名前でキー登録したファイルもワークグループ内のKeymapsディレクトリーに保存すれば同じくワークグループ設定になります。(ディレクトリーは自分で作成します)

Choose MotionTrail from group , set clear on O key , or change to other Key .
This custom keymap can also be saved in the workgroup with unique file name .
tool24_20



ツールの機能;Features
各ツールの基本操作を説明します。
もちろん、対応している機能にも範囲はあるので、それを踏まえて使用してください。

Basic features of the tools .



MotionTrail
キーアニメーションが付いてオブジェクトに、MotionTrailを実行すると白線が表示され、白点がキーが打たれている場所をあらわします。
十字表示になったカーソルで右マウスボタンでメニューが表示されます。
白点を選択状態にさせると赤点 になり移動操作が出来るようになります。選択点は複数でも可能です。
赤点を動かすと、AnimationEditorFCurveも変化します。View画面上で、赤点をどんなに移動させてもキーフレーム数は変わりません。
白線上のどこでも真ん中マウスボタンでキーを追加で、ボタンを離せばそこに打たれます。
Deleteキーで選択点を削除できます。

Run MotionTrail to an animated object with selection , you will get a white path curve .
White Point in the Path is where a Keyframe is . Using + cursor , selected Point will change to Red , ready to move.
You can select as multi point . When you move the Red point , the FCurve will also be edited .
But the Keyframe will not change .
You can add a point anywhere in white path with MMB, meaning adding a Keyframe .
Delete point with delete Key .
tool24_07
横に伸びているハンドルは速度に応じた長さを表し、同時に角度調整も出来ます。
下図のように FCurveだけで見た場合、55フレーム以降が急激な鋭角の変化しているように見えないし、
また、88フレームあたりでループの動きになっていることなど想像も付かないと思います。
ですが、今度はMotionTrailの軌跡を見ただけでは各キー間が狭くて速いのか、遠くて遅いのか、
また縦だけのアニメーションなのか把握しにくい、というのもあります。
ですのでAnimationEditorとの同時併用がお勧めです。
3軸にキーが設定してないと、赤点が自由には動きません。逆にY軸のみの編集なら、Y軸だけのキー設定で他の軸への移動が効かないように動きます。
ツールの終了はもう一度 MotionTrail を実行させるか、Escキーを使います。

The Slope Handles in the white path , meaning is different form FCurve Editor's .
The length shows how fast it is moving , and also you can twist (rotate) in 3D .
The usefulness is quite obvious .
You can't see a Y axis slope in frame 55 in the Fcurve Editor , or you can't guess it is looping in 88 frame from the FCurve.
But then , how many frame there are between each other , which means speed , is good to know using AnimationEditor .
AnimationEditor is also good to know if it is only one axis animation , or two (like X Y animation) .
So , it is good to use both MotionTrail and AnimationEditor .
MotionTrail 's Red selected point will not move in 3D , if there isn't Key on all X,Y,Z .
If you know that , only Y axis animation object's MotionTrail , will only move on Y axis .
MotionTrail will stop operating by pressing the button again , or using ESC Key .
tool24_08
ポップアップのメニューから各機能を適用させると、色々なパス編集が可能です。FCurveの方もそれに従って変化します。

Below is choosing features from the Popup menu . Of course the FCurve also changes .
tool24_21



Animation Manipulator
最初に気を付ける点は、動かすオブジェクトに移動と回転のキーアニメーションが設定されている必要があります。
1フレーム目に移動と回転値の FCurve があれば、次からはKキーでキーを設定すると、移動と回転を同時にキーが打たれます。
AnimationEditor で見ると6点同時に追加されます。
右マウスクリックで設定画面が表示され、移動と回転がどの設定で操作するか別々に設定できます。
移動か回転の全てにチェックが入っていない場合、その操作が出来なくなります。
また、OnlyAnimated も移動と回転のキーフレームがある方にだけ操作が出来ます。
これは、キャラクターアニメーションなどで、回転値のみキーを設定をするオブジェクトには、回転の操作しか出来ない、となります。
誤って移動のキーを打ってしまうことが無くなります。

First to care , the object that you want to translate or rotate , must have keyframe to it .
If you have translate and rotate keyframe in 1 , then from next on , you can set keys using AnimationManipulator + K key.
As you can see below , 6 keys are set in one K keyButton .
+ cursor will select which to manipulate , with RMB you can select how to manipulate . (Translate & Rotation in Global or Local)
Without any checks on , will cause no manipulation .
OnlyAnimated feature , will only able to manipulate on witch animation is on that object .
This means , in character animation , some control are only for rotation , some are for translation .
With this option on , it will prevent form mistaken keys .
tool24_10



参考データ作成;Example Data(MotionBuilder 2013 は SP1 を適用してください。Use MotionBuilder 2013 SP1)
では、修正が必要そうなデータを用意するということで、MotionBuilderのモーションキャプチャーデータで、
しかも K●nect からの欠損のあるデータを修正するのに使えないかと考えました。
読み込んだ動きを Actor に設定し、Charactrize された ControlRig に動きを乗せ換えたら、
Bake to ControlRig を実行します。

To prepare a data that has to be fixed , used K●nect for capturing with MotionBuilder .
Set the data to the Actor , retarget the motion to Characterized Control Rig .
Do , Bake to ControlRig
tool24_11
ControlRigにある動きをStory の Clip に移します。
Story画面でCharacterTrack を作成し、Character欄にControlRigの名前(ここではCharacter)を設定して、
右マウスクリック >  Insert Current Take を実行します。
Clip が出来たら要らない部分のアニメーションをRazerを使って分割して削除します。
そうしたら、CharacterTrack 右マウスクリック >  Plot Whole Scene to Current Take...
を実行すると、Clip化した動きが全てControlRigに戻って来ます。
このあたりの操作は別途のページにて詳しく説明できたらと思います。

Removing CharacterRig Motion to Story Clip .
In the Story , make a new Character Track , set the Character to your own character name (here ; Character) .
On the track RMB > Insert Current Take and will make a Clip .
Use Razor tool to cut the unusing animation on the Clip.
Do some tweak here like changing frame or speed...
Then , on the track RMB > Plot Whole Secene to Current Take....
will make the Clips animation back to ControlRig Motion .
Might have a different page to explain this workflow ....
tool24_12



PlotCurve_from_Anim.py
さて、今回はSoftimageのツール紹介がメインですが、MotionBuilderのツール作成についても少し紹介します。
話題がアニメーションの付いているオブジェクトの軌跡をカーブとして表示するってのぽいので、
MotionBUilderでもPlotCurve_from_Anim.pyというものを作成してみました。

Though this page is mainly writing about Softimage tool ,
thought of something about making key animation to curve ,
and decided to introduce a MotionBuilder tool that makes curve from KeyAnimation.
tool24_18
ご提供しますHere you are  >> PlotCurve_from_Anim.zip
このPythonスクリプトにはUIを作成する部分も含まれているので Pythonツール作成 の良い例になると思います。
インストールは、ユーザーのPythonStartup内の保存すると
(例;C:\Users\ritaro(ユーザー名)\Documents\MB\2013-x64\config\PythonStartup)
自動的に Python Tool Manager に登録されます。

この部分のSDKの親切な解説はhttp://docs.autodesk.com/MB/MB2013/ENU/MotionBuilder-SDK-Documentation/
Python Reference > Examples > UI/SafeToolCreationExample.py UI/ToolCommunicationSender.py UI/Button.py UI/Edit.py 参照
gDevelopment = TrueはMotionBuilderを再起動せずにPythonスクリプトの編集が可能に、Tasks/MatchAuxiliaryEffectors.py 参照


The tool is PlotCurve_from_Anim.py and is of course Python Script ,
which you put inside user's PythonStartup folder .
This will be in PythonToolManager when you start MotionBuider .
This is really good sample to know how to make a custom tool.

For more information see
http://docs.autodesk.com/MB/MB2013/ENU/MotionBuilder-SDK-Documentation/
Python Reference > Examples > UI/SafeToolCreationExample.py UI/ToolCommunicationSender.py UI/Button.py UI/Edit.py
For gDevelopment = True see Tasks/MatchAuxiliaryEffectors.py

from pyfbsdk import *
from pyfbsdk_additions import *

toolname = "Plot Curve from Animation"



gDEVELOPMENT = False



if toolname in FBToolList:
tool = FBToolList[toolname]
ShowTool(tool)
else:
tool=CreateTool_Plot()
if gDEVELOPMENT:
ShowTool(tool)



 < こっちが本当は上 , This is written above>

def CreateTool_Plot():
t = FBCreateUniqueTool(toolname)
t.StartSizeX = 350
t.StartSizeY = 170
BuildUI(t)
return t


 < こっちが本当は上 , This is written above>

# Add our Plot button
labId = "button"
x = FBAddRegionParam(-72,FBAttachType.kFBAttachRight,"")
y = FBAddRegionParam(-30,FBAttachType.kFBAttachBottom,"")
w = FBAddRegionParam(70,FBAttachType.kFBAttachNone,"")
h = FBAddRegionParam(25,FBAttachType.kFBAttachNone,"")
mainLyt.AddRegion(labId,labId, x, y, w, h)

lButton = FBButton()
lButton.Caption = "Plot"
lButton.Justify = FBTextJustify.kFBTextJustifyCenter
mainLyt.SetControl(labId,lButton)
lButton.OnClick.Add(ChgToCurve)
お決まり2つ宣言文
Usual two Python MotionBuilder API , include

ツールの名前設定
set Tool name

これツール開発時に便利!!
スクリプト更新でUIも更新できる。
ensure a recreation of the tool


Python Tool Manager の登録名を見て
大丈夫なら登録し、
See what is in Python Tool Manager
if OK than set





 < こっちが本当は上 , This is written above>

UIの大きさを作り
Making UI size






 < こっちが本当は上 , This is written above>

その中のボタンを配置と動作
Making UI Buttons and action

黄色いカーブは同様な機能の Trajectories ですが、変更すると変わるので元の位置が分らなくなります。
右手の軌跡を見ると分るのですが、体は360度回転しているのに、腕の動きがもうダメダメです。
Bake to Skeleton で元のキャラ骨に動きをプロットしたら、全選択してFBXに保存します。
これをSoftimageで読み込みます。

The yellow path is Trajectories , this path will change its position when you change the keyframe animation ,
which makes you hard to know the original position was .
See the right hand animation , the body is going around , but the hand is .... awful..
In MotionBuilder, use Bake to Skeleton to plot the animation to your own character skeleton ,
and Save that data to FBX using Save Selection .
Read this in Softimage .
tool24_13



データ修正;Fixing Animation
動きの修正をMotionTrail を使って行ってみます。
まず、全フレームたどキー操作が困難なので、ある程度キーを減らします。XYZ軸ともキーがある状態です。
全部のフレーム分のMotionTrailカーブ を表示するのは処理が重くなるし、カーブがたくさんあると分り辛いので、
修正が必要なフレーム数を絞り込みます。 左右タイムラインの範囲を指定します。
下図は修正がかなりされている状態で、手の動作の反復運動が体の裏側に行っても継続され、
尚且つ体の回りを手が円を描いて回るようになっています。

Fixing Character animation using MotionTrail .
For more better handling , used filter to reduce keys . Each frame has XYZ keys . Also limit the frames to show in timeline .
Below , has already fixed the hand animation , which moves it's hand Up and down around the body .
tool24_14
FCurveだけ見ていてはとても気がつきにくい鋭角な動きや変なループになっている動きを
MotionTrail上のキー部分を赤色選択して スロープを変更するだけで動きを修正できます。

You can fix funny sharp and loop animation , just by moving MotionTrail's slope handles .
tool24_15
左右の手の上がった位置や途中の動きもMotionTrail上のキー部分を赤色選択して移動させただけで
ぴったりあわせることができました。これはもう別のモーションになってしまいますね。
他にはUpVectorの位置の編集にも使えました。
うまくコントロールできない時はAnimationEditorと併用して位置調整することをお勧めします。

The raised hands position and animation are different right to left ,
then just move MotionTrail's position .
Also used in fixing UpVector position.
If you have difficulty placing the MotionTrail's position , use AnimationEditor too.
tool24_16



結果;Result
大成功のようです。全フレームのアニメーションの修正例ではなく、
キー間のあるアニメーションの修正ならとても便利なツールです。
ばんざーい!!

The result was fine , can fix any Keyframed Animation..I think..
BANZAI !!
tool24_17

という訳で、次回 は・・・・ MotionBuilder その2に戻れるのか??
乞う、ご期待!!
戻る
次へ

お気軽にお問い合わせください

Daikin CG News お申し込み

CGクリエイター向けのセミナー・イベントやキャンペーン、製品情報をメールマガジンでお届けします。(登録無料)

Twitter

ページの先頭へ