From 9c6678b5e76c485ae915b539327069b43185e16f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 24 Aug 2018 21:55:07 +0100 Subject: [PATCH 01/11] SL-944 - logcontrol options to control which log recorders get used. This can be useful for performance reasons when especially verbose debug logging is needed. --- indra/llcommon/llerror.cpp | 99 +++++++++++++++++++++-- indra/llcommon/llerrorcontrol.h | 6 ++ indra/newview/app_settings/logcontrol.xml | 15 ++++ 3 files changed, 115 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index ba71f4ddfb..3e4dd708a8 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -89,7 +89,12 @@ namespace { { closelog(); } - + + virtual bool enabled() override + { + return LLError::getEnabledLogTypesMask() & 0x01; + } + virtual void recordMessage(LLError::ELevel level, const std::string& message) { @@ -119,6 +124,13 @@ namespace { { LL_INFOS() << "Error setting log file to " << filename << LL_ENDL; } + else + { + if (!LLError::getAlwaysFlush()) + { + mFile.sync_with_stdio(false); + } + } mWantsTime = true; mWantsTags = true; } @@ -128,12 +140,28 @@ namespace { mFile.close(); } + virtual bool enabled() override + { +#ifdef LL_RELEASE_FOR_DOWNLOAD + return 1; +#else + return LLError::getEnabledLogTypesMask() & 0x02; +#endif + } + bool okay() { return mFile.good(); } virtual void recordMessage(LLError::ELevel level, const std::string& message) { - mFile << message << std::endl; + if (LLError::getAlwaysFlush()) + { + mFile << message << std::endl; + } + else + { + mFile << message << "\n"; + } } private: @@ -149,6 +177,11 @@ namespace { mWantsTime = timestamp; } + virtual bool enabled() override + { + return LLError::getEnabledLogTypesMask() & 0x04; + } + virtual void recordMessage(LLError::ELevel level, const std::string& message) { @@ -209,6 +242,11 @@ namespace { public: RecordToFixedBuffer(LLLineBuffer* buffer) : mBuffer(buffer) { } + virtual bool enabled() override + { + return LLError::getEnabledLogTypesMask() & 0x08; + } + virtual void recordMessage(LLError::ELevel level, const std::string& message) { @@ -226,6 +264,11 @@ namespace { RecordToWinDebug() {} + virtual bool enabled() override + { + return LLError::getEnabledLogTypesMask() & 0x10; + } + virtual void recordMessage(LLError::ELevel level, const std::string& message) { @@ -413,7 +456,11 @@ namespace LLError bool mPrintLocation; LLError::ELevel mDefaultLevel; - + + bool mLogAlwaysFlush; + + U32 mEnabledLogTypesMask; + LevelMap mFunctionLevelMap; LevelMap mClassLevelMap; LevelMap mFileLevelMap; @@ -454,6 +501,8 @@ namespace LLError : LLRefCount(), mPrintLocation(false), mDefaultLevel(LLError::LEVEL_DEBUG), + mLogAlwaysFlush(true), + mEnabledLogTypesMask(0xFFFFFFFF), mFunctionLevelMap(), mClassLevelMap(), mFileLevelMap(), @@ -613,6 +662,8 @@ namespace LLError::Settings::getInstance()->reset(); LLError::setDefaultLevel(LLError::LEVEL_INFO); + LLError::setAlwaysFlush(true); + LLError::setEnabledLogTypesMask(0xFFFFFFFF); LLError::setFatalFunction(LLError::crashAndLoop); LLError::setTimeFunction(LLError::utcTime); @@ -686,6 +737,30 @@ namespace LLError return s->mDefaultLevel; } + void setAlwaysFlush(bool flush) + { + SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig(); + s->mLogAlwaysFlush = flush; + } + + bool getAlwaysFlush() + { + SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig(); + return s->mLogAlwaysFlush; + } + + void setEnabledLogTypesMask(U32 mask) + { + SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig(); + s->mEnabledLogTypesMask = mask; + } + + U32 getEnabledLogTypesMask() + { + SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig(); + return s->mEnabledLogTypesMask; + } + void setFunctionLevel(const std::string& function_name, ELevel level) { Globals::getInstance()->invalidateCallSites(); @@ -766,7 +841,15 @@ namespace LLError setPrintLocation(config["print-location"]); setDefaultLevel(decodeLevel(config["default-level"])); - + if (config.has("log-always-flush")) + { + setAlwaysFlush(config["log-always-flush"]); + } + if (config.has("enabled-log-types-mask")) + { + setEnabledLogTypesMask(config["enabled-log-types-mask"].asInteger()); + } + LLSD sets = config["settings"]; LLSD::array_const_iterator a, end; for (a = sets.beginArray(), end = sets.endArray(); a != end; ++a) @@ -910,7 +993,12 @@ namespace ++i) { LLError::RecorderPtr r = *i; - + + if (!r->enabled()) + { + continue; + } + std::ostringstream message_stream; if (show_time && r->wantsTime() && s->mTimeFunction != NULL) @@ -1039,6 +1127,7 @@ namespace { namespace LLError { + bool Log::shouldLog(CallSite& site) { LogLock lock; diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index caf2ba72c2..1730f0c640 100644 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -74,6 +74,10 @@ namespace LLError LL_COMMON_API void setPrintLocation(bool); LL_COMMON_API void setDefaultLevel(LLError::ELevel); LL_COMMON_API ELevel getDefaultLevel(); + LL_COMMON_API void setAlwaysFlush(bool flush); + LL_COMMON_API bool getAlwaysFlush(); + LL_COMMON_API void setEnabledLogTypesMask(U32 mask); + LL_COMMON_API U32 getEnabledLogTypesMask(); LL_COMMON_API void setFunctionLevel(const std::string& function_name, LLError::ELevel); LL_COMMON_API void setClassLevel(const std::string& class_name, LLError::ELevel); LL_COMMON_API void setFileLevel(const std::string& file_name, LLError::ELevel); @@ -140,6 +144,8 @@ namespace LLError virtual void recordMessage(LLError::ELevel, const std::string& message) = 0; // use the level for better display, not for filtering + virtual bool enabled() { return true; } + bool wantsTime(); bool wantsTags(); bool wantsLevel(); diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index ae57e125bb..08741327a5 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -3,6 +3,21 @@ default-level INFO print-location false + log-always-flush true + + enabled-log-types-mask 0xFFFFFFFF settings From 9ae973ec5b271b99d192644cc094ef2d1e3ded2a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 27 Aug 2018 14:22:42 +0100 Subject: [PATCH 02/11] SL-944 - mac build error fix: wants override to be used throughout a class if it is used at all --- indra/llcommon/llerror.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 3e4dd708a8..843244ce92 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -96,7 +96,7 @@ namespace { } virtual void recordMessage(LLError::ELevel level, - const std::string& message) + const std::string& message) override { int syslogPriority = LOG_CRIT; switch (level) { @@ -152,7 +152,7 @@ namespace { bool okay() { return mFile.good(); } virtual void recordMessage(LLError::ELevel level, - const std::string& message) + const std::string& message) override { if (LLError::getAlwaysFlush()) { @@ -183,7 +183,7 @@ namespace { } virtual void recordMessage(LLError::ELevel level, - const std::string& message) + const std::string& message) override { if (ANSI_PROBE == mUseANSI) mUseANSI = (checkANSI() ? ANSI_YES : ANSI_NO); @@ -248,7 +248,7 @@ namespace { } virtual void recordMessage(LLError::ELevel level, - const std::string& message) + const std::string& message) override { mBuffer->addLine(message); } @@ -270,7 +270,7 @@ namespace { } virtual void recordMessage(LLError::ELevel level, - const std::string& message) + const std::string& message) override { debugger_print(message); } From b51972bac7f0b11955474baebebd3f1d7c9e60e3 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 4 Sep 2018 12:39:56 -0400 Subject: [PATCH 03/11] use copy_if_different to copy CrashReporter.nib so that it creates the directory if needed --- indra/mac_crash_logger/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/mac_crash_logger/CMakeLists.txt b/indra/mac_crash_logger/CMakeLists.txt index ab20388261..f6c4dfb59d 100644 --- a/indra/mac_crash_logger/CMakeLists.txt +++ b/indra/mac_crash_logger/CMakeLists.txt @@ -85,7 +85,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} ARGS -E - copy_directory + copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/CrashReporter.nib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mac-crash-logger.app/Contents/Resources/CrashReporter.nib ) From 795aedf4a922f17aac667afc0c368e7fe18b0e03 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 6 Sep 2018 19:47:51 +0100 Subject: [PATCH 04/11] SL-966 - size and pos limit calcs moved to sep method. Global scale option for testing of size limits. --- indra/newview/app_settings/settings.xml | 11 +++ indra/newview/llcontrolavatar.cpp | 91 ++++++++++++++++--------- indra/newview/llcontrolavatar.h | 7 +- 3 files changed, 76 insertions(+), 33 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f911008879..0277d09ae1 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2226,6 +2226,17 @@ Value 0 + AnimatedObjectsGlobalScale + + Comment + Temporary testing: allow an extra scale factor to be forced on animated objects. + Persist + 1 + Type + F32 + Value + 1.00 + AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 83d42f6ccf..fdef60612f 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -35,12 +35,16 @@ #include "llviewerregion.h" #include "llskinningutil.h" +const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f; +const F32 LLControlAvatar::MAX_LEGAL_SIZE = 16.0f; + LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), mPlaying(false), mGlobalScale(1.0f), mMarkedForDeath(false), - mRootVolp(NULL) + mRootVolp(NULL), + mScaleConstraintFixup(1.0) { mIsDummy = TRUE; mIsControlAvatar = true; @@ -68,6 +72,44 @@ void LLControlAvatar::initInstance() mInitFlags |= 1<<4; } +void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_scale_fixup) const +{ + new_pos_fixup = LLVector3(); + new_scale_fixup = 1.0f; + LLVector3 vol_pos = mRootVolp->getRenderPosition(); + + // Fix up position if needed to prevent visual encroachment + if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down + { + // The goal here is to ensure that the extent of the avatar's + // bounding box does not wander too far from the + // official position of the corresponding volume. We + // do this by tracking the distance and applying a + // correction to the control avatar position if + // needed. + LLVector3 uncorrected_extents[2]; + uncorrected_extents[0] = (getLastAnimExtents()[0] - mPositionConstraintFixup)/mScaleConstraintFixup; + uncorrected_extents[1] = (getLastAnimExtents()[1] - mPositionConstraintFixup)/mScaleConstraintFixup; + LLVector3 uncorrected_size = uncorrected_extents[1]-uncorrected_extents[0]; + F32 uncorrected_max_size = llmax(uncorrected_size[0],uncorrected_size[1],uncorrected_size[2]); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); + F32 offset_dist = pos_box_offset.length(); + if (offset_dist > MAX_LEGAL_OFFSET) + { + F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); + new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; + LL_INFOS("ConstraintFix") << "pos fix, offset_dist " << offset_dist << " pos fixup " + << new_pos_fixup << LL_ENDL; + } + if (uncorrected_max_size > MAX_LEGAL_SIZE) + { + new_scale_fixup = MAX_LEGAL_SIZE/uncorrected_max_size; + LL_INFOS("ConstraintFix") << "scale fix, uncorrected_size " << uncorrected_size << " fixup " + << mScaleConstraintFixup << LL_ENDL; + } + } +} + void LLControlAvatar::matchVolumeTransform() { if (mRootVolp) @@ -96,37 +138,16 @@ void LLControlAvatar::matchVolumeTransform() } else { - LLVector3 vol_pos = mRootVolp->getRenderPosition(); - LLVector3 pos_box_offset; - LLVector3 box_offset; - // Fix up position if needed to prevent visual encroachment - if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down - { - const F32 MAX_LEGAL_OFFSET = 3.0; - - // The goal here is to ensure that the extent of the avatar's - // bounding box does not wander too far from the - // official position of the corresponding volume. We - // do this by tracking the distance and applying a - // correction to the control avatar position if - // needed. - LLVector3 uncorrected_extents[2]; - uncorrected_extents[0] = getLastAnimExtents()[0] - mPositionConstraintFixup; - uncorrected_extents[1] = getLastAnimExtents()[1] - mPositionConstraintFixup; - pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); - F32 offset_dist = pos_box_offset.length(); - if (offset_dist > MAX_LEGAL_OFFSET) - { - F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); - box_offset = (target_dist/offset_dist)*pos_box_offset; - } - } + LLVector3 new_pos_fixup; + F32 new_scale_fixup; + getNewConstraintFixups(new_pos_fixup, new_scale_fixup); - mPositionConstraintFixup = box_offset; - - // Currently if you're doing something like playing an + mPositionConstraintFixup = new_pos_fixup; + mScaleConstraintFixup = new_scale_fixup; + + // FIXME: Currently if you're doing something like playing an // animation that moves the pelvis (on an avatar or // animated object), the name tag and debug text will be // left behind. Ideally setPosition() would follow the @@ -152,6 +173,9 @@ void LLControlAvatar::matchVolumeTransform() mRoot->setWorldRotation(bind_rot*obj_rot); setPositionAgent(vol_pos); mRoot->setPosition(vol_pos + mPositionConstraintFixup); + + F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale"); + setGlobalScale(global_scale * mScaleConstraintFixup); } } } @@ -371,10 +395,13 @@ void LLControlAvatar::updateDebugText() addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts)); addDebugText(llformat("pxarea %s rank %d", LLStringOps::getReadableNumber(getPixelArea()).c_str(), getVisibilityRank())); addDebugText(llformat("lod_radius %s dists %s", LLStringOps::getReadableNumber(lod_radius).c_str(),cam_dist_string.c_str())); - if (mPositionConstraintFixup.length() > 0.0f) + if (mPositionConstraintFixup.length() > 0.0f || mScaleConstraintFixup != 1.0f) { - addDebugText(llformat("pos fix (%.1f %.1f %.1f)", - mPositionConstraintFixup[0], mPositionConstraintFixup[1], mPositionConstraintFixup[2])); + addDebugText(llformat("pos fix (%.1f %.1f %.1f) scale %f", + mPositionConstraintFixup[0], + mPositionConstraintFixup[1], + mPositionConstraintFixup[2], + mScaleConstraintFixup)); } #if 0 diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index c72dc03efc..9924697938 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -40,9 +40,10 @@ public: virtual void initInstance(); // Called after construction to initialize the class. virtual ~LLControlAvatar(); + void getNewConstraintFixups(LLVector3& new_pos_constraint, F32& new_scale_constraint) const; void matchVolumeTransform(); void updateVolumeGeom(); - + void setGlobalScale(F32 scale); void recursiveScaleJoint(LLJoint *joint, F32 factor); static LLControlAvatar *createControlAvatar(LLVOVolume *obj); @@ -81,7 +82,11 @@ public: bool mMarkedForDeath; LLVector3 mPositionConstraintFixup; + F32 mScaleConstraintFixup; + static const F32 MAX_LEGAL_OFFSET; + static const F32 MAX_LEGAL_SIZE; + }; typedef std::map signaled_animation_map_t; From f8533d1fdb6dd6699deb8249e5f7e6ea70939dd4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2018 13:48:42 +0100 Subject: [PATCH 05/11] SL-966 - updated logic for size/pos constraints --- indra/newview/llcontrolavatar.cpp | 34 +++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index fdef60612f..adad959412 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -87,25 +87,33 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ // do this by tracking the distance and applying a // correction to the control avatar position if // needed. - LLVector3 uncorrected_extents[2]; - uncorrected_extents[0] = (getLastAnimExtents()[0] - mPositionConstraintFixup)/mScaleConstraintFixup; - uncorrected_extents[1] = (getLastAnimExtents()[1] - mPositionConstraintFixup)/mScaleConstraintFixup; - LLVector3 uncorrected_size = uncorrected_extents[1]-uncorrected_extents[0]; - F32 uncorrected_max_size = llmax(uncorrected_size[0],uncorrected_size[1],uncorrected_size[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); + const LLVector3 *extents = getLastAnimExtents(); + LLVector3 box_dims = extents[1]-extents[0]; + F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, getLastAnimExtents()); F32 offset_dist = pos_box_offset.length(); if (offset_dist > MAX_LEGAL_OFFSET) { F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); - new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; - LL_INFOS("ConstraintFix") << "pos fix, offset_dist " << offset_dist << " pos fixup " - << new_pos_fixup << LL_ENDL; + new_pos_fixup = mPositionConstraintFixup + (target_dist/offset_dist)*pos_box_offset; + LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " + << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - if (uncorrected_max_size > MAX_LEGAL_SIZE) + else if (offset_dist < MAX_LEGAL_OFFSET-1 && mPositionConstraintFixup.length()>0.01f) { - new_scale_fixup = MAX_LEGAL_SIZE/uncorrected_max_size; - LL_INFOS("ConstraintFix") << "scale fix, uncorrected_size " << uncorrected_size << " fixup " - << mScaleConstraintFixup << LL_ENDL; + new_pos_fixup = mPositionConstraintFixup * 0.9; + LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " + << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; + } + else + { + new_pos_fixup = mPositionConstraintFixup; + } + if (max_size/mScaleConstraintFixup > MAX_LEGAL_SIZE) + { + new_scale_fixup = mScaleConstraintFixup*MAX_LEGAL_SIZE/max_size; + LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, max_size " << max_size << " fixup " + << mScaleConstraintFixup << " -> " << new_scale_fixup << LL_ENDL; } } } From 55419ccd4368d8fd0766936ef52fa1d911a46962 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2018 13:53:19 +0100 Subject: [PATCH 06/11] SL-966 - max size = 64 --- indra/newview/llcontrolavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index adad959412..54b1a0dcaf 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -36,7 +36,7 @@ #include "llskinningutil.h" const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f; -const F32 LLControlAvatar::MAX_LEGAL_SIZE = 16.0f; +const F32 LLControlAvatar::MAX_LEGAL_SIZE = 64.0f; LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), From 007a126256219e47c9dd3ba0eafeffe4e6f12ef8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2018 14:32:48 +0100 Subject: [PATCH 07/11] SL-944 - logcontrol.xml update --- indra/newview/app_settings/logcontrol.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 08741327a5..482012cdd6 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -17,7 +17,7 @@ For example, value of 10 = 2|8 would enable logging only to SecondLife.log and the viewer debug console. Note: RecordToFile is always enabled in release builds. --> - enabled-log-types-mask 0xFFFFFFFF + enabled-log-types-mask 255 settings From d6cec8d68de437a3ccc66739cdabc9de6631dddc Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2018 16:00:43 +0100 Subject: [PATCH 08/11] SL-944 - enabled log types consistent notation in xml and cpp --- indra/llcommon/llerror.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 843244ce92..0d19287dd9 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -502,7 +502,7 @@ namespace LLError mPrintLocation(false), mDefaultLevel(LLError::LEVEL_DEBUG), mLogAlwaysFlush(true), - mEnabledLogTypesMask(0xFFFFFFFF), + mEnabledLogTypesMask(255), mFunctionLevelMap(), mClassLevelMap(), mFileLevelMap(), From e4e4ad3c09bdc06f738f60bbfd7899036ad6553f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Sep 2018 20:13:35 +0100 Subject: [PATCH 09/11] SL-966 - animated object size/pos constraints cont, including some settings for debugging. additional options to anim_tool.py for making test animations --- indra/newview/app_settings/settings.xml | 22 ++++++++++++++++++ indra/newview/llcontrolavatar.cpp | 24 +++++++++++++++----- scripts/content_tools/anim_tool.py | 30 ++++++++++++++++++++----- 3 files changed, 64 insertions(+), 12 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0277d09ae1..3ad8b6cded 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2237,6 +2237,28 @@ Value 1.00 + AnimatedObjectsMaxLegalOffset + + Comment + Max visual offset between object position and rendered position + Persist + 1 + Type + F32 + Value + 3.0 + + AnimatedObjectsMaxLegalSize + + Comment + Max bounding box size for animated object's rendered position + Persist + 1 + Type + F32 + Value + 64.0 + AvatarBoundingBoxComplexity Comment diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 54b1a0dcaf..96cdb7f01d 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -74,6 +74,18 @@ void LLControlAvatar::initInstance() void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_scale_fixup) const { + + F32 max_legal_offset = MAX_LEGAL_OFFSET; + if (gSavedSettings.getControl("AnimatedObjectsMaxLegalOffset")) + { + max_legal_offset = gSavedSettings.getF32("AnimatedObjectsMaxLegalOffset"); + } + F32 max_legal_size = MAX_LEGAL_SIZE; + if (gSavedSettings.getControl("AnimatedObjectsMaxLegalSize")) + { + max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); + } + new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; LLVector3 vol_pos = mRootVolp->getRenderPosition(); @@ -90,16 +102,16 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ const LLVector3 *extents = getLastAnimExtents(); LLVector3 box_dims = extents[1]-extents[0]; F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, getLastAnimExtents()); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, extents); F32 offset_dist = pos_box_offset.length(); - if (offset_dist > MAX_LEGAL_OFFSET) + if (offset_dist > max_legal_offset) { - F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); + F32 target_dist = (offset_dist - max_legal_offset); new_pos_fixup = mPositionConstraintFixup + (target_dist/offset_dist)*pos_box_offset; LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - else if (offset_dist < MAX_LEGAL_OFFSET-1 && mPositionConstraintFixup.length()>0.01f) + else if (offset_dist < max_legal_offset-1 && mPositionConstraintFixup.length()>0.01f) { new_pos_fixup = mPositionConstraintFixup * 0.9; LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " @@ -109,9 +121,9 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { new_pos_fixup = mPositionConstraintFixup; } - if (max_size/mScaleConstraintFixup > MAX_LEGAL_SIZE) + if (max_size/mScaleConstraintFixup > max_legal_size) { - new_scale_fixup = mScaleConstraintFixup*MAX_LEGAL_SIZE/max_size; + new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, max_size " << max_size << " fixup " << mScaleConstraintFixup << " -> " << new_scale_fixup << LL_ENDL; } diff --git a/scripts/content_tools/anim_tool.py b/scripts/content_tools/anim_tool.py index 77bf731ae6..b7585112c5 100644 --- a/scripts/content_tools/anim_tool.py +++ b/scripts/content_tools/anim_tool.py @@ -524,11 +524,14 @@ if __name__ == "__main__": parser = argparse.ArgumentParser(description="process SL animations") parser.add_argument("--verbose", help="verbose flag", action="store_true") - parser.add_argument("--dump", help="dump to specified file") + parser.add_argument("--dump", help="dump to stdout", action="store_true") parser.add_argument("--rot", help="specify sequence of rotations", type=float_triple, nargs="+") - parser.add_argument("--rand_pos", help="request random positions", action="store_true") + parser.add_argument("--rand_pos", help="request random positions within specified scale", type=float) parser.add_argument("--reset_pos", help="request original positions", action="store_true") parser.add_argument("--pos", help="specify sequence of positions", type=float_triple, nargs="+") + parser.add_argument("--duration", help="specify duration", type=float) + parser.add_argument("--loop_in", help="specify loop in time", type=float) + parser.add_argument("--loop_out", help="specify loop out time", type=float) parser.add_argument("--num_pos", help="number of positions to create", type=int, default=2) parser.add_argument("--delete_joints", help="specify joints to be deleted", nargs="+") parser.add_argument("--joints", help="specify joints to be added or modified", nargs="+") @@ -572,15 +575,21 @@ if __name__ == "__main__": for name in joints: anim.add_joint(name,0) if args.delete_joints: - for name in args.delete_joints: + del_joints = resolve_joints(args.delete_joints, skel_tree, lad_tree) + if args.verbose: + print "delete_joints resolved to",del_joints + for name in del_joints: anim.delete_joint(name) + joints.remove(name) if joints and args.rot: anim.add_rot(joints, args.rot) if joints and args.pos: anim.add_pos(joints, args.pos) - if joints and args.rand_pos: + print "joints ",joints,"rand_pos",args.rand_pos,"num_pos",args.num_pos + if joints and args.rand_pos is not None: + print "rand_pos",args.rand_pos for joint in joints: - pos_array = list(tuple(random.uniform(-1,1) for i in xrange(3)) for j in xrange(args.num_pos)) + pos_array = list(tuple(random.uniform(-args.rand_pos,args.rand_pos) for i in xrange(3)) for j in xrange(args.num_pos)) pos_array.append(pos_array[0]) anim.add_pos([joint], pos_array) if joints and args.reset_pos: @@ -605,8 +614,17 @@ if __name__ == "__main__": print "set joint priority",args.joint_priority for joint in anim.joints: joint.joint_priority = args.joint_priority + if args.duration is not None: + print "set duration",args.duration + anim.duration = args.duration + if args.loop_in is not None: + print "set loop_in",args.loop_in + anim.loop_in_point = args.loop_in + if args.loop_out is not None: + print "set loop_out",args.loop_out + anim.loop_out_point = args.loop_out if args.dump: - anim.dump(args.dump) + anim.dump("-") if args.summary: anim.summary() if args.outfilename: From c5a2aa0028ea1a31ec2c09f849dd6cb807c7340a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 17 Sep 2018 20:34:43 +0100 Subject: [PATCH 10/11] SL-9671 - refresh simulator features on region change --- indra/newview/llagent.cpp | 10 ++++++++++ indra/newview/llviewerregion.cpp | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 901294d6b4..d656d0b16c 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -881,6 +881,16 @@ void LLAgent::setRegion(LLViewerRegion *regionp) { gSky.mVOGroundp->setRegion(regionp); } + + if (regionp->capabilitiesReceived()) + { + regionp->requestSimulatorFeatures(); + } + else + { + regionp->setCapabilitiesReceivedCallback(boost::bind(&LLViewerRegion::requestSimulatorFeatures, regionp)); + } + } else { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 92e1d86365..527c8e61f2 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2151,6 +2151,8 @@ void LLViewerRegion::getInfo(LLSD& info) void LLViewerRegion::requestSimulatorFeatures() { + LL_DEBUGS("SimulatorFeatures") << "region " << getName() << " ptr " << this + << " trying to request SimulatorFeatures" << LL_ENDL; // kick off a request for simulator features std::string url = getCapability("SimulatorFeatures"); if (!url.empty()) @@ -2198,7 +2200,7 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) std::stringstream str; LLSDSerialize::toPrettyXML(sim_features, str); - LL_INFOS() << str.str() << LL_ENDL; + LL_INFOS() << "region " << getName() << " " << str.str() << LL_ENDL; mSimulatorFeatures = sim_features; setSimulatorFeaturesReceived(true); From 301821337bf692d9f8d56230dc620efa74fcd275 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 19 Sep 2018 15:53:44 +0100 Subject: [PATCH 11/11] SL-9680, SL-9673 - set attachment distance floor at 0.01 to avoid triggering divide-by-zero prevention logic. Force HUD attachments to always be full detail. --- indra/newview/lldrawable.cpp | 14 ++++++++------ indra/newview/llvovolume.cpp | 24 +++++++++++++++--------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 6f48b8a968..55db721ccf 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -913,12 +913,14 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) LLVector3 cam_region_pos = LLVector3(cam_pos - volume->getRegion()->getOriginGlobal()); LLVector3 cam_to_box_offset = point_to_box_offset(cam_region_pos, av_box); - //LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname() - // << " pos (ignored) " << pos - // << " cam pos " << cam_pos - // << " cam region pos " << cam_region_pos - // << " box " << av_box[0] << "," << av_box[1] << LL_ENDL; - mDistanceWRTCamera = ll_round(cam_to_box_offset.magVec(), 0.01f); + mDistanceWRTCamera = llmax(0.01f, ll_round(cam_to_box_offset.magVec(), 0.01f)); + LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname() + << " pos (ignored) " << pos + << " cam pos " << cam_pos + << " cam region pos " << cam_region_pos + << " box " << av_box[0] << "," << av_box[1] + << " -> dist " << mDistanceWRTCamera + << LL_ENDL; mVObjp->updateLOD(); return; } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 8de97c711d..913460b3d1 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1344,24 +1344,22 @@ BOOL LLVOVolume::calcLOD() const LLVector3* box = avatar->getLastAnimExtents(); LLVector3 diag = box[1] - box[0]; radius = diag.magVec() * 0.5f; - //LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL; + LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL; } else { // Volume in a rigged mesh attached to a regular avatar. -#if 0 // Note this isn't really a radius, so distance calcs are off by factor of 2 - radius = avatar->getBinRadius(); -#else + //radius = avatar->getBinRadius(); // SL-937: add dynamic box handling for rigged mesh on regular avatars. const LLVector3* box = avatar->getLastAnimExtents(); LLVector3 diag = box[1] - box[0]; radius = diag.magVec(); // preserve old BinRadius behavior - 2x off -#endif + LL_DEBUGS("DynamicBox") << avatar->getFullname() << " diag " << diag << " radius " << radius << LL_ENDL; } if (distance <= 0.f || radius <= 0.f) { - LL_DEBUGS("CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL; + LL_DEBUGS("DynamicBox","CalcLOD") << "avatar distance/radius uninitialized, skipping" << LL_ENDL; return FALSE; } } @@ -1371,7 +1369,7 @@ BOOL LLVOVolume::calcLOD() radius = getVolume() ? getVolume()->mLODScaleBias.scaledVec(getScale()).length() : getScale().length(); if (distance <= 0.f || radius <= 0.f) { - LL_DEBUGS("CalcLOD") << "non-avatar distance/radius uninitialized, skipping" << LL_ENDL; + LL_DEBUGS("DynamicBox","CalcLOD") << "non-avatar distance/radius uninitialized, skipping" << LL_ENDL; return FALSE; } } @@ -1414,7 +1412,15 @@ BOOL LLVOVolume::calcLOD() mLODAdjustedDistance = distance; - cur_detail = computeLODDetail(ll_round(distance, 0.01f), ll_round(radius, 0.01f), lod_factor); + if (isHUDAttachment()) + { + // HUDs always show at highest detail + cur_detail = 3; + } + else + { + cur_detail = computeLODDetail(ll_round(distance, 0.01f), ll_round(radius, 0.01f), lod_factor); + } if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TRIANGLE_COUNT) && mDrawable->getFace(0)) { @@ -1434,7 +1440,7 @@ BOOL LLVOVolume::calcLOD() if (cur_detail != mLOD) { - LL_DEBUGS("CalcLOD") << "new LOD " << cur_detail << " change from " << mLOD + LL_DEBUGS("DynamicBox","CalcLOD") << "new LOD " << cur_detail << " change from " << mLOD << " distance " << distance << " radius " << radius << " rampDist " << rampDist << " drawable rigged? " << (mDrawable ? (S32) mDrawable->isState(LLDrawable::RIGGED) : (S32) -1) << " mRiggedVolume " << (void*)getRiggedVolume()