diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2017-06-20 15:04:11 +0100 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2017-06-20 15:04:11 +0100 |
commit | 4907e437c1a9523e3b3d098403da8c780c6345f9 (patch) | |
tree | 063ca27101f1317ec0ff850931d7b06a451d79bb /indra | |
parent | e0d6a6a40192caa5b9d62165da5f23a5ade6e4b0 (diff) |
SL-731 - control avatar has pointer back to associated volume. Can use this link to find associated inventory item name for an animation in debug display.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llcontrolavatar.cpp | 43 | ||||
-rw-r--r-- | indra/newview/llcontrolavatar.h | 6 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 25 |
5 files changed, 48 insertions, 30 deletions
diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 8027ea9c73..61055f6f58 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -46,17 +46,17 @@ LLControlAvatar::~LLControlAvatar() { } -void LLControlAvatar::matchTransform(LLVOVolume *obj) +void LLControlAvatar::matchVolumeTransform() { - setPositionAgent(obj->getRenderPosition()); + setPositionAgent(mVolp->getRenderPosition()); //slamPosition(); LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); - LLQuaternion obj_rot = obj->getRotation(); + LLQuaternion obj_rot = mVolp->getRotation(); LLQuaternion result_rot = fix_axes_rot * obj_rot; setRotation(result_rot); mRoot->setWorldRotation(result_rot); - mRoot->setPosition(obj->getRenderPosition()); + mRoot->setPosition(mVolp->getRenderPosition()); } void LLControlAvatar::setGlobalScale(F32 scale) @@ -89,20 +89,20 @@ void LLControlAvatar::recursiveScaleJoint(LLJoint* joint, F32 factor) } // Based on LLViewerJointAttachment::setupDrawable(), without the attaching part. -void LLControlAvatar::updateGeom(LLVOVolume *obj) +void LLControlAvatar::updateVolumeGeom() { - if (!obj->mDrawable) + if (!mVolp->mDrawable) return; - if (obj->mDrawable->isActive()) + if (mVolp->mDrawable->isActive()) { - obj->mDrawable->makeStatic(FALSE); + mVolp->mDrawable->makeStatic(FALSE); } - obj->mDrawable->makeActive(); - gPipeline.markMoved(obj->mDrawable); - gPipeline.markTextured(obj->mDrawable); // face may need to change draw pool to/from POOL_HUD - obj->mDrawable->setState(LLDrawable::USE_BACKLIGHT); + mVolp->mDrawable->makeActive(); + gPipeline.markMoved(mVolp->mDrawable); + gPipeline.markTextured(mVolp->mDrawable); // face may need to change draw pool to/from POOL_HUD + mVolp->mDrawable->setState(LLDrawable::USE_BACKLIGHT); - LLViewerObject::const_child_list_t& child_list = obj->getChildren(); + LLViewerObject::const_child_list_t& child_list = mVolp->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); ++iter) { @@ -115,14 +115,14 @@ void LLControlAvatar::updateGeom(LLVOVolume *obj) } } - gPipeline.markRebuild(obj->mDrawable, LLDrawable::REBUILD_ALL, TRUE); - obj->markForUpdate(TRUE); + gPipeline.markRebuild(mVolp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); + mVolp->markForUpdate(TRUE); // Note that attachment overrides aren't needed here, have already // been applied at the time the mControlAvatar was created, in // llvovolume.cpp. - matchTransform(obj); + matchVolumeTransform(); // AXON testing scale @@ -147,6 +147,9 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) { // AXON Lifted from LLPreviewAnimation LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR); + + cav->mVolp = obj; + cav->createDrawable(&gPipeline); cav->mIsDummy = TRUE; cav->mSpecialRenderMode = 1; @@ -155,14 +158,8 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) //cav->startMotion(ANIM_AGENT_STAND, 5.0f); cav->hideSkirt(); - // stop extraneous animations - cav->stopMotion( ANIM_AGENT_HEAD_ROT, TRUE ); - cav->stopMotion( ANIM_AGENT_EYE, TRUE ); - cav->stopMotion( ANIM_AGENT_BODY_NOISE, TRUE ); - cav->stopMotion( ANIM_AGENT_BREATHE_ROT, TRUE ); - // Sync up position/rotation with object - cav->matchTransform(obj); + cav->matchVolumeTransform(); return cav; } diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index a783b9228f..f29388e035 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -39,8 +39,8 @@ public: LLControlAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); virtual ~LLControlAvatar(); - void matchTransform(LLVOVolume *obj); - void updateGeom(LLVOVolume *obj); + void matchVolumeTransform(); + void updateVolumeGeom(); void setGlobalScale(F32 scale); void recursiveScaleJoint(LLJoint *joint, F32 factor); @@ -49,6 +49,8 @@ public: bool mPlaying; F32 mGlobalScale; + + LLVOVolume *mVolp; }; #endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index df69d6d197..ff33fe79fa 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5110,7 +5110,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) if (!avatarp->mPlaying) { avatarp->mPlaying = true; - avatarp->updateGeom(volp); + avatarp->updateVolumeGeom(); } avatarp->mSignaledAnimations.clear(); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index ff808ba079..f1c7cfae0d 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4010,7 +4010,7 @@ void LLViewerObject::setPosition(const LLVector3 &pos, BOOL damped) } if (mControlAvatar) { - mControlAvatar->matchTransform(dynamic_cast<LLVOVolume*>(this)); + mControlAvatar->matchVolumeTransform(); } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c1331bf521..c1b0f42c84 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3426,8 +3426,27 @@ void LLVOAvatar::updateDebugText() if (motionp->getMinPixelArea() < getPixelArea()) { std::string output; - if (motionp->getName().empty()) + std::string motion_name = motionp->getName(); + if (motion_name.empty()) { + if (isControlAvatar()) + { + LLControlAvatar *control_av = dynamic_cast<LLControlAvatar*>(this); + // Try to get name from inventory of associated object + LLVOVolume *volp = control_av->mVolp; + if (volp) + { + volp->requestInventory(); // AXON should be a no-op if already requested or fetched? + LLViewerInventoryItem* item = volp->getInventoryItemByAsset(motionp->getID()); + if (item) + { + motion_name = item->getName(); + } + } + } + } + if (motion_name.empty()) + { output = llformat("%s - %d", gAgent.isGodlikeWithoutAdminMenuFakery() ? motionp->getID().asString().c_str() : @@ -3437,8 +3456,8 @@ void LLVOAvatar::updateDebugText() else { output = llformat("%s - %d", - motionp->getName().c_str(), - (U32)motionp->getPriority()); + motion_name.c_str(), + (U32)motionp->getPriority()); } addDebugText(output); } |