From 9fdca96f8bd2211a99fe88e57b70cbecefa20b6d Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 8 Jul 2024 20:27:14 +0200 Subject: Re-enable compiler warnings C4244 and C4396 except for lltracerecording.h and llunittype.h for now --- indra/llcharacter/llkeyframewalkmotion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcharacter') diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index 605e15f442..f8691b5f59 100644 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -383,7 +383,7 @@ bool LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask) F32 target_roll = llclamp(ang_vel.mV[VZ], -4.f, 4.f) * roll_factor; // roll is critically damped interpolation between current roll and angular velocity-derived target roll - mRoll = LLSmoothInterpolation::lerp(mRoll, target_roll, U32Milliseconds(100)); + mRoll = LLSmoothInterpolation::lerp(mRoll, target_roll, F32Milliseconds(100.f)); LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f)); mPelvisState->setRotation(roll); -- cgit v1.2.3 From 5d25504f8335132d0d222b266f8772062c88b335 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Fri, 26 Jul 2024 19:32:23 +0200 Subject: #2100 BugSplat Crash #1497210: LLVOAvatar::updateImpostors()(10616) --- indra/llcharacter/llcharacter.cpp | 23 +++-------------------- indra/llcharacter/llcharacter.h | 2 +- indra/llcharacter/llkeyframemotion.cpp | 11 ++++------- 3 files changed, 8 insertions(+), 28 deletions(-) (limited to 'indra/llcharacter') diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 264b9a0be1..ecbcdb3bf5 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -38,7 +38,7 @@ LLStringTable LLCharacter::sVisualParamNames(1024); -std::vector< LLCharacter* > LLCharacter::sInstances; +std::list< LLCharacter* > LLCharacter::sInstances; bool LLCharacter::sAllowInstancesChange = true ; //----------------------------------------------------------------------------- @@ -53,7 +53,6 @@ LLCharacter::LLCharacter() mSkeletonSerialNum( 0 ) { llassert_always(sAllowInstancesChange) ; - sInstances.push_back(this); mMotionController.setCharacter( this ); mPauseRequest = new LLPauseRequestHandle(); @@ -66,28 +65,12 @@ LLCharacter::LLCharacter() //----------------------------------------------------------------------------- LLCharacter::~LLCharacter() { - for (LLVisualParam *param = getFirstVisualParam(); - param; - param = getNextVisualParam()) + for (const auto& it : mVisualParamIndexMap) { - delete param; + delete it.second; } - size_t i ; - size_t size = sInstances.size() ; - for(i = 0 ; i < size ; i++) - { - if(sInstances[i] == this) - { - break ; - } - } - - llassert_always(i < size) ; - llassert_always(sAllowInstancesChange) ; - sInstances[i] = sInstances[size - 1] ; - sInstances.pop_back() ; } diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index b390960a75..6da28f0692 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -255,7 +255,7 @@ public: U32 getSkeletonSerialNum() const { return mSkeletonSerialNum; } void setSkeletonSerialNum( U32 num ) { mSkeletonSerialNum = num; } - static std::vector< LLCharacter* > sInstances; + static std::list< LLCharacter* > sInstances; static bool sAllowInstancesChange ; //debug use virtual void setHoverOffset(const LLVector3& hover_offset, bool send_update=true) { mHoverOffset = hover_offset; } diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index 12212efb66..6c060d7980 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -2407,13 +2407,10 @@ void LLKeyframeMotion::onLoadComplete(const LLUUID& asset_uuid, { LLUUID* id = (LLUUID*)user_data; - std::vector::iterator char_iter = LLCharacter::sInstances.begin(); - - while(char_iter != LLCharacter::sInstances.end() && - (*char_iter)->getID() != *id) - { - ++char_iter; - } + auto char_iter = std::find_if(LLCharacter::sInstances.begin(), LLCharacter::sInstances.end(), [&](LLCharacter* c) + { + return c->getID() == *id; + }); delete id; -- cgit v1.2.3 From c4ff0b48898de86b9ee8e198395e16a8429c8aa4 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 19 Jul 2024 20:17:37 +0300 Subject: viewer#2071 Properly handle 'out of memory' for meshes --- indra/llcharacter/llkeyframemotion.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/llcharacter') diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index 6c060d7980..6790f1ad56 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -2227,7 +2227,12 @@ bool LLKeyframeMotion::dumpToFile(const std::string& name) } S32 file_size = getFileSize(); - U8* buffer = new U8[file_size]; + U8* buffer = new(std::nothrow) U8[file_size]; + if (!buffer) + { + LLError::LLUserWarningMsg::showOutOfMemory(); + LL_ERRS() << "Bad memory allocation for buffer, file: " << name << " " << file_size << LL_ENDL; + } LL_DEBUGS("BVH") << "Dumping " << outfilename << LL_ENDL; LLDataPackerBinaryBuffer dp(buffer, file_size); @@ -2435,7 +2440,12 @@ void LLKeyframeMotion::onLoadComplete(const LLUUID& asset_uuid, LLFileSystem file(asset_uuid, type, LLFileSystem::READ); S32 size = file.getSize(); - U8* buffer = new U8[size]; + U8* buffer = new(std::nothrow) U8[size]; + if (!buffer) + { + LLError::LLUserWarningMsg::showOutOfMemory(); + LL_ERRS() << "Bad memory allocation for buffer of size: " << size << LL_ENDL; + } file.read((U8*)buffer, size); /*Flawfinder: ignore*/ LL_DEBUGS("Animation") << "Loading keyframe data for: " << motionp->getName() << ":" << motionp->getID() << " (" << size << " bytes)" << LL_ENDL; -- cgit v1.2.3 From a6131b5652124d40e782dd6bc653a9020061cf33 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Thu, 8 Aug 2024 22:13:57 +0200 Subject: #2229 BugSplat Crash #1502471: SecondLifeViewer!LLPolySkeletalDistortion::apply(196) --- indra/llcharacter/llcharacter.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'indra/llcharacter') diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index 6da28f0692..6143ec8cd1 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -245,6 +245,24 @@ public: S32 getVisualParamCount() const { return (S32)mVisualParamIndexMap.size(); } LLVisualParam* getVisualParam(const char *name); + void animateTweakableVisualParams(F32 delta) + { + for (auto& it : mVisualParamIndexMap) + { + if (it.second->isTweakable()) + { + it.second->animate(delta); + } + } + } + + void applyAllVisualParams(ESex avatar_sex) + { + for (auto& it : mVisualParamIndexMap) + { + it.second->apply(avatar_sex); + } + } ESex getSex() const { return mSex; } void setSex( ESex sex ) { mSex = sex; } -- cgit v1.2.3 From 316f0f0b8cb05515068e2acb72740fbab2365ce0 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Thu, 22 Aug 2024 09:11:28 -0700 Subject: secondlife/viewer#2391: Remove avatar rigging "callstack" logging --- indra/llcharacter/lljoint.cpp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'indra/llcharacter') diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index c2a10d969f..f31aa5d4c9 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -32,7 +32,6 @@ #include "lljoint.h" #include "llmath.h" -#include "llcallstack.h" #include S32 LLJoint::sNumUpdates = 0; @@ -342,7 +341,6 @@ void LLJoint::setPosition( const LLVector3& requested_pos, bool apply_attachment { if (pos != active_override && do_debug_joint(getName())) { - LLScopedContextString str("setPosition"); LL_DEBUGS("Avatar") << " joint " << getName() << " requested_pos " << requested_pos << " overriden by attachment " << active_override << LL_ENDL; } @@ -350,12 +348,7 @@ void LLJoint::setPosition( const LLVector3& requested_pos, bool apply_attachment } if ((pos != getPosition()) && do_debug_joint(getName())) { - LLScopedContextString str("setPosition"); - LLCallStack cs; - LLContextStatus con_status; LL_DEBUGS("Avatar") << " joint " << getName() << " set pos " << pos << LL_ENDL; - LL_DEBUGS("Avatar") << "CONTEXT:\n" << "====================\n" << con_status << "====================" << LL_ENDL; - LL_DEBUGS("Avatar") << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL; } if (pos != getPosition()) { @@ -879,7 +872,6 @@ void LLJoint::setScale( const LLVector3& requested_scale, bool apply_attachment_ { if (scale != active_override && do_debug_joint(getName())) { - LLScopedContextString str("setScale"); LL_DEBUGS("Avatar") << " joint " << getName() << " requested_scale " << requested_scale << " overriden by attachment " << active_override << LL_ENDL; } @@ -887,12 +879,7 @@ void LLJoint::setScale( const LLVector3& requested_scale, bool apply_attachment_ } if ((mXform.getScale() != scale) && do_debug_joint(getName())) { - LLScopedContextString str("setScale"); - LLCallStack cs; - LLContextStatus con_status; LL_DEBUGS("Avatar") << " joint " << getName() << " set scale " << scale << LL_ENDL; - LL_DEBUGS("Avatar") << "CONTEXT:\n" << "====================\n" << con_status << LL_ENDL; - LL_DEBUGS("Avatar") << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL; } mXform.setScale(scale); touch(); -- cgit v1.2.3