To build an animation clip event, open the Atoms UI and make sure to have selected the "AnimationClipEvents" tab.
Click on "Add" and you will be prompted with a dialog asking if you want to edit your clip in GUI or script mode.
GUI mode
Give a name to your animation clip (i.e. robotWalk).
Select the fbx you exported previously. As soon as you select a file Atoms will look for its preview file and will load it on the right side of the GUI.
Most of the GUI options wer explained here already.
For this tutorial, we are going to change the "Loop Blend" to 4, set the "Direction Type" to static.
The preview will be very handy now to find the loop start and end frames. Move the mouse over the preview and find two poses that are similar to each other. Generally the first frame where a foot get down on the ground will be a good choise.
In our case the start frame will be 6 and the end frame will be 36.
Click the "Register" button or press CTRL+S.
Your Animation Clip is now ready to be used.
Script mode
In case you selected the script mode, you should edit your script so it looks like the following.
Then hit CTRL+S or click on the "Register" button. イベントを作成するには、Atoms UIを開き、必ず
「AnimationClip Events」タブを選択してください。
「Add」をクリックすると、GUIまたはスクリプトモードでクリップを編集するかどうかを尋ねるダイアログが表示されます。
GUI モード
ユーザーのAnimation Clipに名前を付けて下さい(すなわちrobotWalk)。
以前に、エクスポートしたFBXファイルを選択します。ファイルを選択すると、直ちにAtomsは、そのプレビューファイルを検索し、GUIの右側にロードします。ほとんどのGUIオプションは既にこちらで説明されています。
チュートリアルでは、 "Loop Blend"を4に変更します。
プレビューは、ループの開始フレーム、終了フレームを見つける際に、とても便利な機能です。プレビュー上にマウスを移動して、互いに似た2つのポーズを見つけます。一般的に、フットが地面に降りる最初のフレームを選択することは良い選択です。今回の場合、開始フレームは21、終了フレームは50になります。
「Direction Type」をStaticに設定します。
プレビューでは、3D Axisも表示されます。スケルトンの動きを確認して、スケルトンのルートがクリップの最初から最後までの空間をどのように移動するかを確認できます。今回の場合、このクリップの主な移動軸はX軸です。
このため、「Direction」フィールドを(1、0、0)に設定することができます。
「Register」ボタンをクリックするか、Ctrl + Sを押します。
以上で、アニメーションクリップを使用する準備が整いました。
Script モード
Script モードを選択した場合は、次のようにスクリプトを編集する必要があります。
それからCtrl + Sを押すか、「Register」ボタンをクリックしてください。
コード ブロック | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
import os import imathAtomsMath import AtomsCore import Atoms from Atoms import GLOBAL_NAMES class AnimClipEvent6(Atoms.SimulationEvent): eventName = 'robotWalk' clipPath = 'D:/projects/atomsDemo/clips/walk.fbx' blendFramesAfterFootUp = 4 loop = True loopStart = 621 loopEnd = 3650 loopBlend = 4 idle = False direction = [1.0,0.0,0.0] directionType = 1 directionFromJoints = [0,1] def __init__(self): Atoms.SimulationEvent.__init__(self) self.setName(self.eventName) def load(self): CLIP = GLOBAL_NAMES.CLIP aClips = Atoms.AnimationClips.instance() aClips.addAnimationClip(self.eventName, self.clipPath, True) acPtr = aClips.animationClip(self.eventName) if acPtr is None: return metadataMap = acPtr.metadata() metadataMap[CLIP.BLEND_FRAMES_AFTER_FOOT_UP] = AtomsCore.IntMetadata(self.blendFramesAfterFootUp) metadataMap[CLIP.LOOP] = AtomsCore.BoolMetadata(self.loop) metadataMap[CLIP.LOOP_START] = AtomsCore.IntMetadata(self.loopStart) metadataMap[CLIP.LOOP_END] = AtomsCore.IntMetadata(self.loopEnd) metadataMap[CLIP.LOOP_NUM_BLEND_FRAMES] = AtomsCore.IntMetadata(self.loopBlend) if self.directionType == 1: acPtr.setDirectionType(Atoms.AnimationClip.DirectionType.Static) elif self.directionType == 0: acPtr.setDirectionType(Atoms.AnimationClip.DirectionType.Pelvis) else: acPtr.setDirectionType(Atoms.AnimationClip.DirectionType.Joints) acPtr.setDirection(imathAtomsMath.V3d(self.direction[0], self.direction[1], self.direction[2])) acPtr.setDirectionFromJoints(self.directionFromJoints[0], self.directionFromJoints[1]) acPtr.setIdle(self.idle) |