SL-315 - context strings, comments, debugging. joint_test temporarily disabled.

master
Brad Payne (Vir Linden) 2016-02-03 08:59:25 -05:00
parent 19de8f3993
commit ef02c9ea69
20 changed files with 159 additions and 16 deletions

View File

@ -606,6 +606,7 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
parent->addChild( joint );
}
// SL-315
joint->setPosition(info->mPos);
joint->setRotation(mayaQ(info->mRot.mV[VX], info->mRot.mV[VY],
info->mRot.mV[VZ], LLQuaternion::XYZ));
@ -847,6 +848,7 @@ void LLAvatarAppearance::buildCharacter()
//-------------------------------------------------------------------------
// initialize the pelvis
//-------------------------------------------------------------------------
// SL-315
mPelvisp->setPosition( LLVector3(0.0f, 0.0f, 0.0f) );
mIsBuilt = TRUE;

View File

@ -289,6 +289,7 @@ void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh )
}
// acquire the transform from the mesh object
// SL-315
setPosition( mMesh->getPosition() );
setRotation( mMesh->getRotation() );
setScale( mMesh->getScale() );

View File

@ -647,6 +647,7 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )
LLVector3 pos_delta = volume_morph->mPos * delta_weight;
volume_morph->mVolume->setScale(volume_morph->mVolume->getScale() + scale_delta);
// SL-315
volume_morph->mVolume->setPosition(volume_morph->mVolume->getPosition() + pos_delta);
}
}

View File

@ -225,6 +225,7 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
LLVector3 newPosition = joint->getPosition();
LLVector3 positionDelta = iter->second;
newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
// SL-315
joint->setPosition(newPosition);
}

View File

@ -91,12 +91,12 @@ target_link_libraries(
# Add tests
if (LL_TESTS)
include(LLAddBuildTest)
# UNIT TESTS
SET(llcharacter_TEST_SOURCE_FILES
lljoint.cpp
)
LL_ADD_PROJECT_UNIT_TESTS(llcharacter "${llcharacter_TEST_SOURCE_FILES}")
endif (LL_TESTS)
#if (LL_TESTS)
# include(LLAddBuildTest)
# # UNIT TESTS
# SET(llcharacter_TEST_SOURCE_FILES
# lljoint.cpp
# )
# LL_ADD_PROJECT_UNIT_TESTS(llcharacter "${llcharacter_TEST_SOURCE_FILES}")
#endif (LL_TESTS)

View File

@ -117,6 +117,7 @@ LLMotion::LLMotionInitStatus LLEditingMotion::onInitialize(LLCharacter *characte
addJointState( mWristState );
// propagate joint positions to kinematic chain
// SL-315
mParentJoint.setPosition( mParentState->getJoint()->getWorldPosition() );
mShoulderJoint.setPosition( mShoulderState->getJoint()->getPosition() );
mElbowJoint.setPosition( mElbowState->getJoint()->getPosition() );
@ -143,6 +144,7 @@ LLMotion::LLMotionInitStatus LLEditingMotion::onInitialize(LLCharacter *characte
BOOL LLEditingMotion::onActivate()
{
// propagate joint positions to kinematic chain
// SL-315
mParentJoint.setPosition( mParentState->getJoint()->getWorldPosition() );
mShoulderJoint.setPosition( mShoulderState->getJoint()->getPosition() );
mElbowJoint.setPosition( mElbowState->getJoint()->getPosition() );
@ -181,6 +183,7 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask)
focus_pt += mCharacter->getCharacterPosition();
// propagate joint positions to kinematic chain
// SL-315
mParentJoint.setPosition( mParentState->getJoint()->getWorldPosition() );
mShoulderJoint.setPosition( mShoulderState->getJoint()->getPosition() );
mElbowJoint.setPosition( mElbowState->getJoint()->getPosition() );
@ -217,7 +220,8 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask)
" and focus point " << focus_pt << LL_ENDL;
target.setVec(1.f, 1.f, 1.f);
}
// SL-315
mTarget.setPosition( target + mParentJoint.getPosition());
// LL_INFOS() << "Point At: " << mTarget.getPosition() << LL_ENDL;

View File

@ -327,12 +327,15 @@ bool do_debug_joint(const std::string& name)
//--------------------------------------------------------------------
void LLJoint::setPosition( const LLVector3& pos )
{
LLScopedContextString str("setPosition");
if (pos != getPosition())
{
if (do_debug_joint(getName()))
{
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;
}
}
@ -424,12 +427,18 @@ void LLJoint::updatePos(const std::string& av_info)
LLUUID mesh_id;
if (m_attachmentOverrides.findActiveOverride(mesh_id,found_pos))
{
LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " updatePos, winner of " << m_attachmentOverrides.count() << " is mesh " << mesh_id << " pos " << found_pos << LL_ENDL;
if (do_debug_joint(getName()))
{
LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " updatePos, winner of " << m_attachmentOverrides.count() << " is mesh " << mesh_id << " pos " << found_pos << LL_ENDL;
}
pos = found_pos;
}
else
{
LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " updatePos, winner is posBeforeOverrides " << m_posBeforeOverrides << LL_ENDL;
if (do_debug_joint(getName()))
{
LL_DEBUGS("Avatar") << "av " << av_info << " joint " << getName() << " updatePos, winner is posBeforeOverrides " << m_posBeforeOverrides << LL_ENDL;
}
pos = m_posBeforeOverrides;
}
setPosition(pos);

View File

@ -186,7 +186,8 @@ public:
// get/set local position
const LLVector3& getPosition();
void setPosition( const LLVector3& pos );
// BENTO - history? Not implemented or used.
void setDefaultPosition( const LLVector3& pos );
// get/set world position

View File

@ -201,10 +201,12 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask)
//-------------------------------------------------------------------------
// propagate joint positions to internal versions
//-------------------------------------------------------------------------
// SL-315
mPelvisJoint.setPosition(
root_world_pos +
mPelvisState->getPosition() );
// SL-315
mHipLeftJoint.setPosition( mHipLeftState->getJoint()->getPosition() );
mKneeLeftJoint.setPosition( mKneeLeftState->getJoint()->getPosition() );
mAnkleLeftJoint.setPosition( mAnkleLeftState->getJoint()->getPosition() );
@ -213,6 +215,7 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask)
mKneeLeftJoint.setScale( mKneeLeftState->getJoint()->getScale() );
mAnkleLeftJoint.setScale( mAnkleLeftState->getJoint()->getScale() );
// SL-315
mHipRightJoint.setPosition( mHipRightState->getJoint()->getPosition() );
mKneeRightJoint.setPosition( mKneeRightState->getJoint()->getPosition() );
mAnkleRightJoint.setPosition( mAnkleRightState->getJoint()->getPosition() );
@ -265,6 +268,7 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask)
mCharacter->getGround( mAnkleLeftJoint.getWorldPosition(), mPositionLeft, mNormalLeft);
mCharacter->getGround( mAnkleRightJoint.getWorldPosition(), mPositionRight, mNormalRight);
// SL-315
mTargetLeft.setPosition( mPositionLeft );
mTargetRight.setPosition( mPositionRight );
}

View File

@ -114,7 +114,7 @@ void LLMotion::addJointState(const LLPointer<LLJointState>& jointState)
S32 joint_num = jointState->getJoint()->getJointNum();
if ((joint_num >= (S32)LL_CHARACTER_MAX_JOINTS) || (joint_num < 0))
{
LL_WARNS() << "joint_num " << joint_num << " is outside of legal range [0-" << LL_CHARACTER_MAX_JOINTS << ")" << LL_ENDL;
LL_WARNS() << "joint_num " << joint_num << " is outside of legal range [0-" << LL_CHARACTER_MAX_JOINTS << ") for joint " << jointState->getJoint()->getName() << LL_ENDL;
}
mJointSignature[0][joint_num] = (usage & LLJointState::POS) ? (0xff >> (7 - priority)) : 0;
mJointSignature[1][joint_num] = (usage & LLJointState::ROT) ? (0xff >> (7 - priority)) : 0;

View File

@ -386,6 +386,7 @@ void LLJointStateBlender::blendJointStates(BOOL apply_now)
}
// apply transforms
// SL-315
target_joint->setPosition(blended_pos + added_pos);
target_joint->setScale(blended_scale + added_scale);
target_joint->setRotation(added_rot * blended_rot);
@ -417,6 +418,7 @@ void LLJointStateBlender::interpolate(F32 u)
return;
}
// SL-315
target_joint->setPosition(lerp(target_joint->getPosition(), mJointCache.getPosition(), u));
target_joint->setScale(lerp(target_joint->getScale(), mJointCache.getScale(), u));
target_joint->setRotation(nlerp(u, target_joint->getRotation(), mJointCache.getRotation()));
@ -444,6 +446,7 @@ void LLJointStateBlender::resetCachedJoint()
return;
}
LLJoint* source_joint = mJointStates[0]->getJoint();
// SL-315
mJointCache.setPosition(source_joint->getPosition());
mJointCache.setScale(source_joint->getScale());
mJointCache.setRotation(source_joint->getRotation());

View File

@ -88,6 +88,7 @@ namespace tut
{
LLJoint lljoint;
LLVector3 vec3(2.3f,30.f,10.f);
// SL-315
lljoint.setPosition(vec3);
LLVector3 pos = lljoint.getPosition();
ensure("setPosition()/getPosition() failed ", (vec3 == pos));
@ -98,6 +99,7 @@ namespace tut
{
LLJoint lljoint;
LLVector3 vec3(2.3f,30.f,10.f);
// SL-315
lljoint.setWorldPosition(vec3);
LLVector3 pos = lljoint.getWorldPosition();
ensure("1:setWorldPosition()/getWorldPosition() failed ", (vec3 == pos));

View File

@ -24,6 +24,8 @@
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llcommon.h"
#include "llcallstack.h"
#include "StackWalker.h"
@ -95,3 +97,56 @@ std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack)
}
return s;
}
#include "llthreadlocalstorage.h"
LLContextStrings::LLContextStrings()
{
}
// static
LLContextStrings* LLContextStrings::getThreadLocalInstance()
{
LLContextStrings *cons = LLThreadLocalSingletonPointer<LLContextStrings>::getInstance();
if (!cons)
{
LLThreadLocalSingletonPointer<LLContextStrings>::setInstance(new LLContextStrings);
}
return LLThreadLocalSingletonPointer<LLContextStrings>::getInstance();
}
// static
void LLContextStrings::addContextString(const std::string& str)
{
LLContextStrings *cons = getThreadLocalInstance();
//LL_INFOS() << "CTX " << (S32)cons << " ADD " << str << " CNT " << cons->m_contextStrings[str] << LL_ENDL;
cons->m_contextStrings[str]++;
}
// static
void LLContextStrings::removeContextString(const std::string& str)
{
LLContextStrings *cons = getThreadLocalInstance();
cons->m_contextStrings[str]--;
//LL_INFOS() << "CTX " << (S32)cons << " REMOVE " << str << " CNT " << cons->m_contextStrings[str] << LL_ENDL;
if (cons->m_contextStrings[str] == 0)
{
cons->m_contextStrings.erase(str);
}
}
// static
void LLContextStrings::output(std::ostream& os)
{
const std::map<std::string,S32>& strings = LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->m_contextStrings;
for (std::map<std::string,S32>::const_iterator it = strings.begin(); it!=strings.end(); ++it)
{
os << it->first << "[" << it->second << "]" << "\n";
}
}
std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status)
{
LLThreadLocalSingletonPointer<LLContextStrings>::getInstance()->output(s);
return s;
}

View File

@ -24,6 +24,8 @@
* $/LicenseInfo$
*/
#include <map>
class LLCallStackImpl;
class LLCallStack
@ -38,3 +40,39 @@ private:
};
LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack);
class LLContextStrings
{
public:
LLContextStrings();
static void addContextString(const std::string& str);
static void removeContextString(const std::string& str);
static void output(std::ostream& os);
static LLContextStrings* getThreadLocalInstance();
private:
std::map<std::string,S32> m_contextStrings;
};
class LLScopedContextString
{
public:
LLScopedContextString(const std::string& str):
m_str(str)
{
LLContextStrings::addContextString(m_str);
}
~LLScopedContextString()
{
LLContextStrings::removeContextString(m_str);
}
private:
std::string m_str;
};
// This doesn't really have any state, just acts as class to hook the
// ostream override to.
struct LLContextStatus
{
};
LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status);

View File

@ -1448,6 +1448,7 @@ void LLAgentCamera::updateCamera()
diff.mV[VZ] = 0.f;
}
// SL-315
gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff);
gAgentAvatarp->mRoot->updateWorldMatrixChildren();
@ -2144,6 +2145,7 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate)
if (isAgentAvatarValid())
{
// SL-315
gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero);
gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE );
gAgentAvatarp->startMotion( ANIM_AGENT_BREATHE_ROT );
@ -2184,6 +2186,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
{
if (!gAgentAvatarp->isSitting())
{
// SL-315
gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero);
}
gAgentAvatarp->startMotion(ANIM_AGENT_BODY_NOISE);

View File

@ -214,7 +214,10 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski
for (U32 j = 0; j < skin->mJointNames.size(); ++j)
{
LL_DEBUGS("Avatar") << "Starting joint[" << j << "] = " << skin->mJointNames[j] << " j_remap " << j_remap[j] << " ==> " << new_joint_names[j_remap[j]] << LL_ENDL;
if (skin->mJointNames[j] != new_joint_names[j_remap[j]])
{
LL_DEBUGS("Avatar") << "Starting joint[" << j << "] = " << skin->mJointNames[j] << " j_remap " << j_remap[j] << " ==> " << new_joint_names[j_remap[j]] << LL_ENDL;
}
}
skin->mJointNames = new_joint_names;

View File

@ -352,6 +352,7 @@ void LLViewerJointAttachment::setAttachmentVisibility(BOOL visible)
void LLViewerJointAttachment::setOriginalPosition(LLVector3& position)
{
mOriginalPos = position;
// SL-315
setPosition(position);
}

View File

@ -105,6 +105,7 @@
#include "llsdutil.h"
#include "llscenemonitor.h"
#include "llsdserialize.h"
#include "llcallstack.h"
extern F32 SPEED_ADJUST_MAX;
extern F32 SPEED_ADJUST_MAX_SEC;
@ -2097,6 +2098,8 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
return;
}
LLScopedContextString str("avatar_idle_update " + getFullname());
checkTextureLoading() ;
// force immediate pixel area update on avatars using last frames data (before drawable or camera updates)
@ -3098,6 +3101,7 @@ void LLVOAvatar::idleUpdateBelowWater()
void LLVOAvatar::slamPosition()
{
gAgent.setPositionAgent(getPositionAgent());
// SL-315
mRoot->setWorldPosition(getPositionAgent()); // teleport
setChanged(TRANSLATED);
if (mDrawable.notNull())
@ -3450,6 +3454,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
mTimeLast = animation_time;
// put the pelvis at slaved position/mRotation
// SL-315
mRoot->setWorldPosition( getPositionAgent() ); // first frame
mRoot->setWorldRotation( getRotation() );
}
@ -3504,6 +3509,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
if (newPosition != mRoot->getXform()->getWorldPosition())
{
mRoot->touch();
// SL-315
mRoot->setWorldPosition( newPosition ); // regular update
}
@ -3667,6 +3673,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
{
LLVector3 pos = mDrawable->getPosition();
pos += getHoverOffset() * mDrawable->getRotation();
// SL-315
mRoot->setPosition(pos);
mRoot->setRotation(mDrawable->getRotation());
}
@ -3697,6 +3704,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
LLVector3 pos = mRoot->getWorldPosition();
pos.mV[VZ] += off_z;
mRoot->touch();
// SL-315
mRoot->setWorldPosition(pos);
}
}
@ -5171,6 +5179,8 @@ bool LLVOAvatar::getRiggedMeshID(LLViewerObject* pVO, LLUUID& mesh_id)
void LLVOAvatar::clearAttachmentPosOverrides()
{
LLScopedContextString str("clearAttachmentPosOverrides " + getFullname());
//Subsequent joints are relative to pelvis
avatar_joint_list_t::iterator iter = mSkeleton.begin();
avatar_joint_list_t::iterator end = mSkeleton.end();
@ -5195,7 +5205,9 @@ void LLVOAvatar::addAttachmentPosOverridesForObject(LLViewerObject *vo)
{
LL_WARNS("Avatar") << "called with invalid avatar" << LL_ENDL;
}
LLScopedContextString str("addAttachmentPosOverridesForObject " + av->getFullname());
// Process all children
LLViewerObject::const_child_list_t& children = vo->getChildren();
for (LLViewerObject::const_child_list_t::const_iterator it = children.begin();
@ -5316,6 +5328,7 @@ void LLVOAvatar::resetJointPositionsOnDetach(const LLUUID& mesh_id)
if ( pJoint && pJoint == pJointPelvis)
{
removePelvisFixup( mesh_id );
// SL-315
pJoint->setPosition( LLVector3( 0.0f, 0.0f, 0.0f) );
}
}
@ -6098,6 +6111,7 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object)
// objects to be not rendered for new arrivals. See EXT-6835 and EXT-1655.
sitDown(TRUE);
mRoot->getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject
// SL-315
mRoot->setPosition(getPosition());
mRoot->updateWorldMatrixChildren();
@ -6156,6 +6170,7 @@ void LLVOAvatar::getOffObject()
sitDown(FALSE);
mRoot->getXform()->setParent(NULL); // LLVOAvatar::getOffObject
// SL-315
mRoot->setPosition(cur_position_world);
mRoot->setRotation(cur_rotation_world);
mRoot->getXform()->update();

View File

@ -354,6 +354,7 @@ BOOL LLVOAvatarSelf::buildSkeletonSelf(const LLAvatarSkeletonInfo *info)
F32 aspect = LLViewerCamera::getInstance()->getAspect();
LLVector3 scale(1.f, aspect, 1.f);
mScreenp->setScale(scale);
// SL-315
mScreenp->setWorldPosition(LLVector3::zero);
// need to update screen agressively when sidebar opens/closes, for example
mScreenp->mUpdateXform = TRUE;

View File

@ -10,7 +10,6 @@
left="0"
name="notification_panel"
chrome="true"
show_title="false"
top="0"
height="140"
translate="false"