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.

master
Brad Payne (Vir Linden) 2017-06-30 20:49:23 +01:00
parent 999b0b47b5
commit a09cc5f4bb
7 changed files with 60 additions and 53 deletions

View File

@ -183,4 +183,10 @@ void LLControlAvatar::idleUpdate(LLAgent &agent, const F64 &time)
}
}
//virtual
void LLControlAvatar::updateDebugText()
{
addDebugText("I'm a control avatar");
LLVOAvatar::updateDebugText();
}

View File

@ -52,6 +52,8 @@ public:
virtual void idleUpdate(LLAgent &agent, const F64 &time);
virtual void updateDebugText();
bool mPlaying;
F32 mGlobalScale;

View File

@ -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();
}
}

View File

@ -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)
{

View File

@ -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())
if (vo->getAvatar() != this)
{
non_attached_case = true;
}
LLVOAvatar *av;
if (non_attached_case)
{
av = vo->getControlAvatar();
}
else
{
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();

View File

@ -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();

View File

@ -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)