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.
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.
コード ブロック | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
import os
import imath
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 = 6
loopEnd = 36
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(imath.V3d(self.direction[0], self.direction[1], self.direction[2]))
acPtr.setDirectionFromJoints(self.directionFromJoints[0], self.directionFromJoints[1])
acPtr.setIdle(self.idle)
|