diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2016-01-26 11:11:52 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2016-01-26 11:11:52 -0500 |
commit | e91a192301db37f99a4f5a817f3b4c47b448417a (patch) | |
tree | 92ca390554fe05d82a91e11bc78eeb618994d91d | |
parent | 5345d1e115fdf3fca7ea3e8330f1a23ad19257c8 (diff) |
SL-315 WIP - added callstack info to joint debugging. Made joint debugging run-time configurable via debug setting DebugAvatarJoints
-rwxr-xr-x | indra/llcharacter/lljoint.cpp | 27 | ||||
-rwxr-xr-x | indra/llcharacter/lljoint.h | 4 | ||||
-rw-r--r-- | indra/llcommon/StackWalker.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/StackWalker.h | 2 | ||||
-rw-r--r-- | indra/llcommon/llcallstack.cpp | 15 | ||||
-rw-r--r-- | indra/llcommon/llcallstack.h | 3 | ||||
-rwxr-xr-x | indra/newview/app_settings/settings.xml | 11 | ||||
-rwxr-xr-x | indra/newview/llviewercontrol.cpp | 8 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 3 | ||||
-rwxr-xr-x | indra/newview/llvoavatarself.cpp | 3 |
10 files changed, 65 insertions, 13 deletions
diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 8fcab454dc..a314692edc 100755 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -32,6 +32,8 @@ #include "lljoint.h" #include "llmath.h" +#include "llcallstack.h" +#include <boost/algorithm/string.hpp> S32 LLJoint::sNumUpdates = 0; S32 LLJoint::sNumTouches = 0; @@ -313,7 +315,11 @@ const LLVector3& LLJoint::getPosition() bool do_debug_joint(const std::string& name) { - return false; + if (std::find(LLJoint::s_debugJointNames.begin(), LLJoint::s_debugJointNames.end(),name) != LLJoint::s_debugJointNames.end()) + { + return true; + } + return false; } //-------------------------------------------------------------------- @@ -325,7 +331,9 @@ void LLJoint::setPosition( const LLVector3& pos ) { if (do_debug_joint(getName())) { + LLCallStack cs; LL_DEBUGS("Avatar") << " joint " << getName() << " set pos " << pos << LL_ENDL; + LL_DEBUGS("Avatar") << "STACK:\n" << "====================\n" << cs << "====================" << LL_ENDL; } } mXform.setPosition(pos); @@ -427,6 +435,23 @@ void LLJoint::updatePos(const std::string& av_info) setPosition(pos); } +// init static +LLJoint::debug_joint_name_t LLJoint::s_debugJointNames = debug_joint_name_t(); + +//-------------------------------------------------------------------- +// setDebugJointNames +//-------------------------------------------------------------------- +void LLJoint::setDebugJointNames(const debug_joint_name_t& names) +{ + s_debugJointNames = names; +} +void LLJoint::setDebugJointNames(const std::string& names_string) +{ + debug_joint_name_t names; + boost::split(names, names_string, boost::is_any_of(" :,")); + setDebugJointNames(names); +} + //-------------------------------------------------------------------- // getWorldPosition() //-------------------------------------------------------------------- diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index 424f172318..ab21f73122 100755 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -130,6 +130,10 @@ public: // debug statics static S32 sNumTouches; static S32 sNumUpdates; + typedef std::set<std::string> debug_joint_name_t; + static debug_joint_name_t s_debugJointNames; + static void setDebugJointNames(const debug_joint_name_t& names); + static void setDebugJointNames(const std::string& names_string); LLPosOverrideMap m_attachmentOverrides; LLVector3 m_posBeforeOverrides; diff --git a/indra/llcommon/StackWalker.cpp b/indra/llcommon/StackWalker.cpp index da52386a22..768595f5de 100644 --- a/indra/llcommon/StackWalker.cpp +++ b/indra/llcommon/StackWalker.cpp @@ -4,7 +4,7 @@ * http://stackwalker.codeplex.com/ * * - * $LicenseInfo:firstyear=2016&license=viewerlgpl$ + * $LicenseInfo:firstyear=2016&license=bsd$ * * History: * 2005-07-27 v1 - First public release on http://www.codeproject.com/ diff --git a/indra/llcommon/StackWalker.h b/indra/llcommon/StackWalker.h index f4ef8d557f..b29cdbfc81 100644 --- a/indra/llcommon/StackWalker.h +++ b/indra/llcommon/StackWalker.h @@ -4,7 +4,7 @@ * * * - * $LicenseInfo:firstyear=2016&license=viewerlgpl$ + * $LicenseInfo:firstyear=2016&license=bsd$ * * LICENSE (http://www.opensource.org/licenses/bsd-license.php) * diff --git a/indra/llcommon/llcallstack.cpp b/indra/llcommon/llcallstack.cpp index 87eb37de16..02cf4d0173 100644 --- a/indra/llcommon/llcallstack.cpp +++ b/indra/llcommon/llcallstack.cpp @@ -39,12 +39,14 @@ public: ~LLCallStackImpl() { } - void getStack(std::vector<std::string>& stack) + void getStack(std::vector<std::string>& stack, S32 skip_count=0) { m_stack.clear(); ShowCallstack(); - // Skip the first 2 lines because they're just bookkeeping for LLCallStack. - for (S32 i=3; i<m_stack.size(); ++i) + // Skip the first few lines because they're just bookkeeping for LLCallStack, + // plus any additional lines requested to skip. + S32 first_line = skip_count + 3; + for (S32 i=first_line; i<m_stack.size(); ++i) { stack.push_back(m_stack[i]); } @@ -63,7 +65,7 @@ class LLCallStackImpl public: LLCallStackImpl() {} ~LLCallStackImpl() {} - void getStack(std::vector<std::string>& stack) + void getStack(std::vector<std::string>& stack, S32 skip_count=0) { stack.clear(); } @@ -72,14 +74,15 @@ public: LLCallStackImpl *LLCallStack::s_impl = NULL; -LLCallStack::LLCallStack() +LLCallStack::LLCallStack(S32 skip_count): + m_skipCount(skip_count) { if (!s_impl) { s_impl = new LLCallStackImpl; } LLTimer t; - s_impl->getStack(m_strings); + s_impl->getStack(m_strings, m_skipCount); } std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack) diff --git a/indra/llcommon/llcallstack.h b/indra/llcommon/llcallstack.h index 6059d4f2c5..598db3d404 100644 --- a/indra/llcommon/llcallstack.h +++ b/indra/llcommon/llcallstack.h @@ -29,10 +29,11 @@ class LLCallStackImpl; class LLCallStack { public: - LLCallStack(); + LLCallStack(S32 skip_count=0); std::vector<std::string> m_strings; private: static LLCallStackImpl *s_impl; + S32 m_skipCount; }; LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 32707e7653..e1f2ecff0c 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2183,6 +2183,17 @@ <key>Value</key> <string /> </map> + <key>DebugAvatarJoints</key> + <map> + <key>Comment</key> + <string>List of joints to emit additional debugging info about.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>String</string> + <key>Value</key> + <string /> + </map> <key>DebugAvatarRezTime</key> <map> <key>Comment</key> diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 612fd9a326..3532a872c9 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -120,6 +120,13 @@ static bool handleTerrainDetailChanged(const LLSD& newvalue) } +static bool handleDebugAvatarJointsChanged(const LLSD& newvalue) +{ + std::string new_string = newvalue.asString(); + LLJoint::setDebugJointNames(new_string); + return true; +} + static bool handleDeferredDebugSettingChanged(const LLSD& newvalue) { LLNotificationsUtil::add("ChangeDeferredDebugSetting"); @@ -769,6 +776,7 @@ void settings_setup_listeners() gSavedSettings.getControl("SpellCheckDictionary")->getSignal()->connect(boost::bind(&handleSpellCheckChanged)); gSavedSettings.getControl("LoginLocation")->getSignal()->connect(boost::bind(&handleLoginLocationChanged)); gSavedSettings.getControl("IncludeEnhancedSkeleton")->getCommitSignal()->connect(boost::bind(&handleDeferredDebugSettingChanged, _2)); + gSavedSettings.getControl("DebugAvatarJoints")->getCommitSignal()->connect(boost::bind(&handleDebugAvatarJointsChanged, _2)); } #if TEST_CACHED_CONTROL diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index efc07fffe5..ffe51ee0ae 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1084,6 +1084,9 @@ void LLVOAvatar::initClass() gAnimLibrary.animStateSetString(ANIM_AGENT_PELVIS_FIX,"pelvis_fix"); gAnimLibrary.animStateSetString(ANIM_AGENT_TARGET,"target"); gAnimLibrary.animStateSetString(ANIM_AGENT_WALK_ADJUST,"walk_adjust"); + + // Where should this be set initially? + LLJoint::setDebugJointNames(gSavedSettings.getString("DebugAvatarJoints")); } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 0648ee6732..aadcce95b9 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -207,9 +207,6 @@ bool update_avatar_rez_metrics() gAgentAvatarp->updateAvatarRezMetrics(false); - LLCallStack cs; - LL_INFOS() << "CallStack:\n" << cs << LL_ENDL; - return false; } |