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/newview/llwearable.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/newview/llwearable.cpp')
-rw-r--r-- | indra/newview/llwearable.cpp | 125 |
1 files changed, 49 insertions, 76 deletions
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index b4e79109ac..b63543a327 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -132,8 +132,6 @@ LLWearable::LLWearable(const LLAssetID& asset_id) : LLWearable::~LLWearable() { - mVisualParamMap.deleteAllData(); - mTEMap.deleteAllData(); } @@ -227,35 +225,37 @@ BOOL LLWearable::exportFile( FILE* file ) } // parameters - S32 num_parameters = mVisualParamMap.getLength(); + S32 num_parameters = mVisualParamMap.size(); if( fprintf( file, "parameters %d\n", num_parameters ) < 0 ) { return FALSE; } char s[ MAX_STRING ]; /* Flawfinder: ignore */ - for( F32* param_weightp = mVisualParamMap.getFirstData(); param_weightp; param_weightp = mVisualParamMap.getNextData() ) + for (param_map_t::iterator iter = mVisualParamMap.begin(); + iter != mVisualParamMap.end(); ++iter) { - S32 param_id = mVisualParamMap.getCurrentKeyWithoutIncrement(); - if( fprintf( file, "%d %s\n", param_id, terse_F32_to_string( *param_weightp, s ) ) < 0 ) + S32 param_id = iter->first; + F32 param_weight = iter->second; + if( fprintf( file, "%d %s\n", param_id, terse_F32_to_string( param_weight, s ) ) < 0 ) { return FALSE; } } // texture entries - S32 num_textures = mTEMap.getLength(); + S32 num_textures = mTEMap.size(); if( fprintf( file, "textures %d\n", num_textures ) < 0 ) { return FALSE; } - for( LLUUID* image_id = mTEMap.getFirstData(); image_id; image_id = mTEMap.getNextData() ) + for (te_map_t::iterator iter = mTEMap.begin(); + iter != mTEMap.end(); ++iter) { - S32 te = mTEMap.getCurrentKeyWithoutIncrement(); - char image_id_string[UUID_STR_LENGTH]; /* Flawfinder: ignore */ - image_id->toString( image_id_string ); - if( fprintf( file, "%d %s\n", te, image_id_string) < 0 ) + S32 te = iter->first; + LLUUID& image_id = iter->second; + if( fprintf( file, "%d %s\n", te, image_id.asString().c_str()) < 0 ) { return FALSE; } @@ -418,7 +418,7 @@ BOOL LLWearable::importFile( FILE* file ) llwarns << "Bad Wearable asset: bad parameter, #" << i << llendl; return FALSE; } - mVisualParamMap.addData( param_id, new F32(param_weight) ); + mVisualParamMap[param_id] = param_weight; } // textures header @@ -450,7 +450,7 @@ BOOL LLWearable::importFile( FILE* file ) return FALSE; } - mTEMap.addData( te, new LLUUID( text_buffer ) ); + mTEMap[te] = LLUUID(text_buffer ); } return TRUE; @@ -488,13 +488,13 @@ BOOL LLWearable::isOldVersion() if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { param_count++; - if( !mVisualParamMap.checkKey( param->getID() ) ) + if( !is_in_map(mVisualParamMap, param->getID() ) ) { return TRUE; } } } - if( param_count != mVisualParamMap.getLength() ) + if( param_count != mVisualParamMap.size() ) { return TRUE; } @@ -506,13 +506,13 @@ BOOL LLWearable::isOldVersion() if( LLVOAvatar::getTEWearableType( te ) == mType ) { te_count++; - if( !mTEMap.checkKey( te ) ) + if( !is_in_map(mTEMap, te ) ) { return TRUE; } } } - if( te_count != mTEMap.getLength() ) + if( te_count != mTEMap.size() ) { return TRUE; } @@ -543,16 +543,8 @@ BOOL LLWearable::isDirty() { if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { - F32* weightp = mVisualParamMap.getIfThere( param->getID() ); - F32 weight; - if( weightp ) - { - weight = llclamp( *weightp, param->getMinWeight(), param->getMaxWeight() ); - } - else - { - weight = param->getDefaultWeight(); - } + F32 weight = get_if_there(mVisualParamMap, param->getID(), param->getDefaultWeight()); + weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() ); U8 a = F32_to_U8( param->getWeight(), param->getMinWeight(), param->getMaxWeight() ); U8 b = F32_to_U8( weight, param->getMinWeight(), param->getMaxWeight() ); @@ -573,8 +565,7 @@ BOOL LLWearable::isDirty() llassert( 0 ); continue; } - LLUUID* mapped_image_id = mTEMap.getIfThere( te ); - const LLUUID& image_id = mapped_image_id ? *mapped_image_id : LLVOAvatar::getDefaultTEImageID( te ); + const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID( te ) ); if( avatar_image->getID() != image_id ) { return TRUE; @@ -603,24 +594,24 @@ void LLWearable::setParamsToDefaults() return; } - mVisualParamMap.deleteAllData(); + mVisualParamMap.clear(); for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) { if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { - mVisualParamMap.addData( param->getID(), new F32( param->getDefaultWeight() ) ); + mVisualParamMap[param->getID()] = param->getDefaultWeight(); } } } void LLWearable::setTexturesToDefaults() { - mTEMap.deleteAllData(); + mTEMap.clear(); for( S32 te = 0; te < LLVOAvatar::TEX_NUM_ENTRIES; te++ ) { if( LLVOAvatar::getTEWearableType( te ) == mType ) { - mTEMap.addData( te, new LLUUID( LLVOAvatar::getDefaultTEImageID( te ) ) ); + mTEMap[te] = LLVOAvatar::getDefaultTEImageID( te ); } } } @@ -643,30 +634,15 @@ void LLWearable::writeToAvatar( BOOL set_by_user ) if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { S32 param_id = param->getID(); - F32* weight = mVisualParamMap.getIfThere( param_id ); - if( weight ) + F32 weight = get_if_there(mVisualParamMap, param_id, param->getDefaultWeight()); + // only animate with user-originated changes + if (set_by_user) { - // only animate with user-originated changes - if (set_by_user) - { - param->setAnimationTarget(*weight, set_by_user); - } - else - { - avatar->setVisualParamWeight( param_id, *weight, set_by_user ); - } + param->setAnimationTarget(weight, set_by_user); } else { - // only animate with user-originated changes - if (set_by_user) - { - param->setAnimationTarget(param->getDefaultWeight(), set_by_user); - } - else - { - avatar->setVisualParamWeight( param_id, param->getDefaultWeight(), set_by_user ); - } + avatar->setVisualParamWeight( param_id, weight, set_by_user ); } } } @@ -682,8 +658,7 @@ void LLWearable::writeToAvatar( BOOL set_by_user ) { if( LLVOAvatar::getTEWearableType( te ) == mType ) { - LLUUID* mapped_image_id = mTEMap.getIfThere( te ); - const LLUUID& image_id = mapped_image_id ? *mapped_image_id : LLVOAvatar::getDefaultTEImageID( te ); + const LLUUID& image_id = get_if_there(mTEMap, te, LLVOAvatar::getDefaultTEImageID( te ) ); LLViewerImage* image = gImageList.getImage( image_id ); avatar->setLocTexTE( te, image, set_by_user ); } @@ -792,16 +767,16 @@ void LLWearable::readFromAvatar() mDefinitionVersion = LLWearable::sCurrentDefinitionVersion; - mVisualParamMap.deleteAllData(); + mVisualParamMap.clear(); for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) { if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { - mVisualParamMap.addData( param->getID(), new F32( param->getWeight() ) ); + mVisualParamMap[param->getID()] = param->getWeight(); } } - mTEMap.deleteAllData(); + mTEMap.clear(); for( S32 te = 0; te < LLVOAvatar::TEX_NUM_ENTRIES; te++ ) { if( LLVOAvatar::getTEWearableType( te ) == mType ) @@ -809,7 +784,7 @@ void LLWearable::readFromAvatar() LLViewerImage* image = avatar->getTEImage( te ); if( image ) { - mTEMap.addData( te, new LLUUID( image->getID() ) ); + mTEMap[te] = image->getID(); } } } @@ -847,9 +822,8 @@ void LLWearable::copyDataFrom( LLWearable* src ) if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { S32 id = param->getID(); - F32* weightp = src->mVisualParamMap.getIfThere( id ); - F32 weight = weightp ? *weightp : param->getDefaultWeight(); - mVisualParamMap.addData( id, new F32( weight ) ); + F32 weight = get_if_there(src->mVisualParamMap, id, param->getDefaultWeight() ); + mVisualParamMap[id] = weight; } } @@ -858,9 +832,8 @@ void LLWearable::copyDataFrom( LLWearable* src ) { if( LLVOAvatar::getTEWearableType( te ) == mType ) { - LLUUID* mapped_image_id = src->mTEMap.getIfThere( te ); - const LLUUID& image_id = mapped_image_id ? *mapped_image_id : LLVOAvatar::getDefaultTEImageID( te ); - mTEMap.addData( te, new LLUUID( image_id ) ); + const LLUUID& image_id = get_if_there(src->mTEMap, te, LLVOAvatar::getDefaultTEImageID( te ) ); + mTEMap[te] = image_id; } } } @@ -985,21 +958,21 @@ void LLWearable::dump() //mSaleInfo llinfos << " Params:" << llendl; - for( F32* param_weightp = mVisualParamMap.getFirstData(); - param_weightp; - param_weightp = mVisualParamMap.getNextData() ) + for (param_map_t::iterator iter = mVisualParamMap.begin(); + iter != mVisualParamMap.end(); ++iter) { - S32 param_id = mVisualParamMap.getCurrentKeyWithoutIncrement(); - llinfos << " " << param_id << " " << *param_weightp << llendl; + S32 param_id = iter->first; + F32 param_weight = iter->second; + llinfos << " " << param_id << " " << param_weight << llendl; } llinfos << " Textures:" << llendl; - for( LLUUID* image_id = mTEMap.getFirstData(); - image_id; - image_id = mTEMap.getNextData() ) + for (te_map_t::iterator iter = mTEMap.begin(); + iter != mTEMap.end(); ++iter) { - S32 te = mTEMap.getCurrentKeyWithoutIncrement(); - llinfos << " " << te << " " << *image_id << llendl; + S32 te = iter->first; + LLUUID& image_id = iter->second; + llinfos << " " << te << " " << image_id << llendl; } } |