diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index ecfa848630..b50e550deb 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -1223,7 +1223,7 @@ void MyAvatar::setupNewAnimationSystem() { // create a blend node auto blend = make_shared("blend", 0.5f); auto idle = make_shared("clip", "https://hifi-public.s3.amazonaws.com/ozan/support/FightClubBotTest1/Animations/standard_idle.fbx", 0.0f, 90.0f, 1.0f, true); - auto walk = make_shared("clip", "https://hifi-public.s3.amazonaws.com/ozan/support/FightClubBotTest1/Animations/standard_walk.fbx", 0.0f, 29.0f, 1.0f, true); + auto walk = make_shared("clip", "https://hifi-public.s3.amazonaws.com/ozan/support/FightClubBotTest1/Animations/standard_walk.fbx", 0.0f, 28.0f, 1.0f, true); blend->addChild(idle); blend->addChild(walk); _animNode = blend; diff --git a/libraries/animation/src/AnimBlendLinear.h b/libraries/animation/src/AnimBlendLinear.h index db217a25ee..c1c1c928e5 100644 --- a/libraries/animation/src/AnimBlendLinear.h +++ b/libraries/animation/src/AnimBlendLinear.h @@ -12,6 +12,16 @@ #ifndef hifi_AnimBlendLinear_h #define hifi_AnimBlendLinear_h +// Linear blend between two AnimNodes. +// the amount of blending is determined by the alpha parameter. +// If the number of children is 2, then the alpha parameters should be between +// 0 and 1. The first animation will have a (1 - alpha) factor, and the second +// will have factor of alpha. +// This node supports more then 2 children. In this case the alpha should be +// between 0 and n - 1. This alpha can be used to linearly interpolate between +// the closest two children poses. This can be used to sweep through a series +// of animation poses. + class AnimBlendLinear : public AnimNode { public: diff --git a/libraries/animation/src/AnimClip.h b/libraries/animation/src/AnimClip.h index 59b286b95f..1868ac0e03 100644 --- a/libraries/animation/src/AnimClip.h +++ b/libraries/animation/src/AnimClip.h @@ -14,6 +14,12 @@ #include "AnimationCache.h" #include "AnimNode.h" +// Playback a single animation timeline. +// url determines the location of the fbx file to use within this clip. +// startFrame and endFrame are in frames 1/30th of a second. +// timescale can be used to speed-up or slow-down the animation. +// loop flag, when true, will loop the animation as it reaches the end frame. + class AnimClip : public AnimNode { public: friend class AnimClipTests; diff --git a/libraries/animation/src/AnimNode.h b/libraries/animation/src/AnimNode.h index 6ee7ff89c8..debc423e20 100644 --- a/libraries/animation/src/AnimNode.h +++ b/libraries/animation/src/AnimNode.h @@ -21,6 +21,15 @@ class QJsonObject; +// Base class for all elements in the animation blend tree. +// It provides the following categories of functions: +// +// * id getter, id is a string name useful for debugging and searching. +// * type getter, helpful for determining the derived type of this node. +// * hierarchy accessors, for adding, removing and iterating over child AnimNodes +// * skeleton accessors, the skeleton is from the model whose bones we are going to manipulate +// * evaluate method, perform actual joint manipulations here and return result by reference. + class AnimNode { public: friend class AnimDebugDraw; @@ -37,6 +46,7 @@ public: const std::string& getID() const { return _id; } Type getType() const { return _type; } + // hierarchy accessors void addChild(Pointer child) { _children.push_back(child); } void removeChild(Pointer child) { auto iter = std::find(_children.begin(), _children.end(), child); @@ -62,6 +72,9 @@ public: virtual ~AnimNode() {} virtual const std::vector& evaluate(float dt) = 0; + virtual const std::vector& overlay(float dt, const std::vector& underPoses) { + return evaluate(dt); + } protected: