summaryrefslogtreecommitdiff
path: root/indra/llappearance/llwearable.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2023-04-11 00:15:27 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2023-04-11 00:15:27 +0300
commitdb63f252a275beea884bba9177f8156321bde472 (patch)
tree6ef30fcad846c5e8e50ffe137abbda3bd7f39971 /indra/llappearance/llwearable.cpp
parentba8bcf6520eb4cbcdf93393ecdeda4e6c0bc5846 (diff)
parent53d4e69c514374622afb93f81067aaeec64a443b (diff)
Merge branch 'contribute' into DRTVWR-582-maint-U
# Conflicts: # indra/llaudio/llaudioengine.cpp
Diffstat (limited to 'indra/llappearance/llwearable.cpp')
-rw-r--r--indra/llappearance/llwearable.cpp84
1 files changed, 26 insertions, 58 deletions
diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
index e4bc8ff427..10d668d0af 100644
--- a/indra/llappearance/llwearable.cpp
+++ b/indra/llappearance/llwearable.cpp
@@ -60,12 +60,12 @@ LLWearable::LLWearable()
// virtual
LLWearable::~LLWearable()
{
- for (visual_param_index_map_t::iterator vpIter = mVisualParamIndexMap.begin(); vpIter != mVisualParamIndexMap.end(); ++vpIter)
+ for (visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
- LLVisualParam* vp = vpIter->second;
+ LLVisualParam* vp = vp_pair.second;
vp->clearNextParam();
delete vp;
- vpIter->second = NULL;
+ vp_pair.second = NULL;
}
destroyTextures();
@@ -122,12 +122,10 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const
// parameters
output_stream << "parameters " << mVisualParamIndexMap.size() << "\n";
- for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin();
- iter != mVisualParamIndexMap.end();
- ++iter)
+ for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
- S32 param_id = iter->first;
- const LLVisualParam* param = iter->second;
+ S32 param_id = vp_pair.first;
+ const LLVisualParam* param = vp_pair.second;
F32 param_weight = param->getWeight();
output_stream << param_id << " " << terse_F32_to_string( param_weight ) << "\n";
}
@@ -135,11 +133,11 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const
// texture entries
output_stream << "textures " << mTEMap.size() << "\n";
- for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter)
+ for (const te_map_t::value_type& te_pair : mTEMap)
{
- S32 te = iter->first;
- const LLUUID& image_id = iter->second->getID();
- output_stream << te << " " << image_id << "\n";
+ S32 te = te_pair.first;
+ const LLUUID& image_id = te_pair.second->getID();
+ output_stream << te << " " << image_id << "\n";
}
return TRUE;
}
@@ -160,11 +158,9 @@ void LLWearable::createVisualParams(LLAvatarAppearance *avatarp)
}
// resync driver parameters to point to the newly cloned driven parameters
- for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin();
- param_iter != mVisualParamIndexMap.end();
- ++param_iter)
+ for (visual_param_index_map_t::value_type& param_pair : mVisualParamIndexMap)
{
- LLVisualParam* param = param_iter->second;
+ LLVisualParam* param = param_pair.second;
LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam;
// need this line to disambiguate between versions of LLCharacter::getVisualParam()
LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam;
@@ -523,10 +519,9 @@ std::vector<LLLocalTextureObject*> LLWearable::getLocalTextureListSeq()
{
std::vector<LLLocalTextureObject*> result;
- for(te_map_t::const_iterator iter = mTEMap.begin();
- iter != mTEMap.end(); iter++)
+ for(te_map_t::value_type& te_pair : mTEMap)
{
- LLLocalTextureObject* lto = iter->second;
+ LLLocalTextureObject* lto = te_pair.second;
result.push_back(lto);
}
@@ -547,37 +542,15 @@ void LLWearable::revertValues()
// FIXME DRANO - this triggers changes to driven params on avatar, potentially clobbering baked appearance.
//update saved settings so wearable is no longer dirty
- // non-driver params first
- for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
- {
- S32 id = iter->first;
- F32 value = iter->second;
- LLVisualParam *param = getVisualParam(id);
- if(param && !dynamic_cast<LLDriverParam*>(param) )
- {
- setVisualParamWeight(id, value);
- }
- }
-
- //then driver params
- for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
+ // One loop should be necessary here
+ for (param_map_t::value_type& vp_pair : mSavedVisualParamMap)
{
- S32 id = iter->first;
- F32 value = iter->second;
+ S32 id = vp_pair.first;
LLVisualParam *param = getVisualParam(id);
- if(param && dynamic_cast<LLDriverParam*>(param) )
+ if(param)
{
+ F32 value = vp_pair.second;
setVisualParamWeight(id, value);
- }
- }
-
- // make sure that saved values are sane
- for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
- {
- S32 id = iter->first;
- LLVisualParam *param = getVisualParam(id);
- if( param )
- {
mSavedVisualParamMap[id] = param->getWeight();
}
}
@@ -589,10 +562,10 @@ void LLWearable::saveValues()
{
//update saved settings so wearable is no longer dirty
mSavedVisualParamMap.clear();
- for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter)
+ for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
- S32 id = iter->first;
- LLVisualParam *wearable_param = iter->second;
+ S32 id = vp_pair.first;
+ LLVisualParam *wearable_param = vp_pair.second;
F32 value = wearable_param->getWeight();
mSavedVisualParamMap[id] = value;
}
@@ -706,23 +679,18 @@ LLVisualParam* LLWearable::getVisualParam(S32 index) const
void LLWearable::getVisualParams(visual_param_vec_t &list)
{
- visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
- visual_param_index_map_t::iterator end = mVisualParamIndexMap.end();
-
// add all visual params to the passed-in vector
- for( ; iter != end; ++iter )
+ for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
- list.push_back(iter->second);
+ list.push_back(vp_pair.second);
}
}
void LLWearable::animateParams(F32 delta)
{
- for(visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
- iter != mVisualParamIndexMap.end();
- ++iter)
+ for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
- LLVisualParam *param = (LLVisualParam*) iter->second;
+ LLVisualParam *param = (LLVisualParam*)vp_pair.second;
param->animate(delta);
}
}