Add LLMotionController* LLMotion::mMotionController

This is needed for synchronization: motions will have to start
(with a specific start time offset) from a point in the code where
only the motion object is available.

I added/used LLMotionController& in a previous commit, this was
now changed into a pointer. There is (obviously) not much reason
for that, but also no disadvantage: the diff relative to LLs code
doesn't get larger since the references where already added, too.

Conflicts:
	indra/llcharacter/llkeyframemotion.cpp
	indra/llcharacter/llkeyframemotion.h
This commit is contained in:
Aleric Inglewood
2013-12-21 18:46:19 +01:00
parent 61d365e957
commit 66aaa9cf80
25 changed files with 66 additions and 63 deletions

View File

@@ -49,7 +49,7 @@ S32 LLEditingMotion::sHandPosePriority = 3;
// LLEditingMotion()
// Class Constructor
//-----------------------------------------------------------------------------
LLEditingMotion::LLEditingMotion(LLUUID const& id, LLMotionController& controller) : AIMaskedMotion(id, controller, ANIM_AGENT_EDITING)
LLEditingMotion::LLEditingMotion(LLUUID const& id, LLMotionController* controller) : AIMaskedMotion(id, controller, ANIM_AGENT_EDITING)
{
mCharacter = NULL;

View File

@@ -53,7 +53,7 @@ class LLEditingMotion :
{
public:
// Constructor
LLEditingMotion(LLUUID const& id, LLMotionController& controller);
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(LLUUID const& id, LLMotionController& controller) { return new LLEditingMotion(id, controller); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLEditingMotion(id, controller); }
public:
//-------------------------------------------------------------------------

View File

@@ -61,7 +61,7 @@ const F32 HAND_MORPH_BLEND_TIME = 0.2f;
// LLHandMotion()
// Class Constructor
//-----------------------------------------------------------------------------
LLHandMotion::LLHandMotion(LLUUID const& id, LLMotionController& controller) : AIMaskedMotion(id, controller, ANIM_AGENT_HAND_MOTION)
LLHandMotion::LLHandMotion(LLUUID const& id, LLMotionController* controller) : AIMaskedMotion(id, controller, ANIM_AGENT_HAND_MOTION)
{
mCharacter = NULL;
mLastTime = 0.f;

View File

@@ -68,7 +68,7 @@ public:
} eHandPose;
// Constructor
LLHandMotion(LLUUID const& id, LLMotionController& controller);
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(LLUUID const& id, LLMotionController& controller) { return new LLHandMotion(id, controller); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLHandMotion(id, controller); }
public:
//-------------------------------------------------------------------------

View File

@@ -76,7 +76,7 @@ const F32 EYE_BLINK_TIME_DELTA = 0.005f; // time between one eye starting a blin
// LLHeadRotMotion()
// Class Constructor
//-----------------------------------------------------------------------------
LLHeadRotMotion::LLHeadRotMotion(LLUUID const& id, LLMotionController& controller) :
LLHeadRotMotion::LLHeadRotMotion(LLUUID const& id, LLMotionController* controller) :
AIMaskedMotion(id, controller, ANIM_AGENT_HEAD_ROT),
mCharacter(NULL),
mTorsoJoint(NULL),
@@ -260,7 +260,7 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask)
// LLEyeMotion()
// Class Constructor
//-----------------------------------------------------------------------------
LLEyeMotion::LLEyeMotion(LLUUID const& id, LLMotionController& controller) : AIMaskedMotion(id, controller, ANIM_AGENT_EYE)
LLEyeMotion::LLEyeMotion(LLUUID const& id, LLMotionController* controller) : AIMaskedMotion(id, controller, ANIM_AGENT_EYE)
{
mCharacter = NULL;
mEyeJitterTime = 0.f;

View File

@@ -50,7 +50,7 @@ class LLHeadRotMotion :
{
public:
// Constructor
LLHeadRotMotion(LLUUID const& id, LLMotionController& controller);
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(LLUUID const& id, LLMotionController& controller) { return new LLHeadRotMotion(id, controller); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLHeadRotMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -125,7 +125,7 @@ class LLEyeMotion :
{
public:
// Constructor
LLEyeMotion(LLUUID const& id, LLMotionController& controller);
LLEyeMotion(LLUUID const& id, LLMotionController* controller);
// Destructor
virtual ~LLEyeMotion();
@@ -137,7 +137,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLEyeMotion(id, controller); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLEyeMotion(id, controller); }
public:
//-------------------------------------------------------------------------

View File

@@ -49,7 +49,7 @@
// LLKeyframeFallMotion()
// Class Constructor
//-----------------------------------------------------------------------------
LLKeyframeFallMotion::LLKeyframeFallMotion(const LLUUID &id) : LLKeyframeMotion(id)
LLKeyframeFallMotion::LLKeyframeFallMotion(LLUUID const& id, LLMotionController* controller) : LLKeyframeMotion(id, controller)
{
mVelocityZ = 0.f;
mCharacter = NULL;

View File

@@ -47,7 +47,7 @@ class LLKeyframeFallMotion :
{
public:
// Constructor
LLKeyframeFallMotion(const LLUUID &id);
LLKeyframeFallMotion(LLUUID const& id, LLMotionController* controller);
// Destructor
virtual ~LLKeyframeFallMotion();
@@ -59,7 +59,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLKeyframeFallMotion(id); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLKeyframeFallMotion(id, controller); }
public:
//-------------------------------------------------------------------------

View File

@@ -444,8 +444,8 @@ void LLKeyframeMotion::JointMotion::update(LLJointState* joint_state, F32 time,
// LLKeyframeMotion()
// Class Constructor
//-----------------------------------------------------------------------------
LLKeyframeMotion::LLKeyframeMotion(const LLUUID &id)
: LLMotion(id),
LLKeyframeMotion::LLKeyframeMotion(const LLUUID &id, LLMotionController* controller)
: LLMotion(id, controller),
mPelvisp(NULL),
mLastSkeletonSerialNum(0),
mLastUpdateTime(0.f),
@@ -468,9 +468,9 @@ LLKeyframeMotion::~LLKeyframeMotion()
//-----------------------------------------------------------------------------
// create()
//-----------------------------------------------------------------------------
LLMotion* LLKeyframeMotion::create(LLUUID const& id, LLMotionController&)
LLMotion* LLKeyframeMotion::create(LLUUID const& id, LLMotionController* controller)
{
return new LLKeyframeMotion(id);
return new LLKeyframeMotion(id, controller);
}
//-----------------------------------------------------------------------------

View File

@@ -177,7 +177,7 @@ class LLKeyframeMotion :
friend class LLKeyframeDataCache;
public:
// Constructor
LLKeyframeMotion(const LLUUID &id);
LLKeyframeMotion(const LLUUID &id, LLMotionController* controller);
// Destructor
virtual ~LLKeyframeMotion();
@@ -194,7 +194,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
static LLMotion* create(LLUUID const& id, LLMotionController& controller);
static LLMotion* create(LLUUID const& id, LLMotionController* controller);
public:
//-------------------------------------------------------------------------

View File

@@ -50,7 +50,7 @@ const F32 POSITION_THRESHOLD = 0.1f;
// LLKeyframeStandMotion()
// Class Constructor
//-----------------------------------------------------------------------------
LLKeyframeStandMotion::LLKeyframeStandMotion(const LLUUID &id) : LLKeyframeMotion(id)
LLKeyframeStandMotion::LLKeyframeStandMotion(LLUUID const& id, LLMotionController* controller) : LLKeyframeMotion(id, controller)
{
mFlipFeet = FALSE;
mCharacter = NULL;

View File

@@ -48,7 +48,7 @@ class LLKeyframeStandMotion :
{
public:
// Constructor
LLKeyframeStandMotion(const LLUUID &id);
LLKeyframeStandMotion(LLUUID const& id, LLMotionController* controller);
// Destructor
virtual ~LLKeyframeStandMotion();
@@ -60,7 +60,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLKeyframeStandMotion(id); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLKeyframeStandMotion(id, controller); }
public:
//-------------------------------------------------------------------------

View File

@@ -55,8 +55,8 @@ const F32 SPEED_ADJUST_TIME_CONSTANT = 0.1f; // time constant for speed adjustm
// LLKeyframeWalkMotion()
// Class Constructor
//-----------------------------------------------------------------------------
LLKeyframeWalkMotion::LLKeyframeWalkMotion(const LLUUID &id)
: LLKeyframeMotion(id),
LLKeyframeWalkMotion::LLKeyframeWalkMotion(LLUUID const& id, LLMotionController* controller)
: LLKeyframeMotion(id, controller),
mCharacter(NULL),
mCyclePhase(0.0f),
mRealTimeLast(0.0f),
@@ -138,7 +138,7 @@ BOOL LLKeyframeWalkMotion::onUpdate(F32 time, U8* joint_mask)
// LLWalkAdjustMotion()
// Class Constructor
//-----------------------------------------------------------------------------
LLWalkAdjustMotion::LLWalkAdjustMotion(LLUUID const& id, LLMotionController& controller) :
LLWalkAdjustMotion::LLWalkAdjustMotion(LLUUID const& id, LLMotionController* controller) :
AIMaskedMotion(id, controller, ANIM_AGENT_WALK_ADJUST),
mLastTime(0.f),
mAnimSpeed(0.f),
@@ -331,7 +331,7 @@ void LLWalkAdjustMotion::onDeactivate()
//-----------------------------------------------------------------------------
// LLFlyAdjustMotion::LLFlyAdjustMotion()
//-----------------------------------------------------------------------------
LLFlyAdjustMotion::LLFlyAdjustMotion(LLUUID const& id, LLMotionController& controller)
LLFlyAdjustMotion::LLFlyAdjustMotion(LLUUID const& id, LLMotionController* controller)
: AIMaskedMotion(id, controller, ANIM_AGENT_FLY_ADJUST),
mRoll(0.f)
{

View File

@@ -52,7 +52,7 @@ class LLKeyframeWalkMotion :
friend class LLWalkAdjustMotion;
public:
// Constructor
LLKeyframeWalkMotion(LLUUID const& id);
LLKeyframeWalkMotion(LLUUID const& id, LLMotionController* controller);
// Destructor
virtual ~LLKeyframeWalkMotion();
@@ -64,7 +64,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLKeyframeWalkMotion(id); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLKeyframeWalkMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -90,7 +90,7 @@ class LLWalkAdjustMotion : public AIMaskedMotion
{
public:
// Constructor
LLWalkAdjustMotion(LLUUID const& id, LLMotionController& controller);
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(LLUUID const& id, LLMotionController& controller) { return new LLWalkAdjustMotion(id, controller); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLWalkAdjustMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -140,7 +140,7 @@ class LLFlyAdjustMotion : public AIMaskedMotion
{
public:
// Constructor
LLFlyAdjustMotion(LLUUID const& id, LLMotionController& controller);
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(LLUUID const& id, LLMotionController& controller) { return new LLFlyAdjustMotion(id, controller); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLFlyAdjustMotion(id, controller); }
public:
//-------------------------------------------------------------------------

View File

@@ -49,10 +49,11 @@
// LLMotion()
// Class Constructor
//-----------------------------------------------------------------------------
LLMotion::LLMotion( const LLUUID &id ) :
LLMotion::LLMotion(LLUUID const& id, LLMotionController* controller) :
mStopped(TRUE),
mActive(FALSE),
mID(id),
mController(controller),
mActivationTimestamp(0.f),
mStopTimestamp(0.f),
mSendStopTimestamp(F32_MAX),
@@ -181,13 +182,13 @@ BOOL LLMotion::canDeprecate()
BOOL AIMaskedMotion::onActivate()
{
mController.activated(mMaskBit);
mController->activated(mMaskBit);
return TRUE;
}
void AIMaskedMotion::onDeactivate()
{
mController.deactivated(mMaskBit);
mController->deactivated(mMaskBit);
}
// End

View File

@@ -67,7 +67,7 @@ public:
};
// Constructor
LLMotion(const LLUUID &id);
LLMotion(LLUUID const& id, LLMotionController* controller);
// Destructor
virtual ~LLMotion();
@@ -182,6 +182,9 @@ protected:
//-------------------------------------------------------------------------
std::string mName; // instance name assigned by motion controller
LLUUID mID;
//<singu>
LLMotionController* mController;
//</singu>
F32 mActivationTimestamp; // time when motion was activated
F32 mStopTimestamp; // time when motion was told to stop
@@ -200,9 +203,9 @@ protected:
class LLTestMotion : public LLMotion
{
public:
LLTestMotion(const LLUUID &id) : LLMotion(id){}
LLTestMotion(LLUUID const& id, LLMotionController* controller) : LLMotion(id, controller){}
~LLTestMotion() {}
static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLTestMotion(id); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLTestMotion(id, controller); }
BOOL getLoop() { return FALSE; }
F32 getDuration() { return 0.0f; }
F32 getEaseInDuration() { return 0.0f; }
@@ -224,9 +227,9 @@ public:
class LLNullMotion : public LLMotion
{
public:
LLNullMotion(const LLUUID &id) : LLMotion(id) {}
LLNullMotion(LLUUID const& id, LLMotionController* controller) : LLMotion(id, controller) {}
~LLNullMotion() {}
static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLNullMotion(id); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLNullMotion(id, controller); }
// motions must specify whether or not they loop
/*virtual*/ BOOL getLoop() { return TRUE; }
@@ -292,11 +295,10 @@ 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) { }
AIMaskedMotion(LLUUID const& id, LLMotionController* controller, U32 mask_bit) : LLMotion(id, controller), mMaskBit(mask_bit) { }
/*virtual*/ BOOL onActivate();
/*virtual*/ void onDeactivate();

View File

@@ -97,7 +97,7 @@ void LLMotionRegistry::markBad( const LLUUID& id )
//-----------------------------------------------------------------------------
// createMotion()
//-----------------------------------------------------------------------------
LLMotion* LLMotionRegistry::createMotion(LLUUID const& id, LLMotionController& controller)
LLMotion* LLMotionRegistry::createMotion(LLUUID const& id, LLMotionController* controller)
{
LLMotionConstructor constructor = get_if_there(mMotionTable, id, LLMotionConstructor(NULL));
LLMotion* motion = NULL;
@@ -359,7 +359,7 @@ LLMotion* LLMotionController::createMotion( const LLUUID &id )
if (!motion)
{
// look up constructor and create it
motion = sRegistry.createMotion(id, *this);
motion = sRegistry.createMotion(id, this);
if (!motion)
{
return NULL;

View File

@@ -56,7 +56,7 @@ class LLMotionController;
//-----------------------------------------------------------------------------
// LLMotionRegistry
//-----------------------------------------------------------------------------
typedef LLMotion* (*LLMotionConstructor)(LLUUID const& id, LLMotionController&);
typedef LLMotion* (*LLMotionConstructor)(LLUUID const& id, LLMotionController*);
class LLMotionRegistry
{
@@ -73,7 +73,7 @@ public:
// creates a new instance of a named motion
// returns NULL motion is not registered
LLMotion* createMotion(LLUUID const& id, LLMotionController& controller);
LLMotion* createMotion(LLUUID const& id, LLMotionController* controller);
// initialization of motion failed, don't try to create this motion again
void markBad( const LLUUID& id );

View File

@@ -52,7 +52,7 @@ const F32 TORSO_ROT_FRACTION = 0.5f;
// LLTargetingMotion()
// Class Constructor
//-----------------------------------------------------------------------------
LLTargetingMotion::LLTargetingMotion(LLUUID const& id, LLMotionController& controller) : AIMaskedMotion(id, controller, ANIM_AGENT_TARGET)
LLTargetingMotion::LLTargetingMotion(LLUUID const& id, LLMotionController* controller) : AIMaskedMotion(id, controller, ANIM_AGENT_TARGET)
{
mCharacter = NULL;
mName = "targeting";

View File

@@ -52,7 +52,7 @@ class LLTargetingMotion :
{
public:
// Constructor
LLTargetingMotion(LLUUID const& id, LLMotionController& controller);
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(LLUUID const& id, LLMotionController& controller) { return new LLTargetingMotion(id, controller); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLTargetingMotion(id, controller); }
public:
//-------------------------------------------------------------------------

View File

@@ -48,7 +48,7 @@
// LLEmote()
// Class Constructor
//-----------------------------------------------------------------------------
LLEmote::LLEmote(const LLUUID &id) : LLMotion(id)
LLEmote::LLEmote(LLUUID const& id, LLMotionController* controller) : LLMotion(id, controller)
{
mCharacter = NULL;

View File

@@ -55,7 +55,7 @@ class LLEmote :
{
public:
// Constructor
LLEmote(const LLUUID &id);
LLEmote(LLUUID const& id, LLMotionController* controller);
// Destructor
virtual ~LLEmote();
@@ -67,7 +67,7 @@ public:
// static constructor
// all subclasses must implement such a function and register it
static LLMotion* create(LLUUID const& id, LLMotionController&) { return new LLEmote(id); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLEmote(id, controller); }
public:
//-------------------------------------------------------------------------

View File

@@ -314,7 +314,7 @@ void LLPhysicsMotion::getString(std::ostringstream &oss)
}
}
LLPhysicsMotionController::LLPhysicsMotionController(LLUUID const& id, LLMotionController& controller) :
LLPhysicsMotionController::LLPhysicsMotionController(LLUUID const& id, LLMotionController* controller) :
AIMaskedMotion(id, controller, ANIM_AGENT_PHYSICS_MOTION),
mCharacter(NULL),
mIsDefault(true)

View File

@@ -49,7 +49,7 @@ public:
std::string getString();
// Constructor
LLPhysicsMotionController(LLUUID const& id, LLMotionController& controller);
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(LLUUID const& id, LLMotionController& controller) { return new LLPhysicsMotionController(id, controller); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLPhysicsMotionController(id, controller); }
public:
//-------------------------------------------------------------------------

View File

@@ -347,7 +347,7 @@ class LLBodyNoiseMotion :
{
public:
// Constructor
LLBodyNoiseMotion(LLUUID const& id, LLMotionController& controller)
LLBodyNoiseMotion(LLUUID const& id, LLMotionController* controller)
: AIMaskedMotion(id, controller, ANIM_AGENT_BODY_NOISE)
{
mName = "body_noise";
@@ -363,7 +363,7 @@ public:
//-------------------------------------------------------------------------
// static constructor
// all subclasses must implement such a function and register it
static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLBodyNoiseMotion(id, controller); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLBodyNoiseMotion(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -444,7 +444,7 @@ class LLBreatheMotionRot :
{
public:
// Constructor
LLBreatheMotionRot(LLUUID const& id, LLMotionController& controller) :
LLBreatheMotionRot(LLUUID const& id, LLMotionController* controller) :
AIMaskedMotion(id, controller, ANIM_AGENT_BREATHE_ROT),
mBreatheRate(1.f),
mCharacter(NULL)
@@ -462,7 +462,7 @@ public:
//-------------------------------------------------------------------------
// static constructor
// all subclasses must implement such a function and register it
static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLBreatheMotionRot(id, controller); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLBreatheMotionRot(id, controller); }
public:
//-------------------------------------------------------------------------
@@ -546,7 +546,7 @@ class LLPelvisFixMotion :
{
public:
// Constructor
LLPelvisFixMotion(LLUUID const& id, LLMotionController& controller)
LLPelvisFixMotion(LLUUID const& id, LLMotionController* controller)
: AIMaskedMotion(id, controller, ANIM_AGENT_PELVIS_FIX), mCharacter(NULL)
{
mName = "pelvis_fix";
@@ -563,7 +563,7 @@ public:
//-------------------------------------------------------------------------
// static constructor
// all subclasses must implement such a function and register it
static LLMotion* create(LLUUID const& id, LLMotionController& controller) { return new LLPelvisFixMotion(id, controller); }
static LLMotion* create(LLUUID const& id, LLMotionController* controller) { return new LLPelvisFixMotion(id, controller); }
public:
//-------------------------------------------------------------------------