From 25609cd98c04a55c4a3c98a94ffcb0dc479c082e Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Thu, 7 Dec 2023 20:49:07 -0500 Subject: [PATCH] Various fixes to wearable and appearance code --- indra/llappearance/llpolymorph.cpp | 6 ++++-- indra/llappearance/llpolyskeletaldistortion.h | 4 ++-- indra/llappearance/llwearable.cpp | 3 +-- indra/llappearance/llwearabledata.cpp | 5 +++-- indra/llappearance/llwearabletype.h | 6 ++++++ 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp index 94c0217b496..f49c534add7 100644 --- a/indra/llappearance/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -445,7 +445,8 @@ LLVector4a LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMes //----------------------------------------------------------------------------- const LLVector4a *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) { - if (!mMorphData) return nullptr; + static LLVector4a zero = LLVector4a::getZero(); + if (!mMorphData) return &zero; LLVector4a* resultVec; mMorphData->mCurrentIndex = 0; @@ -471,7 +472,8 @@ const LLVector4a *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh * //----------------------------------------------------------------------------- const LLVector4a *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) { - if (!mMorphData) return nullptr; + static LLVector4a zero = LLVector4a::getZero(); + if (!mMorphData) return &zero; LLVector4a* resultVec; mMorphData->mCurrentIndex++; diff --git a/indra/llappearance/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h index c9228c4ee5f..e2b86cb3734 100644 --- a/indra/llappearance/llpolyskeletaldistortion.h +++ b/indra/llappearance/llpolyskeletaldistortion.h @@ -104,8 +104,8 @@ class alignas(16) LLPolySkeletalDistortion : public LLViewerVisualParam /*virtual*/ const LLVector4a& getAvgDistortion() override { return mDefaultVec; } /*virtual*/ F32 getMaxDistortion() override { return 0.1f; } /*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) override {return LLVector4a(0.001f, 0.001f, 0.001f);} - /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) override {index = 0; poly_mesh = NULL; return &mDefaultVec;}; - /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) override {index = 0; poly_mesh = NULL; return NULL;}; + /*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) override { if( index ){ *index = 0;} if( poly_mesh ){ *poly_mesh = NULL; } return &mDefaultVec; }; + /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) override { if( index ){ *index = 0;} if( poly_mesh ){ *poly_mesh = NULL; } return NULL; }; protected: LLPolySkeletalDistortion(const LLPolySkeletalDistortion& pOther) = default; diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index afcd938ddce..dcb557d98dc 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -734,8 +734,7 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp) { // 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. - LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; - if((viewer_param->getWearableType() == mType) && (!viewer_param->getCrossWearable()) ) + if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) ) { S32 param_id = param->getID(); F32 weight = getVisualParamWeight(param_id); diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp index 03a2b8f43ef..27537b04c9b 100644 --- a/indra/llappearance/llwearabledata.cpp +++ b/indra/llappearance/llwearabledata.cpp @@ -195,10 +195,11 @@ void LLWearableData::pullCrossWearableValues(const LLWearableType::EType type) { if( param ) { - if(param->isDriverParam()) + LLDriverParam *driver_param = dynamic_cast<LLDriverParam*>(param); + if(driver_param) { // parameter is a driver parameter, have it update its cross-driven params - static_cast<LLDriverParam*>(param)->updateCrossDrivenParams(type); + driver_param->updateCrossDrivenParams(type); } } } diff --git a/indra/llappearance/llwearabletype.h b/indra/llappearance/llwearabletype.h index e9aa4f943fe..a63f524fcc9 100644 --- a/indra/llappearance/llwearabletype.h +++ b/indra/llappearance/llwearabletype.h @@ -110,6 +110,12 @@ class LLWearableType final : public LLParamSingleton<LLWearableType> public: LLWearableDictionary(LLTranslationBridge::ptr_t& trans); ~LLWearableDictionary() = default; + +// [RLVa:KB] - Checked: 2010-03-03 (RLVa-1.2.0a) | Added: RLVa-1.2.0a + protected: + // The default implementation asserts on 'notFound()' and returns -1 which isn't a valid EWearableType + virtual LLWearableType::EType notFound() const { return LLWearableType::WT_INVALID; } +// [/RLVa:KB] }; LLWearableDictionary mDictionary; -- GitLab