diff options
| author | Steven Bennetts <steve@lindenlab.com> | 2008-03-11 01:47:36 +0000 |
|---|---|---|
| committer | Steven Bennetts <steve@lindenlab.com> | 2008-03-11 01:47:36 +0000 |
| commit | 377ae59c21215473cf05e3cb8a86eb14c9e7715c (patch) | |
| tree | a8cb48901c3c30bc1c2ddfd5d8b2d0cab7c6c95d /indra/llcharacter/llkeyframemotionparam.cpp | |
| parent | 9d12bd5e273b8cb032e25574461a8b4528d96343 (diff) | |
merge Branch_1-19-1-Viewer -r 80930 : 81609 -> release
DEV-11202: Unhandled Excpetion in pipeline.cpp.
Merged over updated windlight ui help text from windlight14.
Reverting a const change in a virtual that was not propagated to all overrides.
DEV-10957 stop and pause Media and music buttons do not work
DEV-10762 Displayed page in the client browser disappears when crossing property boundaries.
DEV-11220 replace misspellings in alerts.xml parameters of 'messsage'
DEV-11221 fix a misspelling of 'participants' in floater_chat_history.xml tooltip
DEV-11193 clean up some viewer strings related to Windlight help text
svn merge -r81144:81147 svn+ssh://svn/svn/linden/branches/1-19-1-viewer-threads
DEV-11110 Media browser history dropdown does not save items across sessions
Ran the xuiparse -process tool on all en-us xml files. This does NOT change any data, merely reorders attributes and cleans up tab/spacing.
DEV-11349 XML CLEANUP: fix duplicate sibling names in en-us xui files
DEV-11348 Change to llmimetypes.cpp broke Media Type dropdown
dev-10623 "parcels that played movies no longer work in combo-merge-ui"
DEV-11379 - crash in LLTabContainer::draw()
DEV-11377 Elminiate dangerous LLLinkedList and LLDoubleLinkedList from newview
DEV-11158 sculpties on the top10 crash list
DEV-11404 "Send Current URL to Parcel" does not set the MIME type
merge 80958:80959 maint-ui-9-qa, DEV-11105 -- Searching for people with 3 characters like "j l" hurts the database.
DEV-10489: no draw distance cheating
DEV-879: water noise frequency
DEV-10764: macbook air support
DEV-10878: Linux Intel945 support
DEV-7551: featuretable adjustments for framerate.
DEV-11426 Enormous mini-map.
DEV-11505 - Crash in gunzip_file.
Removed final LinkedList, SkipMap, and AssocList templates from the Viewer!
DEV-11115 truncated word in the Advanced Water Editor's modal help dialog
Diffstat (limited to 'indra/llcharacter/llkeyframemotionparam.cpp')
| -rw-r--r-- | indra/llcharacter/llkeyframemotionparam.cpp | 149 |
1 files changed, 69 insertions, 80 deletions
diff --git a/indra/llcharacter/llkeyframemotionparam.cpp b/indra/llcharacter/llkeyframemotionparam.cpp index f54d1f4a83..30edc29c6e 100644 --- a/indra/llcharacter/llkeyframemotionparam.cpp +++ b/indra/llcharacter/llkeyframemotionparam.cpp @@ -48,14 +48,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -// sortFunc() -//----------------------------------------------------------------------------- -BOOL LLKeyframeMotionParam::sortFunc(ParameterizedMotion *new_motion, ParameterizedMotion *tested_motion) -{ - return (new_motion->second < tested_motion->second); -} - -//----------------------------------------------------------------------------- // LLKeyframeMotionParam() // Class Constructor //----------------------------------------------------------------------------- @@ -77,17 +69,18 @@ LLKeyframeMotionParam::LLKeyframeMotionParam( const LLUUID &id) : LLMotion(id) //----------------------------------------------------------------------------- LLKeyframeMotionParam::~LLKeyframeMotionParam() { - for (U32 i = 0; i < mParameterizedMotions.length(); i++) + for (motion_map_t::iterator iter = mParameterizedMotions.begin(); + iter != mParameterizedMotions.end(); ++iter) { - LLLinkedList< ParameterizedMotion > *motionList = *mParameterizedMotions.getValueAt(i); - for (ParameterizedMotion* paramMotion = motionList->getFirstData(); paramMotion; paramMotion = motionList->getNextData()) + motion_list_t& motionList = iter->second; + for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { - delete paramMotion->first; + const ParameterizedMotion& paramMotion = *iter2; + delete paramMotion.first; // note - deletes the structure; ParameterizedMotion pair remains intact } - delete motionList; + motionList.clear(); } - - mParameterizedMotions.removeAll(); + mParameterizedMotions.clear(); } //----------------------------------------------------------------------------- @@ -102,36 +95,39 @@ LLMotion::LLMotionInitStatus LLKeyframeMotionParam::onInitialize(LLCharacter *ch return STATUS_FAILURE; } - for (U32 i = 0; i < mParameterizedMotions.length(); i++) + for (motion_map_t::iterator iter = mParameterizedMotions.begin(); + iter != mParameterizedMotions.end(); ++iter) { - LLLinkedList< ParameterizedMotion > *motionList = *mParameterizedMotions.getValueAt(i); - for (ParameterizedMotion* paramMotion = motionList->getFirstData(); paramMotion; paramMotion = motionList->getNextData()) + motion_list_t& motionList = iter->second; + for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { - paramMotion->first->onInitialize(character); + const ParameterizedMotion& paramMotion = *iter2; - if (paramMotion->first->getDuration() > mEaseInDuration) + paramMotion.first->onInitialize(character); + + if (paramMotion.first->getDuration() > mEaseInDuration) { - mEaseInDuration = paramMotion->first->getEaseInDuration(); + mEaseInDuration = paramMotion.first->getEaseInDuration(); } - if (paramMotion->first->getEaseOutDuration() > mEaseOutDuration) + if (paramMotion.first->getEaseOutDuration() > mEaseOutDuration) { - mEaseOutDuration = paramMotion->first->getEaseOutDuration(); + mEaseOutDuration = paramMotion.first->getEaseOutDuration(); } - if (paramMotion->first->getDuration() > mDuration) + if (paramMotion.first->getDuration() > mDuration) { - mDuration = paramMotion->first->getDuration(); + mDuration = paramMotion.first->getDuration(); } - if (paramMotion->first->getPriority() > mPriority) + if (paramMotion.first->getPriority() > mPriority) { - mPriority = paramMotion->first->getPriority(); + mPriority = paramMotion.first->getPriority(); } - LLPose *pose = paramMotion->first->getPose(); + LLPose *pose = paramMotion.first->getPose(); - mPoseBlender.addMotion(paramMotion->first); + mPoseBlender.addMotion(paramMotion.first); for (LLJointState *jsp = pose->getFirstJointState(); jsp; jsp = pose->getNextJointState()) { LLPose *blendedPose = mPoseBlender.getBlendedPose(); @@ -148,12 +144,14 @@ LLMotion::LLMotionInitStatus LLKeyframeMotionParam::onInitialize(LLCharacter *ch //----------------------------------------------------------------------------- BOOL LLKeyframeMotionParam::onActivate() { - for (U32 i = 0; i < mParameterizedMotions.length(); i++) + for (motion_map_t::iterator iter = mParameterizedMotions.begin(); + iter != mParameterizedMotions.end(); ++iter) { - LLLinkedList< ParameterizedMotion > *motionList = *mParameterizedMotions.getValueAt(i); - for (ParameterizedMotion* paramMotion = motionList->getFirstData(); paramMotion; paramMotion = motionList->getNextData()) + motion_list_t& motionList = iter->second; + for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { - paramMotion->first->activate(); + const ParameterizedMotion& paramMotion = *iter2; + paramMotion.first->activate(); } } return TRUE; @@ -165,46 +163,48 @@ BOOL LLKeyframeMotionParam::onActivate() //----------------------------------------------------------------------------- BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) { - F32 weightFactor = 1.f / (F32)mParameterizedMotions.length(); - U32 i; + F32 weightFactor = 1.f / (F32)mParameterizedMotions.size(); // zero out all pose weights - for (i = 0; i < mParameterizedMotions.length(); i++) + for (motion_map_t::iterator iter = mParameterizedMotions.begin(); + iter != mParameterizedMotions.end(); ++iter) { - LLLinkedList< ParameterizedMotion > *motionList = *mParameterizedMotions.getValueAt(i); - - for (ParameterizedMotion* paramMotion = motionList->getFirstData(); paramMotion; paramMotion = motionList->getNextData()) + motion_list_t& motionList = iter->second; + for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { -// llinfos << "Weight for pose " << paramMotion->first->getName() << " is " << paramMotion->first->getPose()->getWeight() << llendl; - paramMotion->first->getPose()->setWeight(0.f); + const ParameterizedMotion& paramMotion = *iter2; +// llinfos << "Weight for pose " << paramMotion.first->getName() << " is " << paramMotion.first->getPose()->getWeight() << llendl; + paramMotion.first->getPose()->setWeight(0.f); } } - for (i = 0; i < mParameterizedMotions.length(); i++) + for (motion_map_t::iterator iter = mParameterizedMotions.begin(); + iter != mParameterizedMotions.end(); ++iter) { - LLLinkedList< ParameterizedMotion > *motionList = *mParameterizedMotions.getValueAt(i); - std::string *paramName = mParameterizedMotions.getIndexAt(i); - F32* paramValue = (F32 *)mCharacter->getAnimationData(*paramName); - ParameterizedMotion* firstMotion = NULL; - ParameterizedMotion* secondMotion = NULL; - + const std::string& paramName = iter->first; + F32* paramValue = (F32 *)mCharacter->getAnimationData(paramName); if (NULL == paramValue) // unexpected, but... { llwarns << "paramValue == NULL" << llendl; continue; } - for (ParameterizedMotion* paramMotion = motionList->getFirstData(); paramMotion; paramMotion = motionList->getNextData()) + const ParameterizedMotion* firstMotion = NULL; + const ParameterizedMotion* secondMotion = NULL; + + motion_list_t& motionList = iter->second; + for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { - paramMotion->first->onUpdate(time, joint_mask); + const ParameterizedMotion& paramMotion = *iter2; + paramMotion.first->onUpdate(time, joint_mask); - F32 distToParam = paramMotion->second - *paramValue; + F32 distToParam = paramMotion.second - *paramValue; if ( distToParam <= 0.f) { // keep track of the motion closest to the parameter value - firstMotion = paramMotion; + firstMotion = ¶mMotion; } else { @@ -212,13 +212,13 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) // so store the first motion we find as the second one we want to blend... if (firstMotion && !secondMotion ) { - secondMotion = paramMotion; + secondMotion = ¶mMotion; } //...or, if we've seen no other motion so far, make sure we blend to this only else if (!firstMotion) { - firstMotion = paramMotion; - secondMotion = paramMotion; + firstMotion = ¶mMotion; + secondMotion = ¶mMotion; } } } @@ -283,12 +283,14 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) //----------------------------------------------------------------------------- void LLKeyframeMotionParam::onDeactivate() { - for (U32 i = 0; i < mParameterizedMotions.length(); i++) + for (motion_map_t::iterator iter = mParameterizedMotions.begin(); + iter != mParameterizedMotions.end(); ++iter) { - LLLinkedList< ParameterizedMotion > *motionList = *mParameterizedMotions.getValueAt(i); - for (ParameterizedMotion* paramMotion = motionList->getFirstData(); paramMotion; paramMotion = motionList->getNextData()) + motion_list_t& motionList = iter->second; + for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { - paramMotion->first->onDeactivate(); + const ParameterizedMotion& paramMotion = *iter2; + paramMotion.first->onDeactivate(); } } } @@ -307,23 +309,8 @@ BOOL LLKeyframeMotionParam::addKeyframeMotion(char *name, const LLUUID &id, char newMotion->setName(name); - // make sure a list of motions exists for this parameter - LLLinkedList< ParameterizedMotion > *motionList; - if (mParameterizedMotions.getValue(param)) - { - motionList = *mParameterizedMotions.getValue(param); - } - else - { - motionList = new LLLinkedList< ParameterizedMotion >; - motionList->setInsertBefore(sortFunc); - mParameterizedMotions.addToHead(param, motionList); - } - // now add motion to this list - ParameterizedMotion *parameterizedMotion = new ParameterizedMotion(newMotion, value); - - motionList->addDataSorted(parameterizedMotion); + mParameterizedMotions[param].insert(ParameterizedMotion(newMotion, value)); return TRUE; } @@ -334,14 +321,16 @@ BOOL LLKeyframeMotionParam::addKeyframeMotion(char *name, const LLUUID &id, char //----------------------------------------------------------------------------- void LLKeyframeMotionParam::setDefaultKeyframeMotion(char *name) { - for (U32 i = 0; i < mParameterizedMotions.length(); i++) + for (motion_map_t::iterator iter = mParameterizedMotions.begin(); + iter != mParameterizedMotions.end(); ++iter) { - LLLinkedList< ParameterizedMotion > *motionList = *mParameterizedMotions.getValueAt(i); - for (ParameterizedMotion* paramMotion = motionList->getFirstData(); paramMotion; paramMotion = motionList->getNextData()) + motion_list_t& motionList = iter->second; + for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { - if (paramMotion->first->getName() == name) + const ParameterizedMotion& paramMotion = *iter2; + if (paramMotion.first->getName() == name) { - mDefaultKeyframeMotion = paramMotion->first; + mDefaultKeyframeMotion = paramMotion.first; } } } |
