diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h
index 2b872effa..74cc35187 100644
--- a/indra/llcharacter/llcharacter.h
+++ b/indra/llcharacter/llcharacter.h
@@ -146,6 +146,7 @@ public:
// is this motion active?
BOOL isMotionActive( const LLUUID& id );
+ bool isMotionActive(U32 bit) const { return mMotionController.isactive(bit); }
// Event handler for motion deactivation.
// Called when a motion has completely stopped and has been deactivated.
diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp
index c2a87d80a..26fca2260 100644
--- a/indra/llcharacter/lleditingmotion.cpp
+++ b/indra/llcharacter/lleditingmotion.cpp
@@ -49,7 +49,7 @@ S32 LLEditingMotion::sHandPosePriority = 3;
// LLEditingMotion()
// Class Constructor
//-----------------------------------------------------------------------------
-LLEditingMotion::LLEditingMotion( const LLUUID &id) : LLMotion(id)
+LLEditingMotion::LLEditingMotion(LLUUID const& id, LLMotionController& controller) : AIMaskedMotion(id, controller, ANIM_AGENT_EDITING)
{
mCharacter = NULL;
@@ -155,7 +155,7 @@ BOOL LLEditingMotion::onActivate()
mShoulderJoint.setRotation( mShoulderState->getJoint()->getRotation() );
mElbowJoint.setRotation( mElbowState->getJoint()->getRotation() );
- return TRUE;
+ return AIMaskedMotion::onActivate();
}
//-----------------------------------------------------------------------------
@@ -256,12 +256,4 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask)
return result;
}
-//-----------------------------------------------------------------------------
-// LLEditingMotion::onDeactivate()
-//-----------------------------------------------------------------------------
-void LLEditingMotion::onDeactivate()
-{
-}
-
-
// End
diff --git a/indra/llcharacter/lleditingmotion.h b/indra/llcharacter/lleditingmotion.h
index 4a83d4b9f..f880a94b7 100644
--- a/indra/llcharacter/lleditingmotion.h
+++ b/indra/llcharacter/lleditingmotion.h
@@ -49,11 +49,11 @@
// class LLEditingMotion
//-----------------------------------------------------------------------------
class LLEditingMotion :
- public LLMotion
+ public AIMaskedMotion
{
public:
// Constructor
- LLEditingMotion(const LLUUID &id);
+ LLEditingMotion(LLUUID const& id, LLMotionController& controller);
// Destructor
virtual ~LLEditingMotion();
@@ -65,7 +65,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLEditingMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLEditingMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -107,9 +107,6 @@ public:
// must return FALSE when the motion is completed.
virtual BOOL onUpdate(F32 time, U8* joint_mask);
- // called when a motion is deactivated
- virtual void onDeactivate();
-
public:
//-------------------------------------------------------------------------
// joint states to be animated
diff --git a/indra/llcharacter/llhandmotion.cpp b/indra/llcharacter/llhandmotion.cpp
index 696dba0d9..c479f0f5f 100644
--- a/indra/llcharacter/llhandmotion.cpp
+++ b/indra/llcharacter/llhandmotion.cpp
@@ -61,7 +61,7 @@ const F32 HAND_MORPH_BLEND_TIME = 0.2f;
// LLHandMotion()
// Class Constructor
//-----------------------------------------------------------------------------
-LLHandMotion::LLHandMotion(const LLUUID &id) : LLMotion(id)
+LLHandMotion::LLHandMotion(LLUUID const& id, LLMotionController& controller) : AIMaskedMotion(id, controller, ANIM_AGENT_HAND_MOTION)
{
mCharacter = NULL;
mLastTime = 0.f;
@@ -112,7 +112,7 @@ BOOL LLHandMotion::onActivate()
mCharacter->setVisualParamWeight(gHandPoseNames[mCurrentPose], 1.f);
mCharacter->updateVisualParams();
}
- return TRUE;
+ return AIMaskedMotion::onActivate();
}
@@ -235,14 +235,6 @@ BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask)
return TRUE;
}
-
-//-----------------------------------------------------------------------------
-// LLHandMotion::onDeactivate()
-//-----------------------------------------------------------------------------
-void LLHandMotion::onDeactivate()
-{
-}
-
//-----------------------------------------------------------------------------
// LLHandMotion::getHandPoseName()
//-----------------------------------------------------------------------------
diff --git a/indra/llcharacter/llhandmotion.h b/indra/llcharacter/llhandmotion.h
index dcf169662..582c6ee2f 100644
--- a/indra/llcharacter/llhandmotion.h
+++ b/indra/llcharacter/llhandmotion.h
@@ -45,7 +45,7 @@
// class LLHandMotion
//-----------------------------------------------------------------------------
class LLHandMotion :
- public LLMotion
+ public AIMaskedMotion
{
public:
typedef enum e_hand_pose
@@ -68,7 +68,7 @@ public:
} eHandPose;
// Constructor
- LLHandMotion(const LLUUID &id);
+ LLHandMotion(LLUUID const& id, LLMotionController& controller);
// Destructor
virtual ~LLHandMotion();
@@ -80,7 +80,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLHandMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLHandMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -122,9 +122,6 @@ public:
// must return FALSE when the motion is completed.
virtual BOOL onUpdate(F32 time, U8* joint_mask);
- // called when a motion is deactivated
- virtual void onDeactivate();
-
virtual BOOL canDeprecate() { return FALSE; }
static std::string getHandPoseName(eHandPose pose);
diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp
index 14017da10..7322c996a 100644
--- a/indra/llcharacter/llheadrotmotion.cpp
+++ b/indra/llcharacter/llheadrotmotion.cpp
@@ -76,8 +76,8 @@ const F32 EYE_BLINK_TIME_DELTA = 0.005f; // time between one eye starting a blin
// LLHeadRotMotion()
// Class Constructor
//-----------------------------------------------------------------------------
-LLHeadRotMotion::LLHeadRotMotion(const LLUUID &id) :
- LLMotion(id),
+LLHeadRotMotion::LLHeadRotMotion(LLUUID const& id, LLMotionController& controller) :
+ AIMaskedMotion(id, controller, ANIM_AGENT_HEAD_ROT),
mCharacter(NULL),
mTorsoJoint(NULL),
mHeadJoint(NULL)
@@ -172,16 +172,6 @@ LLMotion::LLMotionInitStatus LLHeadRotMotion::onInitialize(LLCharacter *characte
return STATUS_SUCCESS;
}
-
-//-----------------------------------------------------------------------------
-// LLHeadRotMotion::onActivate()
-//-----------------------------------------------------------------------------
-BOOL LLHeadRotMotion::onActivate()
-{
- return TRUE;
-}
-
-
//-----------------------------------------------------------------------------
// LLHeadRotMotion::onUpdate()
//-----------------------------------------------------------------------------
@@ -266,19 +256,11 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask)
}
-//-----------------------------------------------------------------------------
-// LLHeadRotMotion::onDeactivate()
-//-----------------------------------------------------------------------------
-void LLHeadRotMotion::onDeactivate()
-{
-}
-
-
//-----------------------------------------------------------------------------
// LLEyeMotion()
// Class Constructor
//-----------------------------------------------------------------------------
-LLEyeMotion::LLEyeMotion(const LLUUID &id) : LLMotion(id)
+LLEyeMotion::LLEyeMotion(LLUUID const& id, LLMotionController& controller) : AIMaskedMotion(id, controller, ANIM_AGENT_EYE)
{
mCharacter = NULL;
mEyeJitterTime = 0.f;
@@ -346,16 +328,6 @@ LLMotion::LLMotionInitStatus LLEyeMotion::onInitialize(LLCharacter *character)
return STATUS_SUCCESS;
}
-
-//-----------------------------------------------------------------------------
-// LLEyeMotion::onActivate()
-//-----------------------------------------------------------------------------
-BOOL LLEyeMotion::onActivate()
-{
- return TRUE;
-}
-
-
//-----------------------------------------------------------------------------
// LLEyeMotion::onUpdate()
//-----------------------------------------------------------------------------
@@ -536,6 +508,8 @@ void LLEyeMotion::onDeactivate()
{
joint->setRotation(LLQuaternion::DEFAULT);
}
+
+ AIMaskedMotion::onDeactivate();
}
// End
diff --git a/indra/llcharacter/llheadrotmotion.h b/indra/llcharacter/llheadrotmotion.h
index 97e61eac1..5342d422f 100644
--- a/indra/llcharacter/llheadrotmotion.h
+++ b/indra/llcharacter/llheadrotmotion.h
@@ -46,11 +46,11 @@
// class LLHeadRotMotion
//-----------------------------------------------------------------------------
class LLHeadRotMotion :
- public LLMotion
+ public AIMaskedMotion
{
public:
// Constructor
- LLHeadRotMotion(const LLUUID &id);
+ LLHeadRotMotion(LLUUID const& id, LLMotionController& controller);
// Destructor
virtual ~LLHeadRotMotion();
@@ -62,7 +62,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLHeadRotMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLHeadRotMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -94,19 +94,11 @@ public:
// must return true to indicate success and be available for activation
virtual LLMotionInitStatus onInitialize(LLCharacter *character);
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate();
-
// called per time step
// must return TRUE while it is active, and
// must return FALSE when the motion is completed.
virtual BOOL onUpdate(F32 time, U8* joint_mask);
- // called when a motion is deactivated
- virtual void onDeactivate();
-
public:
//-------------------------------------------------------------------------
// joint states to be animated
@@ -129,11 +121,11 @@ public:
// class LLEyeMotion
//-----------------------------------------------------------------------------
class LLEyeMotion :
- public LLMotion
+ public AIMaskedMotion
{
public:
// Constructor
- LLEyeMotion(const LLUUID &id);
+ LLEyeMotion(LLUUID const& id, LLMotionController& controller);
// Destructor
virtual ~LLEyeMotion();
@@ -145,7 +137,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create( const LLUUID &id) { return new LLEyeMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLEyeMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -177,11 +169,6 @@ public:
// must return true to indicate success and be available for activation
virtual LLMotionInitStatus onInitialize(LLCharacter *character);
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate();
-
// called per time step
// must return TRUE while it is active, and
// must return FALSE when the motion is completed.
diff --git a/indra/llcharacter/llkeyframefallmotion.h b/indra/llcharacter/llkeyframefallmotion.h
index 495be977f..c36c72798 100644
--- a/indra/llcharacter/llkeyframefallmotion.h
+++ b/indra/llcharacter/llkeyframefallmotion.h
@@ -59,7 +59,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLKeyframeFallMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLKeyframeFallMotion(id); }
public:
//-------------------------------------------------------------------------
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp
index 653d3988c..c6589ddf4 100644
--- a/indra/llcharacter/llkeyframemotion.cpp
+++ b/indra/llcharacter/llkeyframemotion.cpp
@@ -468,7 +468,7 @@ LLKeyframeMotion::~LLKeyframeMotion()
//-----------------------------------------------------------------------------
// create()
//-----------------------------------------------------------------------------
-LLMotion *LLKeyframeMotion::create(const LLUUID &id)
+LLMotion* LLKeyframeMotion::create(LLUUID const& id, LLMotionController&)
{
return new LLKeyframeMotion(id);
}
diff --git a/indra/llcharacter/llkeyframemotion.h b/indra/llcharacter/llkeyframemotion.h
index 55be6df09..14fa4916c 100644
--- a/indra/llcharacter/llkeyframemotion.h
+++ b/indra/llcharacter/llkeyframemotion.h
@@ -54,6 +54,7 @@
class LLKeyframeDataCache;
class LLVFS;
class LLDataPacker;
+class LLMotionController;
#define MIN_REQUIRED_PIXEL_AREA_KEYFRAME (40.f)
#define MAX_CHAIN_LENGTH (4)
@@ -193,7 +194,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID& id);
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller);
public:
//-------------------------------------------------------------------------
diff --git a/indra/llcharacter/llkeyframestandmotion.h b/indra/llcharacter/llkeyframestandmotion.h
index b0500dc8e..1db798021 100644
--- a/indra/llcharacter/llkeyframestandmotion.h
+++ b/indra/llcharacter/llkeyframestandmotion.h
@@ -60,7 +60,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLKeyframeStandMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLKeyframeStandMotion(id); }
public:
//-------------------------------------------------------------------------
diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp
index f9c2e4766..2a12edd29 100644
--- a/indra/llcharacter/llkeyframewalkmotion.cpp
+++ b/indra/llcharacter/llkeyframewalkmotion.cpp
@@ -138,8 +138,8 @@ BOOL LLKeyframeWalkMotion::onUpdate(F32 time, U8* joint_mask)
// LLWalkAdjustMotion()
// Class Constructor
//-----------------------------------------------------------------------------
-LLWalkAdjustMotion::LLWalkAdjustMotion(const LLUUID &id) :
- LLMotion(id),
+LLWalkAdjustMotion::LLWalkAdjustMotion(LLUUID const& id, LLMotionController& controller) :
+ AIMaskedMotion(id, controller, ANIM_AGENT_WALK_ADJUST),
mLastTime(0.f),
mAnimSpeed(0.f),
mAdjustedSpeed(0.f),
@@ -193,7 +193,7 @@ BOOL LLWalkAdjustMotion::onActivate()
F32 rightAnkleOffset = (mRightAnkleJoint->getWorldPosition() - mCharacter->getCharacterPosition()).magVec();
mAnkleOffset = llmax(leftAnkleOffset, rightAnkleOffset);
- return TRUE;
+ return AIMaskedMotion::onActivate();
}
//-----------------------------------------------------------------------------
@@ -325,13 +325,14 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
void LLWalkAdjustMotion::onDeactivate()
{
mCharacter->removeAnimationData("Walk Speed");
+ AIMaskedMotion::onDeactivate();
}
//-----------------------------------------------------------------------------
// LLFlyAdjustMotion::LLFlyAdjustMotion()
//-----------------------------------------------------------------------------
-LLFlyAdjustMotion::LLFlyAdjustMotion(const LLUUID &id)
- : LLMotion(id),
+LLFlyAdjustMotion::LLFlyAdjustMotion(LLUUID const& id, LLMotionController& controller)
+ : AIMaskedMotion(id, controller, ANIM_AGENT_FLY_ADJUST),
mRoll(0.f)
{
mName = "fly_adjust";
@@ -368,7 +369,7 @@ BOOL LLFlyAdjustMotion::onActivate()
mPelvisState->setPosition(LLVector3::zero);
mPelvisState->setRotation(LLQuaternion::DEFAULT);
mRoll = 0.f;
- return TRUE;
+ return AIMaskedMotion::onActivate();
}
//-----------------------------------------------------------------------------
diff --git a/indra/llcharacter/llkeyframewalkmotion.h b/indra/llcharacter/llkeyframewalkmotion.h
index b507e9423..caab2fef3 100644
--- a/indra/llcharacter/llkeyframewalkmotion.h
+++ b/indra/llcharacter/llkeyframewalkmotion.h
@@ -52,7 +52,7 @@ class LLKeyframeWalkMotion :
friend class LLWalkAdjustMotion;
public:
// Constructor
- LLKeyframeWalkMotion(const LLUUID &id);
+ LLKeyframeWalkMotion(LLUUID const& id);
// Destructor
virtual ~LLKeyframeWalkMotion();
@@ -64,7 +64,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLKeyframeWalkMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLKeyframeWalkMotion(id); }
public:
//-------------------------------------------------------------------------
@@ -86,11 +86,11 @@ public:
S32 mDownFoot;
};
-class LLWalkAdjustMotion : public LLMotion
+class LLWalkAdjustMotion : public AIMaskedMotion
{
public:
// Constructor
- LLWalkAdjustMotion(const LLUUID &id);
+ LLWalkAdjustMotion(LLUUID const& id, LLMotionController& controller);
public:
//-------------------------------------------------------------------------
@@ -99,7 +99,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLWalkAdjustMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLWalkAdjustMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -136,11 +136,11 @@ public:
F32 mAnkleOffset;
};
-class LLFlyAdjustMotion : public LLMotion
+class LLFlyAdjustMotion : public AIMaskedMotion
{
public:
// Constructor
- LLFlyAdjustMotion(const LLUUID &id);
+ LLFlyAdjustMotion(LLUUID const& id, LLMotionController& controller);
public:
//-------------------------------------------------------------------------
@@ -149,7 +149,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLFlyAdjustMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLFlyAdjustMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -157,7 +157,6 @@ public:
//-------------------------------------------------------------------------
virtual LLMotionInitStatus onInitialize(LLCharacter *character);
virtual BOOL onActivate();
- virtual void onDeactivate() {};
virtual BOOL onUpdate(F32 time, U8* joint_mask);
virtual LLJoint::JointPriority getPriority(){return LLJoint::HIGHER_PRIORITY;}
virtual BOOL getLoop() { return TRUE; }
diff --git a/indra/llcharacter/llmotion.cpp b/indra/llcharacter/llmotion.cpp
index ce926a38a..203cf2f4c 100644
--- a/indra/llcharacter/llmotion.cpp
+++ b/indra/llcharacter/llmotion.cpp
@@ -37,6 +37,7 @@
#include "llmotion.h"
#include "llcriticaldamp.h"
+#include "llmotioncontroller.h"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
@@ -174,4 +175,19 @@ BOOL LLMotion::canDeprecate()
return TRUE;
}
+//-----------------------------------------------------------------------------
+// AIMaskedMotion
+//-----------------------------------------------------------------------------
+
+BOOL AIMaskedMotion::onActivate()
+{
+ mController.activated(mMaskBit);
+ return TRUE;
+}
+
+void AIMaskedMotion::onDeactivate()
+{
+ mController.deactivated(mMaskBit);
+}
+
// End
diff --git a/indra/llcharacter/llmotion.h b/indra/llcharacter/llmotion.h
index d6628fd99..24504980d 100644
--- a/indra/llcharacter/llmotion.h
+++ b/indra/llcharacter/llmotion.h
@@ -43,6 +43,7 @@
#include "lluuid.h"
class LLCharacter;
+class LLMotionController;
//-----------------------------------------------------------------------------
// class LLMotion
@@ -201,7 +202,7 @@ class LLTestMotion : public LLMotion
public:
LLTestMotion(const LLUUID &id) : LLMotion(id){}
~LLTestMotion() {}
- static LLMotion *create(const LLUUID& id) { return new LLTestMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLTestMotion(id); }
BOOL getLoop() { return FALSE; }
F32 getDuration() { return 0.0f; }
F32 getEaseInDuration() { return 0.0f; }
@@ -225,7 +226,7 @@ class LLNullMotion : public LLMotion
public:
LLNullMotion(const LLUUID &id) : LLMotion(id) {}
~LLNullMotion() {}
- static LLMotion *create(const LLUUID &id) { return new LLNullMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLNullMotion(id); }
// motions must specify whether or not they loop
/*virtual*/ BOOL getLoop() { return TRUE; }
@@ -266,5 +267,42 @@ public:
// called when a motion is deactivated
/*virtual*/ void onDeactivate() {}
};
+
+
+//-----------------------------------------------------------------------------
+// AIMaskedMotion
+//-----------------------------------------------------------------------------
+
+// These motions have a bit assigned in LLMotionController::mActiveMask
+// that is set and uset upon activation/deactivation.
+
+// This must be in the same order as ANIM_AGENT_BODY_NOISE_ID through ANIM_AGENT_WALK_ADJUST_ID in llvoavatar.cpp.
+U32 const ANIM_AGENT_BODY_NOISE = 0x001;
+U32 const ANIM_AGENT_BREATHE_ROT = 0x002;
+U32 const ANIM_AGENT_PHYSICS_MOTION = 0x004;
+U32 const ANIM_AGENT_EDITING = 0x008;
+U32 const ANIM_AGENT_EYE = 0x010;
+U32 const ANIM_AGENT_FLY_ADJUST = 0x020;
+U32 const ANIM_AGENT_HAND_MOTION = 0x040;
+U32 const ANIM_AGENT_HEAD_ROT = 0x080;
+U32 const ANIM_AGENT_PELVIS_FIX = 0x100;
+U32 const ANIM_AGENT_TARGET = 0x200;
+U32 const ANIM_AGENT_WALK_ADJUST = 0x400;
+
+class AIMaskedMotion : public LLMotion
+{
+private:
+ LLMotionController& mController;
+ U32 mMaskBit;
+
+public:
+ AIMaskedMotion(LLUUID const& id, LLMotionController& controller, U32 mask_bit) : LLMotion(id), mController(controller), mMaskBit(mask_bit) { }
+
+ /*virtual*/ BOOL onActivate();
+ /*virtual*/ void onDeactivate();
+
+ U32 getMaskBit(void) const { return mMaskBit; }
+};
+
#endif // LL_LLMOTION_H
diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp
index b5d60205c..4935fb3a7 100644
--- a/indra/llcharacter/llmotioncontroller.cpp
+++ b/indra/llcharacter/llmotioncontroller.cpp
@@ -97,7 +97,7 @@ void LLMotionRegistry::markBad( const LLUUID& id )
//-----------------------------------------------------------------------------
// createMotion()
//-----------------------------------------------------------------------------
-LLMotion *LLMotionRegistry::createMotion( const LLUUID &id )
+LLMotion* LLMotionRegistry::createMotion(LLUUID const& id, LLMotionController& controller)
{
LLMotionConstructor constructor = get_if_there(mMotionTable, id, LLMotionConstructor(NULL));
LLMotion* motion = NULL;
@@ -105,11 +105,11 @@ LLMotion *LLMotionRegistry::createMotion( const LLUUID &id )
if ( constructor == NULL )
{
// *FIX: need to replace with a better default scheme. RN
- motion = LLKeyframeMotion::create(id);
+ motion = LLKeyframeMotion::create(id, controller);
}
else
{
- motion = constructor(id);
+ motion = constructor(id, controller);
}
return motion;
@@ -126,18 +126,19 @@ LLMotion *LLMotionRegistry::createMotion( const LLUUID &id )
// Class Constructor
//-----------------------------------------------------------------------------
LLMotionController::LLMotionController()
- : mTimeFactor(sCurrentTimeFactor),
+ : mIsSelf(FALSE),
+ mTimeFactor(sCurrentTimeFactor),
mCharacter(NULL),
- mAnimTime(0.f),
+ mActiveMask(0),
mPrevTimerElapsed(0.f),
+ mAnimTime(0.f),
mLastTime(0.0f),
mHasRunOnce(FALSE),
mPaused(FALSE),
mPauseTime(0.f),
mTimeStep(0.f),
mTimeStepCount(0),
- mLastInterp(0.f),
- mIsSelf(FALSE)
+ mLastInterp(0.f)
{
}
@@ -169,6 +170,7 @@ void LLMotionController::deleteAllMotions()
mLoadedMotions.clear();
mActiveMotions.clear();
//
+ mActiveMask = 0;
for_each(mDeprecatedMotions.begin(), mDeprecatedMotions.end(), DeletePointer());
mDeprecatedMotions.clear();
//
@@ -357,7 +359,7 @@ LLMotion* LLMotionController::createMotion( const LLUUID &id )
if (!motion)
{
// look up constructor and create it
- motion = sRegistry.createMotion(id);
+ motion = sRegistry.createMotion(id, *this);
if (!motion)
{
return NULL;
diff --git a/indra/llcharacter/llmotioncontroller.h b/indra/llcharacter/llmotioncontroller.h
index 7e0cc7ad7..9b6c71ef1 100644
--- a/indra/llcharacter/llmotioncontroller.h
+++ b/indra/llcharacter/llmotioncontroller.h
@@ -51,11 +51,12 @@
// This is necessary because llcharacter.h includes this file.
//-----------------------------------------------------------------------------
class LLCharacter;
+class LLMotionController;
//-----------------------------------------------------------------------------
// LLMotionRegistry
//-----------------------------------------------------------------------------
-typedef LLMotion*(*LLMotionConstructor)(const LLUUID &id);
+typedef LLMotion* (*LLMotionConstructor)(LLUUID const& id, LLMotionController&);
class LLMotionRegistry
{
@@ -72,7 +73,7 @@ public:
// creates a new instance of a named motion
// returns NULL motion is not registered
- LLMotion *createMotion( const LLUUID &id );
+ LLMotion* createMotion(LLUUID const& id, LLMotionController& controller);
// initialization of motion failed, don't try to create this motion again
void markBad( const LLUUID& id );
@@ -149,6 +150,12 @@ public:
//Flush is a liar.
void deactivateAllMotions();
+ //
+ void activated(U32 bit) { mActiveMask |= bit; }
+ void deactivated(U32 bit) { mActiveMask &= ~bit; }
+ bool isactive(U32 bit) const { return (mActiveMask & bit) != 0; }
+ //
+
// pause and continue all motions
void pauseAllMotions();
void unpauseAllMotions();
@@ -219,7 +226,10 @@ protected:
motion_set_t mLoadedMotions;
motion_list_t mActiveMotions;
motion_set_t mDeprecatedMotions;
-
+
+ //
+ U32 mActiveMask;
+ //
LLFrameTimer mTimer;
F32 mPrevTimerElapsed;
F32 mAnimTime;
diff --git a/indra/llcharacter/lltargetingmotion.cpp b/indra/llcharacter/lltargetingmotion.cpp
index a330b2265..423eca363 100644
--- a/indra/llcharacter/lltargetingmotion.cpp
+++ b/indra/llcharacter/lltargetingmotion.cpp
@@ -52,7 +52,7 @@ const F32 TORSO_ROT_FRACTION = 0.5f;
// LLTargetingMotion()
// Class Constructor
//-----------------------------------------------------------------------------
-LLTargetingMotion::LLTargetingMotion(const LLUUID &id) : LLMotion(id)
+LLTargetingMotion::LLTargetingMotion(LLUUID const& id, LLMotionController& controller) : AIMaskedMotion(id, controller, ANIM_AGENT_TARGET)
{
mCharacter = NULL;
mName = "targeting";
@@ -99,14 +99,6 @@ LLMotion::LLMotionInitStatus LLTargetingMotion::onInitialize(LLCharacter *charac
return STATUS_SUCCESS;
}
-//-----------------------------------------------------------------------------
-// LLTargetingMotion::onActivate()
-//-----------------------------------------------------------------------------
-BOOL LLTargetingMotion::onActivate()
-{
- return TRUE;
-}
-
//-----------------------------------------------------------------------------
// LLTargetingMotion::onUpdate()
//-----------------------------------------------------------------------------
@@ -166,12 +158,4 @@ BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask)
return result;
}
-//-----------------------------------------------------------------------------
-// LLTargetingMotion::onDeactivate()
-//-----------------------------------------------------------------------------
-void LLTargetingMotion::onDeactivate()
-{
-}
-
-
// End
diff --git a/indra/llcharacter/lltargetingmotion.h b/indra/llcharacter/lltargetingmotion.h
index 1ec9f80d6..8dfa32500 100644
--- a/indra/llcharacter/lltargetingmotion.h
+++ b/indra/llcharacter/lltargetingmotion.h
@@ -48,11 +48,11 @@
// class LLTargetingMotion
//-----------------------------------------------------------------------------
class LLTargetingMotion :
- public LLMotion
+ public AIMaskedMotion
{
public:
// Constructor
- LLTargetingMotion(const LLUUID &id);
+ LLTargetingMotion(LLUUID const& id, LLMotionController& controller);
// Destructor
virtual ~LLTargetingMotion();
@@ -64,7 +64,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLTargetingMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLTargetingMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -96,19 +96,11 @@ public:
// must return true to indicate success and be available for activation
virtual LLMotionInitStatus onInitialize(LLCharacter *character);
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate();
-
// called per time step
// must return TRUE while it is active, and
// must return FALSE when the motion is completed.
virtual BOOL onUpdate(F32 time, U8* joint_mask);
- // called when a motion is deactivated
- virtual void onDeactivate();
-
public:
LLCharacter *mCharacter;
diff --git a/indra/newview/llemote.h b/indra/newview/llemote.h
index 99d05b9a2..eb2af5b9d 100644
--- a/indra/newview/llemote.h
+++ b/indra/newview/llemote.h
@@ -67,7 +67,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLEmote(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLEmote(id); }
public:
//-------------------------------------------------------------------------
diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp
index eef650101..9f6acb60b 100644
--- a/indra/newview/llhudeffectlookat.cpp
+++ b/indra/newview/llhudeffectlookat.cpp
@@ -611,8 +611,9 @@ void LLHUDEffectLookAt::update()
{
if (calcTargetPosition())
{
- LLMotion* head_motion = ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->findMotion(ANIM_AGENT_HEAD_ROT);
- if (!head_motion || head_motion->isStopped())
+ //LLMotion* head_motion = ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->findMotion(ANIM_AGENT_HEAD_ROT);
+ //if (!head_motion || head_motion->isStopped())
+ // singu: startMotion does basically the same as the above two lines... it starts it, unless it was already started.
{
((LLVOAvatar*)(LLViewerObject*)mSourceObject)->startMotion(ANIM_AGENT_HEAD_ROT);
}
diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp
index 6fc0ab438..625199b3f 100644
--- a/indra/newview/llphysicsmotion.cpp
+++ b/indra/newview/llphysicsmotion.cpp
@@ -314,8 +314,8 @@ void LLPhysicsMotion::getString(std::ostringstream &oss)
}
}
-LLPhysicsMotionController::LLPhysicsMotionController(const LLUUID &id) :
- LLMotion(id),
+LLPhysicsMotionController::LLPhysicsMotionController(LLUUID const& id, LLMotionController& controller) :
+ AIMaskedMotion(id, controller, ANIM_AGENT_PHYSICS_MOTION),
mCharacter(NULL),
mIsDefault(true)
{
@@ -332,15 +332,6 @@ LLPhysicsMotionController::~LLPhysicsMotionController()
}
}
-BOOL LLPhysicsMotionController::onActivate()
-{
- return TRUE;
-}
-
-void LLPhysicsMotionController::onDeactivate()
-{
-}
-
LLMotion::LLMotionInitStatus LLPhysicsMotionController::onInitialize(LLCharacter *character)
{
mCharacter = character;
@@ -889,4 +880,4 @@ void LLPhysicsMotion::reset()
mCharacter->setVisualParamWeight((*iter).mParam,(*iter).mParam->getDefaultWeight());
}
}
-}
\ No newline at end of file
+}
diff --git a/indra/newview/llphysicsmotion.h b/indra/newview/llphysicsmotion.h
index 7412c9d88..62e0ae658 100644
--- a/indra/newview/llphysicsmotion.h
+++ b/indra/newview/llphysicsmotion.h
@@ -42,14 +42,14 @@ class LLPhysicsMotion;
// class LLPhysicsMotion
//-----------------------------------------------------------------------------
class LLPhysicsMotionController :
- public LLMotion
+ public AIMaskedMotion
{
public:
std::string getString();
// Constructor
- LLPhysicsMotionController(const LLUUID &id);
+ LLPhysicsMotionController(LLUUID const& id, LLMotionController& controller);
// Destructor
virtual ~LLPhysicsMotionController();
@@ -61,7 +61,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLPhysicsMotionController(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLPhysicsMotionController(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -93,19 +93,11 @@ public:
// must return true to indicate success and be available for activation
virtual LLMotionInitStatus onInitialize(LLCharacter *character);
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate();
-
// called per time step
// must return TRUE while it is active, and
// must return FALSE when the motion is completed.
virtual BOOL onUpdate(F32 time, U8* joint_mask);
- // called when a motion is deactivated
- virtual void onDeactivate();
-
LLCharacter* getCharacter() { return mCharacter; }
protected:
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index aec11e199..943279d6b 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -145,18 +145,104 @@ using namespace LLAvatarAppearanceDefines;
//-----------------------------------------------------------------------------
// Global constants
//-----------------------------------------------------------------------------
-const LLUUID ANIM_AGENT_BODY_NOISE = LLUUID("9aa8b0a6-0c6f-9518-c7c3-4f41f2c001ad"); //"body_noise"
-const LLUUID ANIM_AGENT_BREATHE_ROT = LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8"); //"breathe_rot"
-const LLUUID ANIM_AGENT_EDITING = LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb"); //"editing"
-const LLUUID ANIM_AGENT_EYE = LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea"); //"eye"
-const LLUUID ANIM_AGENT_FLY_ADJUST = LLUUID("db95561f-f1b0-9f9a-7224-b12f71af126e"); //"fly_adjust"
-const LLUUID ANIM_AGENT_HAND_MOTION = LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578"); //"hand_motion"
-const LLUUID ANIM_AGENT_HEAD_ROT = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d"); //"head_rot"
-const LLUUID ANIM_AGENT_PELVIS_FIX = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b"); //"pelvis_fix"
-const LLUUID ANIM_AGENT_TARGET = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55"); //"target"
-const LLUUID ANIM_AGENT_WALK_ADJUST = LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d"); //"walk_adjust"
-const LLUUID ANIM_AGENT_PHYSICS_MOTION = LLUUID("7360e029-3cb8-ebc4-863e-212df440d987"); //"physics_motion"
+const LLUUID ANIM_AGENT_BODY_NOISE_ID = LLUUID("9aa8b0a6-0c6f-9518-c7c3-4f41f2c001ad"); //"body_noise"
+const LLUUID ANIM_AGENT_BREATHE_ROT_ID = LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8"); //"breathe_rot"
+const LLUUID ANIM_AGENT_PHYSICS_MOTION_ID = LLUUID("7360e029-3cb8-ebc4-863e-212df440d987"); //"physics_motion"
+const LLUUID ANIM_AGENT_EDITING_ID = LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb"); //"editing"
+const LLUUID ANIM_AGENT_EYE_ID = LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea"); //"eye"
+const LLUUID ANIM_AGENT_FLY_ADJUST_ID = LLUUID("db95561f-f1b0-9f9a-7224-b12f71af126e"); //"fly_adjust"
+const LLUUID ANIM_AGENT_HAND_MOTION_ID = LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578"); //"hand_motion"
+const LLUUID ANIM_AGENT_HEAD_ROT_ID = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d"); //"head_rot"
+const LLUUID ANIM_AGENT_PELVIS_FIX_ID = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b"); //"pelvis_fix"
+const LLUUID ANIM_AGENT_TARGET_ID = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55"); //"target"
+const LLUUID ANIM_AGENT_WALK_ADJUST_ID = LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d"); //"walk_adjust"
+//
+// This must be in the same order as ANIM_AGENT_BODY_NOISE through ANIM_AGENT_WALK_ADJUST (see llmotion.h)!
+static LLUUID const* lookup[] = {
+ &ANIM_AGENT_BODY_NOISE_ID,
+ &ANIM_AGENT_BREATHE_ROT_ID,
+ &ANIM_AGENT_PHYSICS_MOTION_ID,
+ &ANIM_AGENT_EDITING_ID,
+ &ANIM_AGENT_EYE_ID,
+ &ANIM_AGENT_FLY_ADJUST_ID,
+ &ANIM_AGENT_HAND_MOTION_ID,
+ &ANIM_AGENT_HEAD_ROT_ID,
+ &ANIM_AGENT_PELVIS_FIX_ID,
+ &ANIM_AGENT_TARGET_ID,
+ &ANIM_AGENT_WALK_ADJUST_ID
+};
+
+LLUUID const& mask2ID(U32 bit)
+{
+ int const lookupsize = sizeof(lookup) / sizeof(LLUUID const*);
+ int i = lookupsize - 1;
+ U32 mask = 1 << i;
+ for(;;)
+ {
+ if (bit == mask)
+ {
+ return *lookup[i];
+ }
+ --i;
+ mask >>= 1;
+ llassert_always(i >= 0);
+ }
+}
+
+#ifdef CWDEBUG
+static char const* strlookup[] = {
+ "ANIM_AGENT_BODY_NOISE",
+ "ANIM_AGENT_BREATHE_ROT",
+ "ANIM_AGENT_PHYSICS_MOTION",
+ "ANIM_AGENT_EDITING",
+ "ANIM_AGENT_EYE",
+ "ANIM_AGENT_FLY_ADJUST",
+ "ANIM_AGENT_HAND_MOTION",
+ "ANIM_AGENT_HEAD_ROT",
+ "ANIM_AGENT_PELVIS_FIX",
+ "ANIM_AGENT_TARGET",
+ "ANIM_AGENT_WALK_ADJUST"
+};
+
+char const* mask2str(U32 bit)
+{
+ int const lookupsize = sizeof(lookup) / sizeof(LLUUID const*);
+ int i = lookupsize - 1;
+ U32 mask = 1 << i;
+ do
+ {
+ if (bit == mask)
+ {
+ return strlookup[i];
+ }
+ --i;
+ mask >>= 1;
+ }
+ while(i >= 0);
+ return "";
+}
+#endif
+
+// stopMotion(ANIM_AGENT_WALK_ADJUST) is called every frame, and for every avatar on the radar.
+// That can be like 1000 times per second, so... speed that up a bit and lets not lookup the same LLUUID 1000 times
+// per second in a std::map. Added the rest of the animations while I was at it.
+void LLVOAvatar::startMotion(U32 bit, F32 time_offset)
+{
+ if (!isMotionActive(bit))
+ {
+ startMotion(mask2ID(bit), time_offset);
+ }
+}
+
+void LLVOAvatar::stopMotion(U32 bit, BOOL stop_immediate)
+{
+ if (isMotionActive(bit))
+ {
+ stopMotion(mask2ID(bit), stop_immediate);
+ }
+}
+//
//-----------------------------------------------------------------------------
// Constants
@@ -257,12 +343,12 @@ struct LLTextureMaskData
// class LLBodyNoiseMotion
//-----------------------------------------------------------------------------
class LLBodyNoiseMotion :
- public LLMotion
+ public AIMaskedMotion
{
public:
// Constructor
- LLBodyNoiseMotion(const LLUUID &id)
- : LLMotion(id)
+ LLBodyNoiseMotion(LLUUID const& id, LLMotionController& controller)
+ : AIMaskedMotion(id, controller, ANIM_AGENT_BODY_NOISE)
{
mName = "body_noise";
mTorsoState = new LLJointState;
@@ -277,7 +363,7 @@ public:
//-------------------------------------------------------------------------
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLBodyNoiseMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLBodyNoiseMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -320,11 +406,6 @@ public:
return STATUS_SUCCESS;
}
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate() { return TRUE; }
-
// called per time step
// must return TRUE while it is active, and
// must return FALSE when the motion is completed.
@@ -348,9 +429,6 @@ public:
return TRUE;
}
- // called when a motion is deactivated
- virtual void onDeactivate() {}
-
private:
//-------------------------------------------------------------------------
// joint states to be animated
@@ -362,12 +440,12 @@ private:
// class LLBreatheMotionRot
//-----------------------------------------------------------------------------
class LLBreatheMotionRot :
- public LLMotion
+ public AIMaskedMotion
{
public:
// Constructor
- LLBreatheMotionRot(const LLUUID &id) :
- LLMotion(id),
+ LLBreatheMotionRot(LLUUID const& id, LLMotionController& controller) :
+ AIMaskedMotion(id, controller, ANIM_AGENT_BREATHE_ROT),
mBreatheRate(1.f),
mCharacter(NULL)
{
@@ -384,7 +462,7 @@ public:
//-------------------------------------------------------------------------
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLBreatheMotionRot(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLBreatheMotionRot(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -437,11 +515,6 @@ public:
}
}
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate() { return TRUE; }
-
// called per time step
// must return TRUE while it is active, and
// must return FALSE when the motion is completed.
@@ -456,9 +529,6 @@ public:
return TRUE;
}
- // called when a motion is deactivated
- virtual void onDeactivate() {}
-
private:
//-------------------------------------------------------------------------
// joint states to be animated
@@ -472,12 +542,12 @@ private:
// class LLPelvisFixMotion
//-----------------------------------------------------------------------------
class LLPelvisFixMotion :
- public LLMotion
+ public AIMaskedMotion
{
public:
// Constructor
- LLPelvisFixMotion(const LLUUID &id)
- : LLMotion(id), mCharacter(NULL)
+ LLPelvisFixMotion(LLUUID const& id, LLMotionController& controller)
+ : AIMaskedMotion(id, controller, ANIM_AGENT_PELVIS_FIX), mCharacter(NULL)
{
mName = "pelvis_fix";
@@ -493,7 +563,7 @@ public:
//-------------------------------------------------------------------------
// static constructor
// all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID& id) { return new LLPelvisFixMotion(id); }
+ static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLPelvisFixMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -538,11 +608,6 @@ public:
return STATUS_SUCCESS;
}
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual BOOL onActivate() { return TRUE; }
-
// called per time step
// must return TRUE while it is active, and
// must return FALSE when the motion is completed.
@@ -553,9 +618,6 @@ public:
return TRUE;
}
- // called when a motion is deactivated
- virtual void onDeactivate() {}
-
private:
//-------------------------------------------------------------------------
// joint states to be animated
@@ -1438,17 +1500,17 @@ void LLVOAvatar::deleteCachedImages(bool clearAll)
//------------------------------------------------------------------------
void LLVOAvatar::initClass()
{
- gAnimLibrary.animStateSetString(ANIM_AGENT_BODY_NOISE,"body_noise");
- gAnimLibrary.animStateSetString(ANIM_AGENT_BREATHE_ROT,"breathe_rot");
- gAnimLibrary.animStateSetString(ANIM_AGENT_PHYSICS_MOTION,"physics_motion");
- gAnimLibrary.animStateSetString(ANIM_AGENT_EDITING,"editing");
- gAnimLibrary.animStateSetString(ANIM_AGENT_EYE,"eye");
- gAnimLibrary.animStateSetString(ANIM_AGENT_FLY_ADJUST,"fly_adjust");
- gAnimLibrary.animStateSetString(ANIM_AGENT_HAND_MOTION,"hand_motion");
- gAnimLibrary.animStateSetString(ANIM_AGENT_HEAD_ROT,"head_rot");
- gAnimLibrary.animStateSetString(ANIM_AGENT_PELVIS_FIX,"pelvis_fix");
- gAnimLibrary.animStateSetString(ANIM_AGENT_TARGET,"target");
- gAnimLibrary.animStateSetString(ANIM_AGENT_WALK_ADJUST,"walk_adjust");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_BODY_NOISE_ID,"body_noise");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_BREATHE_ROT_ID,"breathe_rot");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_PHYSICS_MOTION_ID,"physics_motion");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_EDITING_ID,"editing");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_EYE_ID,"eye");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_FLY_ADJUST_ID,"fly_adjust");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_HAND_MOTION_ID,"hand_motion");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_HEAD_ROT_ID,"head_rot");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_PELVIS_FIX_ID,"pelvis_fix");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_TARGET_ID,"target");
+ gAnimLibrary.animStateSetString(ANIM_AGENT_WALK_ADJUST_ID,"walk_adjust");
SHClientTagMgr::instance(); //Instantiate. Parse. Will fetch a new tag file if AscentUpdateTagsOnLoad is true.
}
@@ -1506,19 +1568,19 @@ void LLVOAvatar::initInstance(void)
registerMotion( ANIM_AGENT_WALK_NEW, LLKeyframeWalkMotion::create ); //v2
// motions without a start/stop bit
- registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create );
- registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create );
- registerMotion( ANIM_AGENT_PHYSICS_MOTION, LLPhysicsMotionController::create );
- registerMotion( ANIM_AGENT_EDITING, LLEditingMotion::create );
- registerMotion( ANIM_AGENT_EYE, LLEyeMotion::create );
- registerMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create );
- registerMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create );
- registerMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create );
- registerMotion( ANIM_AGENT_PELVIS_FIX, LLPelvisFixMotion::create );
- registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create );
- registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create );
- registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create );
+ registerMotion( ANIM_AGENT_BODY_NOISE_ID, LLBodyNoiseMotion::create );
+ registerMotion( ANIM_AGENT_BREATHE_ROT_ID, LLBreatheMotionRot::create );
+ registerMotion( ANIM_AGENT_PHYSICS_MOTION_ID, LLPhysicsMotionController::create );
+ registerMotion( ANIM_AGENT_EDITING_ID, LLEditingMotion::create );
+ registerMotion( ANIM_AGENT_EYE_ID, LLEyeMotion::create );
+ registerMotion( ANIM_AGENT_FLY_ADJUST_ID, LLFlyAdjustMotion::create );
+ registerMotion( ANIM_AGENT_HAND_MOTION_ID, LLHandMotion::create );
+ registerMotion( ANIM_AGENT_HEAD_ROT_ID, LLHeadRotMotion::create );
+ registerMotion( ANIM_AGENT_PELVIS_FIX_ID, LLPelvisFixMotion::create );
+ registerMotion( ANIM_AGENT_TARGET_ID, LLTargetingMotion::create );
+ registerMotion( ANIM_AGENT_WALK_ADJUST_ID, LLWalkAdjustMotion::create );
+ registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create );
}
LLAvatarAppearance::initInstance();
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 891fae7d9..ded74c50b 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -54,6 +54,9 @@
#include "llavatarname.h"
+//
+#if 0
+// Hide these: should be using the bit masks everywhere.
extern const LLUUID ANIM_AGENT_BODY_NOISE;
extern const LLUUID ANIM_AGENT_BREATHE_ROT;
extern const LLUUID ANIM_AGENT_PHYSICS_MOTION;
@@ -65,6 +68,8 @@ extern const LLUUID ANIM_AGENT_HEAD_ROT;
extern const LLUUID ANIM_AGENT_PELVIS_FIX;
extern const LLUUID ANIM_AGENT_TARGET;
extern const LLUUID ANIM_AGENT_WALK_ADJUST;
+#endif
+//
class LLAPRFile;
class LLViewerWearable;
@@ -230,6 +235,10 @@ public:
/*virtual*/ LLUUID remapMotionID(const LLUUID& id);
/*virtual*/ BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f);
/*virtual*/ BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE);
+ //
+ void startMotion(U32 bit, F32 start_offset = 0.f);
+ void stopMotion(U32 bit, BOOL stop_immediate = FALSE);
+ //
virtual void stopMotionFromSource(const LLUUID& source_id);
virtual void requestStopMotion(LLMotion* motion);
LLMotion* findMotion(const LLUUID& id) const;