Gesture Optimization Pass 2
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
#include "lldatapacker.h"
|
#include "lldatapacker.h"
|
||||||
#include "llstl.h"
|
#include "llstl.h"
|
||||||
|
|
||||||
const S32 GESTURE_VERSION = 2;
|
constexpr S32 GESTURE_VERSION = 2;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// LLMultiGesture
|
// LLMultiGesture
|
||||||
@@ -48,10 +48,10 @@ LLMultiGesture::LLMultiGesture()
|
|||||||
mTrigger(),
|
mTrigger(),
|
||||||
mReplaceText(),
|
mReplaceText(),
|
||||||
mSteps(),
|
mSteps(),
|
||||||
mPlaying(FALSE),
|
mPlaying(false),
|
||||||
mLocal(false),
|
mLocal(false),
|
||||||
mCurrentStep(0),
|
mCurrentStep(0),
|
||||||
mDoneCallback(NULL)
|
mDoneCallback(nullptr)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
@@ -63,13 +63,13 @@ LLMultiGesture::~LLMultiGesture()
|
|||||||
|
|
||||||
void LLMultiGesture::reset()
|
void LLMultiGesture::reset()
|
||||||
{
|
{
|
||||||
mPlaying = FALSE;
|
mPlaying = false;
|
||||||
mLocal = false;
|
mLocal = false;
|
||||||
mCurrentStep = 0;
|
mCurrentStep = 0;
|
||||||
mWaitTimer.reset();
|
mWaitTimer.reset();
|
||||||
mWaitingTimer = FALSE;
|
mWaitingTimer = false;
|
||||||
mWaitingAnimations = FALSE;
|
mWaitingAnimations = false;
|
||||||
mWaitingAtEnd = FALSE;
|
mWaitingAtEnd = false;
|
||||||
mRequestedAnimIDs.clear();
|
mRequestedAnimIDs.clear();
|
||||||
mPlayingAnimIDs.clear();
|
mPlayingAnimIDs.clear();
|
||||||
}
|
}
|
||||||
@@ -88,10 +88,8 @@ S32 LLMultiGesture::getMaxSerialSize() const
|
|||||||
|
|
||||||
max_size += 64; // step count S32
|
max_size += 64; // step count S32
|
||||||
|
|
||||||
std::vector<LLGestureStep*>::const_iterator it;
|
for (const auto& step : mSteps)
|
||||||
for (it = mSteps.begin(); it != mSteps.end(); ++it)
|
|
||||||
{
|
{
|
||||||
LLGestureStep* step = *it;
|
|
||||||
max_size += 64; // type S32
|
max_size += 64; // type S32
|
||||||
max_size += step->getMaxSerialSize();
|
max_size += step->getMaxSerialSize();
|
||||||
}
|
}
|
||||||
@@ -104,10 +102,8 @@ S32 LLMultiGesture::getMaxSerialSize() const
|
|||||||
|
|
||||||
max_size += sizeof(S32); // step count
|
max_size += sizeof(S32); // step count
|
||||||
|
|
||||||
std::vector<LLGestureStep*>::const_iterator it;
|
for (const auto& step : mSteps)
|
||||||
for (it = mSteps.begin(); it != mSteps.end(); ++it)
|
|
||||||
{
|
{
|
||||||
LLGestureStep* step = *it;
|
|
||||||
max_size += sizeof(S32); // type
|
max_size += sizeof(S32); // type
|
||||||
max_size += step->getMaxSerialSize();
|
max_size += step->getMaxSerialSize();
|
||||||
}
|
}
|
||||||
@@ -116,7 +112,7 @@ S32 LLMultiGesture::getMaxSerialSize() const
|
|||||||
return max_size;
|
return max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLMultiGesture::serialize(LLDataPacker& dp) const
|
bool LLMultiGesture::serialize(LLDataPacker& dp) const
|
||||||
{
|
{
|
||||||
dp.packS32(GESTURE_VERSION, "version");
|
dp.packS32(GESTURE_VERSION, "version");
|
||||||
dp.packU8(mKey, "key");
|
dp.packU8(mKey, "key");
|
||||||
@@ -126,22 +122,18 @@ BOOL LLMultiGesture::serialize(LLDataPacker& dp) const
|
|||||||
|
|
||||||
S32 count = (S32)mSteps.size();
|
S32 count = (S32)mSteps.size();
|
||||||
dp.packS32(count, "step_count");
|
dp.packS32(count, "step_count");
|
||||||
S32 i;
|
for (const auto& step : mSteps)
|
||||||
for (i = 0; i < count; ++i)
|
|
||||||
{
|
{
|
||||||
LLGestureStep* step = mSteps[i];
|
|
||||||
|
|
||||||
dp.packS32(step->getType(), "step_type");
|
dp.packS32(step->getType(), "step_type");
|
||||||
BOOL ok = step->serialize(dp);
|
if (!step->serialize(dp))
|
||||||
if (!ok)
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLMultiGesture::deserialize(LLDataPacker& dp)
|
bool LLMultiGesture::deserialize(LLDataPacker& dp)
|
||||||
{
|
{
|
||||||
S32 version;
|
S32 version;
|
||||||
dp.unpackS32(version, "version");
|
dp.unpackS32(version, "version");
|
||||||
@@ -150,15 +142,12 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp)
|
|||||||
LL_WARNS() << "Bad LLMultiGesture version " << version
|
LL_WARNS() << "Bad LLMultiGesture version " << version
|
||||||
<< " should be " << GESTURE_VERSION
|
<< " should be " << GESTURE_VERSION
|
||||||
<< LL_ENDL;
|
<< LL_ENDL;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dp.unpackU8(mKey, "key");
|
dp.unpackU8(mKey, "key");
|
||||||
dp.unpackU32(mMask, "mask");
|
dp.unpackU32(mMask, "mask");
|
||||||
|
|
||||||
|
|
||||||
dp.unpackString(mTrigger, "trigger");
|
dp.unpackString(mTrigger, "trigger");
|
||||||
|
|
||||||
dp.unpackString(mReplaceText, "replace");
|
dp.unpackString(mReplaceText, "replace");
|
||||||
|
|
||||||
S32 count;
|
S32 count;
|
||||||
@@ -166,58 +155,31 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp)
|
|||||||
if (count < 0)
|
if (count < 0)
|
||||||
{
|
{
|
||||||
LL_WARNS() << "Bad LLMultiGesture step count " << count << LL_ENDL;
|
LL_WARNS() << "Bad LLMultiGesture step count " << count << LL_ENDL;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 i;
|
std::unique_ptr<LLGestureStep> step;
|
||||||
for (i = 0; i < count; ++i)
|
for (S32 i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
S32 type;
|
S32 type;
|
||||||
dp.unpackS32(type, "step_type");
|
dp.unpackS32(type, "step_type");
|
||||||
|
|
||||||
EStepType step_type = (EStepType)type;
|
switch((EStepType)type)
|
||||||
switch(step_type)
|
|
||||||
{
|
{
|
||||||
case STEP_ANIMATION:
|
case STEP_ANIMATION: step.reset(new LLGestureStepAnimation); break;
|
||||||
{
|
case STEP_SOUND: step.reset(new LLGestureStepSound); break;
|
||||||
std::unique_ptr<LLGestureStep> step(new LLGestureStepAnimation());
|
case STEP_CHAT: step.reset(new LLGestureStepChat); break;
|
||||||
BOOL ok = step->deserialize(dp);
|
case STEP_WAIT: step.reset(new LLGestureStepWait); break;
|
||||||
if (!ok) return FALSE;
|
|
||||||
mSteps.push_back(step.release());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STEP_SOUND:
|
|
||||||
{
|
|
||||||
std::unique_ptr<LLGestureStep> step(new LLGestureStepSound());
|
|
||||||
BOOL ok = step->deserialize(dp);
|
|
||||||
if (!ok) return FALSE;
|
|
||||||
mSteps.push_back(step.release());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STEP_CHAT:
|
|
||||||
{
|
|
||||||
std::unique_ptr<LLGestureStep> step(new LLGestureStepChat());
|
|
||||||
BOOL ok = step->deserialize(dp);
|
|
||||||
if (!ok) return FALSE;
|
|
||||||
mSteps.push_back(step.release());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STEP_WAIT:
|
|
||||||
{
|
|
||||||
std::unique_ptr<LLGestureStep> step(new LLGestureStepWait());
|
|
||||||
BOOL ok = step->deserialize(dp);
|
|
||||||
if (!ok) return FALSE;
|
|
||||||
mSteps.push_back(step.release());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
LL_WARNS() << "Bad LLMultiGesture step type " << type << LL_ENDL;
|
LL_WARNS() << "Bad LLMultiGesture step type " << type << LL_ENDL;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!step->deserialize(dp)) return false;
|
||||||
|
mSteps.push_back(step.release());
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLMultiGesture::dump()
|
void LLMultiGesture::dump()
|
||||||
@@ -226,10 +188,8 @@ void LLMultiGesture::dump()
|
|||||||
<< " trigger " << mTrigger
|
<< " trigger " << mTrigger
|
||||||
<< " replace " << mReplaceText
|
<< " replace " << mReplaceText
|
||||||
<< LL_ENDL;
|
<< LL_ENDL;
|
||||||
U32 i;
|
for (const auto& step : mSteps)
|
||||||
for (i = 0; i < mSteps.size(); ++i)
|
|
||||||
{
|
{
|
||||||
LLGestureStep* step = mSteps[i];
|
|
||||||
step->dump();
|
step->dump();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,21 +224,21 @@ S32 LLGestureStepAnimation::getMaxSerialSize() const
|
|||||||
return max_size;
|
return max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLGestureStepAnimation::serialize(LLDataPacker& dp) const
|
bool LLGestureStepAnimation::serialize(LLDataPacker& dp) const
|
||||||
{
|
{
|
||||||
dp.packString(mAnimName, "anim_name");
|
dp.packString(mAnimName, "anim_name");
|
||||||
dp.packUUID(mAnimAssetID, "asset_id");
|
dp.packUUID(mAnimAssetID, "asset_id");
|
||||||
dp.packU32(mFlags, "flags");
|
dp.packU32(mFlags, "flags");
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLGestureStepAnimation::deserialize(LLDataPacker& dp)
|
bool LLGestureStepAnimation::deserialize(LLDataPacker& dp)
|
||||||
{
|
{
|
||||||
dp.unpackString(mAnimName, "anim_name");
|
dp.unpackString(mAnimName, "anim_name");
|
||||||
|
|
||||||
// Apparently an earlier version of the gesture code added \r to the end
|
// Apparently an earlier version of the gesture code added \r to the end
|
||||||
// of the animation names. Get rid of it. JC
|
// of the animation names. Get rid of it. JC
|
||||||
if (!mAnimName.empty() && mAnimName[mAnimName.length() - 1] == '\r')
|
if (!mAnimName.empty() && mAnimName.back() == '\r')
|
||||||
{
|
{
|
||||||
// chop the last character
|
// chop the last character
|
||||||
mAnimName.resize(mAnimName.length() - 1);
|
mAnimName.resize(mAnimName.length() - 1);
|
||||||
@@ -286,29 +246,18 @@ BOOL LLGestureStepAnimation::deserialize(LLDataPacker& dp)
|
|||||||
|
|
||||||
dp.unpackUUID(mAnimAssetID, "asset_id");
|
dp.unpackUUID(mAnimAssetID, "asset_id");
|
||||||
dp.unpackU32(mFlags, "flags");
|
dp.unpackU32(mFlags, "flags");
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
// *NOTE: result is translated in LLPreviewGesture::getLabel()
|
// *NOTE: result is translated in LLPreviewGesture::getLabel()
|
||||||
std::vector<std::string> LLGestureStepAnimation::getLabel() const
|
std::vector<std::string> LLGestureStepAnimation::getLabel() const
|
||||||
{
|
{
|
||||||
std::vector<std::string> strings;
|
/* std::string label;
|
||||||
|
|
||||||
// std::string label;
|
|
||||||
if (mFlags & ANIM_FLAG_STOP)
|
if (mFlags & ANIM_FLAG_STOP)
|
||||||
{
|
label = "Stop Animation: ";
|
||||||
strings.push_back( "AnimFlagStop");
|
|
||||||
|
|
||||||
// label = "Stop Animation: ";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
label = "Start Animation: ";
|
||||||
strings.push_back( "AnimFlagStart");
|
label += mAnimName;*/
|
||||||
|
return {mFlags & ANIM_FLAG_STOP ? "AnimFlagStop" : "AnimFlagStart", mAnimName};
|
||||||
// label = "Start Animation: ";
|
|
||||||
}
|
|
||||||
strings.push_back( mAnimName);
|
|
||||||
// label += mAnimName;
|
|
||||||
return strings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGestureStepAnimation::dump()
|
void LLGestureStepAnimation::dump()
|
||||||
@@ -346,31 +295,28 @@ S32 LLGestureStepSound::getMaxSerialSize() const
|
|||||||
return max_size;
|
return max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLGestureStepSound::serialize(LLDataPacker& dp) const
|
bool LLGestureStepSound::serialize(LLDataPacker& dp) const
|
||||||
{
|
{
|
||||||
dp.packString(mSoundName, "sound_name");
|
dp.packString(mSoundName, "sound_name");
|
||||||
dp.packUUID(mSoundAssetID, "asset_id");
|
dp.packUUID(mSoundAssetID, "asset_id");
|
||||||
dp.packU32(mFlags, "flags");
|
dp.packU32(mFlags, "flags");
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLGestureStepSound::deserialize(LLDataPacker& dp)
|
bool LLGestureStepSound::deserialize(LLDataPacker& dp)
|
||||||
{
|
{
|
||||||
dp.unpackString(mSoundName, "sound_name");
|
dp.unpackString(mSoundName, "sound_name");
|
||||||
|
|
||||||
dp.unpackUUID(mSoundAssetID, "asset_id");
|
dp.unpackUUID(mSoundAssetID, "asset_id");
|
||||||
dp.unpackU32(mFlags, "flags");
|
dp.unpackU32(mFlags, "flags");
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
// *NOTE: result is translated in LLPreviewGesture::getLabel()
|
// *NOTE: result is translated in LLPreviewGesture::getLabel()
|
||||||
std::vector<std::string> LLGestureStepSound::getLabel() const
|
std::vector<std::string> LLGestureStepSound::getLabel() const
|
||||||
{
|
{
|
||||||
std::vector<std::string> strings;
|
|
||||||
strings.push_back( "Sound");
|
|
||||||
strings.push_back( mSoundName);
|
|
||||||
// std::string label("Sound: ");
|
// std::string label("Sound: ");
|
||||||
// label += mSoundName;
|
// label += mSoundName;
|
||||||
return strings;
|
return {"Sound", mSoundName};
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGestureStepSound::dump()
|
void LLGestureStepSound::dump()
|
||||||
@@ -406,27 +352,23 @@ S32 LLGestureStepChat::getMaxSerialSize() const
|
|||||||
return max_size;
|
return max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLGestureStepChat::serialize(LLDataPacker& dp) const
|
bool LLGestureStepChat::serialize(LLDataPacker& dp) const
|
||||||
{
|
{
|
||||||
dp.packString(mChatText, "chat_text");
|
dp.packString(mChatText, "chat_text");
|
||||||
dp.packU32(mFlags, "flags");
|
dp.packU32(mFlags, "flags");
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLGestureStepChat::deserialize(LLDataPacker& dp)
|
bool LLGestureStepChat::deserialize(LLDataPacker& dp)
|
||||||
{
|
{
|
||||||
dp.unpackString(mChatText, "chat_text");
|
dp.unpackString(mChatText, "chat_text");
|
||||||
|
|
||||||
dp.unpackU32(mFlags, "flags");
|
dp.unpackU32(mFlags, "flags");
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
// *NOTE: result is translated in LLPreviewGesture::getLabel()
|
// *NOTE: result is translated in LLPreviewGesture::getLabel()
|
||||||
std::vector<std::string> LLGestureStepChat::getLabel() const
|
std::vector<std::string> LLGestureStepChat::getLabel() const
|
||||||
{
|
{
|
||||||
std::vector<std::string> strings;
|
return {"Chat", mChatText};
|
||||||
strings.push_back("Chat");
|
|
||||||
strings.push_back(mChatText);
|
|
||||||
return strings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLGestureStepChat::dump()
|
void LLGestureStepChat::dump()
|
||||||
@@ -461,44 +403,26 @@ S32 LLGestureStepWait::getMaxSerialSize() const
|
|||||||
return max_size;
|
return max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLGestureStepWait::serialize(LLDataPacker& dp) const
|
bool LLGestureStepWait::serialize(LLDataPacker& dp) const
|
||||||
{
|
{
|
||||||
dp.packF32(mWaitSeconds, "wait_seconds");
|
dp.packF32(mWaitSeconds, "wait_seconds");
|
||||||
dp.packU32(mFlags, "flags");
|
dp.packU32(mFlags, "flags");
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLGestureStepWait::deserialize(LLDataPacker& dp)
|
bool LLGestureStepWait::deserialize(LLDataPacker& dp)
|
||||||
{
|
{
|
||||||
dp.unpackF32(mWaitSeconds, "wait_seconds");
|
dp.unpackF32(mWaitSeconds, "wait_seconds");
|
||||||
dp.unpackU32(mFlags, "flags");
|
dp.unpackU32(mFlags, "flags");
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
// *NOTE: result is translated in LLPreviewGesture::getLabel()
|
// *NOTE: result is translated in LLPreviewGesture::getLabel()
|
||||||
std::vector<std::string> LLGestureStepWait::getLabel() const
|
std::vector<std::string> LLGestureStepWait::getLabel() const
|
||||||
{
|
{
|
||||||
std::vector<std::string> strings;
|
return {"Wait",
|
||||||
strings.push_back( "Wait" );
|
mFlags & WAIT_FLAG_TIME ? llformat("%.1f seconds", mWaitSeconds)
|
||||||
|
: mFlags & WAIT_FLAG_ALL_ANIM ? "until animations are done"
|
||||||
// std::string label("--- Wait: ");
|
: LLStringUtil::null};
|
||||||
if (mFlags & WAIT_FLAG_TIME)
|
|
||||||
{
|
|
||||||
char buffer[64]; /* Flawfinder: ignore */
|
|
||||||
snprintf(buffer, sizeof(buffer), "%.1f seconds", (double)mWaitSeconds); /* Flawfinder: ignore */
|
|
||||||
strings.push_back(buffer);
|
|
||||||
// label += buffer;
|
|
||||||
}
|
|
||||||
else if (mFlags & WAIT_FLAG_ALL_ANIM)
|
|
||||||
{
|
|
||||||
strings.push_back("until animations are done");
|
|
||||||
// label += "until animations are done";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strings.push_back("");
|
|
||||||
}
|
|
||||||
|
|
||||||
return strings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#ifndef LL_LLMULTIGESTURE_H
|
#ifndef LL_LLMULTIGESTURE_H
|
||||||
#define LL_LLMULTIGESTURE_H
|
#define LL_LLMULTIGESTURE_H
|
||||||
|
|
||||||
#include <set>
|
#include <unordered_set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -46,8 +46,8 @@ public:
|
|||||||
// Maximum number of bytes this could hold once serialized.
|
// Maximum number of bytes this could hold once serialized.
|
||||||
S32 getMaxSerialSize() const;
|
S32 getMaxSerialSize() const;
|
||||||
|
|
||||||
BOOL serialize(LLDataPacker& dp) const;
|
bool serialize(LLDataPacker& dp) const;
|
||||||
BOOL deserialize(LLDataPacker& dp);
|
bool deserialize(LLDataPacker& dp);
|
||||||
|
|
||||||
void dump();
|
void dump();
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
std::vector<LLGestureStep*> mSteps;
|
std::vector<LLGestureStep*> mSteps;
|
||||||
|
|
||||||
// Is the gesture currently playing?
|
// Is the gesture currently playing?
|
||||||
BOOL mPlaying;
|
bool mPlaying;
|
||||||
|
|
||||||
// Is the gesture to be played locally?
|
// Is the gesture to be played locally?
|
||||||
bool mLocal;
|
bool mLocal;
|
||||||
@@ -86,25 +86,25 @@ public:
|
|||||||
S32 mCurrentStep;
|
S32 mCurrentStep;
|
||||||
|
|
||||||
// We're waiting for triggered animations to stop playing
|
// We're waiting for triggered animations to stop playing
|
||||||
BOOL mWaitingAnimations;
|
bool mWaitingAnimations;
|
||||||
|
|
||||||
// We're waiting a fixed amount of time
|
// We're waiting a fixed amount of time
|
||||||
BOOL mWaitingTimer;
|
bool mWaitingTimer;
|
||||||
|
|
||||||
// Waiting after the last step played for all animations to complete
|
// Waiting after the last step played for all animations to complete
|
||||||
BOOL mWaitingAtEnd;
|
bool mWaitingAtEnd;
|
||||||
|
|
||||||
// Timer for waiting
|
// Timer for waiting
|
||||||
LLFrameTimer mWaitTimer;
|
LLFrameTimer mWaitTimer;
|
||||||
|
|
||||||
boost::function<void (LLMultiGesture*)> mDoneCallback;
|
std::function<void (LLMultiGesture*)> mDoneCallback;
|
||||||
|
|
||||||
// Animations that we requested to start
|
// Animations that we requested to start
|
||||||
std::set<LLUUID> mRequestedAnimIDs;
|
std::unordered_set<LLUUID> mRequestedAnimIDs;
|
||||||
|
|
||||||
// Once the animation starts playing (sim says to start playing)
|
// Once the animation starts playing (sim says to start playing)
|
||||||
// the ID is moved from mRequestedAnimIDs to here.
|
// the ID is moved from mRequestedAnimIDs to here.
|
||||||
std::set<LLUUID> mPlayingAnimIDs;
|
std::unordered_set<LLUUID> mPlayingAnimIDs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -127,14 +127,14 @@ public:
|
|||||||
LLGestureStep() {}
|
LLGestureStep() {}
|
||||||
virtual ~LLGestureStep() {}
|
virtual ~LLGestureStep() {}
|
||||||
|
|
||||||
virtual EStepType getType() = 0;
|
virtual EStepType getType() const = 0;
|
||||||
|
|
||||||
// Return a user-readable label for this step
|
// Return a user-readable label for this step
|
||||||
virtual std::vector<std::string> getLabel() const = 0;
|
virtual std::vector<std::string> getLabel() const = 0;
|
||||||
|
|
||||||
virtual S32 getMaxSerialSize() const = 0;
|
virtual S32 getMaxSerialSize() const = 0;
|
||||||
virtual BOOL serialize(LLDataPacker& dp) const = 0;
|
virtual bool serialize(LLDataPacker& dp) const = 0;
|
||||||
virtual BOOL deserialize(LLDataPacker& dp) = 0;
|
virtual bool deserialize(LLDataPacker& dp) = 0;
|
||||||
|
|
||||||
virtual void dump() = 0;
|
virtual void dump() = 0;
|
||||||
};
|
};
|
||||||
@@ -142,7 +142,7 @@ public:
|
|||||||
|
|
||||||
// By default, animation steps start animations.
|
// By default, animation steps start animations.
|
||||||
// If the least significant bit is 1, it will stop animations.
|
// If the least significant bit is 1, it will stop animations.
|
||||||
const U32 ANIM_FLAG_STOP = 0x01;
|
constexpr U32 ANIM_FLAG_STOP = 0x01;
|
||||||
|
|
||||||
class LLGestureStepAnimation : public LLGestureStep
|
class LLGestureStepAnimation : public LLGestureStep
|
||||||
{
|
{
|
||||||
@@ -150,15 +150,15 @@ public:
|
|||||||
LLGestureStepAnimation();
|
LLGestureStepAnimation();
|
||||||
virtual ~LLGestureStepAnimation();
|
virtual ~LLGestureStepAnimation();
|
||||||
|
|
||||||
virtual EStepType getType() { return STEP_ANIMATION; }
|
EStepType getType() const override { return STEP_ANIMATION; }
|
||||||
|
|
||||||
virtual std::vector<std::string> getLabel() const;
|
std::vector<std::string> getLabel() const override;
|
||||||
|
|
||||||
virtual S32 getMaxSerialSize() const;
|
S32 getMaxSerialSize() const override;
|
||||||
virtual BOOL serialize(LLDataPacker& dp) const;
|
bool serialize(LLDataPacker& dp) const override;
|
||||||
virtual BOOL deserialize(LLDataPacker& dp);
|
bool deserialize(LLDataPacker& dp) override;
|
||||||
|
|
||||||
virtual void dump();
|
void dump() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string mAnimName;
|
std::string mAnimName;
|
||||||
@@ -173,15 +173,15 @@ public:
|
|||||||
LLGestureStepSound();
|
LLGestureStepSound();
|
||||||
virtual ~LLGestureStepSound();
|
virtual ~LLGestureStepSound();
|
||||||
|
|
||||||
virtual EStepType getType() { return STEP_SOUND; }
|
EStepType getType() const override { return STEP_SOUND; }
|
||||||
|
|
||||||
virtual std::vector<std::string> getLabel() const;
|
std::vector<std::string> getLabel() const override;
|
||||||
|
|
||||||
virtual S32 getMaxSerialSize() const;
|
S32 getMaxSerialSize() const override;
|
||||||
virtual BOOL serialize(LLDataPacker& dp) const;
|
bool serialize(LLDataPacker& dp) const override;
|
||||||
virtual BOOL deserialize(LLDataPacker& dp);
|
bool deserialize(LLDataPacker& dp) override;
|
||||||
|
|
||||||
virtual void dump();
|
void dump() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string mSoundName;
|
std::string mSoundName;
|
||||||
@@ -196,15 +196,15 @@ public:
|
|||||||
LLGestureStepChat();
|
LLGestureStepChat();
|
||||||
virtual ~LLGestureStepChat();
|
virtual ~LLGestureStepChat();
|
||||||
|
|
||||||
virtual EStepType getType() { return STEP_CHAT; }
|
EStepType getType() const override { return STEP_CHAT; }
|
||||||
|
|
||||||
virtual std::vector<std::string> getLabel() const;
|
std::vector<std::string> getLabel() const override;
|
||||||
|
|
||||||
virtual S32 getMaxSerialSize() const;
|
S32 getMaxSerialSize() const override;
|
||||||
virtual BOOL serialize(LLDataPacker& dp) const;
|
bool serialize(LLDataPacker& dp) const override;
|
||||||
virtual BOOL deserialize(LLDataPacker& dp);
|
bool deserialize(LLDataPacker& dp) override;
|
||||||
|
|
||||||
virtual void dump();
|
void dump() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string mChatText;
|
std::string mChatText;
|
||||||
@@ -212,8 +212,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const U32 WAIT_FLAG_TIME = 0x01;
|
constexpr U32 WAIT_FLAG_TIME = 0x01;
|
||||||
const U32 WAIT_FLAG_ALL_ANIM = 0x02;
|
constexpr U32 WAIT_FLAG_ALL_ANIM = 0x02;
|
||||||
|
|
||||||
class LLGestureStepWait : public LLGestureStep
|
class LLGestureStepWait : public LLGestureStep
|
||||||
{
|
{
|
||||||
@@ -221,15 +221,15 @@ public:
|
|||||||
LLGestureStepWait();
|
LLGestureStepWait();
|
||||||
virtual ~LLGestureStepWait();
|
virtual ~LLGestureStepWait();
|
||||||
|
|
||||||
virtual EStepType getType() { return STEP_WAIT; }
|
EStepType getType() const override { return STEP_WAIT; }
|
||||||
|
|
||||||
virtual std::vector<std::string> getLabel() const;
|
std::vector<std::string> getLabel() const override;
|
||||||
|
|
||||||
virtual S32 getMaxSerialSize() const;
|
S32 getMaxSerialSize() const override;
|
||||||
virtual BOOL serialize(LLDataPacker& dp) const;
|
bool serialize(LLDataPacker& dp) const override;
|
||||||
virtual BOOL deserialize(LLDataPacker& dp);
|
bool deserialize(LLDataPacker& dp) override;
|
||||||
|
|
||||||
virtual void dump();
|
void dump() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
F32 mWaitSeconds;
|
F32 mWaitSeconds;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -27,8 +27,9 @@
|
|||||||
#ifndef LL_LLGESTUREMGR_H
|
#ifndef LL_LLGESTUREMGR_H
|
||||||
#define LL_LLGESTUREMGR_H
|
#define LL_LLGESTUREMGR_H
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <unordered_set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "llassetstorage.h" // LLAssetType
|
#include "llassetstorage.h" // LLAssetType
|
||||||
@@ -53,10 +54,10 @@ class LLGestureMgr : public LLSingleton<LLGestureMgr>, public LLInventoryFetchIt
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef boost::function<void (LLMultiGesture* loaded_gesture)> gesture_loaded_callback_t;
|
typedef std::function<void (LLMultiGesture* loaded_gesture)> gesture_loaded_callback_t;
|
||||||
// Maps inventory item_id to gesture
|
// Maps inventory item_id to gesture
|
||||||
typedef std::map<LLUUID, LLMultiGesture*> item_map_t;
|
typedef std::unordered_map<LLUUID, LLMultiGesture*> item_map_t;
|
||||||
typedef std::map<LLUUID, gesture_loaded_callback_t> callback_map_t;
|
typedef std::unordered_map<LLUUID, gesture_loaded_callback_t> callback_map_t;
|
||||||
|
|
||||||
LLGestureMgr();
|
LLGestureMgr();
|
||||||
~LLGestureMgr();
|
~LLGestureMgr();
|
||||||
@@ -81,24 +82,24 @@ public:
|
|||||||
|
|
||||||
// Load gesture into in-memory active form.
|
// Load gesture into in-memory active form.
|
||||||
// Can be called even if the inventory item isn't loaded yet.
|
// Can be called even if the inventory item isn't loaded yet.
|
||||||
// inform_server TRUE will send message upstream to update database
|
// inform_server true will send message upstream to update database
|
||||||
// user_gesture_active table, which isn't necessary on login.
|
// user_gesture_active table, which isn't necessary on login.
|
||||||
// deactivate_similar will cause other gestures with the same trigger phrase
|
// deactivate_similar will cause other gestures with the same trigger phrase
|
||||||
// or keybinding to be deactivated.
|
// or keybinding to be deactivated.
|
||||||
void activateGestureWithAsset(const LLUUID& item_id, const LLUUID& asset_id, BOOL inform_server, BOOL deactivate_similar);
|
void activateGestureWithAsset(const LLUUID& item_id, const LLUUID& asset_id, bool inform_server, bool deactivate_similar);
|
||||||
|
|
||||||
// Takes gesture out of active list and deletes it.
|
// Takes gesture out of active list and deletes it.
|
||||||
void deactivateGesture(const LLUUID& item_id);
|
void deactivateGesture(const LLUUID& item_id);
|
||||||
|
|
||||||
// Deactivates all gestures that match either this trigger phrase,
|
// Deactivates all gestures that match either this trigger phrase,
|
||||||
// or this hot key.
|
// or this hot key.
|
||||||
void deactivateSimilarGestures(LLMultiGesture* gesture, const LLUUID& in_item_id);
|
void deactivateSimilarGestures(const LLMultiGesture* gesture, const LLUUID& in_item_id);
|
||||||
|
|
||||||
BOOL isGestureActive(const LLUUID& item_id);
|
bool isGestureActive(const LLUUID& item_id) const;
|
||||||
|
|
||||||
BOOL isGesturePlaying(const LLUUID& item_id);
|
bool isGesturePlaying(const LLUUID& item_id) const;
|
||||||
|
|
||||||
BOOL isGesturePlaying(LLMultiGesture* gesture);
|
bool isGesturePlaying(const LLMultiGesture* gesture) const;
|
||||||
|
|
||||||
const item_map_t& getActiveGestures() const { return mActive; }
|
const item_map_t& getActiveGestures() const { return mActive; }
|
||||||
// Force a gesture to be played, for example, if it is being
|
// Force a gesture to be played, for example, if it is being
|
||||||
@@ -115,19 +116,19 @@ public:
|
|||||||
* Note:
|
* Note:
|
||||||
* Manager will call cb after gesture will be loaded and will remove cb automatically.
|
* Manager will call cb after gesture will be loaded and will remove cb automatically.
|
||||||
*/
|
*/
|
||||||
void setGestureLoadedCallback(LLUUID inv_item_id, gesture_loaded_callback_t cb)
|
void setGestureLoadedCallback(const LLUUID& inv_item_id, gesture_loaded_callback_t cb)
|
||||||
{
|
{
|
||||||
mCallbackMap[inv_item_id] = cb;
|
mCallbackMap[inv_item_id] = cb;
|
||||||
}
|
}
|
||||||
// Trigger the first gesture that matches this key.
|
// Trigger the first gesture that matches this key.
|
||||||
// Returns TRUE if it finds a gesture bound to that key.
|
// Returns TRUE if it finds a gesture bound to that key.
|
||||||
BOOL triggerGesture(KEY key, MASK mask);
|
bool triggerGesture(KEY key, MASK mask);
|
||||||
|
|
||||||
// Trigger all gestures referenced as substrings in this string
|
// Trigger all gestures referenced as substrings in this string
|
||||||
BOOL triggerAndReviseString(const std::string &str, std::string *revised_string = NULL);
|
bool triggerAndReviseString(const std::string &str, std::string *revised_string = NULL);
|
||||||
|
|
||||||
// Does some gesture have this key bound?
|
// Does some gesture have this key bound?
|
||||||
BOOL isKeyBound(KEY key, MASK mask);
|
//bool isKeyBound(KEY key, MASK mask) const;
|
||||||
|
|
||||||
S32 getPlayingCount() const;
|
S32 getPlayingCount() const;
|
||||||
|
|
||||||
@@ -138,10 +139,10 @@ public:
|
|||||||
// Overriding so we can update active gesture names and notify observers
|
// Overriding so we can update active gesture names and notify observers
|
||||||
void changed(U32 mask);
|
void changed(U32 mask);
|
||||||
|
|
||||||
BOOL matchPrefix(const std::string& in_str, std::string* out_str);
|
bool matchPrefix(const std::string& in_str, std::string* out_str) const;
|
||||||
|
|
||||||
// Copy item ids into the vector
|
// Copy item ids into the vector
|
||||||
void getItemIDs(uuid_vec_t* ids);
|
void getItemIDs(uuid_vec_t* ids) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Handle the processing of a single gesture
|
// Handle the processing of a single gesture
|
||||||
@@ -172,7 +173,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Active gestures.
|
// Active gestures.
|
||||||
// NOTE: The gesture pointer CAN BE NULL. This means that
|
// NOTE: The gesture pointer CAN BE a nullptr. This means that
|
||||||
// there is a gesture with that item_id, but the asset data
|
// there is a gesture with that item_id, but the asset data
|
||||||
// is still on its way down from the server.
|
// is still on its way down from the server.
|
||||||
item_map_t mActive;
|
item_map_t mActive;
|
||||||
@@ -183,9 +184,9 @@ private:
|
|||||||
std::vector<LLGestureManagerObserver*> mObservers;
|
std::vector<LLGestureManagerObserver*> mObservers;
|
||||||
callback_map_t mCallbackMap;
|
callback_map_t mCallbackMap;
|
||||||
std::vector<LLMultiGesture*> mPlaying;
|
std::vector<LLMultiGesture*> mPlaying;
|
||||||
BOOL mValid;
|
bool mValid;
|
||||||
|
|
||||||
std::set<LLUUID> mLoadingAssets;
|
std::unordered_set<LLUUID> mLoadingAssets;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user