Speed up of particular inefficient part related to motions.
For these standard motions, the viewer likes to very frequently flood-call startMotion/stopMotion sometimes, which at the very least needs a LLUUID lookup in a std::map. In particular, this is done for two of them for every avatar in the sim every frame. This code makes it possible to test if that makes sense by merely doing a bit test. Conflicts: indra/llcharacter/llkeyframemotion.h
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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:
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@@ -468,7 +468,7 @@ LLKeyframeMotion::~LLKeyframeMotion()
|
||||
//-----------------------------------------------------------------------------
|
||||
// create()
|
||||
//-----------------------------------------------------------------------------
|
||||
LLMotion *LLKeyframeMotion::create(const LLUUID &id)
|
||||
LLMotion* LLKeyframeMotion::create(LLUUID const& id, LLMotionController&)
|
||||
{
|
||||
return new LLKeyframeMotion(id);
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@@ -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:
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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();
|
||||
//<singu>
|
||||
mActiveMask = 0;
|
||||
for_each(mDeprecatedMotions.begin(), mDeprecatedMotions.end(), DeletePointer());
|
||||
mDeprecatedMotions.clear();
|
||||
//</singu>
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
//<edit>
|
||||
void activated(U32 bit) { mActiveMask |= bit; }
|
||||
void deactivated(U32 bit) { mActiveMask &= ~bit; }
|
||||
bool isactive(U32 bit) const { return (mActiveMask & bit) != 0; }
|
||||
//</edit>
|
||||
|
||||
// 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;
|
||||
|
||||
|
||||
//<edit>
|
||||
U32 mActiveMask;
|
||||
//</edit>
|
||||
LLFrameTimer mTimer;
|
||||
F32 mPrevTimerElapsed;
|
||||
F32 mAnimTime;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user