summaryrefslogtreecommitdiff
path: root/indra/llappearance/llwearable.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2026-09-01 18:35:23 +0800
committerErik Kundiman <erik@megapahit.org>2026-09-04 21:58:53 +0800
commit00bb3bb6f07660bd914d29a1389342bb3060d254 (patch)
tree431f574922494d2201718f13085f17bc6bd7fb42 /indra/llappearance/llwearable.cpp
parenta8636720129952c10cf49ab80da21bf8b340b96c (diff)
parent4ef9f8f14b35ed388c294d53767a0dca0e890924 (diff)
Merge remote-tracking branch 'secondlife/release/26.4' into 26.4
Diffstat (limited to 'indra/llappearance/llwearable.cpp')
-rw-r--r--indra/llappearance/llwearable.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
index 4acb0ef3d4..5758f79791 100644
--- a/indra/llappearance/llwearable.cpp
+++ b/indra/llappearance/llwearable.cpp
@@ -727,17 +727,22 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp)
if (!avatarp) return;
// Pull params
- for( const LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
+ // Iterate over wearable's params first since they should be fewer than avatar params.
+ // Wearables are cloned from avatar params by mType, so they should be always be a
+ // subset of the avatar's params and a situation where mType param doesn't exist in
+ // a wearable yet exist in the avatar should not happen.
+ for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap)
{
+ LLVisualParam* wearable_param = vp_pair.second;
+
// cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the
// avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way.
- if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) )
- {
- S32 param_id = param->getID();
- F32 weight = getVisualParamWeight(param_id);
+ if (((LLViewerVisualParam*)wearable_param)->getCrossWearable())
+ continue;
- avatarp->setVisualParamWeight( param_id, weight);
- }
+ F32 weight = wearable_param->getWeight();
+ // Silently fails if param was not found
+ avatarp->setVisualParamWeight(vp_pair.first, mType, weight);
}
}