diff options
Diffstat (limited to 'indra/llcharacter')
43 files changed, 740 insertions, 691 deletions
diff --git a/indra/llcharacter/llanimationstates.cpp b/indra/llcharacter/llanimationstates.cpp index b44dccbe6c..7710589b06 100644 --- a/indra/llcharacter/llanimationstates.cpp +++ b/indra/llcharacter/llanimationstates.cpp @@ -367,7 +367,7 @@ const char *LLAnimationLibrary::animStateToString( const LLUUID& state ) //----------------------------------------------------------------------------- // Return the animation state for a given name //----------------------------------------------------------------------------- -LLUUID LLAnimationLibrary::stringToAnimState( const std::string& name, BOOL allow_ids ) +LLUUID LLAnimationLibrary::stringToAnimState( const std::string& name, bool allow_ids ) { std::string lower_case_name(name); LLStringUtil::toLower(lower_case_name); @@ -391,7 +391,7 @@ LLUUID LLAnimationLibrary::stringToAnimState( const std::string& name, BOOL allo else if (allow_ids) { // try to convert string to LLUUID - id.set(name, FALSE); + id.set(name, false); } return id; diff --git a/indra/llcharacter/llanimationstates.h b/indra/llcharacter/llanimationstates.h index 70134c12ab..85232b6612 100644 --- a/indra/llcharacter/llanimationstates.h +++ b/indra/llcharacter/llanimationstates.h @@ -220,7 +220,7 @@ public: // Return the animation state for the given name. // Retun NULL if the name is invalid. //----------------------------------------------------------------------------- - LLUUID stringToAnimState( const std::string& name, BOOL allow_ids = TRUE ); + LLUUID stringToAnimState( const std::string& name, bool allow_ids = true ); //----------------------------------------------------------------------------- // Associate an anim state with a name diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp index 3aa2c86aad..9dace08e6f 100644 --- a/indra/llcharacter/llbvhloader.cpp +++ b/indra/llcharacter/llbvhloader.cpp @@ -184,7 +184,7 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error LL_DEBUGS("BVH") << "After translations and optimize" << LL_ENDL; dumpBVHInfo(); - mInitialized = TRUE; + mInitialized = true; } @@ -227,7 +227,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName) //-------------------------------------------------------------------- // load data one line at a time //-------------------------------------------------------------------- - BOOL loadingGlobals = FALSE; + bool loadingGlobals = false; while ( getLine(fp) ) { //---------------------------------------------------------------- @@ -251,7 +251,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName) if (strcmp(name, "GLOBALS")==0) { - loadingGlobals = TRUE; + loadingGlobals = true; continue; } } @@ -298,7 +298,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName) if ( sscanf(mLine, " %*s = %f %f", &loop_in, &loop_out) == 2 ) { - mLoop = TRUE; + mLoop = true; } else if ( sscanf(mLine, " %*s = %127s", trueFalse) == 1 ) /* Flawfinder: ignore */ { @@ -496,8 +496,8 @@ void LLBVHLoader::makeTranslation(std::string alias_name, std::string joint_name if (joint_name == "mPelvis") { - newTrans.mRelativePositionKey = TRUE; - newTrans.mRelativeRotationKey = TRUE; + newTrans.mRelativePositionKey = true; + newTrans.mRelativeRotationKey = true; } } @@ -609,7 +609,7 @@ ELoadStatus LLBVHLoader::loadBVHFile(const char *buffer, char* error_text, S32 & //-------------------------------------------------------------------- // consume joints //-------------------------------------------------------------------- - while (TRUE) + while (true) { //---------------------------------------------------------------- // get next line @@ -969,7 +969,7 @@ void LLBVHLoader::applyTranslations() if ( trans.mIgnore ) { //LL_INFOS() << "NOTE: Ignoring " << joint->mName.c_str() << LL_ENDL; - joint->mIgnore = TRUE; + joint->mIgnore = true; continue; } @@ -983,10 +983,10 @@ void LLBVHLoader::applyTranslations() } //Allow joint position changes as of SL-318 - joint->mIgnorePositions = FALSE; + joint->mIgnorePositions = false; if (joint->mNumChannels == 3) { - joint->mIgnorePositions = TRUE; + joint->mIgnorePositions = true; } //---------------------------------------------------------------- @@ -995,13 +995,13 @@ void LLBVHLoader::applyTranslations() if ( trans.mRelativePositionKey ) { // LL_INFOS() << "NOTE: Removing 1st position offset from all keys for " << joint->mOutName.c_str() << LL_ENDL; - joint->mRelativePositionKey = TRUE; + joint->mRelativePositionKey = true; } if ( trans.mRelativeRotationKey ) { // LL_INFOS() << "NOTE: Removing 1st rotation from all keys for " << joint->mOutName.c_str() << LL_ENDL; - joint->mRelativeRotationKey = TRUE; + joint->mRelativeRotationKey = true; } if ( trans.mRelativePosition.magVec() > 0.0f ) @@ -1065,8 +1065,8 @@ void LLBVHLoader::optimize() for (Joint* joint : mJoints) { - BOOL pos_changed = FALSE; - BOOL rot_changed = FALSE; + bool pos_changed = false; + bool rot_changed = false; if ( ! joint->mIgnore ) { @@ -1079,7 +1079,7 @@ void LLBVHLoader::optimize() // no keys? if (first_key == joint->mKeys.end()) { - joint->mIgnore = TRUE; + joint->mIgnore = true; continue; } @@ -1092,13 +1092,13 @@ void LLBVHLoader::optimize() { // *FIX: use single frame to move pelvis // if only one keyframe force output for this joint - rot_changed = TRUE; + rot_changed = true; } else { // if more than one keyframe, use first frame as reference and skip to second - first_key->mIgnorePos = TRUE; - first_key->mIgnoreRot = TRUE; + first_key->mIgnorePos = true; + first_key->mIgnoreRot = true; ++ki; } @@ -1119,7 +1119,7 @@ void LLBVHLoader::optimize() joint->mNumPosKeys++; if (dist_vec_squared(LLVector3(ki_prev->mPos), first_frame_pos) > POSITION_MOTION_THRESHOLD_SQUARED) { - pos_changed = TRUE; + pos_changed = true; } } else @@ -1132,12 +1132,12 @@ void LLBVHLoader::optimize() if (dist_vec_squared(current_pos, first_frame_pos) > POSITION_MOTION_THRESHOLD_SQUARED) { - pos_changed = TRUE; + pos_changed = true; } if (dist_vec_squared(interp_pos, test_pos) < POSITION_KEYFRAME_THRESHOLD_SQUARED) { - ki_prev->mIgnorePos = TRUE; + ki_prev->mIgnorePos = true; numPosFramesConsidered++; } else @@ -1158,7 +1158,7 @@ void LLBVHLoader::optimize() if (rot_test > ROTATION_MOTION_THRESHOLD) { - rot_changed = TRUE; + rot_changed = true; } } else @@ -1180,7 +1180,7 @@ void LLBVHLoader::optimize() rot_test = x_delta + y_delta; if (rot_test > ROTATION_MOTION_THRESHOLD) { - rot_changed = TRUE; + rot_changed = true; } x_delta = dist_vec(LLVector3::x_axis * interp_rot, LLVector3::x_axis * test_rot); y_delta = dist_vec(LLVector3::y_axis * interp_rot, LLVector3::y_axis * test_rot); @@ -1202,9 +1202,9 @@ void LLBVHLoader::optimize() // because it's significantly faster. if (diff_max > 0) { - if (ki_max->mIgnoreRot == TRUE) + if (ki_max->mIgnoreRot) { - ki_max->mIgnoreRot = FALSE; + ki_max->mIgnoreRot = false; joint->mNumRotKeys++; } diff_max = 0; @@ -1213,7 +1213,7 @@ void LLBVHLoader::optimize() else { // This keyframe isn't significant enough, throw it away. - ki_prev->mIgnoreRot = TRUE; + ki_prev->mIgnoreRot = true; numRotFramesConsidered++; // Store away the keyframe that has the largest deviation from the interpolated line, for insertion later. if (rot_test > diff_max) @@ -1232,7 +1232,7 @@ void LLBVHLoader::optimize() if (!(pos_changed || rot_changed)) { //LL_INFOS() << "Ignoring joint " << joint->mName << LL_ENDL; - joint->mIgnore = TRUE; + joint->mIgnore = true; } } } @@ -1245,13 +1245,13 @@ void LLBVHLoader::reset() mDuration = 0.0f; mPriority = 2; - mLoop = FALSE; + mLoop = false; mLoopInPoint = 0.f; mLoopOutPoint = 0.f; mEaseIn = 0.3f; mEaseOut = 0.3f; mHand = 1; - mInitialized = FALSE; + mInitialized = false; mEmoteName = ""; mLineNumber = 0; @@ -1262,19 +1262,19 @@ void LLBVHLoader::reset() //------------------------------------------------------------------------ // LLBVHLoader::getLine() //------------------------------------------------------------------------ -BOOL LLBVHLoader::getLine(apr_file_t* fp) +bool LLBVHLoader::getLine(apr_file_t* fp) { if (apr_file_eof(fp) == APR_EOF) { - return FALSE; + return false; } if ( apr_file_gets(mLine, BVH_PARSER_LINE_SIZE, fp) == APR_SUCCESS) { mLineNumber++; - return TRUE; + return true; } - return FALSE; + return false; } // returns required size of output buffer @@ -1287,7 +1287,7 @@ U32 LLBVHLoader::getOutputSize() } // writes contents to datapacker -BOOL LLBVHLoader::serialize(LLDataPacker& dp) +bool LLBVHLoader::serialize(LLDataPacker& dp) { F32 time; @@ -1496,5 +1496,5 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp) } - return TRUE; + return true; } diff --git a/indra/llcharacter/llbvhloader.h b/indra/llcharacter/llbvhloader.h index 7923666d5c..de31f76dd3 100644 --- a/indra/llcharacter/llbvhloader.h +++ b/indra/llcharacter/llbvhloader.h @@ -71,8 +71,8 @@ struct Key F32 mPos[3]; F32 mRot[3]; - BOOL mIgnorePos; - BOOL mIgnoreRot; + bool mIgnorePos; + bool mIgnoreRot; }; @@ -89,10 +89,10 @@ struct Joint Joint(const char *name) { mName = name; - mIgnore = FALSE; - mIgnorePositions = FALSE; - mRelativePositionKey = FALSE; - mRelativeRotationKey = FALSE; + mIgnore = false; + mIgnorePositions = false; + mRelativePositionKey = false; + mRelativeRotationKey = false; mOutName = name; mOrder[0] = 'X'; mOrder[1] = 'Y'; @@ -111,10 +111,10 @@ struct Joint LLVector3 mRelativePosition; // std::string mName; - BOOL mIgnore; - BOOL mIgnorePositions; - BOOL mRelativePositionKey; - BOOL mRelativeRotationKey; + bool mIgnore; + bool mIgnorePositions; + bool mRelativePositionKey; + bool mRelativeRotationKey; std::string mOutName; std::string mMergeParentName; std::string mMergeChildName; @@ -161,18 +161,18 @@ class Translation public: Translation() { - mIgnore = FALSE; - mIgnorePositions = FALSE; - mRelativePositionKey = FALSE; - mRelativeRotationKey = FALSE; + mIgnore = false; + mIgnorePositions = false; + mRelativePositionKey = false; + mRelativeRotationKey = false; mPriorityModifier = 0; } std::string mOutName; - BOOL mIgnore; - BOOL mIgnorePositions; - BOOL mRelativePositionKey; - BOOL mRelativeRotationKey; + bool mIgnore; + bool mIgnorePositions; + bool mRelativePositionKey; + bool mRelativeRotationKey; LLMatrix3 mFrameMatrix; LLMatrix3 mOffsetMatrix; LLVector3 mRelativePosition; @@ -293,7 +293,7 @@ public: U32 getOutputSize(); // writes contents to datapacker - BOOL serialize(LLDataPacker& dp); + bool serialize(LLDataPacker& dp); // flags redundant keyframe data void optimize(); @@ -302,13 +302,13 @@ public: F32 getDuration() { return mDuration; } - BOOL isInitialized() { return mInitialized; } + bool isInitialized() { return mInitialized; } ELoadStatus getStatus() { return mStatus; } protected: // Consumes one line of input from file. - BOOL getLine(apr_file_t *fp); + bool getLine(apr_file_t *fp); // parser state char mLine[BVH_PARSER_LINE_SIZE]; /* Flawfinder: ignore */ @@ -322,7 +322,7 @@ protected: TranslationMap mTranslations; S32 mPriority; - BOOL mLoop; + bool mLoop; F32 mLoopInPoint; F32 mLoopOutPoint; F32 mEaseIn; @@ -330,7 +330,7 @@ protected: S32 mHand; std::string mEmoteName; - BOOL mInitialized; + bool mInitialized; ELoadStatus mStatus; // computed values diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index f2aa55a32c..264b9a0be1 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -39,7 +39,7 @@ LLStringTable LLCharacter::sVisualParamNames(1024); std::vector< LLCharacter* > LLCharacter::sInstances; -BOOL LLCharacter::sAllowInstancesChange = TRUE ; +bool LLCharacter::sAllowInstancesChange = true ; //----------------------------------------------------------------------------- // LLCharacter() @@ -73,8 +73,8 @@ LLCharacter::~LLCharacter() delete param; } - U32 i ; - U32 size = sInstances.size() ; + size_t i ; + size_t size = sInstances.size() ; for(i = 0 ; i < size ; i++) { if(sInstances[i] == this) @@ -114,7 +114,7 @@ LLJoint *LLCharacter::getJoint( const std::string &name ) //----------------------------------------------------------------------------- // registerMotion() //----------------------------------------------------------------------------- -BOOL LLCharacter::registerMotion( const LLUUID& id, LLMotionConstructor create ) +bool LLCharacter::registerMotion( const LLUUID& id, LLMotionConstructor create ) { return mMotionController.registerMotion(id, create); } @@ -147,7 +147,7 @@ LLMotion* LLCharacter::createMotion( const LLUUID &id ) //----------------------------------------------------------------------------- // startMotion() //----------------------------------------------------------------------------- -BOOL LLCharacter::startMotion(const LLUUID &id, F32 start_offset) +bool LLCharacter::startMotion(const LLUUID &id, F32 start_offset) { return mMotionController.startMotion(id, start_offset); } @@ -156,7 +156,7 @@ BOOL LLCharacter::startMotion(const LLUUID &id, F32 start_offset) //----------------------------------------------------------------------------- // stopMotion() //----------------------------------------------------------------------------- -BOOL LLCharacter::stopMotion(const LLUUID& id, BOOL stop_immediate) +bool LLCharacter::stopMotion(const LLUUID& id, bool stop_immediate) { return mMotionController.stopMotionLocally(id, stop_immediate); } @@ -164,7 +164,7 @@ BOOL LLCharacter::stopMotion(const LLUUID& id, BOOL stop_immediate) //----------------------------------------------------------------------------- // isMotionActive() //----------------------------------------------------------------------------- -BOOL LLCharacter::isMotionActive(const LLUUID& id) +bool LLCharacter::isMotionActive(const LLUUID& id) { LLMotion *motionp = mMotionController.findMotion(id); if (motionp) @@ -172,7 +172,7 @@ BOOL LLCharacter::isMotionActive(const LLUUID& id) return mMotionController.isMotionActive(motionp); } - return FALSE; + return false; } @@ -279,22 +279,22 @@ void LLCharacter::removeAnimationData(std::string name) //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight) +bool LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight) { S32 index = which_param->getID(); visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index); if (index_iter != mVisualParamIndexMap.end()) { index_iter->second->setWeight(weight); - return TRUE; + return true; } - return FALSE; + return false; } //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight) +bool LLCharacter::setVisualParamWeight(const char* param_name, F32 weight) { std::string tname(param_name); LLStringUtil::toLower(tname); @@ -303,25 +303,25 @@ BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight) if (name_iter != mVisualParamNameMap.end()) { name_iter->second->setWeight(weight); - return TRUE; + return true; } LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter: " << param_name << LL_ENDL; - return FALSE; + return false; } //----------------------------------------------------------------------------- // setVisualParamWeight() //----------------------------------------------------------------------------- -BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight) +bool LLCharacter::setVisualParamWeight(S32 index, F32 weight) { visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index); if (index_iter != mVisualParamIndexMap.end()) { index_iter->second->setWeight(weight); - return TRUE; + return true; } LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter index: " << index << LL_ENDL; - return FALSE; + return false; } //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index b186b9052e..b390960a75 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -125,7 +125,7 @@ public: //------------------------------------------------------------------------- // registers a motion with the character // returns true if successfull - BOOL registerMotion( const LLUUID& id, LLMotionConstructor create ); + bool registerMotion( const LLUUID& id, LLMotionConstructor create ); void removeMotion( const LLUUID& id ); @@ -137,13 +137,13 @@ public: // start a motion // returns true if successful, false if an error occurred - virtual BOOL startMotion( const LLUUID& id, F32 start_offset = 0.f); + virtual bool startMotion( const LLUUID& id, F32 start_offset = 0.f); // stop a motion - virtual BOOL stopMotion( const LLUUID& id, BOOL stop_immediate = FALSE ); + virtual bool stopMotion( const LLUUID& id, bool stop_immediate = false ); // is this motion active? - BOOL isMotionActive( const LLUUID& id ); + bool isMotionActive( const LLUUID& id ); // Event handler for motion deactivation. // Called when a motion has completely stopped and has been deactivated. @@ -156,7 +156,7 @@ public: void updateMotions(e_update_t update_type); LLAnimPauseRequest requestPause(); - BOOL areAnimationsPaused() const { return mMotionController.isPaused(); } + bool areAnimationsPaused() const { return mMotionController.isPaused(); } void setAnimTimeFactor(F32 factor) { mMotionController.setTimeFactor(factor); } void setTimeStep(F32 time_step) { mMotionController.setTimeStep(time_step); } @@ -190,9 +190,9 @@ public: void addVisualParam(LLVisualParam *param); void addSharedVisualParam(LLVisualParam *param); - virtual BOOL setVisualParamWeight(const LLVisualParam *which_param, F32 weight); - virtual BOOL setVisualParamWeight(const char* param_name, F32 weight); - virtual BOOL setVisualParamWeight(S32 index, F32 weight); + virtual bool setVisualParamWeight(const LLVisualParam *which_param, F32 weight); + virtual bool setVisualParamWeight(const char* param_name, F32 weight); + virtual bool setVisualParamWeight(S32 index, F32 weight); // get visual param weight by param or name F32 getVisualParamWeight(LLVisualParam *distortion); @@ -256,7 +256,7 @@ public: void setSkeletonSerialNum( U32 num ) { mSkeletonSerialNum = num; } static std::vector< LLCharacter* > sInstances; - static BOOL sAllowInstancesChange ; //debug use + static bool sAllowInstancesChange ; //debug use virtual void setHoverOffset(const LLVector3& hover_offset, bool send_update=true) { mHoverOffset = hover_offset; } const LLVector3& getHoverOffset() const { return mHoverOffset; } diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp index b46f210d2b..9fb2a931f9 100644 --- a/indra/llcharacter/lleditingmotion.cpp +++ b/indra/llcharacter/lleditingmotion.cpp @@ -141,7 +141,7 @@ LLMotion::LLMotionInitStatus LLEditingMotion::onInitialize(LLCharacter *characte //----------------------------------------------------------------------------- // LLEditingMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLEditingMotion::onActivate() +bool LLEditingMotion::onActivate() { // propagate joint positions to kinematic chain // SL-315 @@ -155,25 +155,25 @@ BOOL LLEditingMotion::onActivate() mShoulderJoint.setRotation( mShoulderState->getJoint()->getRotation() ); mElbowJoint.setRotation( mElbowState->getJoint()->getRotation() ); - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLEditingMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask) +bool LLEditingMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; LLVector3 focus_pt; LLVector3* pointAtPt = (LLVector3*)mCharacter->getAnimationData("PointAtPoint"); - BOOL result = TRUE; + bool result = true; if (!pointAtPt) { focus_pt = mLastSelectPt; - result = FALSE; + result = false; } else { diff --git a/indra/llcharacter/lleditingmotion.h b/indra/llcharacter/lleditingmotion.h index f8834ebdea..f94756d43d 100644 --- a/indra/llcharacter/lleditingmotion.h +++ b/indra/llcharacter/lleditingmotion.h @@ -69,7 +69,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -94,14 +94,14 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + 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); + // 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(); diff --git a/indra/llcharacter/llgesture.cpp b/indra/llcharacter/llgesture.cpp index 8533605c2d..b69462ce28 100644 --- a/indra/llcharacter/llgesture.cpp +++ b/indra/llcharacter/llgesture.cpp @@ -91,17 +91,17 @@ const LLGesture &LLGesture::operator =(const LLGesture &rhs) } -BOOL LLGesture::trigger(KEY key, MASK mask) +bool LLGesture::trigger(KEY key, MASK mask) { LL_WARNS() << "Parent class trigger called: you probably didn't mean this." << LL_ENDL; - return FALSE; + return false; } -BOOL LLGesture::trigger(const std::string& trigger_string) +bool LLGesture::trigger(const std::string& trigger_string) { LL_WARNS() << "Parent class trigger called: you probably didn't mean this." << LL_ENDL; - return FALSE; + return false; } // NOT endian-neutral @@ -189,12 +189,12 @@ void LLGestureList::deleteAll() // Iterates through space delimited tokens in string, triggering any gestures found. // Generates a revised string that has the found tokens replaced by their replacement strings // and (as a minor side effect) has multiple spaces in a row replaced by single spaces. -BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::string* revised_string) +bool LLGestureList::triggerAndReviseString(const std::string &string, std::string* revised_string) { std::string tokenized = string; - BOOL found_gestures = FALSE; - BOOL first_token = TRUE; + bool found_gestures = false; + bool first_token = true; typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep(" "); @@ -235,7 +235,7 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin } } - found_gestures = TRUE; + found_gestures = true; break; } gesture = NULL; @@ -251,14 +251,14 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin revised_string->append( cur_token ); } - first_token = FALSE; + first_token = false; } return found_gestures; } -BOOL LLGestureList::trigger(KEY key, MASK mask) +bool LLGestureList::trigger(KEY key, MASK mask) { for (U32 i = 0; i < mList.size(); i++) { @@ -267,7 +267,7 @@ BOOL LLGestureList::trigger(KEY key, MASK mask) { if (gesture->trigger(key, mask)) { - return TRUE; + return true; } } else @@ -275,14 +275,14 @@ BOOL LLGestureList::trigger(KEY key, MASK mask) LL_WARNS() << "NULL gesture in gesture list (" << i << ")" << LL_ENDL; } } - return FALSE; + return false; } // NOT endian-neutral U8 *LLGestureList::serialize(U8 *buffer) const { // a single S32 serves as the header that tells us how many to read - U32 count = mList.size(); + auto count = mList.size(); htolememcpy(buffer, &count, MVT_S32, 4); buffer += sizeof(count); diff --git a/indra/llcharacter/llgesture.h b/indra/llcharacter/llgesture.h index 4e7fb6d1cc..f8504d06d2 100644 --- a/indra/llcharacter/llgesture.h +++ b/indra/llcharacter/llgesture.h @@ -55,10 +55,10 @@ public: const std::string& getOutputString() const { return mOutputString; } // Triggers if a key/mask matches it - virtual BOOL trigger(KEY key, MASK mask); + virtual bool trigger(KEY key, MASK mask); // Triggers if case-insensitive substring matches (assumes string is lowercase) - virtual BOOL trigger(const std::string &string); + virtual bool trigger(const std::string &string); // non-endian-neutral serialization U8 *serialize(U8 *buffer) const; @@ -84,13 +84,13 @@ public: virtual ~LLGestureList(); // Triggers if a key/mask matches one in the list - BOOL trigger(KEY key, MASK mask); + bool trigger(KEY key, MASK mask); // Triggers if substring matches and generates revised string. - BOOL triggerAndReviseString(const std::string &string, std::string* revised_string); + bool triggerAndReviseString(const std::string &string, std::string* revised_string); // Used for construction from UI - S32 count() const { return mList.size(); } + S32 count() const { return static_cast<S32>(mList.size()); } virtual LLGesture* get(S32 i) const { return mList.at(i); } virtual void put(LLGesture* gesture) { mList.push_back( gesture ); } void deleteAll(); diff --git a/indra/llcharacter/llhandmotion.cpp b/indra/llcharacter/llhandmotion.cpp index 5fc98a4b4d..2c03ded841 100644 --- a/indra/llcharacter/llhandmotion.cpp +++ b/indra/llcharacter/llhandmotion.cpp @@ -98,7 +98,7 @@ LLMotion::LLMotionInitStatus LLHandMotion::onInitialize(LLCharacter *character) //----------------------------------------------------------------------------- // LLHandMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLHandMotion::onActivate() +bool LLHandMotion::onActivate() { LLPolyMesh *upperBodyMesh = mCharacter->getUpperBodyMesh(); @@ -112,14 +112,14 @@ BOOL LLHandMotion::onActivate() mCharacter->setVisualParamWeight(gHandPoseNames[mCurrentPose], 1.f); mCharacter->updateVisualParams(); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLHandMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask) +bool LLHandMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; eHandPose *requestedHandPose; @@ -233,7 +233,7 @@ BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask) } } - return TRUE; + return true; } diff --git a/indra/llcharacter/llhandmotion.h b/indra/llcharacter/llhandmotion.h index a88a2aa85a..42f3411148 100644 --- a/indra/llcharacter/llhandmotion.h +++ b/indra/llcharacter/llhandmotion.h @@ -82,7 +82,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -107,19 +107,19 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + 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); + // 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(); - virtual BOOL canDeprecate() { return FALSE; } + virtual bool canDeprecate() { return false; } static std::string getHandPoseName(eHandPose pose); static eHandPose getHandPose(std::string posename); diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp index 55acb12490..6169647423 100644 --- a/indra/llcharacter/llheadrotmotion.cpp +++ b/indra/llcharacter/llheadrotmotion.cpp @@ -164,16 +164,16 @@ LLMotion::LLMotionInitStatus LLHeadRotMotion::onInitialize(LLCharacter *characte //----------------------------------------------------------------------------- // LLHeadRotMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLHeadRotMotion::onActivate() +bool LLHeadRotMotion::onActivate() { - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLHeadRotMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask) +bool LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; LLQuaternion targetHeadRotWorld; @@ -251,7 +251,7 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask) mHeadState->setRotation( nlerp(1.f - NECK_LAG, LLQuaternion::DEFAULT, head_rot_local)); } - return TRUE; + return true; } @@ -279,7 +279,7 @@ LLEyeMotion::LLEyeMotion(const LLUUID &id) : LLMotion(id) mEyeLookAwayPitch = 0.f; mEyeBlinkTime = 0.f; - mEyesClosed = FALSE; + mEyesClosed = false; mHeadJoint = NULL; @@ -362,9 +362,9 @@ LLMotion::LLMotionInitStatus LLEyeMotion::onInitialize(LLCharacter *character) //----------------------------------------------------------------------------- // LLEyeMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLEyeMotion::onActivate() +bool LLEyeMotion::onActivate() { - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -373,7 +373,7 @@ BOOL LLEyeMotion::onActivate() void LLEyeMotion::adjustEyeTarget(LLVector3* targetPos, LLJointState& left_eye_state, LLJointState& right_eye_state) { // Compute eye rotation. - BOOL has_eye_target = FALSE; + bool has_eye_target = false; LLQuaternion target_eye_rot; LLVector3 eye_look_at; F32 vergence; @@ -385,7 +385,7 @@ void LLEyeMotion::adjustEyeTarget(LLVector3* targetPos, LLJointState& left_eye_s LLVector3 up; eye_look_at = *targetPos; - has_eye_target = TRUE; + has_eye_target = true; F32 lookAtDistance = eye_look_at.normVec(); left.setVec(skyward % eye_look_at); @@ -457,7 +457,7 @@ void LLEyeMotion::adjustEyeTarget(LLVector3* targetPos, LLJointState& left_eye_s //----------------------------------------------------------------------------- // LLEyeMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) +bool LLEyeMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; //calculate jitter @@ -505,7 +505,7 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) if (rightEyeBlinkMorph == 1.f) { - mEyesClosed = TRUE; + mEyesClosed = true; mEyeBlinkTime = EYE_BLINK_CLOSE_TIME; mEyeBlinkTimer.reset(); } @@ -525,7 +525,7 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) if (rightEyeBlinkMorph == 0.f) { - mEyesClosed = FALSE; + mEyesClosed = false; mEyeBlinkTime = EYE_BLINK_MIN_TIME + ll_frand(EYE_BLINK_MAX_TIME - EYE_BLINK_MIN_TIME); mEyeBlinkTimer.reset(); } @@ -537,7 +537,7 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) adjustEyeTarget(targetPos, *mLeftEyeState, *mRightEyeState); adjustEyeTarget(targetPos, *mAltLeftEyeState, *mAltRightEyeState); - return TRUE; + return true; } diff --git a/indra/llcharacter/llheadrotmotion.h b/indra/llcharacter/llheadrotmotion.h index 3239008b92..50de4ffa26 100644 --- a/indra/llcharacter/llheadrotmotion.h +++ b/indra/llcharacter/llheadrotmotion.h @@ -64,7 +64,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -89,14 +89,14 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + 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); + // 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(); @@ -147,7 +147,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -172,16 +172,16 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + virtual bool onActivate(); void adjustEyeTarget(LLVector3* targetPos, LLJointState& left_eye_state, LLJointState& right_eye_state); // 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); + // 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(); @@ -209,7 +209,7 @@ public: // eye blinking LLFrameTimer mEyeBlinkTimer; F32 mEyeBlinkTime; - BOOL mEyesClosed; + bool mEyesClosed; }; #endif // LL_LLHEADROTMOTION_H diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 4e66777c11..c2a10d969f 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -76,7 +76,7 @@ void LLVector3OverrideMap::showJointVector3Overrides( std::ostringstream& os ) c U32 LLVector3OverrideMap::count() const { - return m_map.size(); + return static_cast<U32>(m_map.size()); } void LLVector3OverrideMap::add(const LLUUID& mesh_id, const LLVector3& pos) @@ -86,7 +86,7 @@ void LLVector3OverrideMap::add(const LLUUID& mesh_id, const LLVector3& pos) bool LLVector3OverrideMap::remove(const LLUUID& mesh_id) { - U32 remove_count = m_map.erase(mesh_id); + auto remove_count = m_map.erase(mesh_id); return (remove_count > 0); } @@ -105,10 +105,10 @@ void LLJoint::init() { mName = "unnamed"; mParent = NULL; - mXform.setScaleChildOffset(TRUE); + mXform.setScaleChildOffset(true); mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f)); mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY; - mUpdateXform = TRUE; + mUpdateXform = true; mSupport = SUPPORT_BASE; mEnd = LLVector3(0.0f, 0.0f, 0.0f); } @@ -135,7 +135,7 @@ LLJoint::LLJoint(const std::string &name, LLJoint *parent) : mJointNum(-2) { init(); - mUpdateXform = FALSE; + mUpdateXform = false; setName(name); if (parent) @@ -996,7 +996,7 @@ void LLJoint::updateWorldMatrix() if (mDirtyFlags & MATRIX_DIRTY) { sNumUpdates++; - mXform.updateMatrix(FALSE); + mXform.updateMatrix(false); mWorldMatrix.loadu(mXform.getWorldMatrix()); mDirtyFlags = 0x0; } diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index 1f08c9c91c..763c1e3865 100644 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -40,21 +40,21 @@ #include "xform.h" #include "llmatrix4a.h" -const S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15; +constexpr S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15; // Need to set this to count of animate-able joints, // currently = #bones + #collision_volumes + #attachments + 2, // rounded to next multiple of 4. -const U32 LL_CHARACTER_MAX_ANIMATED_JOINTS = 216; // must be divisible by 4! -const U32 LL_MAX_JOINTS_PER_MESH_OBJECT = 110; +constexpr U32 LL_CHARACTER_MAX_ANIMATED_JOINTS = 216; // must be divisible by 4! +constexpr U32 LL_MAX_JOINTS_PER_MESH_OBJECT = 110; // These should be higher than the joint_num of any // other joint, to avoid conflicts in updateMotionsByType() -const U32 LL_HAND_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-1); -const U32 LL_FACE_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-2); -const S32 LL_CHARACTER_MAX_PRIORITY = 7; -const F32 LL_MAX_PELVIS_OFFSET = 5.f; +constexpr U32 LL_HAND_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-1); +constexpr U32 LL_FACE_JOINT_NUM = (LL_CHARACTER_MAX_ANIMATED_JOINTS-2); +constexpr S32 LL_CHARACTER_MAX_PRIORITY = 7; +constexpr F32 LL_MAX_PELVIS_OFFSET = 5.f; -const F32 LL_JOINT_TRESHOLD_POS_OFFSET = 0.0001f; //0.1 mm +constexpr F32 LL_JOINT_TRESHOLD_POS_OFFSET = 0.0001f; //0.1 mm class LLVector3OverrideMap { @@ -133,7 +133,7 @@ protected: public: U32 mDirtyFlags; - BOOL mUpdateXform; + bool mUpdateXform; // describes the skin binding pose LLVector3 mSkinOffset; @@ -280,7 +280,7 @@ public: void clampRotation(LLQuaternion old_rot, LLQuaternion new_rot); - virtual BOOL isAnimatable() const { return TRUE; } + virtual bool isAnimatable() const { return true; } void addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed ); void removeAttachmentPosOverride( const LLUUID& mesh_id, const std::string& av_info, bool& active_override_changed ); diff --git a/indra/llcharacter/lljointsolverrp3.cpp b/indra/llcharacter/lljointsolverrp3.cpp index 6ec04bdb00..626029059e 100644 --- a/indra/llcharacter/lljointsolverrp3.cpp +++ b/indra/llcharacter/lljointsolverrp3.cpp @@ -53,9 +53,9 @@ LLJointSolverRP3::LLJointSolverRP3() mLengthAB = 1.0f; mLengthBC = 1.0f; mPoleVector.setVec( 1.0f, 0.0f, 0.0f ); - mbUseBAxis = FALSE; + mbUseBAxis = false; mTwist = 0.0f; - mFirstTime = TRUE; + mFirstTime = true; } @@ -114,7 +114,7 @@ void LLJointSolverRP3::setBAxis( const LLVector3& bAxis ) { mBAxis = bAxis; mBAxis.normVec(); - mbUseBAxis = TRUE; + mbUseBAxis = true; } //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/lljointsolverrp3.h b/indra/llcharacter/lljointsolverrp3.h index d6080a1ab2..b5c8e24a64 100644 --- a/indra/llcharacter/lljointsolverrp3.h +++ b/indra/llcharacter/lljointsolverrp3.h @@ -97,11 +97,11 @@ protected: LLVector3 mPoleVector; LLVector3 mBAxis; - BOOL mbUseBAxis; + bool mbUseBAxis; F32 mTwist; - BOOL mFirstTime; + bool mFirstTime; LLMatrix4 mSavedJointAMat; LLMatrix4 mSavedInvPlaneMat; diff --git a/indra/llcharacter/lljointstate.h b/indra/llcharacter/lljointstate.h index 584b123046..1b17400200 100644 --- a/indra/llcharacter/lljointstate.h +++ b/indra/llcharacter/lljointstate.h @@ -80,7 +80,7 @@ public: // joint that this state is applied to LLJoint* getJoint() { return mJoint; } const LLJoint* getJoint() const { return mJoint; } - BOOL setJoint( LLJoint *joint ) { mJoint = joint; return mJoint != NULL; } + bool setJoint( LLJoint *joint ) { mJoint = joint; return mJoint != NULL; } // transform type (bitwise flags can be combined) // Note that these are set automatically when various diff --git a/indra/llcharacter/llkeyframefallmotion.cpp b/indra/llcharacter/llkeyframefallmotion.cpp index ba00ee8984..82ffc87843 100644 --- a/indra/llcharacter/llkeyframefallmotion.cpp +++ b/indra/llcharacter/llkeyframefallmotion.cpp @@ -91,7 +91,7 @@ LLMotion::LLMotionInitStatus LLKeyframeFallMotion::onInitialize(LLCharacter *cha //----------------------------------------------------------------------------- // LLKeyframeFallMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLKeyframeFallMotion::onActivate() +bool LLKeyframeFallMotion::onActivate() { LLVector3 ground_pos; LLVector3 ground_normal; @@ -119,10 +119,10 @@ BOOL LLKeyframeFallMotion::onActivate() //----------------------------------------------------------------------------- // LLKeyframeFallMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLKeyframeFallMotion::onUpdate(F32 activeTime, U8* joint_mask) +bool LLKeyframeFallMotion::onUpdate(F32 activeTime, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - BOOL result = LLKeyframeMotion::onUpdate(activeTime, joint_mask); + bool result = LLKeyframeMotion::onUpdate(activeTime, joint_mask); F32 slerp_amt = clamp_rescale(activeTime / getDuration(), 0.5f, 0.75f, 0.f, 1.f); if (mPelvisState.notNull()) diff --git a/indra/llcharacter/llkeyframefallmotion.h b/indra/llcharacter/llkeyframefallmotion.h index b0136d302f..8049aff328 100644 --- a/indra/llcharacter/llkeyframefallmotion.h +++ b/indra/llcharacter/llkeyframefallmotion.h @@ -60,9 +60,9 @@ public: // animation callbacks to be implemented by subclasses //------------------------------------------------------------------------- virtual LLMotionInitStatus onInitialize(LLCharacter *character); - virtual BOOL onActivate(); + virtual bool onActivate(); virtual F32 getEaseInDuration(); - virtual BOOL onUpdate(F32 activeTime, U8* joint_mask); + virtual bool onUpdate(F32 activeTime, U8* joint_mask); protected: //------------------------------------------------------------------------- diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index 10d35c4527..12212efb66 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -66,7 +66,7 @@ static F32 MAX_CONSTRAINTS = 10; //----------------------------------------------------------------------------- LLKeyframeMotion::JointMotionList::JointMotionList() : mDuration(0.f), - mLoop(FALSE), + mLoop(false), mLoopInPoint(0.f), mLoopOutPoint(0.f), mEaseInDuration(0.f), @@ -430,8 +430,9 @@ void LLKeyframeMotion::JointMotion::update(LLJointState* joint_state, F32 time, //----------------------------------------------------------------------------- LLKeyframeMotion::LLKeyframeMotion(const LLUUID &id) : LLMotion(id), - mJointMotionList(NULL), - mPelvisp(NULL), + mJointMotionList(nullptr), + mPelvisp(nullptr), + mCharacter(nullptr), mLastSkeletonSerialNum(0), mLastUpdateTime(0.f), mLastLoopedTime(0.f), @@ -505,11 +506,12 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact LLAssetType::AT_ANIMATION, onLoadComplete, (void*)character_id, - FALSE); + false); } else { - LL_INFOS("Animation") << "Attempted to fetch animation " << mName << " with null id for character " << mCharacter->getID() << LL_ENDL; + LL_INFOS("Animation") << "Attempted to fetch animation '" << mName << "' with null id" + << " for character " << mCharacter->getID() << LL_ENDL; } return STATUS_HOLD; @@ -565,7 +567,7 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact U8 *anim_data; S32 anim_file_size; - BOOL success = FALSE; + bool success = false; LLFileSystem* anim_file = new LLFileSystem(mID, LLAssetType::AT_ANIMATION); if (!anim_file || !anim_file->getSize()) { @@ -620,7 +622,7 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact //----------------------------------------------------------------------------- // setupPose() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotion::setupPose() +bool LLKeyframeMotion::setupPose() { // add all valid joint states to the pose for (U32 jm=0; jm<mJointMotionList->getNumJointMotions(); jm++) @@ -645,7 +647,7 @@ BOOL LLKeyframeMotion::setupPose() mPelvisp = mCharacter->getJoint("mPelvis"); if (!mPelvisp) { - return FALSE; + return false; } } @@ -653,34 +655,33 @@ BOOL LLKeyframeMotion::setupPose() setLoopIn(mJointMotionList->mLoopInPoint); setLoopOut(mJointMotionList->mLoopOutPoint); - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLKeyframeMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotion::onActivate() +bool LLKeyframeMotion::onActivate() { // If the keyframe anim has an associated emote, trigger it. - if( mJointMotionList->mEmoteName.length() > 0 ) + if (mJointMotionList->mEmoteID.notNull()) { - LLUUID emote_anim_id = gAnimLibrary.stringToAnimState(mJointMotionList->mEmoteName); // don't start emote if already active to avoid recursion - if (!mCharacter->isMotionActive(emote_anim_id)) + if (!mCharacter->isMotionActive(mJointMotionList->mEmoteID)) { - mCharacter->startMotion( emote_anim_id ); + mCharacter->startMotion(mJointMotionList->mEmoteID); } } mLastLoopedTime = 0.f; - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLKeyframeMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotion::onUpdate(F32 time, U8* joint_mask) +bool LLKeyframeMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; // llassert(time >= 0.f); // This will fire @@ -869,7 +870,7 @@ void LLKeyframeMotion::initializeConstraint(JointConstraint* constraint) void LLKeyframeMotion::activateConstraint(JointConstraint* constraint) { JointConstraintSharedData *shared_data = constraint->mSharedData; - constraint->mActive = TRUE; + constraint->mActive = true; S32 joint_num; // grab ground position if we need to @@ -901,17 +902,17 @@ void LLKeyframeMotion::deactivateConstraint(JointConstraint *constraintp) { if (constraintp->mSourceVolume) { - constraintp->mSourceVolume->mUpdateXform = FALSE; + constraintp->mSourceVolume->mUpdateXform = false; } if (constraintp->mSharedData->mConstraintTargetType != CONSTRAINT_TARGET_TYPE_GROUND) { if (constraintp->mTargetVolume) { - constraintp->mTargetVolume->mUpdateXform = FALSE; + constraintp->mTargetVolume->mUpdateXform = false; } } - constraintp->mActive = FALSE; + constraintp->mActive = false; } //----------------------------------------------------------------------------- @@ -1088,9 +1089,9 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 // convert intermediate joint positions to world coordinates positions[joint_num] = ( constraint->mPositions[joint_num] * mPelvisp->getWorldRotation()) + mPelvisp->getWorldPosition(); F32 time_constant = 1.f / clamp_rescale(constraint->mFixupDistanceRMS, 0.f, 0.5f, 0.2f, 8.f); -// LL_INFOS() << "Interpolant " << LLSmoothInterpolation::getInterpolant(time_constant, FALSE) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL; +// LL_INFOS() << "Interpolant " << LLSmoothInterpolation::getInterpolant(time_constant, false) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL; positions[joint_num] = lerp(positions[joint_num], kinematic_position, - LLSmoothInterpolation::getInterpolant(time_constant, FALSE)); + LLSmoothInterpolation::getInterpolant(time_constant, false)); } S32 iteration_count; @@ -1225,9 +1226,9 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 // allow_invalid_joints should be true when handling existing content, to avoid breakage. // During upload, we should be more restrictive and reject such animations. //----------------------------------------------------------------------------- -BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints) +bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints) { - BOOL old_version = FALSE; + bool old_version = false; std::unique_ptr<LLKeyframeMotion::JointMotionList> joint_motion_list(new LLKeyframeMotion::JointMotionList); //------------------------------------------------------------------------- @@ -1237,39 +1238,47 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo U16 version; U16 sub_version; + // Amimation identifier for log messages + auto asset = [&]() -> std::string + { + return asset_id.asString() + ", char " + mCharacter->getID().asString(); + }; + if (!dp.unpackU16(version, "version")) { - LL_WARNS() << "can't read version number for animation " << asset_id << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read version number" + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU16(sub_version, "sub_version")) { - LL_WARNS() << "can't read sub version number for animation " << asset_id << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read sub version number" + << " for animation " << asset() << LL_ENDL; + return false; } if (version == 0 && sub_version == 1) { - old_version = TRUE; + old_version = true; } else if (version != KEYFRAME_MOTION_VERSION || sub_version != KEYFRAME_MOTION_SUBVERSION) { #if LL_RELEASE LL_WARNS() << "Bad animation version " << version << "." << sub_version - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; #else LL_ERRS() << "Bad animation version " << version << "." << sub_version - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; #endif } if (!dp.unpackS32(temp_priority, "base_priority")) { LL_WARNS() << "can't read animation base_priority" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion_list->mBasePriority = (LLJoint::JointPriority) temp_priority; @@ -1281,8 +1290,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo else if (joint_motion_list->mBasePriority < LLJoint::USE_MOTION_PRIORITY) { LL_WARNS() << "bad animation base_priority " << joint_motion_list->mBasePriority - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } //------------------------------------------------------------------------- @@ -1291,16 +1300,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackF32(joint_motion_list->mDuration, "duration")) { LL_WARNS() << "can't read duration" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (joint_motion_list->mDuration > MAX_ANIM_DURATION || !llfinite(joint_motion_list->mDuration)) { LL_WARNS() << "invalid animation duration" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } //------------------------------------------------------------------------- @@ -1308,16 +1317,34 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo //------------------------------------------------------------------------- if (!dp.unpackString(joint_motion_list->mEmoteName, "emote_name")) { - LL_WARNS() << "can't read optional_emote_animation" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read emote_name" + << " for animation " << asset() << LL_ENDL; + return false; } - if(joint_motion_list->mEmoteName==mID.asString()) + if (!joint_motion_list->mEmoteName.empty()) { - LL_WARNS() << "Malformed animation mEmoteName==mID" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + if (joint_motion_list->mEmoteName == mID.asString()) + { + LL_WARNS() << "Malformed animation mEmoteName==mID" + << " for animation " << asset() << LL_ENDL; + return false; + } + // "Closed_Mouth" is a very popular emote name we should ignore + if (joint_motion_list->mEmoteName == "Closed_Mouth") + { + joint_motion_list->mEmoteName.clear(); + } + else + { + joint_motion_list->mEmoteID = gAnimLibrary.stringToAnimState(joint_motion_list->mEmoteName); + if (joint_motion_list->mEmoteID.isNull()) + { + LL_WARNS() << "unknown emote_name '" << joint_motion_list->mEmoteName << "'" + << " for animation " << asset() << LL_ENDL; + joint_motion_list->mEmoteName.clear(); + } + } } //------------------------------------------------------------------------- @@ -1327,32 +1354,34 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(joint_motion_list->mLoopInPoint)) { LL_WARNS() << "can't read loop point" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackF32(joint_motion_list->mLoopOutPoint, "loop_out_point") || !llfinite(joint_motion_list->mLoopOutPoint)) { LL_WARNS() << "can't read loop point" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } - if (!dp.unpackS32(joint_motion_list->mLoop, "loop")) + S32 loop{ 0 }; + if (!dp.unpackS32(loop, "loop")) { LL_WARNS() << "can't read loop" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } + joint_motion_list->mLoop = static_cast<bool>(loop); //SL-17206 hack to alter Female_land loop setting, while current behavior won't be changed serverside LLUUID const female_land_anim("ca1baf4d-0a18-5a1f-0330-e4bd1e71f09e"); LLUUID const formal_female_land_anim("6a9a173b-61fa-3ad5-01fa-a851cfc5f66a"); if (female_land_anim == asset_id || formal_female_land_anim == asset_id) { - LL_WARNS() << "Animation(" << asset_id << ") won't be looped." << LL_ENDL; - joint_motion_list->mLoop = FALSE; + LL_WARNS() << "Animation " << asset() << " won't be looped." << LL_ENDL; + joint_motion_list->mLoop = false; } //------------------------------------------------------------------------- @@ -1362,16 +1391,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(joint_motion_list->mEaseInDuration)) { LL_WARNS() << "can't read easeIn" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackF32(joint_motion_list->mEaseOutDuration, "ease_out_duration") || !llfinite(joint_motion_list->mEaseOutDuration)) { LL_WARNS() << "can't read easeOut" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } //------------------------------------------------------------------------- @@ -1381,15 +1410,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU32(word, "hand_pose")) { LL_WARNS() << "can't read hand pose" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } - if(word > LLHandMotion::NUM_HAND_POSES) + if (word > LLHandMotion::NUM_HAND_POSES) { LL_WARNS() << "invalid LLHandMotion::eHandPose index: " << word - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion_list->mHandPose = (LLHandMotion::eHandPose)word; @@ -1398,26 +1427,26 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo // get number of joint motions //------------------------------------------------------------------------- U32 num_motions = 0; - S32 rotation_dupplicates = 0; - S32 position_dupplicates = 0; + S32 rotation_duplicates = 0; + S32 position_duplicates = 0; if (!dp.unpackU32(num_motions, "num_joints")) { LL_WARNS() << "can't read number of joints" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (num_motions == 0) { LL_WARNS() << "no joints" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } else if (num_motions > LL_CHARACTER_MAX_ANIMATED_JOINTS) { LL_WARNS() << "too many joints" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion_list->mJointMotionArray.clear(); @@ -1429,7 +1458,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo // initialize joint motions //------------------------------------------------------------------------- - for(U32 i=0; i<num_motions; ++i) + for (U32 i = 0; i < num_motions; ++i) { JointMotion* joint_motion = new JointMotion; joint_motion_list->mJointMotionArray.push_back(joint_motion); @@ -1438,15 +1467,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackString(joint_name, "joint_name")) { LL_WARNS() << "can't read joint name" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (joint_name == "mScreen" || joint_name == "mRoot") { LL_WARNS() << "attempted to animate special " << joint_name << " joint" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } //--------------------------------------------------------------------- @@ -1463,17 +1492,17 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo LL_WARNS() << "Joint will be omitted from animation: joint_num " << joint_num << " is outside of legal range [0-" << LL_CHARACTER_MAX_ANIMATED_JOINTS << ") for joint " << joint->getName() - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; joint = NULL; } } else { LL_WARNS() << "invalid joint name: " << joint_name - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; if (!allow_invalid_joints) { - return FALSE; + return false; } } @@ -1491,15 +1520,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(joint_priority, "joint_priority")) { LL_WARNS() << "can't read joint priority." - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (joint_priority < LLJoint::USE_MOTION_PRIORITY) { LL_WARNS() << "joint priority unknown - too low." - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion->mPriority = (LLJoint::JointPriority)joint_priority; @@ -1517,8 +1546,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(joint_motion->mRotationCurve.mNumKeys, "num_rot_keys") || joint_motion->mRotationCurve.mNumKeys < 0) { LL_WARNS() << "can't read number of rotation keys" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion->mRotationCurve.mInterpolationType = IT_LINEAR; @@ -1543,8 +1572,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(time)) { LL_WARNS() << "can't read rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } } @@ -1553,8 +1582,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU16(time_short, "time")) { LL_WARNS() << "can't read rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } time = U16_to_F32(time_short, 0.f, joint_motion_list->mDuration); @@ -1562,8 +1591,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (time < 0 || time > joint_motion_list->mDuration) { LL_WARNS() << "invalid frame time" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } } @@ -1576,13 +1605,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { if (!dp.unpackVector3(rot_angles, "rot_angles")) { - LL_WARNS() << "can't read rot_angles in rotation key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read rot_angles in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } if (!rot_angles.isFinite()) { - LL_WARNS() << "non-finite angle in rotation key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "non-finite angle in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } LLQuaternion::Order ro = StringToOrder("ZYX"); @@ -1592,18 +1623,21 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { if (!dp.unpackU16(x, "rot_angle_x")) { - LL_WARNS() << "can't read rot_angle_x in rotation key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read rot_angle_x in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU16(y, "rot_angle_y")) { - LL_WARNS() << "can't read rot_angle_y in rotation key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read rot_angle_y in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU16(z, "rot_angle_z")) { - LL_WARNS() << "can't read rot_angle_z in rotation key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read rot_angle_z in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } LLVector3 rot_vec; @@ -1611,20 +1645,20 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo rot_vec.mV[VY] = U16_to_F32(y, -1.f, 1.f); rot_vec.mV[VZ] = U16_to_F32(z, -1.f, 1.f); - if(!rot_vec.isFinite()) + if (!rot_vec.isFinite()) { LL_WARNS() << "non-finite angle in rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } rot_key.mRotation.unpackFromVector3(rot_vec); } - if(!rot_key.mRotation.isFinite()) + if (!rot_key.mRotation.isFinite()) { LL_WARNS() << "non-finite angle in rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } rCurve->mKeys[time] = rot_key; @@ -1632,8 +1666,10 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (joint_motion->mRotationCurve.mNumKeys > joint_motion->mRotationCurve.mKeys.size()) { - rotation_dupplicates++; - LL_INFOS() << "Motion: " << asset_id << " had dupplicate rotation keys that were removed" << LL_ENDL; + rotation_duplicates++; + LL_INFOS() << "Motion " << asset() << " had duplicated rotation keys that were removed: " + << joint_motion->mRotationCurve.mNumKeys << " > " << joint_motion->mRotationCurve.mKeys.size() + << " (" << rotation_duplicates << ")" << LL_ENDL; } //--------------------------------------------------------------------- @@ -1642,8 +1678,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(joint_motion->mPositionCurve.mNumKeys, "num_pos_keys") || joint_motion->mPositionCurve.mNumKeys < 0) { LL_WARNS() << "can't read number of position keys" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint_motion->mPositionCurve.mInterpolationType = IT_LINEAR; @@ -1656,7 +1692,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo // scan position curve keys //--------------------------------------------------------------------- PositionCurve *pCurve = &joint_motion->mPositionCurve; - BOOL is_pelvis = joint_motion->mJointName == "mPelvis"; + bool is_pelvis = joint_motion->mJointName == "mPelvis"; for (S32 k = 0; k < joint_motion->mPositionCurve.mNumKeys; k++) { U16 time_short; @@ -1668,8 +1704,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(pos_key.mTime)) { LL_WARNS() << "can't read position key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } } else @@ -1677,8 +1713,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU16(time_short, "time")) { LL_WARNS() << "can't read position key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } pos_key.mTime = U16_to_F32(time_short, 0.f, joint_motion_list->mDuration); @@ -1688,8 +1724,9 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { if (!dp.unpackVector3(pos_key.mPosition, "pos")) { - LL_WARNS() << "can't read pos in position key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read pos in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } //MAINT-6162 @@ -1704,18 +1741,21 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU16(x, "pos_x")) { - LL_WARNS() << "can't read pos_x in position key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read pos_x in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU16(y, "pos_y")) { - LL_WARNS() << "can't read pos_y in position key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read pos_y in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU16(z, "pos_z")) { - LL_WARNS() << "can't read pos_z in position key (" << k << ")" << LL_ENDL; - return FALSE; + LL_WARNS() << "can't read pos_z in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; + return false; } pos_key.mPosition.mV[VX] = U16_to_F32(x, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET); @@ -1723,11 +1763,11 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo pos_key.mPosition.mV[VZ] = U16_to_F32(z, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET); } - if(!pos_key.mPosition.isFinite()) + if (!pos_key.mPosition.isFinite()) { LL_WARNS() << "non-finite position in key" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } pCurve->mKeys[pos_key.mTime] = pos_key; @@ -1740,20 +1780,25 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (joint_motion->mPositionCurve.mNumKeys > joint_motion->mPositionCurve.mKeys.size()) { - position_dupplicates++; + position_duplicates++; + LL_INFOS() << "Motion " << asset() << " had duplicated position keys that were removed: " + << joint_motion->mPositionCurve.mNumKeys << " > " << joint_motion->mPositionCurve.mKeys.size() + << " (" << position_duplicates << ")" << LL_ENDL; } joint_motion->mUsage = joint_state->getUsage(); } - if (rotation_dupplicates > 0) + if (rotation_duplicates > 0) { - LL_INFOS() << "Motion: " << asset_id << " had " << rotation_dupplicates << " dupplicate rotation keys that were removed" << LL_ENDL; + LL_INFOS() << "Motion " << asset() << " had " << rotation_duplicates + << " duplicated rotation keys that were removed" << LL_ENDL; } - if (position_dupplicates > 0) + if (position_duplicates > 0) { - LL_INFOS() << "Motion: " << asset_id << " had " << position_dupplicates << " dupplicate position keys that were removed" << LL_ENDL; + LL_INFOS() << "Motion " << asset() << " had " << position_duplicates + << " duplicated position keys that were removed" << LL_ENDL; } //------------------------------------------------------------------------- @@ -1763,14 +1808,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(num_constraints, "num_constraints")) { LL_WARNS() << "can't read number of constraints" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (num_constraints > MAX_CONSTRAINTS || num_constraints < 0) { LL_WARNS() << "Bad number of constraints... ignoring: " << num_constraints - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; } else { @@ -1787,30 +1832,30 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU8(byte, "chain_length")) { LL_WARNS() << "can't read constraint chain length" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } constraintp->mChainLength = (S32) byte; if((U32)constraintp->mChainLength > joint_motion_list->getNumJointMotions()) { LL_WARNS() << "invalid constraint chain length" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackU8(byte, "constraint_type")) { LL_WARNS() << "can't read constraint type" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if( byte >= NUM_CONSTRAINT_TYPES ) { LL_WARNS() << "invalid constraint type" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } constraintp->mConstraintType = (EConstraintType)byte; @@ -1819,8 +1864,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "source_volume")) { LL_WARNS() << "can't read source volume name" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } bin_data[BIN_DATA_LENGTH] = 0; // Ensure null termination @@ -1829,29 +1874,29 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (constraintp->mSourceConstraintVolume == -1) { LL_WARNS() << "not a valid source constraint volume " << str - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset")) { LL_WARNS() << "can't read constraint source offset" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if( !(constraintp->mSourceConstraintOffset.isFinite()) ) { LL_WARNS() << "non-finite constraint source offset" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "target_volume")) { LL_WARNS() << "can't read target volume name" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } bin_data[BIN_DATA_LENGTH] = 0; // Ensure null termination @@ -1868,78 +1913,78 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (constraintp->mTargetConstraintVolume == -1) { LL_WARNS() << "not a valid target constraint volume " << str - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } } if (!dp.unpackVector3(constraintp->mTargetConstraintOffset, "target_offset")) { LL_WARNS() << "can't read constraint target offset" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if( !(constraintp->mTargetConstraintOffset.isFinite()) ) { LL_WARNS() << "non-finite constraint target offset" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackVector3(constraintp->mTargetConstraintDir, "target_dir")) { LL_WARNS() << "can't read constraint target direction" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if( !(constraintp->mTargetConstraintDir.isFinite()) ) { LL_WARNS() << "non-finite constraint target direction" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!constraintp->mTargetConstraintDir.isExactlyZero()) { - constraintp->mUseTargetOffset = TRUE; + constraintp->mUseTargetOffset = true; // constraintp->mTargetConstraintDir *= constraintp->mSourceConstraintOffset.magVec(); } if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start") || !llfinite(constraintp->mEaseInStartTime)) { LL_WARNS() << "can't read constraint ease in start time" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop") || !llfinite(constraintp->mEaseInStopTime)) { LL_WARNS() << "can't read constraint ease in stop time" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start") || !llfinite(constraintp->mEaseOutStartTime)) { LL_WARNS() << "can't read constraint ease out start time" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop") || !llfinite(constraintp->mEaseOutStopTime)) { LL_WARNS() << "can't read constraint ease out stop time" - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } LLJoint* joint = mCharacter->findCollisionVolume(constraintp->mSourceConstraintVolume); // get joint to which this collision volume is attached if (!joint) { - return FALSE; + return false; } constraintp->mJointStateIndices = new S32[constraintp->mChainLength + 1]; // note: mChainLength is size-limited - comes from a byte @@ -1951,8 +1996,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "Joint with no parent: " << joint->getName() << " Emote: " << joint_motion_list->mEmoteName - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } joint = parent; constraintp->mJointStateIndices[i] = -1; @@ -1963,8 +2008,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if ( !constraint_joint ) { LL_WARNS() << "Invalid joint " << j - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } if(constraint_joint == joint) @@ -1976,8 +2021,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (constraintp->mJointStateIndices[i] < 0 ) { LL_WARNS() << "No joint index for constraint " << i - << " for animation " << asset_id << LL_ENDL; - return FALSE; + << " for animation " << asset() << LL_ENDL; + return false; } } @@ -1992,15 +2037,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo setupPose(); - return TRUE; + return true; } //----------------------------------------------------------------------------- // serialize() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const +bool LLKeyframeMotion::serialize(LLDataPacker& dp) const { - BOOL success = TRUE; + bool success = true; LL_DEBUGS("BVH") << "serializing" << LL_ENDL; @@ -2035,7 +2080,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const JointMotion* joint_motionp = mJointMotionList->getJointMotion(i); success &= dp.packString(joint_motionp->mJointName, "joint_name"); success &= dp.packS32(joint_motionp->mPriority, "joint_priority"); - success &= dp.packS32(joint_motionp->mRotationCurve.mKeys.size(), "num_rot_keys"); + success &= dp.packS32(static_cast<S32>(joint_motionp->mRotationCurve.mKeys.size()), "num_rot_keys"); LL_DEBUGS("BVH") << "Joint " << i << " name: " << joint_motionp->mJointName @@ -2061,7 +2106,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const LL_DEBUGS("BVH") << " rot: t " << rot_key.mTime << " angles " << rot_angles.mV[VX] <<","<< rot_angles.mV[VY] <<","<< rot_angles.mV[VZ] << LL_ENDL; } - success &= dp.packS32(joint_motionp->mPositionCurve.mKeys.size(), "num_pos_keys"); + success &= dp.packS32(static_cast<S32>(joint_motionp->mPositionCurve.mKeys.size()), "num_pos_keys"); for (PositionCurve::key_map_t::value_type& pos_pair : joint_motionp->mPositionCurve.mKeys) { PositionKey& pos_key = pos_pair.second; @@ -2081,7 +2126,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const } } - success &= dp.packS32(mJointMotionList->mConstraints.size(), "num_constraints"); + success &= dp.packS32(static_cast<S32>(mJointMotionList->mConstraints.size()), "num_constraints"); LL_DEBUGS("BVH") << "num_constraints " << mJointMotionList->mConstraints.size() << LL_ENDL; for (JointConstraintSharedData* shared_constraintp : mJointMotionList->mConstraints) { @@ -2241,10 +2286,12 @@ void LLKeyframeMotion::setEmote(const LLUUID& emote_id) if (emote_name) { mJointMotionList->mEmoteName = emote_name; + mJointMotionList->mEmoteID = emote_id; } else { - mJointMotionList->mEmoteName = ""; + mJointMotionList->mEmoteName.clear(); + mJointMotionList->mEmoteID.setNull(); } } @@ -2283,7 +2330,7 @@ void LLKeyframeMotion::flushKeyframeCache() //----------------------------------------------------------------------------- // setLoop() //----------------------------------------------------------------------------- -void LLKeyframeMotion::setLoop(BOOL loop) +void LLKeyframeMotion::setLoop(bool loop) { if (mJointMotionList) { @@ -2515,7 +2562,7 @@ LLKeyframeMotion::JointConstraint::JointConstraint(JointConstraintSharedData* sh { mWeight = 0.f; mTotalLength = 0.f; - mActive = FALSE; + mActive = false; mSourceVolume = NULL; mTargetVolume = NULL; mFixupDistanceRMS = 0.f; diff --git a/indra/llcharacter/llkeyframemotion.h b/indra/llcharacter/llkeyframemotion.h index b1c4f5afb7..d5b27c8102 100644 --- a/indra/llcharacter/llkeyframemotion.h +++ b/indra/llcharacter/llkeyframemotion.h @@ -86,9 +86,9 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { + virtual bool getLoop() { if (mJointMotionList) return mJointMotionList->mLoop; - else return FALSE; + else return false; } // motions must report their total duration @@ -135,14 +135,14 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + 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); + // 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(); @@ -155,14 +155,14 @@ public: public: U32 getFileSize(); - BOOL serialize(LLDataPacker& dp) const; - BOOL deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints = true); - BOOL isLoaded() { return mJointMotionList != NULL; } + bool serialize(LLDataPacker& dp) const; + bool deserialize(LLDataPacker& dp, const LLUUID& asset_id, bool allow_invalid_joints = true); + bool isLoaded() { return mJointMotionList != NULL; } bool dumpToFile(const std::string& name); // setters for modifying a keyframe animation - void setLoop(BOOL loop); + void setLoop(bool loop); F32 getLoopIn() { return (mJointMotionList) ? mJointMotionList->mLoopInPoint : 0.f; @@ -211,7 +211,7 @@ protected: mEaseInStopTime(0.f), mEaseOutStartTime(0.f), mEaseOutStopTime(0.f), - mUseTargetOffset(FALSE), + mUseTargetOffset(false), mConstraintType(CONSTRAINT_TYPE_POINT), mConstraintTargetType(CONSTRAINT_TARGET_TYPE_BODY), mSourceConstraintVolume(0), @@ -231,7 +231,7 @@ protected: F32 mEaseInStopTime; F32 mEaseOutStartTime; F32 mEaseOutStopTime; - BOOL mUseTargetOffset; + bool mUseTargetOffset; EConstraintType mConstraintType; EConstraintTargetType mConstraintTargetType; }; @@ -251,7 +251,7 @@ protected: LLVector3 mPositions[MAX_CHAIN_LENGTH]; F32 mJointLengths[MAX_CHAIN_LENGTH]; F32 mJointLengthFractions[MAX_CHAIN_LENGTH]; - BOOL mActive; + bool mActive; LLVector3d mGroundPos; LLVector3 mGroundNorm; LLJoint* mSourceVolume; @@ -271,7 +271,7 @@ protected: void applyConstraint(JointConstraint* constraintp, F32 time, U8* joint_mask); - BOOL setupPose(); + bool setupPose(); public: enum AssetStatus { ASSET_LOADED, ASSET_FETCHED, ASSET_NEEDS_FETCH, ASSET_FETCH_FAILED, ASSET_UNDEFINED }; @@ -398,7 +398,7 @@ public: public: std::vector<JointMotion*> mJointMotionArray; F32 mDuration; - BOOL mLoop; + bool mLoop; F32 mLoopInPoint; F32 mLoopOutPoint; F32 mEaseInDuration; @@ -413,12 +413,14 @@ public: // TODO: LLKeyframeDataCache::getKeyframeData should probably return a class containing // JointMotionList and mEmoteName, see LLKeyframeMotion::onInitialize. std::string mEmoteName; + LLUUID mEmoteID; + public: JointMotionList(); ~JointMotionList(); U32 dumpDiagInfo(); JointMotion* getJointMotion(U32 index) const { llassert(index < mJointMotionArray.size()); return mJointMotionArray[index]; } - U32 getNumJointMotions() const { return mJointMotionArray.size(); } + U32 getNumJointMotions() const { return static_cast<U32>(mJointMotionArray.size()); } }; protected: diff --git a/indra/llcharacter/llkeyframemotionparam.cpp b/indra/llcharacter/llkeyframemotionparam.cpp index 3082d30897..e4552b96c9 100644 --- a/indra/llcharacter/llkeyframemotionparam.cpp +++ b/indra/llcharacter/llkeyframemotionparam.cpp @@ -133,7 +133,7 @@ LLMotion::LLMotionInitStatus LLKeyframeMotionParam::onInitialize(LLCharacter *ch //----------------------------------------------------------------------------- // LLKeyframeMotionParam::onActivate() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotionParam::onActivate() +bool LLKeyframeMotionParam::onActivate() { for (motion_map_t::value_type& motion_pair : mParameterizedMotions) { @@ -143,14 +143,14 @@ BOOL LLKeyframeMotionParam::onActivate() paramMotion.mMotion->activate(mActivationTimestamp); } } - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLKeyframeMotionParam::onUpdate() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) +bool LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; F32 weightFactor = 1.f / (F32)mParameterizedMotions.size(); @@ -262,7 +262,7 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) LL_INFOS() << "Param Motion weight " << mPoseBlender.getBlendedPose()->getWeight() << LL_ENDL; - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -283,13 +283,13 @@ void LLKeyframeMotionParam::onDeactivate() //----------------------------------------------------------------------------- // LLKeyframeMotionParam::addKeyframeMotion() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotionParam::addKeyframeMotion(char *name, const LLUUID &id, char *param, F32 value) +bool LLKeyframeMotionParam::addKeyframeMotion(char *name, const LLUUID &id, char *param, F32 value) { LLMotion *newMotion = mCharacter->createMotion( id ); if (!newMotion) { - return FALSE; + return false; } newMotion->setName(name); @@ -297,7 +297,7 @@ BOOL LLKeyframeMotionParam::addKeyframeMotion(char *name, const LLUUID &id, char // now add motion to this list mParameterizedMotions[param].insert(ParameterizedMotion(newMotion, value)); - return TRUE; + return true; } @@ -322,7 +322,7 @@ void LLKeyframeMotionParam::setDefaultKeyframeMotion(char *name) //----------------------------------------------------------------------------- // loadMotions() //----------------------------------------------------------------------------- -BOOL LLKeyframeMotionParam::loadMotions() +bool LLKeyframeMotionParam::loadMotions() { //------------------------------------------------------------------------- // Load named file by concatenating the character prefix with the motion name. @@ -344,7 +344,7 @@ BOOL LLKeyframeMotionParam::loadMotions() if (!fp || fileSize == 0) { LL_INFOS() << "ERROR: can't open: " << path << LL_ENDL; - return FALSE; + return false; } // allocate a text buffer @@ -383,7 +383,7 @@ BOOL LLKeyframeMotionParam::loadMotions() if ( error ) { LL_INFOS() << "ERROR: error while reading from " << path << LL_ENDL; - return FALSE; + return false; } LL_INFOS() << "Loading parametric keyframe data for: " << getName() << LL_ENDL; @@ -401,7 +401,7 @@ BOOL LLKeyframeMotionParam::loadMotions() //------------------------------------------------------------------------- // get priority //------------------------------------------------------------------------- - BOOL isFirstMotion = TRUE; + bool isFirstMotion = true; num = sscanf(p, "%79s %79s %f", strA, strB, &floatA); /* Flawfinder: ignore */ while(1) @@ -410,13 +410,13 @@ BOOL LLKeyframeMotionParam::loadMotions() if ((num != 3)) { LL_INFOS() << "WARNING: can't read parametric motion" << LL_ENDL; - return FALSE; + return false; } addKeyframeMotion(strA, gAnimLibrary.stringToAnimState(std::string(strA)), strB, floatA); if (isFirstMotion) { - isFirstMotion = FALSE; + isFirstMotion = false; setDefaultKeyframeMotion(strA); } @@ -430,7 +430,7 @@ BOOL LLKeyframeMotionParam::loadMotions() num = sscanf(p, "%79s %79s %f", strA, strB, &floatA); /* Flawfinder: ignore */ } - return TRUE; + return true; } // End diff --git a/indra/llcharacter/llkeyframemotionparam.h b/indra/llcharacter/llkeyframemotionparam.h index c906a25ceb..8c57766e9b 100644 --- a/indra/llcharacter/llkeyframemotionparam.h +++ b/indra/llcharacter/llkeyframemotionparam.h @@ -67,8 +67,8 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { - return TRUE; + virtual bool getLoop() { + return true; } // motions must report their total duration @@ -102,14 +102,14 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + 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); + // 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(); @@ -128,12 +128,12 @@ protected: }; // add a motion and associated parameter triplet - BOOL addKeyframeMotion(char *name, const LLUUID &id, char *param, F32 value); + bool addKeyframeMotion(char *name, const LLUUID &id, char *param, F32 value); // set default motion for LOD and retrieving blend constants void setDefaultKeyframeMotion(char *); - BOOL loadMotions(); + bool loadMotions(); protected: //------------------------------------------------------------------------- diff --git a/indra/llcharacter/llkeyframestandmotion.cpp b/indra/llcharacter/llkeyframestandmotion.cpp index 16f4cdc115..a882ab3563 100644 --- a/indra/llcharacter/llkeyframestandmotion.cpp +++ b/indra/llcharacter/llkeyframestandmotion.cpp @@ -46,7 +46,7 @@ const F32 POSITION_THRESHOLD = 0.1f; //----------------------------------------------------------------------------- LLKeyframeStandMotion::LLKeyframeStandMotion(const LLUUID &id) : LLKeyframeMotion(id) { - mFlipFeet = FALSE; + mFlipFeet = false; mCharacter = NULL; // create kinematic hierarchy @@ -67,7 +67,7 @@ LLKeyframeStandMotion::LLKeyframeStandMotion(const LLUUID &id) : LLKeyframeMotio mKneeRightState = NULL; mAnkleRightState = NULL; - mTrackAnkles = TRUE; + mTrackAnkles = true; mFrameNum = 0; } @@ -90,7 +90,7 @@ LLMotion::LLMotionInitStatus LLKeyframeStandMotion::onInitialize(LLCharacter *ch // save character pointer for later use mCharacter = character; - mFlipFeet = FALSE; + mFlipFeet = false; // load keyframe data, setup pose and joint states LLMotion::LLMotionInitStatus status = LLKeyframeMotion::onInitialize(character); @@ -129,7 +129,7 @@ LLMotion::LLMotionInitStatus LLKeyframeStandMotion::onInitialize(LLCharacter *ch //----------------------------------------------------------------------------- // LLKeyframeStandMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLKeyframeStandMotion::onActivate() +bool LLKeyframeStandMotion::onActivate() { //------------------------------------------------------------------------- // setup the IK solvers @@ -158,15 +158,15 @@ void LLKeyframeStandMotion::onDeactivate() //----------------------------------------------------------------------------- // LLKeyframeStandMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) +bool LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) { //------------------------------------------------------------------------- // let the base class update the cycle //------------------------------------------------------------------------- - BOOL status = LLKeyframeMotion::onUpdate(time, joint_mask); + bool status = LLKeyframeMotion::onUpdate(time, joint_mask); if (!status) { - return FALSE; + return false; } LLVector3 root_world_pos = mPelvisState->getJoint()->getParent()->getWorldPosition(); @@ -174,7 +174,7 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) // have we received a valid world position for this avatar? if (root_world_pos.isExactlyZero()) { - return TRUE; + return true; } //------------------------------------------------------------------------- @@ -185,16 +185,16 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) { mLastGoodPelvisRotation = mPelvisState->getJoint()->getWorldRotation(); mLastGoodPelvisRotation.normalize(); - mTrackAnkles = TRUE; + mTrackAnkles = true; } else if ((mCharacter->getCharacterPosition() - mLastGoodPosition).magVecSquared() > POSITION_THRESHOLD) { mLastGoodPosition = mCharacter->getCharacterPosition(); - mTrackAnkles = TRUE; + mTrackAnkles = true; } else if (mPose.getWeight() < 1.f) { - mTrackAnkles = TRUE; + mTrackAnkles = true; } @@ -255,7 +255,7 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) else if (mFrameNum < 2) { mFrameNum++; - return TRUE; + return true; } mFrameNum++; @@ -336,7 +336,7 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) //LL_INFOS() << "Stand drift amount " << (mCharacter->getCharacterPosition() - mLastGoodPosition).magVec() << LL_ENDL; // LL_INFOS() << "DEBUG: " << speed << " : " << mTrackAnkles << LL_ENDL; - return TRUE; + return true; } // End diff --git a/indra/llcharacter/llkeyframestandmotion.h b/indra/llcharacter/llkeyframestandmotion.h index 2e3634828f..df458c7a0c 100644 --- a/indra/llcharacter/llkeyframestandmotion.h +++ b/indra/llcharacter/llkeyframestandmotion.h @@ -63,9 +63,9 @@ public: // animation callbacks to be implemented by subclasses //------------------------------------------------------------------------- virtual LLMotionInitStatus onInitialize(LLCharacter *character); - virtual BOOL onActivate(); + virtual bool onActivate(); void onDeactivate(); - virtual BOOL onUpdate(F32 time, U8* joint_mask); + virtual bool onUpdate(F32 time, U8* joint_mask); public: //------------------------------------------------------------------------- @@ -85,7 +85,7 @@ public: LLCharacter *mCharacter; - BOOL mFlipFeet; + bool mFlipFeet; LLPointer<LLJointState> mPelvisState; @@ -109,7 +109,7 @@ public: LLQuaternion mLastGoodPelvisRotation; LLVector3 mLastGoodPosition; - BOOL mTrackAnkles; + bool mTrackAnkles; S32 mFrameNum; } LL_ALIGN_POSTFIX(16); diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index 132fb85785..605e15f442 100644 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -83,7 +83,7 @@ LLMotion::LLMotionInitStatus LLKeyframeWalkMotion::onInitialize(LLCharacter *cha //----------------------------------------------------------------------------- // LLKeyframeWalkMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLKeyframeWalkMotion::onActivate() +bool LLKeyframeWalkMotion::onActivate() { mRealTimeLast = 0.0f; mAdjTimeLast = 0.0f; @@ -103,7 +103,7 @@ void LLKeyframeWalkMotion::onDeactivate() //----------------------------------------------------------------------------- // LLKeyframeWalkMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLKeyframeWalkMotion::onUpdate(F32 time, U8* joint_mask) +bool LLKeyframeWalkMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; // compute time since last update @@ -174,7 +174,7 @@ LLMotion::LLMotionInitStatus LLWalkAdjustMotion::onInitialize(LLCharacter *chara //----------------------------------------------------------------------------- // LLWalkAdjustMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLWalkAdjustMotion::onActivate() +bool LLWalkAdjustMotion::onActivate() { mAnimSpeed = 0.f; mAdjustedSpeed = 0.f; @@ -191,13 +191,13 @@ BOOL LLWalkAdjustMotion::onActivate() F32 rightAnkleOffset = (mRightAnkleJoint->getWorldPosition() - mCharacter->getCharacterPosition()).magVec(); mAnkleOffset = llmax(leftAnkleOffset, rightAnkleOffset); - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLWalkAdjustMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) +bool LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; // delta_time is guaranteed to be non zero @@ -315,7 +315,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) // need to update *some* joint to keep this animation active mPelvisState->setPosition(mPelvisOffset); - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -362,18 +362,18 @@ LLMotion::LLMotionInitStatus LLFlyAdjustMotion::onInitialize(LLCharacter *charac //----------------------------------------------------------------------------- // LLFlyAdjustMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLFlyAdjustMotion::onActivate() +bool LLFlyAdjustMotion::onActivate() { mPelvisState->setPosition(LLVector3::zero); mPelvisState->setRotation(LLQuaternion::DEFAULT); mRoll = 0.f; - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLFlyAdjustMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask) +bool LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; LLVector3 ang_vel = mCharacter->getCharacterAngularVelocity() * mCharacter->getTimeDilation(); @@ -388,6 +388,6 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask) LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f)); mPelvisState->setRotation(roll); - return TRUE; + return true; } diff --git a/indra/llcharacter/llkeyframewalkmotion.h b/indra/llcharacter/llkeyframewalkmotion.h index 110dbeeee3..6320c81399 100644 --- a/indra/llcharacter/llkeyframewalkmotion.h +++ b/indra/llcharacter/llkeyframewalkmotion.h @@ -65,9 +65,9 @@ public: // animation callbacks to be implemented by subclasses //------------------------------------------------------------------------- virtual LLMotionInitStatus onInitialize(LLCharacter *character); - virtual BOOL onActivate(); + virtual bool onActivate(); virtual void onDeactivate(); - virtual BOOL onUpdate(F32 time, U8* joint_mask); + virtual bool onUpdate(F32 time, U8* joint_mask); public: //------------------------------------------------------------------------- @@ -100,11 +100,11 @@ public: // animation callbacks to be implemented by subclasses //------------------------------------------------------------------------- virtual LLMotionInitStatus onInitialize(LLCharacter *character); - virtual BOOL onActivate(); + virtual bool onActivate(); virtual void onDeactivate(); - virtual BOOL onUpdate(F32 time, U8* joint_mask); + virtual bool onUpdate(F32 time, U8* joint_mask); virtual LLJoint::JointPriority getPriority(){return LLJoint::HIGH_PRIORITY;} - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } virtual F32 getDuration() { return 0.f; } virtual F32 getEaseInDuration() { return 0.f; } virtual F32 getEaseOutDuration() { return 0.f; } @@ -150,11 +150,11 @@ public: // animation callbacks to be implemented by subclasses //------------------------------------------------------------------------- virtual LLMotionInitStatus onInitialize(LLCharacter *character); - virtual BOOL onActivate(); + virtual bool onActivate(); virtual void onDeactivate() {}; - virtual BOOL onUpdate(F32 time, U8* joint_mask); + virtual bool onUpdate(F32 time, U8* joint_mask); virtual LLJoint::JointPriority getPriority(){return LLJoint::HIGHER_PRIORITY;} - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } virtual F32 getDuration() { return 0.f; } virtual F32 getEaseInDuration() { return 0.f; } virtual F32 getEaseOutDuration() { return 0.f; } diff --git a/indra/llcharacter/llmotion.cpp b/indra/llcharacter/llmotion.cpp index 0e0df26b04..bc9f578660 100644 --- a/indra/llcharacter/llmotion.cpp +++ b/indra/llcharacter/llmotion.cpp @@ -43,8 +43,8 @@ // Class Constructor //----------------------------------------------------------------------------- LLMotion::LLMotion( const LLUUID &id ) : - mStopped(TRUE), - mActive(FALSE), + mStopped(true), + mActive(false), mID(id), mActivationTimestamp(0.f), mStopTimestamp(0.f), @@ -132,10 +132,10 @@ void LLMotion::setDeactivateCallback( void (*cb)(void *), void* userdata ) void LLMotion::setStopTime(F32 time) { mStopTimestamp = time; - mStopped = TRUE; + mStopped = true; } -BOOL LLMotion::isBlending() +bool LLMotion::isBlending() { return mPose.getWeight() < 1.f; } @@ -146,8 +146,8 @@ BOOL LLMotion::isBlending() void LLMotion::activate(F32 time) { mActivationTimestamp = time; - mStopped = FALSE; - mActive = TRUE; + mStopped = false; + mActive = true; onActivate(); } @@ -156,7 +156,7 @@ void LLMotion::activate(F32 time) //----------------------------------------------------------------------------- void LLMotion::deactivate() { - mActive = FALSE; + mActive = false; mPose.setWeight(0.f); if (mDeactivateCallback) @@ -169,9 +169,9 @@ void LLMotion::deactivate() onDeactivate(); } -BOOL LLMotion::canDeprecate() +bool LLMotion::canDeprecate() { - return TRUE; + return true; } // End diff --git a/indra/llcharacter/llmotion.h b/indra/llcharacter/llmotion.h index d45b8bceb6..4120de76a5 100644 --- a/indra/llcharacter/llmotion.h +++ b/indra/llcharacter/llmotion.h @@ -91,21 +91,21 @@ public: virtual void setStopTime(F32 time); - BOOL isStopped() const { return mStopped; } + bool isStopped() const { return mStopped; } - void setStopped(BOOL stopped) { mStopped = stopped; } + void setStopped(bool stopped) { mStopped = stopped; } - BOOL isBlending(); + bool isBlending(); // Activation functions. // It is OK for other classes to activate a motion, // but only the controller can deactivate it. - // Thus, if mActive == TRUE, the motion *may* be on the controllers active list, - // but if mActive == FALSE, the motion is gauranteed not to be on the active list. + // Thus, if mActive == true, the motion *may* be on the controllers active list, + // but if mActive == false, the motion is gauranteed not to be on the active list. protected: // Used by LLMotionController only void deactivate(); - BOOL isActive() { return mActive; } + bool isActive() { return mActive; } public: void activate(F32 time); @@ -115,7 +115,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() = 0; + virtual bool getLoop() = 0; // motions must report their total duration virtual F32 getDuration() = 0; @@ -144,33 +144,33 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character) = 0; // called per time step - // must return TRUE while it is active, and - // must return FALSE when the motion is completed. - virtual BOOL onUpdate(F32 activeTime, U8* joint_mask) = 0; + // must return true while it is active, and + // must return false when the motion is completed. + virtual bool onUpdate(F32 activeTime, U8* joint_mask) = 0; // called when a motion is deactivated virtual void onDeactivate() = 0; // can we crossfade this motion with a new instance when restarted? - // should ultimately always be TRUE, but lack of emote blending, etc + // should ultimately always be true, but lack of emote blending, etc // requires this - virtual BOOL canDeprecate(); + virtual bool canDeprecate(); // optional callback routine called when animation deactivated. void setDeactivateCallback( void (*cb)(void *), void* userdata ); protected: // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate() = 0; + virtual bool onActivate() = 0; void addJointState(const LLPointer<LLJointState>& jointState); protected: LLPose mPose; - BOOL mStopped; // motion has been stopped; - BOOL mActive; // motion is on active list (can be stopped or not stopped) + bool mStopped; // motion has been stopped; + bool mActive; // motion is on active list (can be stopped or not stopped) //------------------------------------------------------------------------- // these are set implicitly by the motion controller and @@ -199,7 +199,7 @@ public: LLTestMotion(const LLUUID &id) : LLMotion(id){} ~LLTestMotion() {} static LLMotion *create(const LLUUID& id) { return new LLTestMotion(id); } - BOOL getLoop() { return FALSE; } + bool getLoop() { return false; } F32 getDuration() { return 0.0f; } F32 getEaseInDuration() { return 0.0f; } F32 getEaseOutDuration() { return 0.0f; } @@ -208,8 +208,8 @@ public: F32 getMinPixelArea() { return 0.f; } LLMotionInitStatus onInitialize(LLCharacter*) { LL_INFOS() << "LLTestMotion::onInitialize()" << LL_ENDL; return STATUS_SUCCESS; } - BOOL onActivate() { LL_INFOS() << "LLTestMotion::onActivate()" << LL_ENDL; return TRUE; } - BOOL onUpdate(F32 time, U8* joint_mask) { LL_INFOS() << "LLTestMotion::onUpdate(" << time << ")" << LL_ENDL; return TRUE; } + bool onActivate() { LL_INFOS() << "LLTestMotion::onActivate()" << LL_ENDL; return true; } + bool onUpdate(F32 time, U8* joint_mask) { LL_INFOS() << "LLTestMotion::onUpdate(" << time << ")" << LL_ENDL; return true; } void onDeactivate() { LL_INFOS() << "LLTestMotion::onDeactivate()" << LL_ENDL; } }; @@ -225,7 +225,7 @@ public: static LLMotion *create(const LLUUID &id) { return new LLNullMotion(id); } // motions must specify whether or not they loop - /*virtual*/ BOOL getLoop() { return TRUE; } + /*virtual*/ bool getLoop() { return true; } // motions must report their total duration /*virtual*/ F32 getDuration() { return 1.f; } @@ -251,14 +251,14 @@ public: /*virtual*/ LLMotionInitStatus onInitialize(LLCharacter *character) { return STATUS_SUCCESS; } // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - /*virtual*/ BOOL onActivate() { return TRUE; } + /*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. - /*virtual*/ BOOL onUpdate(F32 activeTime, U8* joint_mask) { return TRUE; } + // must return true while it is active, and + // must return false when the motion is completed. + /*virtual*/ bool onUpdate(F32 activeTime, U8* joint_mask) { return true; } // called when a motion is deactivated /*virtual*/ void onDeactivate() {} diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 689737a190..c204c96f6c 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -76,16 +76,16 @@ LLMotionRegistry::~LLMotionRegistry() //----------------------------------------------------------------------------- // addMotion() //----------------------------------------------------------------------------- -BOOL LLMotionRegistry::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) +bool LLMotionRegistry::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) { // LL_INFOS() << "Registering motion: " << name << LL_ENDL; if (!is_in_map(mMotionTable, id)) { mMotionTable[id] = constructor; - return TRUE; + return true; } - return FALSE; + return false; } //----------------------------------------------------------------------------- @@ -133,13 +133,13 @@ LLMotionController::LLMotionController() mAnimTime(0.f), mPrevTimerElapsed(0.f), mLastTime(0.0f), - mHasRunOnce(FALSE), - mPaused(FALSE), + mHasRunOnce(false), + mPaused(false), mPausedFrame(0), mTimeStep(0.f), mTimeStepCount(0), mLastInterp(0.f), - mIsSelf(FALSE), + mIsSelf(false), mLastCountAfterPurge(0) { } @@ -156,11 +156,11 @@ LLMotionController::~LLMotionController() void LLMotionController::incMotionCounts(S32& num_motions, S32& num_loading_motions, S32& num_loaded_motions, S32& num_active_motions, S32& num_deprecated_motions) { - num_motions += mAllMotions.size(); - num_loading_motions += mLoadingMotions.size(); - num_loaded_motions += mLoadedMotions.size(); - num_active_motions += mActiveMotions.size(); - num_deprecated_motions += mDeprecatedMotions.size(); + num_motions += static_cast<S32>(mAllMotions.size()); + num_loading_motions += static_cast<S32>(mLoadingMotions.size()); + num_loaded_motions += static_cast<S32>(mLoadedMotions.size()); + num_active_motions += static_cast<S32>(mActiveMotions.size()); + num_deprecated_motions += static_cast<S32>(mDeprecatedMotions.size()); } //----------------------------------------------------------------------------- @@ -222,7 +222,7 @@ void LLMotionController::purgeExcessMotions() } // clean up all inactive, loaded motions - for (LLUUID motion_id : motions_to_kill) + for (const LLUUID& motion_id : motions_to_kill) { // look up the motion again by ID to get canonical instance // and kill it only if that one is inactive @@ -233,7 +233,7 @@ void LLMotionController::purgeExcessMotions() } } - U32 loaded_count = mLoadedMotions.size(); + U32 loaded_count = static_cast<U32>(mLoadedMotions.size()); if (loaded_count > (2 * MAX_MOTION_INSTANCES) && loaded_count > mLastCountAfterPurge) { LL_WARNS_ONCE("Animation") << loaded_count << " Loaded Motions. Amount of motions is over limit." << LL_ENDL; @@ -275,7 +275,7 @@ void LLMotionController::setTimeStep(F32 step) LLMotion* motionp = *iter; F32 activation_time = motionp->mActivationTimestamp; motionp->mActivationTimestamp = (F32)(llfloor(activation_time / step)) * step; - BOOL stopped = motionp->isStopped(); + bool stopped = motionp->isStopped(); motionp->setStopTime((F32)(llfloor(motionp->getStopTime() / step)) * step); motionp->setStopped(stopped); motionp->mSendStopTimestamp = (F32)llfloor(motionp->mSendStopTimestamp / step) * step; @@ -303,7 +303,7 @@ void LLMotionController::setCharacter(LLCharacter *character) //----------------------------------------------------------------------------- // registerMotion() //----------------------------------------------------------------------------- -BOOL LLMotionController::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) +bool LLMotionController::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) { return sRegistry.registerMotion(id, constructor); } @@ -389,7 +389,7 @@ LLMotion* LLMotionController::createMotion( const LLUUID &id ) //----------------------------------------------------------------------------- // startMotion() //----------------------------------------------------------------------------- -BOOL LLMotionController::startMotion(const LLUUID &id, F32 start_offset) +bool LLMotionController::startMotion(const LLUUID &id, F32 start_offset) { // do we have an instance of this motion for this character? LLMotion *motion = findMotion(id); @@ -415,12 +415,12 @@ BOOL LLMotionController::startMotion(const LLUUID &id, F32 start_offset) if (!motion) { - return FALSE; + return false; } //if the motion is already active and allows deprecation, then let it keep playing else if (motion->canDeprecate() && isMotionActive(motion)) { - return TRUE; + return true; } // LL_INFOS() << "Starting motion " << name << LL_ENDL; @@ -431,7 +431,7 @@ BOOL LLMotionController::startMotion(const LLUUID &id, F32 start_offset) //----------------------------------------------------------------------------- // stopMotionLocally() //----------------------------------------------------------------------------- -BOOL LLMotionController::stopMotionLocally(const LLUUID &id, BOOL stop_immediate) +bool LLMotionController::stopMotionLocally(const LLUUID &id, bool stop_immediate) { // if already inactive, return false LLMotion *motion = findMotion(id); @@ -439,11 +439,11 @@ BOOL LLMotionController::stopMotionLocally(const LLUUID &id, BOOL stop_immediate return stopMotionInstance(motion, stop_immediate||mPaused); } -BOOL LLMotionController::stopMotionInstance(LLMotion* motion, BOOL stop_immediate) +bool LLMotionController::stopMotionInstance(LLMotion* motion, bool stop_immediate) { if (!motion) { - return FALSE; + return false; } @@ -455,15 +455,15 @@ BOOL LLMotionController::stopMotionInstance(LLMotion* motion, BOOL stop_immediat { deactivateMotionInstance(motion); } - return TRUE; + return true; } else if (isMotionLoading(motion)) { - motion->setStopped(TRUE); - return TRUE; + motion->setStopped(true); + return true; } - return FALSE; + return false; } //----------------------------------------------------------------------------- @@ -518,7 +518,7 @@ void LLMotionController::updateIdleMotion(LLMotion* motionp) if (mLastTime <= motionp->mSendStopTimestamp) { mCharacter->requestStopMotion( motionp ); - stopMotionInstance(motionp, FALSE); + stopMotionInstance(motionp, false); } } else if (mAnimTime >= motionp->mActivationTimestamp) @@ -552,7 +552,7 @@ void LLMotionController::updateIdleActiveMotions() void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - BOOL update_result = TRUE; + bool update_result = true; U8 last_joint_signature[LL_CHARACTER_MAX_ANIMATED_JOINTS]; memset(&last_joint_signature, 0, sizeof(U8) * LL_CHARACTER_MAX_ANIMATED_JOINTS); @@ -568,11 +568,11 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty continue; } - BOOL update_motion = FALSE; + bool update_motion = false; if (motionp->getPose()->getWeight() < 1.f) { - update_motion = TRUE; + update_motion = true; } else { @@ -584,7 +584,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty if ((*current_signature | test_signature) > (*current_signature)) { *current_signature |= test_signature; - update_motion = TRUE; + update_motion = true; } *((U32*)&last_joint_signature[i * 4]) = *(U32*)&(mJointSignature[1][i * 4]); @@ -594,7 +594,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty if ((*current_signature | test_signature) > (*current_signature)) { *current_signature |= test_signature; - update_motion = TRUE; + update_motion = true; } } } @@ -620,7 +620,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty if (mLastTime <= motionp->mSendStopTimestamp) { mCharacter->requestStopMotion( motionp ); - stopMotionInstance(motionp, FALSE); + stopMotionInstance(motionp, false); } } @@ -701,7 +701,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty if (mLastTime <= motionp->mSendStopTimestamp) { mCharacter->requestStopMotion( motionp ); - stopMotionInstance(motionp, FALSE); + stopMotionInstance(motionp, false); } } @@ -747,12 +747,12 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty // propagate this to the network // as not all viewers are guaranteed to have access to the same logic mCharacter->requestStopMotion( motionp ); - stopMotionInstance(motionp, FALSE); + stopMotionInstance(motionp, false); } } - // even if onupdate returns FALSE, add this motion in to the blend one last time + // even if onupdate returns false, add this motion in to the blend one last time mPoseBlender.addMotion(motionp); } } @@ -815,7 +815,7 @@ void LLMotionController::updateMotions(bool force_update) // The use_quantum optimization or possibly the associated code in setTimeStamp() // does not work as implemented. // Currently setting mTimeStep to nonzero is disabled elsewhere. - BOOL use_quantum = (mTimeStep != 0.f); + bool use_quantum = (mTimeStep != 0.f); // Always update mPrevTimerElapsed F32 cur_time = mTimer.getElapsedTimeF32(); @@ -885,7 +885,7 @@ void LLMotionController::updateMotions(bool force_update) if (use_quantum) { - mPoseBlender.blendAndCache(TRUE); + mPoseBlender.blendAndCache(true); } else { @@ -893,7 +893,7 @@ void LLMotionController::updateMotions(bool force_update) } } - mHasRunOnce = TRUE; + mHasRunOnce = true; // LL_INFOS() << "Motion controller time " << motionTimer.getElapsedTimeF32() << LL_ENDL; } @@ -913,28 +913,28 @@ void LLMotionController::updateMotionsMinimal() deactivateStoppedMotions(); - mHasRunOnce = TRUE; + mHasRunOnce = true; } //----------------------------------------------------------------------------- // activateMotionInstance() //----------------------------------------------------------------------------- -BOOL LLMotionController::activateMotionInstance(LLMotion *motion, F32 time) +bool LLMotionController::activateMotionInstance(LLMotion *motion, F32 time) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; // It's not clear why the getWeight() line seems to be crashing this, but // hopefully this fixes it. if (motion == NULL || motion->getPose() == NULL) { - return FALSE; + return false; } if (mLoadingMotions.find(motion) != mLoadingMotions.end()) { // we want to start this motion, but we can't yet, so flag it as started - motion->setStopped(FALSE); + motion->setStopped(false); // report pending animations as activated - return TRUE; + return true; } motion->mResidualWeight = motion->getPose()->getWeight(); @@ -978,13 +978,13 @@ BOOL LLMotionController::activateMotionInstance(LLMotion *motion, F32 time) } } - return TRUE; + return true; } //----------------------------------------------------------------------------- // deactivateMotionInstance() //----------------------------------------------------------------------------- -BOOL LLMotionController::deactivateMotionInstance(LLMotion *motion) +bool LLMotionController::deactivateMotionInstance(LLMotion *motion) { motion->deactivate(); @@ -1001,7 +1001,7 @@ BOOL LLMotionController::deactivateMotionInstance(LLMotion *motion) mActiveMotions.remove(motion); } - return TRUE; + return true; } void LLMotionController::deprecateMotionInstance(LLMotion* motion) @@ -1009,7 +1009,7 @@ void LLMotionController::deprecateMotionInstance(LLMotion* motion) mDeprecatedMotions.insert(motion); //fade out deprecated motion - stopMotionInstance(motion, FALSE); + stopMotionInstance(motion, false); //no longer canonical mAllMotions.erase(motion->getID()); } @@ -1124,7 +1124,7 @@ void LLMotionController::pauseAllMotions() if (!mPaused) { //LL_INFOS() << "Pausing animations..." << LL_ENDL; - mPaused = TRUE; + mPaused = true; mPausedFrame = LLFrameTimer::getFrameCount(); } @@ -1138,7 +1138,7 @@ void LLMotionController::unpauseAllMotions() if (mPaused) { //LL_INFOS() << "Unpausing animations..." << LL_ENDL; - mPaused = FALSE; + mPaused = false; } } // End diff --git a/indra/llcharacter/llmotioncontroller.h b/indra/llcharacter/llmotioncontroller.h index 67193b0cf3..0c262bf24a 100644 --- a/indra/llcharacter/llmotioncontroller.h +++ b/indra/llcharacter/llmotioncontroller.h @@ -62,7 +62,7 @@ public: // adds motion classes to the registry // returns true if successfull - BOOL registerMotion( const LLUUID& id, LLMotionConstructor create); + bool registerMotion( const LLUUID& id, LLMotionConstructor create); // creates a new instance of a named motion // returns NULL motion is not registered @@ -85,7 +85,7 @@ class LLMotionController public: typedef std::list<LLMotion*> motion_list_t; typedef std::set<LLMotion*> motion_set_t; - BOOL mIsSelf; + bool mIsSelf; public: // Constructor @@ -102,7 +102,7 @@ public: // registers a motion with the controller // (actually just forwards call to motion registry) // returns true if successfull - BOOL registerMotion( const LLUUID& id, LLMotionConstructor create ); + bool registerMotion( const LLUUID& id, LLMotionConstructor create ); // creates a motion from the registry LLMotion *createMotion( const LLUUID &id ); @@ -115,13 +115,13 @@ public: // start motion // begins playing the specified motion // returns true if successful - BOOL startMotion( const LLUUID &id, F32 start_offset ); + bool startMotion( const LLUUID &id, F32 start_offset ); // stop motion // stops a playing motion // in reality, it begins the ease out transition phase // returns true if successful - BOOL stopMotionLocally( const LLUUID &id, BOOL stop_immediate ); + bool stopMotionLocally( const LLUUID &id, bool stop_immediate ); // Move motions from loading to loaded void updateLoadingMotions(); @@ -147,7 +147,7 @@ public: // pause and continue all motions void pauseAllMotions(); void unpauseAllMotions(); - BOOL isPaused() const { return mPaused; } + bool isPaused() const { return mPaused; } S32 getPausedFrame() const { return mPausedFrame; } void setTimeStep(F32 step); @@ -178,10 +178,10 @@ protected: // internal operations act on motion instances directly // as there can be duplicate motions per id during blending overlap void deleteAllMotions(); - BOOL activateMotionInstance(LLMotion *motion, F32 time); - BOOL deactivateMotionInstance(LLMotion *motion); + bool activateMotionInstance(LLMotion *motion, F32 time); + bool deactivateMotionInstance(LLMotion *motion); void deprecateMotionInstance(LLMotion* motion); - BOOL stopMotionInstance(LLMotion *motion, BOOL stop_imemdiate); + bool stopMotionInstance(LLMotion *motion, bool stop_imemdiate); void removeMotionInstance(LLMotion* motion); void updateRegularMotions(); void updateAdditiveMotions(); @@ -220,8 +220,8 @@ protected: F32 mPrevTimerElapsed; F32 mAnimTime; F32 mLastTime; - BOOL mHasRunOnce; - BOOL mPaused; + bool mHasRunOnce; + bool mPaused; S32 mPausedFrame; F32 mTimeStep; S32 mTimeStepCount; diff --git a/indra/llcharacter/llmultigesture.cpp b/indra/llcharacter/llmultigesture.cpp index e5ca051f82..a3118a401f 100644 --- a/indra/llcharacter/llmultigesture.cpp +++ b/indra/llcharacter/llmultigesture.cpp @@ -54,15 +54,15 @@ LLMultiGesture::~LLMultiGesture() void LLMultiGesture::reset() { - mPlaying = FALSE; + mPlaying = false; mCurrentStep = 0; mWaitTimer.reset(); - mWaitingAnimations = FALSE; - mWaitingKeyRelease = FALSE; - mWaitingTimer = FALSE; - mTriggeredByKey = FALSE; - mKeyReleased = FALSE; - mWaitingAtEnd = FALSE; + mWaitingAnimations = false; + mWaitingKeyRelease = false; + mWaitingTimer = false; + mTriggeredByKey = false; + mKeyReleased = false; + mWaitingAtEnd = false; mRequestedAnimIDs.clear(); mPlayingAnimIDs.clear(); } @@ -107,7 +107,7 @@ S32 LLMultiGesture::getMaxSerialSize() const return max_size; } -BOOL LLMultiGesture::serialize(LLDataPacker& dp) const +bool LLMultiGesture::serialize(LLDataPacker& dp) const { dp.packS32(GESTURE_VERSION, "version"); dp.packU8(mKey, "key"); @@ -123,16 +123,16 @@ BOOL LLMultiGesture::serialize(LLDataPacker& dp) const LLGestureStep* step = mSteps[i]; dp.packS32(step->getType(), "step_type"); - BOOL ok = step->serialize(dp); + bool ok = 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; dp.unpackS32(version, "version"); @@ -141,7 +141,7 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp) LL_WARNS() << "Bad LLMultiGesture version " << version << " should be " << GESTURE_VERSION << LL_ENDL; - return FALSE; + return false; } dp.unpackU8(mKey, "key"); @@ -157,7 +157,7 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp) if (count < 0) { LL_WARNS() << "Bad LLMultiGesture step count " << count << LL_ENDL; - return FALSE; + return false; } S32 i; @@ -172,43 +172,43 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp) case STEP_ANIMATION: { LLGestureStepAnimation* step = new LLGestureStepAnimation(); - BOOL ok = step->deserialize(dp); - if (!ok) return FALSE; + bool ok = step->deserialize(dp); + if (!ok) return false; mSteps.push_back(step); break; } case STEP_SOUND: { LLGestureStepSound* step = new LLGestureStepSound(); - BOOL ok = step->deserialize(dp); - if (!ok) return FALSE; + bool ok = step->deserialize(dp); + if (!ok) return false; mSteps.push_back(step); break; } case STEP_CHAT: { LLGestureStepChat* step = new LLGestureStepChat(); - BOOL ok = step->deserialize(dp); - if (!ok) return FALSE; + bool ok = step->deserialize(dp); + if (!ok) return false; mSteps.push_back(step); break; } case STEP_WAIT: { LLGestureStepWait* step = new LLGestureStepWait(); - BOOL ok = step->deserialize(dp); - if (!ok) return FALSE; + bool ok = step->deserialize(dp); + if (!ok) return false; mSteps.push_back(step); break; } default: { LL_WARNS() << "Bad LLMultiGesture step type " << type << LL_ENDL; - return FALSE; + return false; } } } - return TRUE; + return true; } void LLMultiGesture::dump() @@ -255,15 +255,15 @@ S32 LLGestureStepAnimation::getMaxSerialSize() const return max_size; } -BOOL LLGestureStepAnimation::serialize(LLDataPacker& dp) const +bool LLGestureStepAnimation::serialize(LLDataPacker& dp) const { dp.packString(mAnimName, "anim_name"); dp.packUUID(mAnimAssetID, "asset_id"); dp.packU32(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLGestureStepAnimation::deserialize(LLDataPacker& dp) +bool LLGestureStepAnimation::deserialize(LLDataPacker& dp) { dp.unpackString(mAnimName, "anim_name"); @@ -277,7 +277,7 @@ BOOL LLGestureStepAnimation::deserialize(LLDataPacker& dp) dp.unpackUUID(mAnimAssetID, "asset_id"); dp.unpackU32(mFlags, "flags"); - return TRUE; + return true; } // *NOTE: result is translated in LLPreviewGesture::getLabel() std::vector<std::string> LLGestureStepAnimation::getLabel() const @@ -337,21 +337,21 @@ S32 LLGestureStepSound::getMaxSerialSize() const return max_size; } -BOOL LLGestureStepSound::serialize(LLDataPacker& dp) const +bool LLGestureStepSound::serialize(LLDataPacker& dp) const { dp.packString(mSoundName, "sound_name"); dp.packUUID(mSoundAssetID, "asset_id"); dp.packU32(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLGestureStepSound::deserialize(LLDataPacker& dp) +bool LLGestureStepSound::deserialize(LLDataPacker& dp) { dp.unpackString(mSoundName, "sound_name"); dp.unpackUUID(mSoundAssetID, "asset_id"); dp.unpackU32(mFlags, "flags"); - return TRUE; + return true; } // *NOTE: result is translated in LLPreviewGesture::getLabel() std::vector<std::string> LLGestureStepSound::getLabel() const @@ -397,19 +397,19 @@ S32 LLGestureStepChat::getMaxSerialSize() const return max_size; } -BOOL LLGestureStepChat::serialize(LLDataPacker& dp) const +bool LLGestureStepChat::serialize(LLDataPacker& dp) const { dp.packString(mChatText, "chat_text"); dp.packU32(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLGestureStepChat::deserialize(LLDataPacker& dp) +bool LLGestureStepChat::deserialize(LLDataPacker& dp) { dp.unpackString(mChatText, "chat_text"); dp.unpackU32(mFlags, "flags"); - return TRUE; + return true; } // *NOTE: result is translated in LLPreviewGesture::getLabel() std::vector<std::string> LLGestureStepChat::getLabel() const @@ -452,18 +452,18 @@ S32 LLGestureStepWait::getMaxSerialSize() const return max_size; } -BOOL LLGestureStepWait::serialize(LLDataPacker& dp) const +bool LLGestureStepWait::serialize(LLDataPacker& dp) const { dp.packF32(mWaitSeconds, "wait_seconds"); dp.packU32(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLGestureStepWait::deserialize(LLDataPacker& dp) +bool LLGestureStepWait::deserialize(LLDataPacker& dp) { dp.unpackF32(mWaitSeconds, "wait_seconds"); dp.unpackU32(mFlags, "flags"); - return TRUE; + return true; } // *NOTE: result is translated in LLPreviewGesture::getLabel() std::vector<std::string> LLGestureStepWait::getLabel() const diff --git a/indra/llcharacter/llmultigesture.h b/indra/llcharacter/llmultigesture.h index bc9963f2b1..af0cb08650 100644 --- a/indra/llcharacter/llmultigesture.h +++ b/indra/llcharacter/llmultigesture.h @@ -46,8 +46,8 @@ public: // Maximum number of bytes this could hold once serialized. S32 getMaxSerialSize() const; - BOOL serialize(LLDataPacker& dp) const; - BOOL deserialize(LLDataPacker& dp); + bool serialize(LLDataPacker& dp) const; + bool deserialize(LLDataPacker& dp); void dump(); @@ -75,28 +75,28 @@ public: std::vector<LLGestureStep*> mSteps; // Is the gesture currently playing? - BOOL mPlaying { FALSE }; + bool mPlaying { false }; // "instruction pointer" for steps S32 mCurrentStep { 0 }; // We're waiting for triggered animations to stop playing - BOOL mWaitingAnimations { FALSE }; + bool mWaitingAnimations { false }; // We're waiting for key release - BOOL mWaitingKeyRelease { FALSE }; + bool mWaitingKeyRelease { false }; // We're waiting a fixed amount of time - BOOL mWaitingTimer { FALSE }; + bool mWaitingTimer { false }; // We're waiting for triggered animations to stop playing - BOOL mTriggeredByKey { FALSE }; + bool mTriggeredByKey { false }; // Has the key been released? - BOOL mKeyReleased { FALSE }; + bool mKeyReleased { false }; // Waiting after the last step played for all animations to complete - BOOL mWaitingAtEnd { FALSE }; + bool mWaitingAtEnd { false }; // Timer for waiting LLFrameTimer mWaitTimer; @@ -138,8 +138,8 @@ public: virtual std::vector<std::string> getLabel() const = 0; virtual S32 getMaxSerialSize() const = 0; - virtual BOOL serialize(LLDataPacker& dp) const = 0; - virtual BOOL deserialize(LLDataPacker& dp) = 0; + virtual bool serialize(LLDataPacker& dp) const = 0; + virtual bool deserialize(LLDataPacker& dp) = 0; virtual void dump() = 0; }; @@ -160,8 +160,8 @@ public: virtual std::vector<std::string> getLabel() const; virtual S32 getMaxSerialSize() const; - virtual BOOL serialize(LLDataPacker& dp) const; - virtual BOOL deserialize(LLDataPacker& dp); + virtual bool serialize(LLDataPacker& dp) const; + virtual bool deserialize(LLDataPacker& dp); virtual void dump(); @@ -183,8 +183,8 @@ public: virtual std::vector<std::string> getLabel() const; virtual S32 getMaxSerialSize() const; - virtual BOOL serialize(LLDataPacker& dp) const; - virtual BOOL deserialize(LLDataPacker& dp); + virtual bool serialize(LLDataPacker& dp) const; + virtual bool deserialize(LLDataPacker& dp); virtual void dump(); @@ -206,8 +206,8 @@ public: virtual std::vector<std::string> getLabel() const; virtual S32 getMaxSerialSize() const; - virtual BOOL serialize(LLDataPacker& dp) const; - virtual BOOL deserialize(LLDataPacker& dp); + virtual bool serialize(LLDataPacker& dp) const; + virtual bool deserialize(LLDataPacker& dp); virtual void dump(); @@ -232,8 +232,8 @@ public: virtual std::vector<std::string> getLabel() const; virtual S32 getMaxSerialSize() const; - virtual BOOL serialize(LLDataPacker& dp) const; - virtual BOOL deserialize(LLDataPacker& dp); + virtual bool serialize(LLDataPacker& dp) const; + virtual bool deserialize(LLDataPacker& dp); virtual void dump(); diff --git a/indra/llcharacter/llpose.cpp b/indra/llcharacter/llpose.cpp index 723b68b0a3..0652e9eb25 100644 --- a/indra/llcharacter/llpose.cpp +++ b/indra/llcharacter/llpose.cpp @@ -81,31 +81,31 @@ LLJointState *LLPose::getNextJointState() //----------------------------------------------------------------------------- // addJointState() //----------------------------------------------------------------------------- -BOOL LLPose::addJointState(const LLPointer<LLJointState>& jointState) +bool LLPose::addJointState(const LLPointer<LLJointState>& jointState) { if (mJointMap.find(jointState->getJoint()->getName()) == mJointMap.end()) { mJointMap[jointState->getJoint()->getName()] = jointState; } - return TRUE; + return true; } //----------------------------------------------------------------------------- // removeJointState() //----------------------------------------------------------------------------- -BOOL LLPose::removeJointState(const LLPointer<LLJointState>& jointState) +bool LLPose::removeJointState(const LLPointer<LLJointState>& jointState) { mJointMap.erase(jointState->getJoint()->getName()); - return TRUE; + return true; } //----------------------------------------------------------------------------- // removeAllJointStates() //----------------------------------------------------------------------------- -BOOL LLPose::removeAllJointStates() +bool LLPose::removeAllJointStates() { mJointMap.clear(); - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -181,7 +181,7 @@ LLJointStateBlender::LLJointStateBlender() { mJointStates[i] = NULL; mPriorities[i] = S32_MIN; - mAdditiveBlends[i] = FALSE; + mAdditiveBlends[i] = false; } } @@ -193,13 +193,13 @@ LLJointStateBlender::~LLJointStateBlender() //----------------------------------------------------------------------------- // addJointState() //----------------------------------------------------------------------------- -BOOL LLJointStateBlender::addJointState(const LLPointer<LLJointState>& joint_state, S32 priority, BOOL additive_blend) +bool LLJointStateBlender::addJointState(const LLPointer<LLJointState>& joint_state, S32 priority, bool additive_blend) { llassert(joint_state); if (!joint_state->getJoint()) // this joint state doesn't point to an actual joint, so we don't care about applying it - return FALSE; + return false; for(S32 i = 0; i < JSB_NUM_JOINT_STATES; i++) { @@ -208,7 +208,7 @@ BOOL LLJointStateBlender::addJointState(const LLPointer<LLJointState>& joint_sta mJointStates[i] = joint_state; mPriorities[i] = priority; mAdditiveBlends[i] = additive_blend; - return TRUE; + return true; } else if (priority > mPriorities[i]) { @@ -225,17 +225,17 @@ BOOL LLJointStateBlender::addJointState(const LLPointer<LLJointState>& joint_sta mJointStates[i] = joint_state; mPriorities[i] = priority; mAdditiveBlends[i] = additive_blend; - return TRUE; + return true; } } - return FALSE; + return false; } //----------------------------------------------------------------------------- // blendJointStates() //----------------------------------------------------------------------------- -void LLJointStateBlender::blendJointStates(BOOL apply_now) +void LLJointStateBlender::blendJointStates(bool apply_now) { // we need at least one joint to blend // if there is one, it will be in slot zero according to insertion logic @@ -468,7 +468,7 @@ LLPoseBlender::~LLPoseBlender() //----------------------------------------------------------------------------- // addMotion() //----------------------------------------------------------------------------- -BOOL LLPoseBlender::addMotion(LLMotion* motion) +bool LLPoseBlender::addMotion(LLMotion* motion) { LLPose* pose = motion->getPose(); @@ -503,7 +503,7 @@ BOOL LLPoseBlender::addMotion(LLMotion* motion) mActiveBlenders.push_front(joint_blender); } } - return TRUE; + return true; } //----------------------------------------------------------------------------- @@ -525,7 +525,7 @@ void LLPoseBlender::blendAndApply() //----------------------------------------------------------------------------- // blendAndCache() //----------------------------------------------------------------------------- -void LLPoseBlender::blendAndCache(BOOL reset_cached_joints) +void LLPoseBlender::blendAndCache(bool reset_cached_joints) { for (blender_list_t::iterator iter = mActiveBlenders.begin(); iter != mActiveBlenders.end(); ++iter) @@ -535,7 +535,7 @@ void LLPoseBlender::blendAndCache(BOOL reset_cached_joints) { jsbp->resetCachedJoint(); } - jsbp->blendJointStates(FALSE); + jsbp->blendJointStates(false); } } diff --git a/indra/llcharacter/llpose.h b/indra/llcharacter/llpose.h index 8b488a8218..f2032220e0 100644 --- a/indra/llcharacter/llpose.h +++ b/indra/llcharacter/llpose.h @@ -65,11 +65,11 @@ public: // Destructor ~LLPose(); // add a joint state in this pose - BOOL addJointState(const LLPointer<LLJointState>& jointState); + bool addJointState(const LLPointer<LLJointState>& jointState); // remove a joint state from this pose - BOOL removeJointState(const LLPointer<LLJointState>& jointState); + bool removeJointState(const LLPointer<LLJointState>& jointState); // removes all joint states from this pose - BOOL removeAllJointStates(); + bool removeAllJointStates(); // set weight for all joint states in this pose void setWeight(F32 weight); // get weight for this pose @@ -87,12 +87,12 @@ class LLJointStateBlender protected: LLPointer<LLJointState> mJointStates[JSB_NUM_JOINT_STATES]; S32 mPriorities[JSB_NUM_JOINT_STATES]; - BOOL mAdditiveBlends[JSB_NUM_JOINT_STATES]; + bool mAdditiveBlends[JSB_NUM_JOINT_STATES]; public: LLJointStateBlender(); ~LLJointStateBlender(); - void blendJointStates(BOOL apply_now = TRUE); - BOOL addJointState(const LLPointer<LLJointState>& joint_state, S32 priority, BOOL additive_blend); + void blendJointStates(bool apply_now = true); + bool addJointState(const LLPointer<LLJointState>& joint_state, S32 priority, bool additive_blend); void interpolate(F32 u); void clear(); void resetCachedJoint(); @@ -120,7 +120,7 @@ public: ~LLPoseBlender(); // request motion joint states to be added to pose blender joint state records - BOOL addMotion(LLMotion* motion); + bool addMotion(LLMotion* motion); // blend all joint states and apply to skeleton void blendAndApply(); @@ -129,7 +129,7 @@ public: void clearBlenders(); // blend all joint states and cache results - void blendAndCache(BOOL reset_cached_joints); + void blendAndCache(bool reset_cached_joints); // interpolate all joints towards cached values void interpolate(F32 u); diff --git a/indra/llcharacter/llstatemachine.cpp b/indra/llcharacter/llstatemachine.cpp index beee6f386b..38e9ef444c 100644 --- a/indra/llcharacter/llstatemachine.cpp +++ b/indra/llcharacter/llstatemachine.cpp @@ -49,7 +49,7 @@ bool operator!=(const LLUniqueID &a, const LLUniqueID &b) LLStateDiagram::LLStateDiagram() { mDefaultState = NULL; - mUseDefaultState = FALSE; + mUseDefaultState = false; } LLStateDiagram::~LLStateDiagram() @@ -58,14 +58,14 @@ LLStateDiagram::~LLStateDiagram() } // add a state to the state graph -BOOL LLStateDiagram::addState(LLFSMState *state) +bool LLStateDiagram::addState(LLFSMState *state) { mStates[state] = Transitions(); - return TRUE; + return true; } // add a directed transition between 2 states -BOOL LLStateDiagram::addTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition) +bool LLStateDiagram::addTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition) { StateMap::iterator state_it; state_it = mStates.find(&start_state); @@ -89,17 +89,17 @@ BOOL LLStateDiagram::addTransition(LLFSMState& start_state, LLFSMState& end_stat if (transition_it != state_transitions->end()) { LL_ERRS() << "LLStateTable::addDirectedTransition() : transition already exists" << LL_ENDL; - return FALSE; // transition already exists + return false; // transition already exists } (*state_transitions)[&transition] = &end_state; - return TRUE; + return true; } // add an undirected transition between 2 states -BOOL LLStateDiagram::addUndirectedTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition) +bool LLStateDiagram::addUndirectedTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition) { - BOOL result; + bool result; result = addTransition(start_state, end_state, transition); if (result) { @@ -162,7 +162,7 @@ LLFSMState* LLStateDiagram::processTransition(LLFSMState& start_state, LLFSMTran void LLStateDiagram::setDefaultState(LLFSMState& default_state) { - mUseDefaultState = TRUE; + mUseDefaultState = true; mDefaultState = &default_state; } @@ -179,13 +179,13 @@ S32 LLStateDiagram::numDeadendStates() return numDeadends; } -BOOL LLStateDiagram::stateIsValid(LLFSMState& state) +bool LLStateDiagram::stateIsValid(LLFSMState& state) { if (mStates.find(&state) != mStates.end()) { - return TRUE; + return true; } - return FALSE; + return false; } LLFSMState* LLStateDiagram::getState(U32 state_id) @@ -200,7 +200,7 @@ LLFSMState* LLStateDiagram::getState(U32 state_id) return NULL; } -BOOL LLStateDiagram::saveDotFile(const std::string& filename) +bool LLStateDiagram::saveDotFile(const std::string& filename) { LLAPRFile outfile ; outfile.open(filename, LL_APR_W); @@ -209,7 +209,7 @@ BOOL LLStateDiagram::saveDotFile(const std::string& filename) if (!dot_file) { LL_WARNS() << "LLStateDiagram::saveDotFile() : Couldn't open " << filename << " to save state diagram." << LL_ENDL; - return FALSE; + return false; } apr_file_printf(dot_file, "digraph StateMachine {\n\tsize=\"100,100\";\n\tfontsize=40;\n\tlabel=\"Finite State Machine\";\n\torientation=landscape\n\tratio=.77\n"); @@ -248,7 +248,7 @@ BOOL LLStateDiagram::saveDotFile(const std::string& filename) apr_file_printf(dot_file, "}\n"); - return TRUE; + return true; } std::ostream& operator<<(std::ostream &s, LLStateDiagram &FSM) @@ -308,7 +308,7 @@ void LLStateMachine::runCurrentState(void *data) } // set current state -BOOL LLStateMachine::setCurrentState(LLFSMState *initial_state, void* user_data, BOOL skip_entry) +bool LLStateMachine::setCurrentState(LLFSMState *initial_state, void* user_data, bool skip_entry) { llassert(mStateDiagram); @@ -319,13 +319,13 @@ BOOL LLStateMachine::setCurrentState(LLFSMState *initial_state, void* user_data, { initial_state->onEntry(user_data); } - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLStateMachine::setCurrentState(U32 state_id, void* user_data, BOOL skip_entry) +bool LLStateMachine::setCurrentState(U32 state_id, void* user_data, bool skip_entry) { llassert(mStateDiagram); @@ -338,10 +338,10 @@ BOOL LLStateMachine::setCurrentState(U32 state_id, void* user_data, BOOL skip_en { state->onEntry(user_data); } - return TRUE; + return true; } - return FALSE; + return false; } void LLStateMachine::processTransition(LLFSMTransition& transition, void* user_data) diff --git a/indra/llcharacter/llstatemachine.h b/indra/llcharacter/llstatemachine.h index 2dfd106b18..9a33798d96 100644 --- a/indra/llcharacter/llstatemachine.h +++ b/indra/llcharacter/llstatemachine.h @@ -74,7 +74,7 @@ protected: StateMap mStates; Transitions mDefaultTransitions; LLFSMState* mDefaultState; - BOOL mUseDefaultState; + bool mUseDefaultState; public: LLStateDiagram(); @@ -82,13 +82,13 @@ public: protected: // add a state to the state graph, executed implicitly when adding transitions - BOOL addState(LLFSMState *state); + bool addState(LLFSMState *state); // add a directed transition between 2 states - BOOL addTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition); + bool addTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition); // add an undirected transition between 2 states - BOOL addUndirectedTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition); + bool addUndirectedTransition(LLFSMState& start_state, LLFSMState& end_state, LLFSMTransition& transition); // add a transition that is taken if none other exist void addDefaultTransition(LLFSMState& end_state, LLFSMTransition& transition); @@ -103,14 +103,14 @@ protected: S32 numDeadendStates(); // does this state exist in the state diagram? - BOOL stateIsValid(LLFSMState& state); + bool stateIsValid(LLFSMState& state); // get a state pointer by ID LLFSMState* getState(U32 state_id); public: // save the graph in a DOT file for rendering and visualization - BOOL saveDotFile(const std::string& filename); + bool saveDotFile(const std::string& filename); }; class LLStateMachine @@ -138,10 +138,10 @@ public: void runCurrentState(void *data); // set state by state pointer - BOOL setCurrentState(LLFSMState *initial_state, void* user_data, BOOL skip_entry = TRUE); + bool setCurrentState(LLFSMState *initial_state, void* user_data, bool skip_entry = true); // set state by unique ID - BOOL setCurrentState(U32 state_id, void* user_data, BOOL skip_entry = TRUE); + bool setCurrentState(U32 state_id, void* user_data, bool skip_entry = true); }; #endif //_LL_LLSTATEMACHINE_H diff --git a/indra/llcharacter/lltargetingmotion.cpp b/indra/llcharacter/lltargetingmotion.cpp index 38cba7b778..0683a1125c 100644 --- a/indra/llcharacter/lltargetingmotion.cpp +++ b/indra/llcharacter/lltargetingmotion.cpp @@ -93,15 +93,15 @@ LLMotion::LLMotionInitStatus LLTargetingMotion::onInitialize(LLCharacter *charac //----------------------------------------------------------------------------- // LLTargetingMotion::onActivate() //----------------------------------------------------------------------------- -BOOL LLTargetingMotion::onActivate() +bool LLTargetingMotion::onActivate() { - return TRUE; + return true; } //----------------------------------------------------------------------------- // LLTargetingMotion::onUpdate() //----------------------------------------------------------------------------- -BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask) +bool LLTargetingMotion::onUpdate(F32 time, U8* joint_mask) { LL_PROFILE_ZONE_SCOPED; F32 slerp_amt = LLSmoothInterpolation::getInterpolant(TORSO_TARGET_HALF_LIFE); @@ -109,11 +109,11 @@ BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask) LLVector3 target; LLVector3* lookAtPoint = (LLVector3*)mCharacter->getAnimationData("LookAtPoint"); - BOOL result = TRUE; + bool result = true; if (!lookAtPoint) { - return TRUE; + return true; } else { diff --git a/indra/llcharacter/lltargetingmotion.h b/indra/llcharacter/lltargetingmotion.h index 7a3f5566ac..9e46a76e33 100644 --- a/indra/llcharacter/lltargetingmotion.h +++ b/indra/llcharacter/lltargetingmotion.h @@ -66,7 +66,7 @@ public: //------------------------------------------------------------------------- // motions must specify whether or not they loop - virtual BOOL getLoop() { return TRUE; } + virtual bool getLoop() { return true; } // motions must report their total duration virtual F32 getDuration() { return 0.0; } @@ -91,14 +91,14 @@ public: virtual LLMotionInitStatus onInitialize(LLCharacter *character); // called when a motion is activated - // must return TRUE to indicate success, or else + // must return true to indicate success, or else // it will be deactivated - virtual BOOL onActivate(); + 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); + // must return true while it is active, and + // must return true when the motion is completed. + virtual bool onUpdate(F32 time, U8* joint_mask); // called when a motion is deactivated virtual void onDeactivate(); diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp index 3dbab7f081..105b31de65 100644 --- a/indra/llcharacter/llvisualparam.cpp +++ b/indra/llcharacter/llvisualparam.cpp @@ -48,7 +48,7 @@ LLVisualParamInfo::LLVisualParamInfo() //----------------------------------------------------------------------------- // parseXml() //----------------------------------------------------------------------------- -BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) +bool LLVisualParamInfo::parseXml(LLXmlTreeNode *node) { // attribute: id static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id"); @@ -102,7 +102,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) else { LL_WARNS() << "Avatar file: <param> has invalid sex attribute: " << sex << LL_ENDL; - return FALSE; + return false; } // attribute: name @@ -110,7 +110,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) if( !node->getFastAttributeString( name_string, mName ) ) { LL_WARNS() << "Avatar file: <param> is missing name attribute" << LL_ENDL; - return FALSE; + return false; } // attribute: label @@ -138,7 +138,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) mMaxName = "More"; } - return TRUE; + return true; } //virtual @@ -164,8 +164,8 @@ LLVisualParam::LLVisualParam() mLastWeight( 0.f ), mNext( NULL ), mTargetWeight( 0.f ), - mIsAnimating( FALSE ), - mIsDummy(FALSE), + mIsAnimating( false ), + mIsDummy(false), mID( -1 ), mInfo( 0 ), mParamLocation(LOC_UNKNOWN) @@ -207,29 +207,29 @@ LLVisualParam::~LLVisualParam() // setInfo() //----------------------------------------------------------------------------- -BOOL LLVisualParam::setInfo(LLVisualParamInfo *info) +bool LLVisualParam::setInfo(LLVisualParamInfo *info) { llassert(mInfo == NULL); if (info->mID < 0) - return FALSE; + return false; mInfo = info; mID = info->mID; - setWeight(getDefaultWeight(), FALSE ); - return TRUE; + setWeight(getDefaultWeight(), false ); + return true; } //----------------------------------------------------------------------------- // parseData() //----------------------------------------------------------------------------- -BOOL LLVisualParam::parseData(LLXmlTreeNode *node) +bool LLVisualParam::parseData(LLXmlTreeNode *node) { LLVisualParamInfo *info = new LLVisualParamInfo; info->parseXml(node); if (!setInfo(info)) - return FALSE; + return false; - return TRUE; + return true; } */ @@ -282,7 +282,7 @@ void LLVisualParam::setAnimationTarget(F32 target_value) { mTargetWeight = target_value; } - mIsAnimating = TRUE; + mIsAnimating = true; if (mNext) { @@ -327,16 +327,16 @@ void LLVisualParam::stopAnimating() { if (mIsAnimating && isTweakable()) { - mIsAnimating = FALSE; + mIsAnimating = false; setWeight(mTargetWeight); } } //virtual -BOOL LLVisualParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params) +bool LLVisualParam::linkDrivenParams(visual_param_mapper mapper, bool only_cross_params) { // nothing to do for non-driver parameters - return TRUE; + return true; } //virtual diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index 4d760ed6fa..3caddb9c62 100644 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -74,7 +74,7 @@ public: LLVisualParamInfo(); virtual ~LLVisualParamInfo() {}; - virtual BOOL parseXml(LLXmlTreeNode *node); + virtual bool parseXml(LLXmlTreeNode *node); S32 getID() const { return mID; } @@ -113,11 +113,11 @@ public: // (They can not be virtual because they use specific derived Info classes) LLVisualParamInfo* getInfo() const { return mInfo; } // This sets mInfo and calls initialization functions - BOOL setInfo(LLVisualParamInfo *info); + bool setInfo(LLVisualParamInfo *info); // Virtual functions // Pure virtuals - //virtual BOOL parseData( LLXmlTreeNode *node ) = 0; + //virtual bool parseData( LLXmlTreeNode *node ) = 0; virtual void apply( ESex avatar_sex ) = 0; // Default functions virtual void setWeight(F32 weight); @@ -125,7 +125,7 @@ public: virtual void animate(F32 delta); virtual void stopAnimating(); - virtual BOOL linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params); + virtual bool linkDrivenParams(visual_param_mapper mapper, bool only_cross_params); virtual void resetDrivenParams(); // Interface methods @@ -151,17 +151,17 @@ public: F32 getCurrentWeight() const { return mCurWeight; } F32 getLastWeight() const { return mLastWeight; } void setLastWeight(F32 val) { mLastWeight = val; } - BOOL isAnimating() const { return mIsAnimating; } - BOOL isTweakable() const { return (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) || (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT); } + bool isAnimating() const { return mIsAnimating; } + bool isTweakable() const { return (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) || (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT); } LLVisualParam* getNextParam() { return mNext; } void setNextParam( LLVisualParam *next ); void clearNextParam(); - virtual void setAnimating(BOOL is_animating) { mIsAnimating = is_animating && !mIsDummy; } - BOOL getAnimating() const { return mIsAnimating; } + virtual void setAnimating(bool is_animating) { mIsAnimating = is_animating && !mIsDummy; } + bool getAnimating() const { return mIsAnimating; } - void setIsDummy(BOOL is_dummy) { mIsDummy = is_dummy; } + void setIsDummy(bool is_dummy) { mIsDummy = is_dummy; } void setParamLocation(EParamLocation loc); EParamLocation getParamLocation() const { return mParamLocation; } @@ -173,8 +173,8 @@ protected: F32 mLastWeight; // last weight LLVisualParam* mNext; // next param in a shared chain F32 mTargetWeight; // interpolation target - BOOL mIsAnimating; // this value has been given an interpolation target - BOOL mIsDummy; // this is used to prevent dummy visual params from animating + bool mIsAnimating; // this value has been given an interpolation target + bool mIsDummy; // this is used to prevent dummy visual params from animating S32 mID; // id for storing weight/morphtarget compares compactly |