From 55612611c679efda5d491944dee75f4768749277 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 30 May 2017 22:03:43 +0100 Subject: SL-694 - stub support for ObjectAnimation message type --- indra/newview/llviewermessage.cpp | 63 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 507087d1ae..6a6e932b4a 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -103,6 +103,7 @@ #include "llviewerwindow.h" #include "llvlmanager.h" #include "llvoavatarself.h" +#include "llvovolume.h" #include "llworld.h" #include "pipeline.h" #include "llfloaterworldmap.h" @@ -4976,12 +4977,15 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) LLUUID animation_id; LLUUID uuid; S32 anim_sequence_id; - LLVOAvatar *avatarp; + LLVOAvatar *avatarp = NULL; mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid); - //clear animation flags - avatarp = (LLVOAvatar *)gObjectList.findObject(uuid); + LLViewerObject *objp = gObjectList.findObject(uuid); + if (objp) + { + avatarp = objp->asAvatar(); + } if (!avatarp) { @@ -4993,6 +4997,7 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); S32 num_source_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationSourceList); + //clear animation flags avatarp->mSignaledAnimations.clear(); if (avatarp->isSelf()) @@ -5063,6 +5068,58 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) } } +void process_object_animation(LLMessageSystem *mesgsys, void **user_data) +{ + LLUUID animation_id; + LLUUID uuid; +#if 0 + S32 anim_sequence_id; +#endif + + mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid); + + LLViewerObject *objp = gObjectList.findObject(uuid); + if (!objp) + { + LL_WARNS("Messaging") << "Received animation state for unknown object" << uuid << LL_ENDL; + return; + } + + LLVOVolume *volp = dynamic_cast(objp); + if (!volp) + { + LL_WARNS("Messaging") << "Received animation state for non-volume object" << uuid << LL_ENDL; + return; + } + + if (!volp->isAnimatedMesh()) + { + LL_WARNS("Messaging") << "Received animation state for non-animated object" << uuid << LL_ENDL; + return; + } + + LL_WARNS() << "ADD SUPPORT FOR OBJECT ANIMATION HERE" << LL_ENDL; +#if 0 + S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); + S32 num_source_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationSourceList); + + avatarp->mSignaledAnimations.clear(); + + for( S32 i = 0; i < num_blocks; i++ ) + { + 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; + } + + if (num_blocks) + { + avatarp->processAnimationStateChanges(); + } +#endif +} + + void process_avatar_appearance(LLMessageSystem *mesgsys, void **user_data) { LLUUID uuid; -- cgit v1.3 From 74957676fc0b05825abc3af907241479f06fa8c3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 5 Jun 2017 20:22:59 +0100 Subject: SL-694 - message changes for ObjectAnimation, more logging to validate behavior --- indra/newview/llviewermessage.cpp | 23 +++++++++++------------ scripts/messages/message_template.msg | 4 ---- scripts/messages/message_template.msg.sha1 | 2 +- 3 files changed, 12 insertions(+), 17 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6a6e932b4a..2b62ccd62f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5072,51 +5072,50 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) { LLUUID animation_id; LLUUID uuid; -#if 0 S32 anim_sequence_id; -#endif mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid); LLViewerObject *objp = gObjectList.findObject(uuid); if (!objp) { - LL_WARNS("Messaging") << "Received animation state for unknown object" << uuid << LL_ENDL; + LL_WARNS("Messaging") << "AXON Received animation state for unknown object" << uuid << LL_ENDL; return; } LLVOVolume *volp = dynamic_cast(objp); if (!volp) { - LL_WARNS("Messaging") << "Received animation state for non-volume object" << uuid << LL_ENDL; + LL_WARNS("Messaging") << "AXON Received animation state for non-volume object" << uuid << LL_ENDL; return; } if (!volp->isAnimatedMesh()) { - LL_WARNS("Messaging") << "Received animation state for non-animated object" << uuid << LL_ENDL; + LL_WARNS("Messaging") << "AXON Received animation state for non-animated object" << uuid << LL_ENDL; return; } - LL_WARNS() << "ADD SUPPORT FOR OBJECT ANIMATION HERE" << LL_ENDL; -#if 0 S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); - S32 num_source_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationSourceList); + LL_WARNS() << "AXON handle object animation here, num_blocks " << num_blocks << LL_ENDL; - avatarp->mSignaledAnimations.clear(); + //avatarp->mSignaledAnimations.clear(); + volp->setDebugText(llformat("Animations %d", num_blocks)); for( S32 i = 0; i < num_blocks; i++ ) { 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; + //avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; + LL_INFOS() << "AXON got object animation request for object " + << uuid << " animation id " << animation_id << LL_ENDL; } if (num_blocks) { - avatarp->processAnimationStateChanges(); + LL_INFOS() << "AXON process animation state changes here" << LL_ENDL; + //avatarp->processAnimationStateChanges(); } -#endif } diff --git a/scripts/messages/message_template.msg b/scripts/messages/message_template.msg index 3185121a6e..18264ee59c 100755 --- a/scripts/messages/message_template.msg +++ b/scripts/messages/message_template.msg @@ -7305,10 +7305,6 @@ version 2.0 { AnimID LLUUID } { AnimSequenceID S32 } } - { - AnimationSourceList Variable - { ObjectID LLUUID } - } } // ************************************************************************* diff --git a/scripts/messages/message_template.msg.sha1 b/scripts/messages/message_template.msg.sha1 index 88b84e29da..db87ad5e77 100755 --- a/scripts/messages/message_template.msg.sha1 +++ b/scripts/messages/message_template.msg.sha1 @@ -1 +1 @@ -428700550e70f611b632e3bb6422fe1d093a0313 \ No newline at end of file +55df2c7135733c5da64ef8f01859b83a433a3a09 \ No newline at end of file -- cgit v1.3 From c9baf4c66157c601cc4d4e325c7843b3bf9a0cad Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 7 Jun 2017 14:23:49 +0100 Subject: SL-691,SL-694 - viewer can animate objects based on server messaging. First end-to-end demo for animated objects. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llcontrolavatar.cpp | 119 +++++++++++++++++++++++++++++++++++ indra/newview/llcontrolavatar.h | 50 +++++++++++++++ indra/newview/lldrawpoolavatar.cpp | 3 +- indra/newview/llviewermenu.cpp | 2 +- indra/newview/llviewermessage.cpp | 15 +++-- indra/newview/llviewerobject.cpp | 35 +++++++++-- indra/newview/llviewerobject.h | 11 +++- indra/newview/llviewerobjectlist.cpp | 4 +- indra/newview/llviewerobjectlist.h | 2 +- indra/newview/llvoavatar.cpp | 52 +++++++++++---- indra/newview/llvoavatar.h | 8 +++ indra/newview/llvoavatarself.cpp | 2 +- indra/newview/llvograss.cpp | 3 +- indra/newview/llvovolume.cpp | 32 +++++++++- 15 files changed, 305 insertions(+), 35 deletions(-) create mode 100644 indra/newview/llcontrolavatar.cpp create mode 100644 indra/newview/llcontrolavatar.h (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index b4e930d062..3787a25a9b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -149,6 +149,7 @@ set(viewer_SOURCE_FILES llcommunicationchannel.cpp llcompilequeue.cpp llconfirmationmanager.cpp + llcontrolavatar.cpp llconversationlog.cpp llconversationloglist.cpp llconversationloglistitem.cpp @@ -769,6 +770,7 @@ set(viewer_HEADER_FILES llcommunicationchannel.h llcompilequeue.h llconfirmationmanager.h + llcontrolavatar.h llconversationlog.h llconversationloglist.h llconversationloglistitem.h diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp new file mode 100644 index 0000000000..1ecd3305ed --- /dev/null +++ b/indra/newview/llcontrolavatar.cpp @@ -0,0 +1,119 @@ +/** + * @file llcontrolavatar.cpp + * @brief Implementation for special dummy avatar used to drive rigged meshes. + * + * $LicenseInfo:firstyear=2017&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2017, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llcontrolavatar.h" +#include "llagent.h" // Get state values from here +#include "llviewerobjectlist.h" +#include "pipeline.h" +#include "llanimationstates.h" + +LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : + LLVOAvatar(id, pcode, regionp), + mPlaying(false) +{ + mIsControlAvatar = true; +} + +// virtual +LLControlAvatar::~LLControlAvatar() +{ +} + +void LLControlAvatar::matchTransform(LLVOVolume *obj) +{ + setPositionAgent(obj->getRenderPosition()); + //slamPosition(); + + LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); + LLQuaternion obj_rot = obj->getRotation(); + LLQuaternion result_rot = fix_axes_rot * obj_rot; + setRotation(result_rot); + mRoot->setWorldRotation(result_rot); + mRoot->setPosition(obj->getRenderPosition()); +} + +// Based on LLViewerJointAttachment::setupDrawable(), without the attaching part. +void LLControlAvatar::updateGeom(LLVOVolume *obj) +{ + if (!obj->mDrawable) + return; + if (obj->mDrawable->isActive()) + { + obj->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); + + LLViewerObject::const_child_list_t& child_list = obj->getChildren(); + for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); ++iter) + { + LLViewerObject* childp = *iter; + if (childp && childp->mDrawable.notNull()) + { + childp->mDrawable->setState(LLDrawable::USE_BACKLIGHT); + gPipeline.markTextured(childp->mDrawable); // face may need to change draw pool to/from POOL_HUD + gPipeline.markMoved(childp->mDrawable); + } + } + + gPipeline.markRebuild(obj->mDrawable, LLDrawable::REBUILD_ALL, TRUE); + obj->markForUpdate(TRUE); + + matchTransform(obj); + //addAttachmentOverridesForObject(obj); +} + +LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) +{ + // TRIF Lifted from LLPreviewAnimation + LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR); + cav->createDrawable(&gPipeline); + cav->mIsDummy = TRUE; + cav->mSpecialRenderMode = 1; + //cav->setPositionAgent(obj->getRenderPosition()); + //cav->slamPosition(); + //cav->setRotation(obj->getRotation()); + cav->updateJointLODs(); + cav->updateGeometry(cav->mDrawable); + 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); + + return cav; +} + diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h new file mode 100644 index 0000000000..c8b1039363 --- /dev/null +++ b/indra/newview/llcontrolavatar.h @@ -0,0 +1,50 @@ +/** + * @file llcontrolavatar.h + * @brief Special dummy avatar used to drive rigged meshes. + * + * $LicenseInfo:firstyear=2017&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2017, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_CONTROLAVATAR_H +#define LL_CONTROLAVATAR_H + +#include "llvoavatar.h" +#include "llvovolume.h" + +class LLControlAvatar: + public LLVOAvatar +{ + LOG_CLASS(LLControlAvatar); + +public: + LLControlAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); + virtual ~LLControlAvatar(); + + void matchTransform(LLVOVolume *obj); + void updateGeom(LLVOVolume *obj); + + static LLControlAvatar *createControlAvatar(LLVOVolume *obj); + + bool mPlaying; +}; + +#endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index b221221f16..fa4fd7c533 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -467,7 +467,8 @@ void LLDrawPoolAvatar::renderShadow(S32 pass) } LLVOAvatar *avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get(); - if (avatarp->isDead() || avatarp->mIsDummy || avatarp->mDrawable.isNull()) +// AXON fix + if (avatarp->isDead() || /*avatarp->mIsDummy ||*/ avatarp->mDrawable.isNull()) { return; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index c68f6b8a15..eddbe16482 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6907,7 +6907,7 @@ class LLAttachmentEnableDrop : public view_listener_t // Do not enable drop if all faces of object are not enabled if (object && LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES )) { - S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getState()); + S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getAttachmentState()); attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL); if (attachment) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 2b62ccd62f..7fd87f99d3 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -55,6 +55,7 @@ #include "llagentcamera.h" #include "llcallingcard.h" #include "llbuycurrencyhtml.h" +#include "llcontrolavatar.h" #include "llfirstuse.h" #include "llfloaterbump.h" #include "llfloaterbuyland.h" @@ -5099,22 +5100,28 @@ 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; - //avatarp->mSignaledAnimations.clear(); + LLControlAvatar *avatarp = volp->mControlAvatar; + if (!avatarp->mPlaying) + { + avatarp->mPlaying = true; + avatarp->updateGeom(volp); + } + avatarp->mSignaledAnimations.clear(); volp->setDebugText(llformat("Animations %d", num_blocks)); for( S32 i = 0; i < num_blocks; i++ ) { 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; + avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; LL_INFOS() << "AXON got object animation request for object " << uuid << " animation id " << animation_id << LL_ENDL; } - if (num_blocks) + if (num_blocks >= 0) { LL_INFOS() << "AXON process animation state changes here" << LL_ENDL; - //avatarp->processAnimationStateChanges(); + avatarp->processAnimationStateChanges(); } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 030c0ca9f6..ff808ba079 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -60,6 +60,7 @@ #include "llbbox.h" #include "llbox.h" #include "llcylinder.h" +#include "llcontrolavatar.h" #include "lldrawable.h" #include "llface.h" #include "llfloaterproperties.h" @@ -138,7 +139,7 @@ const F32 PHYSICS_TIMESTEP = 1.f / 45.f; static LLTrace::BlockTimerStatHandle FTM_CREATE_OBJECT("Create Object"); // static -LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) +LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, S32 flags) { LLViewerObject *res = NULL; LL_RECORD_BLOCK_TIME(FTM_CREATE_OBJECT); @@ -166,6 +167,12 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco } res = gAgentAvatarp; } + else if (flags & CO_FLAG_CONTROL_AVATAR) + { + LLControlAvatar *avatar = new LLControlAvatar(id, pcode, regionp); + avatar->initInstance(); + res = avatar; + } else { LLVOAvatar *avatar = new LLVOAvatar(id, pcode, regionp); @@ -235,6 +242,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mText(), mHudText(""), mHudTextColor(LLColor4::white), + mControlAvatar(NULL), mLastInterpUpdateSecs(0.f), mLastMessageUpdateSecs(0.f), mLatestRecvPacketID(0), @@ -259,7 +267,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mRotTime(0.f), mAngularVelocityRot(), mPreviousRotation(), - mState(0), + mAttachmentState(0), mMedia(NULL), mClickAction(0), mObjectCost(0), @@ -369,11 +377,18 @@ void LLViewerObject::markDead() ((LLViewerObject *)getParent())->removeChild(this); } LLUUID mesh_id; + // FIXME AXON - need to do this for control avatars too if (av && LLVOAvatar::getRiggedMeshID(this,mesh_id)) { // This case is needed for indirectly attached mesh objects. av->resetJointsOnDetach(mesh_id); } + if (mControlAvatar) + { + LLControlAvatar *av = mControlAvatar; + mControlAvatar = NULL; + av->markDead(); + } // Mark itself as dead mDead = TRUE; @@ -1378,7 +1393,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U8 state; mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_State, state, block_num ); - mState = state; + mAttachmentState = state; // ...new objects that should come in selected need to be added to the selected list mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0); @@ -1648,7 +1663,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U8 state; mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_State, state, block_num ); - mState = state; + mAttachmentState = state; break; } @@ -1671,7 +1686,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U8 state; dp->unpackU8(state, "State"); - mState = state; + mAttachmentState = state; switch(update_type) { @@ -3857,7 +3872,7 @@ const LLVector3 LLViewerObject::getRenderPosition() const if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED)) { LLVOAvatar* avatar = getAvatar(); - if (avatar) + if (avatar && !mControlAvatar) { return avatar->getPositionAgent(); } @@ -3993,6 +4008,10 @@ void LLViewerObject::setPosition(const LLVector3 &pos, BOOL damped) // position caches need to be up to date on root objects updatePositionCaches(); } + if (mControlAvatar) + { + mControlAvatar->matchTransform(dynamic_cast(this)); + } } void LLViewerObject::setPositionGlobal(const LLVector3d &pos_global, BOOL damped) @@ -6358,6 +6377,10 @@ const std::string& LLViewerObject::getAttachmentItemName() const //virtual LLVOAvatar* LLViewerObject::getAvatar() const { + if (mControlAvatar) + { + return mControlAvatar; + } if (isAttachment()) { LLViewerObject* vobj = (LLViewerObject*) getParent(); diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 24fcf0517e..e727567957 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -47,6 +47,7 @@ class LLAgent; // TODO: Get rid of this. class LLAudioSource; class LLAudioSourceVO; class LLColor4; +class LLControlAvatar; class LLDataPacker; class LLDataPackerBinaryBuffer; class LLDrawable; @@ -374,7 +375,7 @@ public: void sendShapeUpdate(); - U8 getState() { return mState; } + U8 getAttachmentState() { return mAttachmentState; } F32 getAppAngle() const { return mAppAngle; } F32 getPixelArea() const { return mPixelArea; } @@ -683,6 +684,8 @@ public: static BOOL sUseSharedDrawables; + LLPointer mControlAvatar; + protected: // delete an item in the inventory, but don't tell the // server. This is used internally by remove, update, and @@ -693,8 +696,10 @@ protected: // updateInventory. void doUpdateInventory(LLPointer& item, U8 key, bool is_new); + // Flags for createObject + static const S32 CO_FLAG_CONTROL_AVATAR = 1 << 1; - static LLViewerObject *createObject(const LLUUID &id, LLPCode pcode, LLViewerRegion *regionp); + static LLViewerObject *createObject(const LLUUID &id, LLPCode pcode, LLViewerRegion *regionp, S32 flags = 0); BOOL setData(const U8 *datap, const U32 data_size); @@ -782,7 +787,7 @@ protected: LLQuaternion mAngularVelocityRot; // accumulated rotation from the angular velocity computations LLQuaternion mPreviousRotation; - U8 mState; // legacy + U8 mAttachmentState; // this encodes the attachment id in a somewhat complex way. 0 if not an attachment. LLViewerObjectMedia* mMedia; // NULL if no media associated U8 mClickAction; F32 mObjectCost; //resource cost of this object or -1 if unknown diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 8f98d66c0c..1f99119d82 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1942,12 +1942,12 @@ void LLViewerObjectList::resetObjectBeacons() mDebugBeacons.clear(); } -LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp) +LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp, S32 flags) { LLUUID fullid; fullid.generate(); - LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp); + LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp, flags); if (!objectp) { // LL_WARNS() << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << LL_ENDL; diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 94c751acc6..72b2b99004 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -67,7 +67,7 @@ public: inline LLViewerObject *getObject(const S32 index); inline LLViewerObject *findObject(const LLUUID &id); - LLViewerObject *createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp); // Create a viewer-side object + LLViewerObject *createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp, S32 flags = 0); // Create a viewer-side object LLViewerObject *createObjectFromCache(const LLPCode pcode, LLViewerRegion *regionp, const LLUUID &uuid, const U32 local_id); LLViewerObject *createObject(const LLPCode pcode, LLViewerRegion *regionp, const LLUUID &uuid, const U32 local_id, const LLHost &sender); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3968266c27..7ba264f35a 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -44,6 +44,7 @@ #include "llavatarnamecache.h" #include "llavatarpropertiesprocessor.h" #include "llavatarrendernotifier.h" +#include "llcontrolavatar.h" #include "llexperiencecache.h" #include "llphysicsmotion.h" #include "llviewercontrol.h" @@ -663,7 +664,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastUpdateRequestCOFVersion(-1), mLastUpdateReceivedCOFVersion(-1), mCachedMuteListUpdateTime(0), - mCachedInMuteList(false) + mCachedInMuteList(false), + mIsControlAvatar(false) { LL_DEBUGS("AvatarRender") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL; @@ -1942,7 +1944,7 @@ void LLVOAvatar::resetSkeleton(bool reset_animations) //----------------------------------------------------------------------------- void LLVOAvatar::releaseMeshData() { - if (sInstances.size() < AVATAR_RELEASE_THRESHOLD || mIsDummy) + if (sInstances.size() < AVATAR_RELEASE_THRESHOLD)// || mIsDummy) { return; } @@ -2738,7 +2740,8 @@ void LLVOAvatar::idleUpdateLoadingEffect() LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK | LLPartData::LL_PART_TARGET_POS_MASK ); - if (!isTooComplex()) // do not generate particles for overly-complex avatars + // TRIF skip cloud effects for dummy avs as well + if (!mIsDummy && !isTooComplex()) // do not generate particles for overly-complex avatars { setParticleSource(particle_parameters, getID()); } @@ -3530,7 +3533,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } // change animation time quanta based on avatar render load - if (!isSelf() && !mIsDummy) + if (!isSelf())// && !mIsDummy) { F32 time_quantum = clamp_rescale((F32)sInstances.size(), 10.f, 35.f, 0.f, 0.25f); F32 pixel_area_scale = clamp_rescale(mPixelArea, 100, 5000, 1.f, 0.f); @@ -3652,7 +3655,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) //-------------------------------------------------------------------- // Propagate viewer object rotation to root of avatar //-------------------------------------------------------------------- - if (!isAnyAnimationSignaled(AGENT_NO_ROTATE_ANIMS, NUM_AGENT_NO_ROTATE_ANIMS)) + // FIXME TRIF - just skipping this for now for all dummy avs + if (!mIsDummy && !isAnyAnimationSignaled(AGENT_NO_ROTATE_ANIMS, NUM_AGENT_NO_ROTATE_ANIMS)) { LLQuaternion iQ; LLVector3 upDir( 0.0f, 0.0f, 1.0f ); @@ -4041,7 +4045,7 @@ void LLVOAvatar::updateVisibility() if (mIsDummy) { - visible = TRUE; + visible = FALSE; } else if (mDrawable.isNull()) { @@ -4356,7 +4360,7 @@ U32 LLVOAvatar::renderSkinned() { if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { - if (isTextureVisible(TEX_HEAD_BAKED) || mIsDummy) + if (isTextureVisible(TEX_HEAD_BAKED))// || mIsDummy) { LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD); if (head_mesh) @@ -4366,7 +4370,7 @@ U32 LLVOAvatar::renderSkinned() first_pass = FALSE; } } - if (isTextureVisible(TEX_UPPER_BAKED) || mIsDummy) + if (isTextureVisible(TEX_UPPER_BAKED))// || mIsDummy) { LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY); if (upper_mesh) @@ -4376,7 +4380,7 @@ U32 LLVOAvatar::renderSkinned() first_pass = FALSE; } - if (isTextureVisible(TEX_LOWER_BAKED) || mIsDummy) + if (isTextureVisible(TEX_LOWER_BAKED))// || mIsDummy) { LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY); if (lower_mesh) @@ -4435,6 +4439,8 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) } // Can't test for baked hair being defined, since that won't always be the case (not all viewers send baked hair) // TODO: 1.25 will be able to switch this logic back to calling isTextureVisible(); + if (!mIsDummy) + { if ( (getImage(TEX_HAIR_BAKED, 0) && getImage(TEX_HAIR_BAKED, 0)->getID() != IMG_INVISIBLE) || LLDrawPoolAlpha::sShowDebugAlpha) { @@ -4445,6 +4451,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) } first_pass = FALSE; } + } if (LLPipeline::sImpostorRender) { gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); @@ -5521,12 +5528,26 @@ void LLVOAvatar::rebuildAttachmentOverrides() //----------------------------------------------------------------------------- void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) { - LLVOAvatar *av = vo->getAvatarAncestor(); + bool non_attached_case = false; + // FIXME TRIF - will this work if vo has child objects? + if (vo->mControlAvatar) + { + non_attached_case = true; + } + LLVOAvatar *av; + if (non_attached_case) + { + av = vo->mControlAvatar; + } + else + { + av = vo->getAvatarAncestor(); if (!av || (av != this)) { LL_WARNS("Avatar") << "called with invalid avatar" << LL_ENDL; return; } + } LLScopedContextString str("addAttachmentOverridesForObject " + av->getFullname()); @@ -5554,7 +5575,7 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) LLUUID currentId = vobj->getVolume()->getParams().getSculptID(); const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( currentId, vobj ); - if ( vobj && vobj->isAttachment() && vobj->isMesh() && pSkinData ) + if ( vobj && (vobj->isAttachment()||non_attached_case) && vobj->isMesh() && pSkinData ) { const int bindCnt = pSkinData->mAlternateBindMatrix.size(); const int jointCnt = pSkinData->mJointNames.size(); @@ -5738,6 +5759,7 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const //----------------------------------------------------------------------------- // resetJointsOnDetach //----------------------------------------------------------------------------- +// TRIF handle NPC case void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) { LLVOAvatar *av = vo->getAvatarAncestor(); @@ -5766,6 +5788,7 @@ void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) //----------------------------------------------------------------------------- // resetJointsOnDetach //----------------------------------------------------------------------------- +// TRIF handle NPC case void LLVOAvatar::resetJointsOnDetach(const LLUUID& mesh_id) { //Subsequent joints are relative to pelvis @@ -6288,7 +6311,7 @@ void LLVOAvatar::removeChild(LLViewerObject *childp) LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* viewer_object) { - S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getState()); + S32 attachmentID = ATTACHMENT_ID_FROM_STATE(viewer_object->getAttachmentState()); // This should never happen unless the server didn't process the attachment point // correctly, but putting this check in here to be safe. @@ -6812,6 +6835,11 @@ BOOL LLVOAvatar::isVisible() const // Determine if we have enough avatar data to render bool LLVOAvatar::getIsCloud() const { + if (mIsDummy) + { + return false; + } + return ( ((const_cast(this))->visualParamWeightsAreDefault())// Do we have a shape? || ( !isTextureDefined(TEX_LOWER_BAKED) || !isTextureDefined(TEX_UPPER_BAKED) diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index bd89d4ef23..2832f940f4 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -233,6 +233,8 @@ public: public: virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent + virtual bool isControlAvatar() const { return mIsControlAvatar; } // True if this avatar is a control av (no associated user) + private: //aligned members LL_ALIGN_16(LLVector4a mImpostorExtents[2]); @@ -440,6 +442,12 @@ public: VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV + //-------------------------------------------------------------------- + // NPC status + //-------------------------------------------------------------------- +public: + bool mIsControlAvatar; + //-------------------------------------------------------------------- // Morph masks //-------------------------------------------------------------------- diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index aa5d82a096..2137bf4eb3 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2789,7 +2789,7 @@ BOOL LLVOAvatarSelf::needsRenderBeam() // don't render selection beam on hud objects is_touching_or_grabbing = FALSE; } - return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection()); + return is_touching_or_grabbing || (getAttachmentState() & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection()); } // static diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index de63a3963c..e7e4e6f228 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -92,7 +92,8 @@ LLVOGrass::~LLVOGrass() void LLVOGrass::updateSpecies() { - mSpecies = mState; + // TRIF is grass still even supported? This use of state seems odd. + mSpecies = getAttachmentState(); if (!sSpeciesTable.count(mSpecies)) { diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index ed0205704f..a2f417a5cc 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -76,8 +76,13 @@ #include "lldatapacker.h" #include "llviewershadermgr.h" #include "llvoavatar.h" +#include "llcontrolavatar.h" +#include "llvoavatarself.h" #include "llvocache.h" #include "llmaterialmgr.h" +#include "llanimationstates.h" +#include "llinventorytype.h" +#include "llviewerinventory.h" const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; const F32 FORCE_CULL_AREA = 8.f; @@ -3383,7 +3388,7 @@ void LLVOVolume::updateRadius() BOOL LLVOVolume::isAttachment() const { - return mState != 0 ; + return mAttachmentState != 0 ; } BOOL LLVOVolume::isHUDAttachment() const @@ -3391,7 +3396,7 @@ BOOL LLVOVolume::isHUDAttachment() const // *NOTE: we assume hud attachment points are in defined range // since this range is constant for backwards compatibility // reasons this is probably a reasonable assumption to make - S32 attachment_id = ATTACHMENT_ID_FROM_STATE(mState); + S32 attachment_id = ATTACHMENT_ID_FROM_STATE(mAttachmentState); return ( attachment_id >= 31 && attachment_id <= 38 ); } @@ -4825,10 +4830,31 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) vobj->isMesh() && gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj); + bool rigged_non_attachment = !vobj->isAttachment() && + vobj->isMesh() && + gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj); + + if (rigged_non_attachment) + { + if (!vobj->mControlAvatar) + { + vobj->mControlAvatar = LLControlAvatar::createControlAvatar(vobj); + vobj->mControlAvatar->addAttachmentOverridesForObject(vobj); + vobj->requestInventory(); + } + if (vobj->mControlAvatar) + { + pAvatarVO = vobj->mControlAvatar; + } + } + bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic(); + // TRIF why this variable? Only different from rigged if + // there are no LLFaces associated with the drawable. bool is_rigged = false; + // TRIF handle NPC case if (rigged && pAvatarVO) { pAvatarVO->addAttachmentOverridesForObject(vobj); @@ -4855,7 +4881,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) //sum up face verts and indices drawablep->updateFaceSize(i); - if (rigged) + if (rigged || (vobj->mControlAvatar && vobj->mControlAvatar->mPlaying)) { if (!facep->isState(LLFace::RIGGED)) { //completely reset vertex buffer -- cgit v1.3 From c5dc0ee36e8d17fd0cf25f5a1fbdfb8609a64ee0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 9 Jun 2017 21:13:54 +0100 Subject: SL-704 - code cleanup --- indra/newview/llcontrolavatar.cpp | 5 +--- indra/newview/lldrawpoolavatar.cpp | 2 +- indra/newview/llpanelvolume.cpp | 4 +-- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llvoavatar.cpp | 54 ++++++++++++++++++++------------------ indra/newview/llvograss.cpp | 2 +- indra/newview/llvovolume.cpp | 10 +++---- indra/newview/llvovolume.h | 4 +-- 8 files changed, 42 insertions(+), 41 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 1ecd3305ed..a8caba08af 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -92,14 +92,11 @@ void LLControlAvatar::updateGeom(LLVOVolume *obj) LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) { - // TRIF Lifted from LLPreviewAnimation + // AXON Lifted from LLPreviewAnimation LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR); cav->createDrawable(&gPipeline); cav->mIsDummy = TRUE; cav->mSpecialRenderMode = 1; - //cav->setPositionAgent(obj->getRenderPosition()); - //cav->slamPosition(); - //cav->setRotation(obj->getRotation()); cav->updateJointLODs(); cav->updateGeometry(cav->mDrawable); cav->startMotion(ANIM_AGENT_STAND, 5.0f); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index fa4fd7c533..869e37e08c 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -468,7 +468,7 @@ void LLDrawPoolAvatar::renderShadow(S32 pass) LLVOAvatar *avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get(); // AXON fix - if (avatarp->isDead() || /*avatarp->mIsDummy ||*/ avatarp->mDrawable.isNull()) + if (avatarp->isDead() || avatarp->mIsDummy || avatarp->mDrawable.isNull()) { return; } diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 58cbede57b..f34194db19 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -355,8 +355,8 @@ void LLPanelVolume::getState( ) // AXON FIXME CHECK FOR SKIN INFO ALSO // WHAT ABOUT isPermanentEnforced? // What about linksets with some skinned objects? - BOOL can_be_animated_mesh = volobjp && volobjp->canBeAnimatedMesh() && editable; - getChildView("Animated Mesh Checkbox Ctrl")->setEnabled(can_be_animated_mesh); + BOOL can_be_animated_object = volobjp && volobjp->canBeAnimatedObject() && editable; + getChildView("Animated Mesh Checkbox Ctrl")->setEnabled(can_be_animated_object); // Flexible properties BOOL is_flexible = volobjp && volobjp->isFlexible(); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 7fd87f99d3..db237d30ea 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5091,7 +5091,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) return; } - if (!volp->isAnimatedMesh()) + if (!volp->isAnimatedObject()) { LL_WARNS("Messaging") << "AXON Received animation state for non-animated object" << uuid << LL_ENDL; return; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7ba264f35a..1c9f79b200 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1944,7 +1944,9 @@ void LLVOAvatar::resetSkeleton(bool reset_animations) //----------------------------------------------------------------------------- void LLVOAvatar::releaseMeshData() { - if (sInstances.size() < AVATAR_RELEASE_THRESHOLD)// || mIsDummy) + // AXON what should we be doing here for control avs? Why are + // dummies treated differently in the first place? + if (sInstances.size() < AVATAR_RELEASE_THRESHOLD || mIsDummy) { return; } @@ -2740,7 +2742,7 @@ void LLVOAvatar::idleUpdateLoadingEffect() LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK | LLPartData::LL_PART_TARGET_POS_MASK ); - // TRIF skip cloud effects for dummy avs as well + // AXON skip cloud effects for dummy avs as well if (!mIsDummy && !isTooComplex()) // do not generate particles for overly-complex avatars { setParticleSource(particle_parameters, getID()); @@ -3533,7 +3535,9 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } // change animation time quanta based on avatar render load - if (!isSelf())// && !mIsDummy) + // AXON how should control avs be handled here? + bool is_pure_dummy = mIsDummy && !isControlAvatar(); + if (!isSelf() && !is_pure_dummy) { F32 time_quantum = clamp_rescale((F32)sInstances.size(), 10.f, 35.f, 0.f, 0.25f); F32 pixel_area_scale = clamp_rescale(mPixelArea, 100, 5000, 1.f, 0.f); @@ -3655,8 +3659,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) //-------------------------------------------------------------------- // Propagate viewer object rotation to root of avatar //-------------------------------------------------------------------- - // FIXME TRIF - just skipping this for now for all dummy avs - if (!mIsDummy && !isAnyAnimationSignaled(AGENT_NO_ROTATE_ANIMS, NUM_AGENT_NO_ROTATE_ANIMS)) + // AXON - also skip for control avatars + if (!isControlAvatar() && !isAnyAnimationSignaled(AGENT_NO_ROTATE_ANIMS, NUM_AGENT_NO_ROTATE_ANIMS)) { LLQuaternion iQ; LLVector3 upDir( 0.0f, 0.0f, 1.0f ); @@ -4356,11 +4360,12 @@ U32 LLVOAvatar::renderSkinned() } BOOL first_pass = TRUE; + bool is_pure_dummy = mIsDummy && !isControlAvatar(); if (!LLDrawPoolAvatar::sSkipOpaque) { if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { - if (isTextureVisible(TEX_HEAD_BAKED))// || mIsDummy) + if (isTextureVisible(TEX_HEAD_BAKED) || is_pure_dummy) { LLViewerJoint* head_mesh = getViewerJoint(MESH_ID_HEAD); if (head_mesh) @@ -4370,7 +4375,7 @@ U32 LLVOAvatar::renderSkinned() first_pass = FALSE; } } - if (isTextureVisible(TEX_UPPER_BAKED))// || mIsDummy) + if (isTextureVisible(TEX_UPPER_BAKED) || is_pure_dummy) { LLViewerJoint* upper_mesh = getViewerJoint(MESH_ID_UPPER_BODY); if (upper_mesh) @@ -4380,7 +4385,7 @@ U32 LLVOAvatar::renderSkinned() first_pass = FALSE; } - if (isTextureVisible(TEX_LOWER_BAKED))// || mIsDummy) + if (isTextureVisible(TEX_LOWER_BAKED) || is_pure_dummy) { LLViewerJoint* lower_mesh = getViewerJoint(MESH_ID_LOWER_BODY); if (lower_mesh) @@ -4437,20 +4442,14 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) } first_pass = FALSE; } - // Can't test for baked hair being defined, since that won't always be the case (not all viewers send baked hair) - // TODO: 1.25 will be able to switch this logic back to calling isTextureVisible(); - if (!mIsDummy) + if (isTextureVisible(TEX_HAIR_BAKED)) { - if ( (getImage(TEX_HAIR_BAKED, 0) && getImage(TEX_HAIR_BAKED, 0)->getID() != IMG_INVISIBLE) - || LLDrawPoolAlpha::sShowDebugAlpha) - { - LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR); - if (hair_mesh) - { - num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); - } - first_pass = FALSE; - } + LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR); + if (hair_mesh) + { + num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); + } + first_pass = FALSE; } if (LLPipeline::sImpostorRender) { @@ -4491,7 +4490,9 @@ U32 LLVOAvatar::renderRigid() gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); } - if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy) + bool is_pure_dummy = mIsDummy && !isControlAvatar(); + + if (isTextureVisible(TEX_EYES_BAKED) || is_pure_dummy) { LLViewerJoint* eyeball_left = getViewerJoint(MESH_ID_EYEBALL_LEFT); LLViewerJoint* eyeball_right = getViewerJoint(MESH_ID_EYEBALL_RIGHT); @@ -5529,7 +5530,7 @@ void LLVOAvatar::rebuildAttachmentOverrides() void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) { bool non_attached_case = false; - // FIXME TRIF - will this work if vo has child objects? + // FIXME AXON - will this work if vo has child objects? if (vo->mControlAvatar) { non_attached_case = true; @@ -5759,7 +5760,7 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const //----------------------------------------------------------------------------- // resetJointsOnDetach //----------------------------------------------------------------------------- -// TRIF handle NPC case +// AXON handle NPC case void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) { LLVOAvatar *av = vo->getAvatarAncestor(); @@ -5788,7 +5789,7 @@ void LLVOAvatar::resetJointsOnDetach(LLViewerObject *vo) //----------------------------------------------------------------------------- // resetJointsOnDetach //----------------------------------------------------------------------------- -// TRIF handle NPC case +// AXON handle NPC case void LLVOAvatar::resetJointsOnDetach(const LLUUID& mesh_id) { //Subsequent joints are relative to pelvis @@ -5867,6 +5868,7 @@ void LLVOAvatar::getGround(const LLVector3 &in_pos_agent, LLVector3 &out_pos_age LLVector3d z_vec(0.0f, 0.0f, 1.0f); LLVector3d p0_global, p1_global; + // AXON update for control avs? if (mIsDummy) { outNorm.setVec(z_vec); @@ -5896,6 +5898,7 @@ F32 LLVOAvatar::getTimeDilation() //----------------------------------------------------------------------------- F32 LLVOAvatar::getPixelArea() const { + // AXON update for control avatars if (mIsDummy) { return 100000.f; @@ -6827,6 +6830,7 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color) BOOL LLVOAvatar::isVisible() const { + // AXON should we flag control avs as invisible? return mDrawable.notNull() && (!mOrphaned || isSelf()) && (mDrawable->isVisible() || mIsDummy); diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index e7e4e6f228..337f969f3d 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -92,7 +92,7 @@ LLVOGrass::~LLVOGrass() void LLVOGrass::updateSpecies() { - // TRIF is grass still even supported? This use of state seems odd. + // AXON is grass still even supported? This use of state seems odd. mSpecies = getAttachmentState(); if (!sSpeciesTable.count(mSpecies)) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a2f417a5cc..59e1895bc6 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3308,7 +3308,7 @@ void LLVOVolume::setExtendedMeshFlags(U32 flags) } } -bool LLVOVolume::canBeAnimatedMesh() const +bool LLVOVolume::canBeAnimatedObject() const { if (!isMesh()) { @@ -3322,9 +3322,9 @@ bool LLVOVolume::canBeAnimatedMesh() const return true; } -bool LLVOVolume::isAnimatedMesh() const +bool LLVOVolume::isAnimatedObject() const { - return canBeAnimatedMesh() && (getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG); + return canBeAnimatedObject() && (getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG); } //---------------------------------------------------------------------------- @@ -4850,11 +4850,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic(); - // TRIF why this variable? Only different from rigged if + // AXON why this variable? Only different from rigged if // there are no LLFaces associated with the drawable. bool is_rigged = false; - // TRIF handle NPC case + // AXON handle NPC case if (rigged && pAvatarVO) { pAvatarVO->addAttachmentOverridesForObject(vobj); diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 5918166aff..75dabd961a 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -269,8 +269,8 @@ public: // Extended Mesh Properties U32 getExtendedMeshFlags() const; void setExtendedMeshFlags(U32 flags); - bool canBeAnimatedMesh() const; - bool isAnimatedMesh() const; + bool canBeAnimatedObject() const; + bool isAnimatedObject() const; // Functions that deal with media, or media navigation -- cgit v1.3 From b2a06578187af5446b5e24379abc8764f0cd731f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 16 Jun 2017 16:03:06 +0100 Subject: SL-697 - global scale function for LLControlAvatar, to support arbitrary scaling of animated objects. Not currently used. --- indra/llcharacter/lljoint.cpp | 2 +- indra/newview/llcontrolavatar.cpp | 55 +++++++++++++++++++++++++++++++++++++-- indra/newview/llcontrolavatar.h | 4 +++ indra/newview/llviewermessage.cpp | 8 +++++- 4 files changed, 65 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index a3d5679f65..89335a20f5 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -881,7 +881,7 @@ void LLJoint::setWorldRotation( const LLQuaternion& rot ) //-------------------------------------------------------------------- const LLVector3& LLJoint::getScale() { - return mXform.getScale(); + return mXform.getScale(); } //-------------------------------------------------------------------- diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index a8caba08af..03a374ebdb 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -33,7 +33,8 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), - mPlaying(false) + mPlaying(false), + mGlobalScale(1.0f) { mIsControlAvatar = true; } @@ -56,6 +57,35 @@ void LLControlAvatar::matchTransform(LLVOVolume *obj) mRoot->setPosition(obj->getRenderPosition()); } +void LLControlAvatar::setGlobalScale(F32 scale) +{ + if (scale <= 0.0) + { + LL_WARNS() << "invalid global scale " << scale << LL_ENDL; + return; + } + if (scale != mGlobalScale) + { + F32 adjust_scale = scale/mGlobalScale; + LL_INFOS() << "scale " << scale << " adjustment " << adjust_scale << LL_ENDL; + // AXON - should we be scaling from the pelvis or the root? + recursiveScaleJoint(mPelvisp,adjust_scale); + mGlobalScale = scale; + } +} + +void LLControlAvatar::recursiveScaleJoint(LLJoint* joint, F32 factor) +{ + joint->setScale(factor * joint->getScale()); + + for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin(); + iter != joint->mChildren.end(); ++iter) + { + LLJoint* child = *iter; + recursiveScaleJoint(child, factor); + } +} + // Based on LLViewerJointAttachment::setupDrawable(), without the attaching part. void LLControlAvatar::updateGeom(LLVOVolume *obj) { @@ -86,8 +116,29 @@ void LLControlAvatar::updateGeom(LLVOVolume *obj) gPipeline.markRebuild(obj->mDrawable, LLDrawable::REBUILD_ALL, TRUE); obj->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); - //addAttachmentOverridesForObject(obj); + + // AXON testing scale + + // What should the scale be? What we really want is the ratio + // between the scale at which the object was originally designed + // and rigged, and the scale to which it has been subsequently + // modified - for example, if the object has been scaled down by a + // factor of 2 then we should use 0.5 as the global scale. But we + // don't have the original scale stored anywhere, just the current + // scale. Possibilities - 1) remember the original scale + // somewhere, 2) add another field to let the user specify the + // global scale, 3) approximate the original scale by looking at + // the proportions of the skeleton after joint positions have + // been applied + + //LLVector3 obj_scale = obj->getScale(); + //F32 obj_scale_z = llmax(obj_scale[2],0.1f); + //setGlobalScale(obj_scale_z/2.0f); // roughly fit avatar height range (2m) into object height } LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index c8b1039363..a783b9228f 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -42,9 +42,13 @@ public: void matchTransform(LLVOVolume *obj); void updateGeom(LLVOVolume *obj); + void setGlobalScale(F32 scale); + void recursiveScaleJoint(LLJoint *joint, F32 factor); static LLControlAvatar *createControlAvatar(LLVOVolume *obj); bool mPlaying; + + F32 mGlobalScale; }; #endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index db237d30ea..f359c1455f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5097,10 +5097,16 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) return; } + LLControlAvatar *avatarp = volp->mControlAvatar; + if (!avatarp) + { + LL_WARNS() << "AXON no control avatar, ignoring" << LL_ENDL; + return; + } + S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); LL_WARNS() << "AXON handle object animation here, num_blocks " << num_blocks << LL_ENDL; - LLControlAvatar *avatarp = volp->mControlAvatar; if (!avatarp->mPlaying) { avatarp->mPlaying = true; -- cgit v1.3 From e0d6a6a40192caa5b9d62165da5f23a5ade6e4b0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 19 Jun 2017 20:44:04 +0100 Subject: SL-725 - suppress default animations for LLControlAvatar, using a new mEnableDefaultAnimations field --- indra/newview/llcontrolavatar.cpp | 4 +++- indra/newview/llviewermessage.cpp | 1 - indra/newview/llvoavatar.cpp | 30 ++++++++++++++++++++++++------ indra/newview/llvoavatar.h | 5 +++-- 4 files changed, 30 insertions(+), 10 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 03a374ebdb..8027ea9c73 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -30,6 +30,7 @@ #include "llviewerobjectlist.h" #include "pipeline.h" #include "llanimationstates.h" +#include "llviewercontrol.h" LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), @@ -37,6 +38,7 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer mGlobalScale(1.0f) { mIsControlAvatar = true; + mEnableDefaultMotions = false; } // virtual @@ -150,7 +152,7 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) cav->mSpecialRenderMode = 1; cav->updateJointLODs(); cav->updateGeometry(cav->mDrawable); - cav->startMotion(ANIM_AGENT_STAND, 5.0f); + //cav->startMotion(ANIM_AGENT_STAND, 5.0f); cav->hideSkirt(); // stop extraneous animations diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index f359c1455f..df69d6d197 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5113,7 +5113,6 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) avatarp->updateGeom(volp); } avatarp->mSignaledAnimations.clear(); - volp->setDebugText(llformat("Animations %d", num_blocks)); for( S32 i = 0; i < num_blocks; i++ ) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1c9f79b200..c1331bf521 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -665,7 +665,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastUpdateReceivedCOFVersion(-1), mCachedMuteListUpdateTime(0), mCachedInMuteList(false), - mIsControlAvatar(false) + mIsControlAvatar(false), + mEnableDefaultMotions(true) { LL_DEBUGS("AvatarRender") << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL; @@ -1798,7 +1799,11 @@ void LLVOAvatar::buildCharacter() mAahMorph = getVisualParam( "Express_Open_Mouth" ); } - startDefaultMotions(); + // Currently disabled for control avatars (animated objects), enabled for all others. + if (mEnableDefaultMotions) + { + startDefaultMotions(); + } //------------------------------------------------------------------------- // restart any currently active motions @@ -3411,6 +3416,7 @@ void LLVOAvatar::updateDebugText() addDebugText(mBakedTextureDebugText); } + // Develop -> Avatar -> Animation Info if (LLVOAvatar::sShowAnimationDebug) { for (LLMotionController::motion_list_t::iterator iter = mMotionController.getActiveMotions().begin(); @@ -5042,7 +5048,10 @@ void LLVOAvatar::processAnimationStateChanges() else if (mInAir && !mIsSitting) { stopMotion(ANIM_AGENT_WALK_ADJUST); - startMotion(ANIM_AGENT_FLY_ADJUST); + if (mEnableDefaultMotions) + { + startMotion(ANIM_AGENT_FLY_ADJUST); + } } else { @@ -5052,13 +5061,19 @@ void LLVOAvatar::processAnimationStateChanges() if ( isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) ) { - startMotion(ANIM_AGENT_TARGET); + if (mEnableDefaultMotions) + { + startMotion(ANIM_AGENT_TARGET); + } stopMotion(ANIM_AGENT_BODY_NOISE); } else { stopMotion(ANIM_AGENT_TARGET); - startMotion(ANIM_AGENT_BODY_NOISE); + if (mEnableDefaultMotions) + { + startMotion(ANIM_AGENT_BODY_NOISE); + } } // clear all current animations @@ -6670,7 +6685,10 @@ void LLVOAvatar::getOffObject() mRoot->setRotation(cur_rotation_world); mRoot->getXform()->update(); - startMotion(ANIM_AGENT_BODY_NOISE); + if (mEnableDefaultMotions) + { + startMotion(ANIM_AGENT_BODY_NOISE); + } if (isSelf()) { diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2832f940f4..2b71cfbe61 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -242,7 +242,7 @@ private: //aligned members // Updates //-------------------------------------------------------------------- public: - void updateDebugText(); + virtual void updateDebugText(); virtual BOOL updateCharacter(LLAgent &agent); void idleUpdateVoiceVisualizer(bool voice_enabled); void idleUpdateMisc(bool detailed_update); @@ -443,10 +443,11 @@ public: VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV //-------------------------------------------------------------------- - // NPC status + // animated object status //-------------------------------------------------------------------- public: bool mIsControlAvatar; + bool mEnableDefaultMotions; //-------------------------------------------------------------------- // Morph masks -- cgit v1.3 From 4907e437c1a9523e3b3d098403da8c780c6345f9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 20 Jun 2017 15:04:11 +0100 Subject: 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. --- indra/newview/llcontrolavatar.cpp | 43 ++++++++++++++++++--------------------- indra/newview/llcontrolavatar.h | 6 ++++-- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llviewerobject.cpp | 2 +- indra/newview/llvoavatar.cpp | 25 ++++++++++++++++++++--- 5 files changed, 48 insertions(+), 30 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') 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(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(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); } -- cgit v1.3 From b6aedb116f60b9e4823f61b945b3f374d9267c1d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 27 Jun 2017 14:15:42 +0100 Subject: SL-722 - in progress on managing animated object state with linksets --- indra/newview/llcontrolavatar.cpp | 28 ++++++++--------- indra/newview/llcontrolavatar.h | 2 +- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llviewerobject.cpp | 65 +++++++++++++++++++++++++++++++++------ indra/newview/llviewerobject.h | 11 +++++++ indra/newview/llvoavatar.cpp | 6 ++-- indra/newview/llvovolume.cpp | 30 +++++++++++------- 7 files changed, 105 insertions(+), 39 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 61055f6f58..26c4865e4c 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -48,15 +48,15 @@ LLControlAvatar::~LLControlAvatar() void LLControlAvatar::matchVolumeTransform() { - setPositionAgent(mVolp->getRenderPosition()); + setPositionAgent(mRootVolp->getRenderPosition()); //slamPosition(); LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); - LLQuaternion obj_rot = mVolp->getRotation(); + LLQuaternion obj_rot = mRootVolp->getRotation(); LLQuaternion result_rot = fix_axes_rot * obj_rot; setRotation(result_rot); mRoot->setWorldRotation(result_rot); - mRoot->setPosition(mVolp->getRenderPosition()); + mRoot->setPosition(mRootVolp->getRenderPosition()); } void LLControlAvatar::setGlobalScale(F32 scale) @@ -91,18 +91,18 @@ void LLControlAvatar::recursiveScaleJoint(LLJoint* joint, F32 factor) // Based on LLViewerJointAttachment::setupDrawable(), without the attaching part. void LLControlAvatar::updateVolumeGeom() { - if (!mVolp->mDrawable) + if (!mRootVolp->mDrawable) return; - if (mVolp->mDrawable->isActive()) + if (mRootVolp->mDrawable->isActive()) { - mVolp->mDrawable->makeStatic(FALSE); + mRootVolp->mDrawable->makeStatic(FALSE); } - 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); + mRootVolp->mDrawable->makeActive(); + gPipeline.markMoved(mRootVolp->mDrawable); + gPipeline.markTextured(mRootVolp->mDrawable); // face may need to change draw pool to/from POOL_HUD + mRootVolp->mDrawable->setState(LLDrawable::USE_BACKLIGHT); - LLViewerObject::const_child_list_t& child_list = mVolp->getChildren(); + LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); ++iter) { @@ -115,8 +115,8 @@ void LLControlAvatar::updateVolumeGeom() } } - gPipeline.markRebuild(mVolp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); - mVolp->markForUpdate(TRUE); + gPipeline.markRebuild(mRootVolp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); + mRootVolp->markForUpdate(TRUE); // Note that attachment overrides aren't needed here, have already // been applied at the time the mControlAvatar was created, in @@ -148,7 +148,7 @@ 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->mRootVolp = obj; cav->createDrawable(&gPipeline); cav->mIsDummy = TRUE; diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index f29388e035..bb54cc5b2d 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -50,7 +50,7 @@ public: F32 mGlobalScale; - LLVOVolume *mVolp; + LLVOVolume *mRootVolp; }; #endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ff33fe79fa..f8cdb5bf92 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5097,7 +5097,7 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) return; } - LLControlAvatar *avatarp = volp->mControlAvatar; + LLControlAvatar *avatarp = volp->getControlAvatar(); if (!avatarp) { LL_WARNS() << "AXON no control avatar, ignoring" << LL_ENDL; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index f1c7cfae0d..bd0e864f80 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -383,11 +383,9 @@ void LLViewerObject::markDead() // This case is needed for indirectly attached mesh objects. av->resetJointsOnDetach(mesh_id); } - if (mControlAvatar) + if (getControlAvatar()) { - LLControlAvatar *av = mControlAvatar; - mControlAvatar = NULL; - av->markDead(); + unlinkControlAvatar(); } // Mark itself as dead @@ -2917,6 +2915,55 @@ void LLViewerObject::fetchInventoryFromServer() } } +LLControlAvatar *LLViewerObject::getControlAvatar() +{ + return getRootEdit()->mControlAvatar.get(); +} + +LLControlAvatar *LLViewerObject::getControlAvatar() const +{ + return getRootEdit()->mControlAvatar.get(); +} + +void LLViewerObject::linkControlAvatar() +{ + if (!getControlAvatar() && isRootEdit()) + { + LLVOVolume *volp = dynamic_cast(this); + if (!volp) + { + LL_WARNS() << "called with null or non-volume object" << LL_ENDL; + return; + } + mControlAvatar = LLControlAvatar::createControlAvatar(volp); + } + if (getControlAvatar()) + { + getControlAvatar()->addAttachmentOverridesForObject(this); + } + else + { + LL_WARNS() << "no control avatar found!" << LL_ENDL; + } +} + +void LLViewerObject::unlinkControlAvatar() +{ + if (getControlAvatar()) + { + getControlAvatar()->resetJointsOnDetach(this); + } + if (isRootEdit()) + { + // This will remove the entire linkset from the control avatar + LLControlAvatar *av = mControlAvatar; + mControlAvatar = NULL; + av->markDead(); + } + // For non-root prims, removing from the linkset will + // automatically remove the control avatar connection. +} + struct LLFilenameAndTask { LLUUID mTaskID; @@ -3872,7 +3919,7 @@ const LLVector3 LLViewerObject::getRenderPosition() const if (mDrawable.notNull() && mDrawable->isState(LLDrawable::RIGGED)) { LLVOAvatar* avatar = getAvatar(); - if (avatar && !mControlAvatar) + if (avatar && !getControlAvatar()) { return avatar->getPositionAgent(); } @@ -4008,9 +4055,9 @@ void LLViewerObject::setPosition(const LLVector3 &pos, BOOL damped) // position caches need to be up to date on root objects updatePositionCaches(); } - if (mControlAvatar) + if (getControlAvatar() && isRootEdit()) { - mControlAvatar->matchVolumeTransform(); + getControlAvatar()->matchVolumeTransform(); } } @@ -6377,9 +6424,9 @@ const std::string& LLViewerObject::getAttachmentItemName() const //virtual LLVOAvatar* LLViewerObject::getAvatar() const { - if (mControlAvatar) + if (getControlAvatar()) { - return mControlAvatar; + return getControlAvatar(); } if (isAttachment()) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index e727567957..bef00e2bab 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -684,6 +684,17 @@ public: static BOOL sUseSharedDrawables; +public: + // Returns mControlAvatar for the edit root prim of this linkset + LLControlAvatar *getControlAvatar(); + LLControlAvatar *getControlAvatar() const; + + // Create or connect to an existing control av as applicable + void linkControlAvatar(); + // Remove any reference to control av for this prim + void unlinkControlAvatar(); + +private: LLPointer mControlAvatar; protected: diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index beb6f08899..c268ab5f3c 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3433,7 +3433,7 @@ void LLVOAvatar::updateDebugText() { LLControlAvatar *control_av = dynamic_cast(this); // Try to get name from inventory of associated object - LLVOVolume *volp = control_av->mVolp; + LLVOVolume *volp = control_av->mRootVolp; if (volp) { volp->requestInventory(); // AXON should be a no-op if already requested or fetched? @@ -5565,14 +5565,14 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo) { bool non_attached_case = false; // FIXME AXON - will this work if vo has child objects? - if (vo->mControlAvatar) + if (vo->getControlAvatar()) { non_attached_case = true; } LLVOAvatar *av; if (non_attached_case) { - av = vo->mControlAvatar; + av = vo->getControlAvatar(); } else { diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 150769845b..da24d9f9c2 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3311,6 +3311,10 @@ void LLVOVolume::setExtendedMeshFlags(U32 flags) bool LLVOVolume::canBeAnimatedObject() const { if (!isMesh()) + { + return false; + } + if (isAttachment()) { return false; } @@ -4830,20 +4834,24 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) vobj->isMesh() && gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj); - bool rigged_non_attachment = !vobj->isAttachment() && - vobj->isMesh() && - gMeshRepo.getSkinInfo(vobj->getVolume()->getParams().getSculptID(), vobj); - - if (rigged_non_attachment) + if (vobj->isAnimatedObject()) { - if (!vobj->mControlAvatar) + if (!vobj->getControlAvatar()) { - vobj->mControlAvatar = LLControlAvatar::createControlAvatar(vobj); - vobj->mControlAvatar->addAttachmentOverridesForObject(vobj); + vobj->linkControlAvatar(); } - if (vobj->mControlAvatar) + if (vobj->getControlAvatar()) + { + pAvatarVO = vobj->getControlAvatar(); + } + } + else + { + // Not animated but has a control avatar - probably + // the checkbox has changed since the last rebuild. + if (vobj->getControlAvatar()) { - pAvatarVO = vobj->mControlAvatar; + vobj->unlinkControlAvatar(); } } @@ -4880,7 +4888,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) //sum up face verts and indices drawablep->updateFaceSize(i); - if (rigged || (vobj->mControlAvatar && vobj->mControlAvatar->mPlaying)) + if (rigged || (vobj->getControlAvatar() && vobj->getControlAvatar()->mPlaying)) { if (!facep->isState(LLFace::RIGGED)) { //completely reset vertex buffer -- cgit v1.3 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/newview/llviewermessage.cpp') 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.3 From f55667397e75991348fa25b6ad581a36de99acf0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 6 Jul 2017 01:25:10 +0100 Subject: SL-722 - handle per-object animation requests, combine for control avatar animation state. --- indra/newview/app_settings/logcontrol.xml | 1 + indra/newview/llcontrolavatar.cpp | 64 +++++++++++++++++++++++++ indra/newview/llcontrolavatar.h | 3 ++ indra/newview/llviewermessage.cpp | 13 ++--- indra/newview/llvoavatar.cpp | 1 + indra/newview/llvovolume.h | 5 ++ scripts/testing/lsl/cycle_object_animations.lsl | 6 +-- 7 files changed, 82 insertions(+), 11 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index ecd7c4bc36..ddd07dba80 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -50,6 +50,7 @@ tags + AXON