From a09cc5f4bb9ccf93db7233d0b1fd0142803b2f23 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 30 Jun 2017 20:49:23 +0100 Subject: SL-731 - added a hook for debug text specific to control avatars. Also renamed resetJointsOnDetach to removeAttachmentOverridesForObject to make the connection to addAttachmentOverridesForObject more obvious. --- indra/newview/llcontrolavatar.cpp | 6 ++++ indra/newview/llcontrolavatar.h | 2 ++ indra/newview/llviewermessage.cpp | 6 ++-- indra/newview/llviewerobject.cpp | 17 +++++---- indra/newview/llvoavatar.cpp | 76 +++++++++++++++++++-------------------- indra/newview/llvoavatar.h | 4 +-- indra/newview/llvovolume.cpp | 2 +- 7 files changed, 60 insertions(+), 53 deletions(-) (limited to 'indra') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 6fc3d52fe7..bd99f66459 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -183,4 +183,10 @@ void LLControlAvatar::idleUpdate(LLAgent &agent, const F64 &time) } } +//virtual +void LLControlAvatar::updateDebugText() +{ + addDebugText("I'm a control avatar"); + LLVOAvatar::updateDebugText(); +} diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index 5cca0ab9dd..fc7b4aa06d 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -52,6 +52,8 @@ public: virtual void idleUpdate(LLAgent &agent, const F64 &time); + virtual void updateDebugText(); + bool mPlaying; F32 mGlobalScale; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f8cdb5bf92..227c6afcb0 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5105,7 +5105,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) } S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); - LL_WARNS() << "AXON handle object animation here, num_blocks " << num_blocks << LL_ENDL; + LL_DEBUGS("AXON") << "handle object animation here, num_blocks " << num_blocks << LL_ENDL; if (!avatarp->mPlaying) { @@ -5119,13 +5119,13 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i); mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i); avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; - LL_INFOS() << "AXON got object animation request for object " + LL_DEBUGS("AXON") << "got object animation request for object " << uuid << " animation id " << animation_id << LL_ENDL; } if (num_blocks >= 0) { - LL_INFOS() << "AXON process animation state changes here" << LL_ENDL; + LL_DEBUGS("AXON") << "process animation state changes here" << LL_ENDL; avatarp->processAnimationStateChanges(); } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 9a6153d3e6..c6051650cf 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -371,17 +371,19 @@ void LLViewerObject::markDead() //LL_INFOS() << "Marking self " << mLocalID << " as dead." << LL_ENDL; // Root object of this hierarchy unlinks itself. - LLVOAvatar *av = getAvatarAncestor(); if (getParent()) { ((LLViewerObject *)getParent())->removeChild(this); } LLUUID mesh_id; - if (av && LLVOAvatar::getRiggedMeshID(this,mesh_id)) - { - // This case is needed for indirectly attached mesh objects. - av->resetJointsOnDetach(mesh_id); - } + { + LLVOAvatar *av = getAvatar(); + if (av && LLVOAvatar::getRiggedMeshID(this,mesh_id)) + { + // This case is needed for indirectly attached mesh objects. + av->removeAttachmentOverridesForObject(mesh_id); + } + } if (getControlAvatar()) { unlinkControlAvatar(); @@ -2950,7 +2952,7 @@ void LLViewerObject::unlinkControlAvatar() { if (getControlAvatar()) { - getControlAvatar()->resetJointsOnDetach(this); + getControlAvatar()->removeAttachmentOverridesForObject(this); } if (isRootEdit()) { @@ -5187,6 +5189,7 @@ LLVOAvatar* LLViewerObject::asAvatar() // If this object is directly or indirectly parented by an avatar, return it. LLVOAvatar* LLViewerObject::getAvatarAncestor() { + LL_ERRS("AXON") << "this method has been targetted for termination. Use getAvatar()." << LL_ENDL; LLViewerObject *pobj = (LLViewerObject*) getParent(); while (pobj) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4ed924f828..9a1629fbfb 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1409,13 +1409,29 @@ void LLVOAvatar::renderCollisionVolumes() static F32 sphere_scale = 1.0f; static F32 center_dot_scale = 0.05f; - static LLVector3 CV_COLOR_OCCLUDED(0.0f, 0.0f, 1.0f); - static LLVector3 CV_COLOR_VISIBLE(0.5f, 0.5f, 1.0f); - static LLVector3 DOT_COLOR_OCCLUDED(1.0f, 1.0f, 1.0f); - static LLVector3 DOT_COLOR_VISIBLE(1.0f, 1.0f, 1.0f); + static LLVector3 BLUE(0.0f, 0.0f, 1.0f); + static LLVector3 PASTEL_BLUE(0.5f, 0.5f, 1.0f); + static LLVector3 RED(1.0f, 0.0f, 0.0f); + static LLVector3 PASTEL_RED(1.0f, 0.5f, 0.5f); + static LLVector3 WHITE(1.0f, 1.0f, 1.0f); + - render_sphere_and_line(begin_pos, end_pos, sphere_scale, CV_COLOR_OCCLUDED, CV_COLOR_VISIBLE); - render_sphere_and_line(begin_pos, end_pos, center_dot_scale, DOT_COLOR_OCCLUDED, DOT_COLOR_VISIBLE); + LLVector3 cv_color_occluded; + LLVector3 cv_color_visible; + LLVector3 dot_color_occluded(WHITE); + LLVector3 dot_color_visible(WHITE); + if (isControlAvatar()) + { + cv_color_occluded = RED; + cv_color_visible = PASTEL_RED; + } + else + { + cv_color_occluded = BLUE; + cv_color_visible = PASTEL_BLUE; + } + render_sphere_and_line(begin_pos, end_pos, sphere_scale, cv_color_occluded, cv_color_visible); + render_sphere_and_line(begin_pos, end_pos, center_dot_scale, dot_color_occluded, dot_color_visible); gGL.popMatrix(); } @@ -1427,9 +1443,6 @@ void LLVOAvatar::renderCollisionVolumes() mNameText->lineSegmentIntersect(unused, unused, unused, TRUE); } - - mDebugText.clear(); - addDebugText(ostr.str()); } void LLVOAvatar::renderBones() @@ -3357,8 +3370,7 @@ bool LLVOAvatar::isInMuteList() void LLVOAvatar::updateDebugText() { - // clear debug text - mDebugText.clear(); + // Leave mDebugText uncleared here, in case a derived class has added some state first if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { @@ -3482,8 +3494,7 @@ void LLVOAvatar::updateDebugText() { setDebugText(mDebugText); } - mDebugText.clear(); - + mDebugText.clear(); } //------------------------------------------------------------------------ @@ -5579,28 +5590,13 @@ void LLVOAvatar::rebuildAttachmentOverrides() //----------------------------------------------------------------------------- void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) { - bool non_attached_case = false; - // FIXME AXON - will this work if vo has child objects? - if (vo->getControlAvatar()) - { - non_attached_case = true; - } - LLVOAvatar *av; - if (non_attached_case) - { - av = vo->getControlAvatar(); - } - else + if (vo->getAvatar() != this) { - av = vo->getAvatarAncestor(); - if (!av || (av != this)) - { LL_WARNS("Avatar") << "called with invalid avatar" << LL_ENDL; return; - } } - LLScopedContextString str("addAttachmentOverridesForObject " + av->getFullname()); + LLScopedContextString str("addAttachmentOverridesForObject " + vo->getAvatar()->getFullname()); // Process all children LLViewerObject::const_child_list_t& children = vo->getChildren(); @@ -5626,7 +5622,7 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) LLUUID currentId = vobj->getVolume()->getParams().getSculptID(); const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( currentId, vobj ); - if ( vobj && (vobj->isAttachment()||non_attached_case) && vobj->isMesh() && pSkinData ) + if ( vobj && vobj->isMesh() && pSkinData ) { const int bindCnt = pSkinData->mAlternateBindMatrix.size(); const int jointCnt = pSkinData->mJointNames.size(); @@ -5808,15 +5804,15 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const } //----------------------------------------------------------------------------- -// resetJointsOnDetach +// removeAttachmentOverridesForObject //----------------------------------------------------------------------------- // AXON handle NPC case -void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) +void LLVOAvatar::removeAttachmentOverridesForObject(LLViewerObject *vo) { - LLVOAvatar *av = vo->getAvatarAncestor(); - if (!av || (av != this)) + if (vo->getAvatar() != this) { LL_WARNS("Avatar") << "called with invalid avatar" << LL_ENDL; + return; } // Process all children @@ -5825,22 +5821,22 @@ void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) it != children.end(); ++it) { LLViewerObject *childp = *it; - resetJointsOnDetach(childp); + removeAttachmentOverridesForObject(childp); } // Process self. LLUUID mesh_id; if (getRiggedMeshID(vo,mesh_id)) { - resetJointsOnDetach(mesh_id); + removeAttachmentOverridesForObject(mesh_id); } } //----------------------------------------------------------------------------- -// resetJointsOnDetach +// removeAttachmentOverridesForObject //----------------------------------------------------------------------------- // AXON handle NPC case -void LLVOAvatar::resetJointsOnDetach(const LLUUID& mesh_id) +void LLVOAvatar::removeAttachmentOverridesForObject(const LLUUID& mesh_id) { //Subsequent joints are relative to pelvis avatar_joint_list_t::iterator iter = mSkeleton.begin(); @@ -6559,7 +6555,7 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO ) LLUUID mesh_id; if (getRiggedMeshID(pVO, mesh_id)) { - resetJointsOnDetach(mesh_id); + removeAttachmentOverridesForObject(mesh_id); if ( gAgentCamera.cameraCustomizeAvatar() ) { gAgent.unpauseAnimation(); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2b71cfbe61..406b9d8a22 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -202,8 +202,8 @@ public: LLJoint* getJoint(S32 num); void addAttachmentOverridesForObject(LLViewerObject *vo); - void resetJointsOnDetach(const LLUUID& mesh_id); - void resetJointsOnDetach(LLViewerObject *vo); + void removeAttachmentOverridesForObject(const LLUUID& mesh_id); + void removeAttachmentOverridesForObject(LLViewerObject *vo); bool jointIsRiggedTo(const std::string& joint_name); bool jointIsRiggedTo(const std::string& joint_name, const LLViewerObject *vo); void clearAttachmentOverrides(); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 911575138b..94556a9f70 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3415,7 +3415,7 @@ void LLVOVolume::updateAnimatedObjectState(LLViewerObject *old_parent, LLViewerO if (old_volp && old_volp->isAnimatedObject()) { // W have been removed from an animated object, need to do cleanup. - old_volp->getControlAvatar()->resetJointsOnDetach(this); + old_volp->getControlAvatar()->removeAttachmentOverridesForObject(this); } if (old_volp) -- cgit v1.2.3