diff options
| author | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-06-26 21:05:13 +0300 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-07-01 20:01:14 +0300 |
| commit | 4e0283133e87035c16fe2341748a2d68aa1a0302 (patch) | |
| tree | b3a74b92e3a9ae92f8e3fffa98bff448923a5721 /indra/llappearance | |
| parent | dc58a8730bf6422d51f2ecf457e8a973fb99b964 (diff) | |
#5962 Optimize writeWearablesToAvatar
Diffstat (limited to 'indra/llappearance')
| -rw-r--r-- | indra/llappearance/llwearable.cpp | 19 |
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); } } |
