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/llcontrolavatar.cpp | 119 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 indra/newview/llcontrolavatar.cpp (limited to 'indra/newview/llcontrolavatar.cpp') 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; +} + -- cgit v1.2.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 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indra/newview/llcontrolavatar.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); -- cgit v1.2.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/newview/llcontrolavatar.cpp | 55 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') 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) -- cgit v1.2.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 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.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 -- cgit v1.2.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 ++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 23 deletions(-) (limited to 'indra/newview/llcontrolavatar.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; } -- cgit v1.2.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 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/newview/llcontrolavatar.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; -- cgit v1.2.3 From 7af46e7fe37552175c46a9366e9574bb9c716a68 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 27 Jun 2017 20:24:15 +0100 Subject: SL-722 - defer markDead() for LLControlAvatar when unlinking. Fixes asset crash in pipeline. Also added various checks for mDrawable null in llvoavatar.cpp. --- indra/newview/llcontrolavatar.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 26c4865e4c..6fc3d52fe7 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -35,7 +35,8 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), mPlaying(false), - mGlobalScale(1.0f) + mGlobalScale(1.0f), + mMarkedForDeath(false) { mIsControlAvatar = true; mEnableDefaultMotions = false; @@ -155,7 +156,6 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) cav->mSpecialRenderMode = 1; cav->updateJointLODs(); cav->updateGeometry(cav->mDrawable); - //cav->startMotion(ANIM_AGENT_STAND, 5.0f); cav->hideSkirt(); // Sync up position/rotation with object @@ -164,3 +164,23 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) return cav; } +void LLControlAvatar::markForDeath() +{ + mMarkedForDeath = true; +} + +// static +void LLControlAvatar::idleUpdate(LLAgent &agent, const F64 &time) +{ + if (mMarkedForDeath) + { + markDead(); + mMarkedForDeath = false; + } + else + { + LLVOAvatar::idleUpdate(agent,time); + } +} + + -- cgit v1.2.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 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llcontrolavatar.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(); +} -- cgit v1.2.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/llcontrolavatar.cpp | 64 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index bd99f66459..f18d1c636a 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -190,3 +190,67 @@ void LLControlAvatar::updateDebugText() LLVOAvatar::updateDebugText(); } + +void LLControlAvatar::getAnimatedVolumes(std::vector& volumes) +{ + if (!mRootVolp) + { + return; + } + + volumes.push_back(mRootVolp); + + LLViewerObject::const_child_list_t& child_list = mRootVolp->getChildren(); + for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); ++iter) + { + LLViewerObject* childp = *iter; + LLVOVolume *child_volp = dynamic_cast(childp); + if (child_volp && child_volp->isAnimatedObject()) + { + volumes.push_back(child_volp); + } + } +} + +// This is called after an associated object receives an animation +// message. Combine the signaled animations for all associated objects +// and process any resulting state changes. +void LLControlAvatar::updateAnimations() +{ + if (!mRootVolp) + { + LL_WARNS("AXON") << "No root vol" << LL_ENDL; + return; + } + + std::vector volumes; + getAnimatedVolumes(volumes); + + // Rebuild mSignaledAnimations from the associated volumes. + std::map anims; + for (std::vector::iterator vol_it = volumes.begin(); vol_it != volumes.end(); ++vol_it) + { + LLVOVolume *volp = *vol_it; + for (std::map::iterator anim_it = volp->mObjectSignaledAnimations.begin(); + anim_it != volp->mObjectSignaledAnimations.end(); + ++anim_it) + { + std::map::iterator found_anim_it = anims.find(anim_it->first); + if (found_anim_it != anims.end()) + { + // Animation already present, use the larger sequence id + anims[anim_it->first] = llmax(found_anim_it->second, anim_it->second); + } + else + { + // Animation not already present, use this sequence id. + anims[anim_it->first] = anim_it->second; + } + } + } + mSignaledAnimations = anims; + + LL_DEBUGS("AXON") << "process animation state changes here" << LL_ENDL; + processAnimationStateChanges(); +} -- cgit v1.2.3 From 0ca9b74516eb73e3b0943fce61fbd7473bd707c2 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Jul 2017 20:23:51 +0100 Subject: SL-718 - start on support of animated objects as attachments. --- indra/newview/llcontrolavatar.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index f18d1c636a..4aee5819aa 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -186,7 +186,15 @@ void LLControlAvatar::idleUpdate(LLAgent &agent, const F64 &time) //virtual void LLControlAvatar::updateDebugText() { - addDebugText("I'm a control avatar"); + S32 total_linkset_count = 0; + if (mRootVolp) + { + total_linkset_count = 1 + mRootVolp->getChildren().size(); + } + std::vector volumes; + getAnimatedVolumes(volumes); + S32 animated_volume_count = volumes.size(); + addDebugText(llformat("CAV obj %d anim %d", total_linkset_count, animated_volume_count)); LLVOAvatar::updateDebugText(); } -- cgit v1.2.3 From 6837ca5cd899d0aba71f856f540b535a7fc78595 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 18 Jul 2017 19:33:14 +0100 Subject: SL-727 - right-click menus and hover info ignore control avatars. --- indra/newview/llcontrolavatar.cpp | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 4aee5819aa..94e5666a70 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -195,6 +195,18 @@ void LLControlAvatar::updateDebugText() getAnimatedVolumes(volumes); S32 animated_volume_count = volumes.size(); addDebugText(llformat("CAV obj %d anim %d", total_linkset_count, animated_volume_count)); +#if 0 + // AXON - detailed rigged mesh info + for (std::vector::iterator it = volumes.begin(); + it != volumes.end(); ++it) + { + LLRiggedVolume *rig_vol = (*it)->getRiggedVolume(); + if (rig_vol) + { + addDebugText(rig_vol->mExtraDebugText); + } + } +#endif LLVOAvatar::updateDebugText(); } @@ -262,3 +274,37 @@ void LLControlAvatar::updateAnimations() LL_DEBUGS("AXON") << "process animation state changes here" << LL_ENDL; processAnimationStateChanges(); } + +// virtual +LLViewerObject* LLControlAvatar::lineSegmentIntersectRiggedAttachments(const LLVector4a& start, const LLVector4a& end, + S32 face, + BOOL pick_transparent, + BOOL pick_rigged, + S32* face_hit, + LLVector4a* intersection, + LLVector2* tex_coord, + LLVector4a* normal, + LLVector4a* tangent) +{ + LLViewerObject* hit = NULL; + + if (lineSegmentBoundingBox(start, end)) + { + LLVector4a local_end = end; + LLVector4a local_intersection; + + if (mRootVolp && + mRootVolp->lineSegmentIntersect(start, local_end, face, pick_transparent, pick_rigged, face_hit, &local_intersection, tex_coord, normal, tangent)) + { + local_end = local_intersection; + if (intersection) + { + *intersection = local_intersection; + } + + hit = mRootVolp; + } + } + + return hit; +} -- cgit v1.2.3 From 5610444d6450d5eb2e203be527116fe01d2d436a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 19 Jul 2017 22:21:08 +0100 Subject: SL-714 - fixes to get wireframes to display consistently when right-clicking on animated objects. --- indra/newview/llcontrolavatar.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 94e5666a70..e9df81e255 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -194,7 +194,29 @@ void LLControlAvatar::updateDebugText() std::vector volumes; getAnimatedVolumes(volumes); S32 animated_volume_count = volumes.size(); - addDebugText(llformat("CAV obj %d anim %d", total_linkset_count, animated_volume_count)); + std::string active_string; + for (std::vector::iterator it = volumes.begin(); + it != volumes.end(); ++it) + { + LLVOVolume *volp = *it; + if (volp && volp->mDrawable) + { + if (volp->mDrawable->isActive()) + { + active_string += "A"; + } + else + { + active_string += "S"; + } + } + else + { + active_string += "-"; + } + } + addDebugText(llformat("CAV obj %d anim %d active %s", + total_linkset_count, animated_volume_count, active_string.c_str())); #if 0 // AXON - detailed rigged mesh info for (std::vector::iterator it = volumes.begin(); -- cgit v1.2.3 From 22c8efc2ce8cac2056b73c504b95a9413fff8818 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 26 Jul 2017 18:56:18 +0100 Subject: SL-731, SL-751 - added debug option DebugAnimatedObjects, updated LSL test script --- indra/newview/llcontrolavatar.cpp | 82 ++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 31 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index e9df81e255..8dfc2e81dc 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -31,6 +31,7 @@ #include "pipeline.h" #include "llanimationstates.h" #include "llviewercontrol.h" +#include "llmeshrepository.h" LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), @@ -49,6 +50,20 @@ LLControlAvatar::~LLControlAvatar() void LLControlAvatar::matchVolumeTransform() { + { + LLVolume *volume = mRootVolp->getVolume(); + if (volume) + { + LLUUID mesh_id = volume->getParams().getSculptID(); + const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(mesh_id, mRootVolp); + if (skin) + { + LLMatrix4 bind_shape = skin->mBindShapeMatrix; + LL_INFOS("AXON") << "bind_shape is " << bind_shape << LL_ENDL; + } + } + } + setPositionAgent(mRootVolp->getRenderPosition()); //slamPosition(); @@ -186,50 +201,55 @@ void LLControlAvatar::idleUpdate(LLAgent &agent, const F64 &time) //virtual void LLControlAvatar::updateDebugText() { - S32 total_linkset_count = 0; - if (mRootVolp) - { - total_linkset_count = 1 + mRootVolp->getChildren().size(); - } - std::vector volumes; - getAnimatedVolumes(volumes); - S32 animated_volume_count = volumes.size(); - std::string active_string; - for (std::vector::iterator it = volumes.begin(); - it != volumes.end(); ++it) + if (gSavedSettings.getBOOL("DebugAnimatedObjects")) { - LLVOVolume *volp = *it; - if (volp && volp->mDrawable) + S32 total_linkset_count = 0; + if (mRootVolp) { - if (volp->mDrawable->isActive()) + total_linkset_count = 1 + mRootVolp->getChildren().size(); + } + std::vector volumes; + getAnimatedVolumes(volumes); + S32 animated_volume_count = volumes.size(); + std::string active_string; + for (std::vector::iterator it = volumes.begin(); + it != volumes.end(); ++it) + { + LLVOVolume *volp = *it; + if (volp && volp->mDrawable) { - active_string += "A"; + if (volp->mDrawable->isActive()) + { + active_string += "A"; + } + else + { + active_string += "S"; + } } else { - active_string += "S"; + active_string += "-"; } } - else - { - active_string += "-"; - } - } - addDebugText(llformat("CAV obj %d anim %d active %s", - total_linkset_count, animated_volume_count, active_string.c_str())); + addDebugText(llformat("CAV obj %d anim %d active %s", + total_linkset_count, animated_volume_count, active_string.c_str())); + #if 0 - // AXON - detailed rigged mesh info - for (std::vector::iterator it = volumes.begin(); - it != volumes.end(); ++it) - { - LLRiggedVolume *rig_vol = (*it)->getRiggedVolume(); - if (rig_vol) + // AXON - detailed rigged mesh info + for (std::vector::iterator it = volumes.begin(); + it != volumes.end(); ++it) { - addDebugText(rig_vol->mExtraDebugText); + LLRiggedVolume *rig_vol = (*it)->getRiggedVolume(); + if (rig_vol) + { + addDebugText(rig_vol->mExtraDebugText); + } } - } #endif + } + LLVOAvatar::updateDebugText(); } -- cgit v1.2.3 From 1b9e6225c8e438d44beb6a993cf1d0f24659d1e0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 28 Jul 2017 13:39:54 +0100 Subject: SL-763 - added some additional logging related to animation playback speed --- indra/newview/llcontrolavatar.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 8dfc2e81dc..9ed3020b66 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -248,6 +248,10 @@ void LLControlAvatar::updateDebugText() } #endif + addDebugText(llformat("anim time %.1f (step %f factor %f)", + mMotionController.getAnimTime(), + mMotionController.getTimeStep(), + mMotionController.getTimeFactor())); } LLVOAvatar::updateDebugText(); -- cgit v1.2.3 From 912c8faf55a4d391f69eb18d4fda5a85a70de6ca Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Sat, 29 Jul 2017 14:48:43 +0100 Subject: SL-731 - diagnostic displays for LOD, tri count --- indra/newview/llcontrolavatar.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 9ed3020b66..fb61328a1b 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -212,11 +212,15 @@ void LLControlAvatar::updateDebugText() getAnimatedVolumes(volumes); S32 animated_volume_count = volumes.size(); std::string active_string; + std::string lod_string; + S32 total_tris = 0; for (std::vector::iterator it = volumes.begin(); it != volumes.end(); ++it) { LLVOVolume *volp = *it; - if (volp && volp->mDrawable) + total_tris += volp->getTriangleCount(); + lod_string += llformat("%d",volp->getLOD()); + if (volp && volp->mDrawable) { if (volp->mDrawable->isActive()) { @@ -248,10 +252,13 @@ void LLControlAvatar::updateDebugText() } #endif - addDebugText(llformat("anim time %.1f (step %f factor %f)", - mMotionController.getAnimTime(), - mMotionController.getTimeStep(), - mMotionController.getTimeFactor())); + addDebugText(llformat("lod %s",lod_string.c_str())); + addDebugText(llformat("tris %d", total_tris)); + //addDebugText(llformat("anim time %.1f (step %f factor %f)", + // mMotionController.getAnimTime(), + // mMotionController.getTimeStep(), + // mMotionController.getTimeFactor())); + } LLVOAvatar::updateDebugText(); -- cgit v1.2.3 From a57170724344842e26b8cd0fa4a47c24efa834c5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 3 Aug 2017 14:23:02 +0100 Subject: SL-731 - render metadata includes triangle count, triangle and vertex count included with debug text for control avatar --- indra/newview/llcontrolavatar.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index fb61328a1b..d458e2951b 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -214,11 +214,14 @@ void LLControlAvatar::updateDebugText() std::string active_string; std::string lod_string; S32 total_tris = 0; + S32 total_verts = 0; for (std::vector::iterator it = volumes.begin(); it != volumes.end(); ++it) { LLVOVolume *volp = *it; - total_tris += volp->getTriangleCount(); + S32 verts = 0; + total_tris += volp->getTriangleCount(&verts); + total_verts += verts; lod_string += llformat("%d",volp->getLOD()); if (volp && volp->mDrawable) { @@ -253,7 +256,7 @@ void LLControlAvatar::updateDebugText() #endif addDebugText(llformat("lod %s",lod_string.c_str())); - addDebugText(llformat("tris %d", total_tris)); + addDebugText(llformat("tris %d verts %d", total_tris, total_verts)); //addDebugText(llformat("anim time %.1f (step %f factor %f)", // mMotionController.getAnimTime(), // mMotionController.getTimeStep(), -- cgit v1.2.3 From 2aa890da0bd8b42493745daa736c5ed9451bbf91 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 8 Sep 2017 16:05:49 +0100 Subject: SL-718 - better support for transforms of animated attachments --- indra/newview/llcontrolavatar.cpp | 46 ++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index d458e2951b..172816b3e3 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -50,6 +50,8 @@ LLControlAvatar::~LLControlAvatar() void LLControlAvatar::matchVolumeTransform() { +#if 0 + // AXON - should we be using bind_shape? { LLVolume *volume = mRootVolp->getVolume(); if (volume) @@ -63,16 +65,40 @@ void LLControlAvatar::matchVolumeTransform() } } } - - setPositionAgent(mRootVolp->getRenderPosition()); - //slamPosition(); - - LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); - LLQuaternion obj_rot = mRootVolp->getRotation(); - LLQuaternion result_rot = fix_axes_rot * obj_rot; - setRotation(result_rot); - mRoot->setWorldRotation(result_rot); - mRoot->setPosition(mRootVolp->getRenderPosition()); +#endif + + + if (mRootVolp) + { + if (mRootVolp->isAttachment()) + { + LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor(); + if (attached_av) + { + LLViewerJointAttachment *attach = attached_av->getTargetAttachmentPoint(mRootVolp); + setPositionAgent(mRootVolp->getRenderPosition()); + LLVector3 pos = attach->getParent()->getWorldPosition(); + mRoot->setWorldPosition(pos); + mRoot->setRotation(attach->getParent()->getWorldRotation()); + } + else + { + LL_WARNS_ONCE() << "can't find attached av!" << LL_ENDL; + } + } + else + { + setPositionAgent(mRootVolp->getRenderPosition()); + //slamPosition(); + + LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); + LLQuaternion obj_rot = mRootVolp->getRotation(); + LLQuaternion result_rot = fix_axes_rot * obj_rot; + setRotation(result_rot); + mRoot->setWorldRotation(result_rot); + mRoot->setPosition(mRootVolp->getRenderPosition()); + } + } } void LLControlAvatar::setGlobalScale(F32 scale) -- cgit v1.2.3 From fff9dde8a8ec5f3afb2ebd32fc0d54827671fc2a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Sep 2017 21:40:39 +0100 Subject: SL-726, SL-718 - refactoring updateCharacter() --- indra/newview/llcontrolavatar.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 172816b3e3..fa578907c8 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -210,7 +210,6 @@ void LLControlAvatar::markForDeath() mMarkedForDeath = true; } -// static void LLControlAvatar::idleUpdate(LLAgent &agent, const F64 &time) { if (mMarkedForDeath) @@ -224,6 +223,11 @@ void LLControlAvatar::idleUpdate(LLAgent &agent, const F64 &time) } } +BOOL LLControlAvatar::updateCharacter(LLAgent &agent) +{ + return LLVOAvatar::updateCharacter(agent); +} + //virtual void LLControlAvatar::updateDebugText() { -- cgit v1.2.3 From 7839f77071e8e66ebd890a3bea40c6b6c9a8cfff Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Sep 2017 18:21:31 +0100 Subject: SL-718 - more transform tweaking for animesh, still some issues with attachments. --- indra/newview/llcontrolavatar.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index fa578907c8..7a8d5bce03 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -77,9 +77,19 @@ void LLControlAvatar::matchVolumeTransform() { LLViewerJointAttachment *attach = attached_av->getTargetAttachmentPoint(mRootVolp); setPositionAgent(mRootVolp->getRenderPosition()); - LLVector3 pos = attach->getParent()->getWorldPosition(); - mRoot->setWorldPosition(pos); - mRoot->setRotation(attach->getParent()->getWorldRotation()); + // AXON why doesn't attach joint have a valid world + // position? Using the parent as a kludge but not + // right. + //LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); + LLVector3 joint_pos = attach->getParent()->getWorldPosition(); + LLQuaternion joint_rot = attach->getParent()->getWorldRotation(); + //LLVector3 attach_pos = mRootVolp->mDrawable->getPosition(); + //attach_pos.rotVec(joint_rot); + //LLQuaternion attach_rot = mRootVolp->mDrawable->getRotation(); + //mRoot->setWorldPosition(joint_pos + attach_pos); + //mRoot->setWorldRotation(joint_rot * (attach_rot * ~fix_axes_rot)); + mRoot->setWorldPosition(joint_pos); + mRoot->setWorldRotation(joint_rot); } else { -- cgit v1.2.3 From 108fe6234488d9a383dea0be327af403487135f3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 28 Sep 2017 19:06:36 +0100 Subject: SL-761, SL-718 - transform matrix munging for skeletons of animated object attachments, to allow editing to work correctly --- indra/newview/llcontrolavatar.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 7a8d5bce03..1e8bd0066b 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -68,6 +68,9 @@ void LLControlAvatar::matchVolumeTransform() #endif + // Avatars seem to 90 degrees off from the rest of the world, this is a fixup. + LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); + if (mRootVolp) { if (mRootVolp->isAttachment()) @@ -77,19 +80,15 @@ void LLControlAvatar::matchVolumeTransform() { LLViewerJointAttachment *attach = attached_av->getTargetAttachmentPoint(mRootVolp); setPositionAgent(mRootVolp->getRenderPosition()); - // AXON why doesn't attach joint have a valid world - // position? Using the parent as a kludge but not - // right. - //LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); - LLVector3 joint_pos = attach->getParent()->getWorldPosition(); - LLQuaternion joint_rot = attach->getParent()->getWorldRotation(); - //LLVector3 attach_pos = mRootVolp->mDrawable->getPosition(); - //attach_pos.rotVec(joint_rot); - //LLQuaternion attach_rot = mRootVolp->mDrawable->getRotation(); - //mRoot->setWorldPosition(joint_pos + attach_pos); - //mRoot->setWorldRotation(joint_rot * (attach_rot * ~fix_axes_rot)); - mRoot->setWorldPosition(joint_pos); - mRoot->setWorldRotation(joint_rot); + attach->updateWorldPRSParent(); + LLVector3 joint_pos = attach->getWorldPosition(); + LLQuaternion joint_rot = attach->getWorldRotation(); + LLVector3 obj_pos = mRootVolp->mDrawable->getPosition(); + LLQuaternion obj_rot = mRootVolp->mDrawable->getRotation(); + obj_pos.rotVec(joint_rot); + mRoot->setWorldPosition(obj_pos + joint_pos); + mRoot->setWorldRotation(fix_axes_rot * obj_rot * joint_rot); + setRotation(mRoot->getRotation()); } else { @@ -99,9 +98,6 @@ void LLControlAvatar::matchVolumeTransform() else { setPositionAgent(mRootVolp->getRenderPosition()); - //slamPosition(); - - LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); LLQuaternion obj_rot = mRootVolp->getRotation(); LLQuaternion result_rot = fix_axes_rot * obj_rot; setRotation(result_rot); -- cgit v1.2.3 From 4ded45eb90667e63abc75e3ee63d957886412c84 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 10 Oct 2017 15:40:30 +0100 Subject: Sl-761 - removed the 90-degree fixup, so objects can be moved in a predictable and standard X-forward way in scripts. --- indra/newview/llcontrolavatar.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 1e8bd0066b..1a86718acd 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -67,10 +67,6 @@ void LLControlAvatar::matchVolumeTransform() } #endif - - // Avatars seem to 90 degrees off from the rest of the world, this is a fixup. - LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); - if (mRootVolp) { if (mRootVolp->isAttachment()) @@ -87,7 +83,7 @@ void LLControlAvatar::matchVolumeTransform() LLQuaternion obj_rot = mRootVolp->mDrawable->getRotation(); obj_pos.rotVec(joint_rot); mRoot->setWorldPosition(obj_pos + joint_pos); - mRoot->setWorldRotation(fix_axes_rot * obj_rot * joint_rot); + mRoot->setWorldRotation(obj_rot * joint_rot); setRotation(mRoot->getRotation()); } else @@ -99,7 +95,7 @@ void LLControlAvatar::matchVolumeTransform() { setPositionAgent(mRootVolp->getRenderPosition()); LLQuaternion obj_rot = mRootVolp->getRotation(); - LLQuaternion result_rot = fix_axes_rot * obj_rot; + LLQuaternion result_rot = obj_rot; setRotation(result_rot); mRoot->setWorldRotation(result_rot); mRoot->setPosition(mRootVolp->getRenderPosition()); -- cgit v1.2.3 From aae13d1966b74adf59e1510bade8652f33e6867e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 10 Oct 2017 19:30:51 +0100 Subject: SL-704 - comment and dead code cleanup --- indra/newview/llcontrolavatar.cpp | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 1a86718acd..fab95ab1d8 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -50,23 +50,6 @@ LLControlAvatar::~LLControlAvatar() void LLControlAvatar::matchVolumeTransform() { -#if 0 - // AXON - should we be using bind_shape? - { - LLVolume *volume = mRootVolp->getVolume(); - if (volume) - { - LLUUID mesh_id = volume->getParams().getSculptID(); - const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(mesh_id, mRootVolp); - if (skin) - { - LLMatrix4 bind_shape = skin->mBindShapeMatrix; - LL_INFOS("AXON") << "bind_shape is " << bind_shape << LL_ENDL; - } - } - } -#endif - if (mRootVolp) { if (mRootVolp->isAttachment()) @@ -255,7 +238,7 @@ void LLControlAvatar::updateDebugText() total_tris += volp->getTriangleCount(&verts); total_verts += verts; lod_string += llformat("%d",volp->getLOD()); - if (volp && volp->mDrawable) + if (volp && volp->mDrawable) { if (volp->mDrawable->isActive()) { @@ -274,19 +257,6 @@ void LLControlAvatar::updateDebugText() addDebugText(llformat("CAV obj %d anim %d active %s", total_linkset_count, animated_volume_count, active_string.c_str())); -#if 0 - // AXON - detailed rigged mesh info - for (std::vector::iterator it = volumes.begin(); - it != volumes.end(); ++it) - { - LLRiggedVolume *rig_vol = (*it)->getRiggedVolume(); - if (rig_vol) - { - addDebugText(rig_vol->mExtraDebugText); - } - } -#endif - addDebugText(llformat("lod %s",lod_string.c_str())); addDebugText(llformat("tris %d verts %d", total_tris, total_verts)); //addDebugText(llformat("anim time %.1f (step %f factor %f)", @@ -328,7 +298,7 @@ void LLControlAvatar::updateAnimations() { if (!mRootVolp) { - LL_WARNS("AXON") << "No root vol" << LL_ENDL; + LL_WARNS_ONCE("AXON") << "No root vol" << LL_ENDL; return; } -- cgit v1.2.3 From ef0e3bfdd92bb5faea633a14487f123dfeb2f5f1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 27 Oct 2017 21:27:36 +0100 Subject: SL-731, SL-779 - more diagnostics for DebugAnimatedObjects, fixed a problem with recursiveMarkForUpdate --- indra/newview/llcontrolavatar.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index fab95ab1d8..51dc7d7de1 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -227,6 +227,7 @@ void LLControlAvatar::updateDebugText() getAnimatedVolumes(volumes); S32 animated_volume_count = volumes.size(); std::string active_string; + std::string type_string; std::string lod_string; S32 total_tris = 0; S32 total_verts = 0; @@ -248,16 +249,31 @@ void LLControlAvatar::updateDebugText() { active_string += "S"; } + if (volp->isRiggedMesh()) + { + // Rigged/animateable mesh + type_string += "R"; + } + else if (volp->isMesh()) + { + // Static mesh + type_string += "M"; + } + else + { + // Any other prim + type_string += "P"; + } } else { active_string += "-"; + type_string += "-"; } } addDebugText(llformat("CAV obj %d anim %d active %s", total_linkset_count, animated_volume_count, active_string.c_str())); - - addDebugText(llformat("lod %s",lod_string.c_str())); + addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str())); addDebugText(llformat("tris %d verts %d", total_tris, total_verts)); //addDebugText(llformat("anim time %.1f (step %f factor %f)", // mMotionController.getAnimTime(), @@ -329,7 +345,6 @@ void LLControlAvatar::updateAnimations() } mSignaledAnimations = anims; - LL_DEBUGS("AXON") << "process animation state changes here" << LL_ENDL; processAnimationStateChanges(); } -- cgit v1.2.3 From 07e925d279b6c52c0cf352173dfb81fd1740d651 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 9 Nov 2017 16:48:04 +0000 Subject: MAINT-7913, MAINT-7817 - fix for animesh attachment corruption after teleporting to a different simulator. Turns out the control avatar (skeleton) was getting caught up in the cleanup for the original region --- indra/newview/llcontrolavatar.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 51dc7d7de1..699c3ce1f9 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -32,6 +32,7 @@ #include "llanimationstates.h" #include "llviewercontrol.h" #include "llmeshrepository.h" +#include "llviewerregion.h" LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), @@ -275,6 +276,19 @@ void LLControlAvatar::updateDebugText() total_linkset_count, animated_volume_count, active_string.c_str())); addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str())); addDebugText(llformat("tris %d verts %d", total_tris, total_verts)); + std::string region_name = "no region"; + if (mRootVolp->getRegion()) + { + region_name = mRootVolp->getRegion()->getName(); + } + std::string skel_region_name = "skel no region"; + if (getRegion()) + { + skel_region_name = getRegion()->getName(); + } + addDebugText(llformat("region %x %s skel %x %s", + mRootVolp->getRegion(), region_name.c_str(), + getRegion(), skel_region_name.c_str())); //addDebugText(llformat("anim time %.1f (step %f factor %f)", // mMotionController.getAnimTime(), // mMotionController.getTimeStep(), -- cgit v1.2.3 From 2c8007bc4b295b69b5b8a9c540876e402e6d63dc Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 9 Nov 2017 20:53:24 +0000 Subject: no-op whitespace commit to unstick the build machinery --- indra/newview/llcontrolavatar.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 699c3ce1f9..848a8b0d40 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -295,7 +295,6 @@ void LLControlAvatar::updateDebugText() // mMotionController.getTimeFactor())); } - LLVOAvatar::updateDebugText(); } -- cgit v1.2.3 From 2f1b75f03e8066b54d9dae16ab29095752c4ee8a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 16 Nov 2017 19:24:53 +0000 Subject: SL-704 - first pass cleaning up comments. Also added LLControlAvatar::initInstance() as a potential hook for optimizations. --- indra/newview/llcontrolavatar.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 848a8b0d40..afa6be188d 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -49,6 +49,13 @@ LLControlAvatar::~LLControlAvatar() { } +// virtual +void LLControlAvatar::initInstance() +{ + // AXON - potential optimizations here - avoid creating system avatar mesh since it's not used. + LLVOAvatar::initInstance(); +} + void LLControlAvatar::matchVolumeTransform() { if (mRootVolp) @@ -173,7 +180,6 @@ void LLControlAvatar::updateVolumeGeom() 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->mRootVolp = obj; -- cgit v1.2.3 From 64e5cfc05452993bf15a31d9d4a0deeb1414edf0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 16 Nov 2017 20:00:38 +0000 Subject: SL-704 - more cleanup, including releaseMeshData() for control avatars, which don't need mesh data. --- indra/newview/llcontrolavatar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index afa6be188d..7600bc6959 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -52,7 +52,8 @@ LLControlAvatar::~LLControlAvatar() // virtual void LLControlAvatar::initInstance() { - // AXON - potential optimizations here - avoid creating system avatar mesh since it's not used. + // AXON - potential optimizations here - avoid creating system + // avatar mesh since it's not used. LLVOAvatar::initInstance(); } -- cgit v1.2.3 From b625f9cd9956d135760da0053e46cf01692779c5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 16 Nov 2017 20:33:11 +0000 Subject: SL-763 - disabling the use_quantum optimization in LLMotionController until it can be fixed. --- indra/newview/llcontrolavatar.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 7600bc6959..7e89a97c03 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -52,8 +52,9 @@ LLControlAvatar::~LLControlAvatar() // virtual void LLControlAvatar::initInstance() { - // AXON - potential optimizations here - avoid creating system - // avatar mesh since it's not used. + // AXON - potential optimizations here: avoid creating system + // avatar mesh content since it's not used. For now we just clean some + // things up after the fact in releaseMeshData(). LLVOAvatar::initInstance(); } -- cgit v1.2.3 From 0d2d6b42baa4fc6d253c5499324ffe5572676d87 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Dec 2017 14:15:34 +0000 Subject: SL-704, SL-759 - support for impostoring of animated objects, comment and code cleanup --- indra/newview/llcontrolavatar.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 7e89a97c03..920b0fa151 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -52,7 +52,7 @@ LLControlAvatar::~LLControlAvatar() // virtual void LLControlAvatar::initInstance() { - // AXON - potential optimizations here: avoid creating system + // Potential optimizations here: avoid creating system // avatar mesh content since it's not used. For now we just clean some // things up after the fact in releaseMeshData(). LLVOAvatar::initInstance(); @@ -280,10 +280,11 @@ void LLControlAvatar::updateDebugText() type_string += "-"; } } - addDebugText(llformat("CAV obj %d anim %d active %s", - total_linkset_count, animated_volume_count, active_string.c_str())); + addDebugText(llformat("CAV obj %d anim %d active %s impost %d", + total_linkset_count, animated_volume_count, active_string.c_str(), (S32) isImpostor())); addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str())); addDebugText(llformat("tris %d verts %d", total_tris, total_verts)); + addDebugText(llformat("pxarea %s", LLStringOps::getReadableNumber(getPixelArea()).c_str())); std::string region_name = "no region"; if (mRootVolp->getRegion()) { @@ -335,7 +336,7 @@ void LLControlAvatar::updateAnimations() { if (!mRootVolp) { - LL_WARNS_ONCE("AXON") << "No root vol" << LL_ENDL; + LL_WARNS_ONCE("AnimatedObjects") << "No root vol" << LL_ENDL; return; } -- cgit v1.2.3 From 4b439ff968a934c127cd685b54bcc206e467a948 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 4 Dec 2017 11:15:47 +0000 Subject: SL-704 - made avatar hierarchy more consistent by adding lluiavatar for viewer-local avs used in upload previews --- indra/newview/llcontrolavatar.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 920b0fa151..39a8fd469d 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -40,6 +40,7 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer mGlobalScale(1.0f), mMarkedForDeath(false) { + mIsDummy = TRUE; mIsControlAvatar = true; mEnableDefaultMotions = false; } @@ -56,6 +57,14 @@ void LLControlAvatar::initInstance() // avatar mesh content since it's not used. For now we just clean some // things up after the fact in releaseMeshData(). LLVOAvatar::initInstance(); + + // AXON mSpecialRenderMode here is probably wrong, need to review. + mSpecialRenderMode = 1; + + createDrawable(&gPipeline); + updateJointLODs(); + updateGeometry(mDrawable); + hideSkirt(); } void LLControlAvatar::matchVolumeTransform() @@ -185,13 +194,6 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj) LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR); cav->mRootVolp = obj; - - cav->createDrawable(&gPipeline); - cav->mIsDummy = TRUE; - cav->mSpecialRenderMode = 1; - cav->updateJointLODs(); - cav->updateGeometry(cav->mDrawable); - cav->hideSkirt(); // Sync up position/rotation with object cav->matchVolumeTransform(); -- cgit v1.2.3 From fd893e18361fb5e919759256825cdc4b7b58381f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 4 Dec 2017 11:35:08 +0000 Subject: SL-704 - removed gratuitous mSpecialRenderMode --- indra/newview/llcontrolavatar.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 39a8fd469d..0f4898e8d3 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -58,9 +58,6 @@ void LLControlAvatar::initInstance() // things up after the fact in releaseMeshData(). LLVOAvatar::initInstance(); - // AXON mSpecialRenderMode here is probably wrong, need to review. - mSpecialRenderMode = 1; - createDrawable(&gPipeline); updateJointLODs(); updateGeometry(mDrawable); -- cgit v1.2.3 From 6199cecd8bd40e9929f1863fcfa8220ccf9fdf3b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Dec 2017 21:18:05 +0000 Subject: SL-704 - more comment review/cleanup, some avatar state handling updated for animated objects. --- indra/newview/llcontrolavatar.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 0f4898e8d3..9b7118d9cb 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -113,7 +113,7 @@ void LLControlAvatar::setGlobalScale(F32 scale) { 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? + // should we be scaling from the pelvis or the root? recursiveScaleJoint(mPelvisp,adjust_scale); mGlobalScale = scale; } @@ -167,7 +167,10 @@ void LLControlAvatar::updateVolumeGeom() matchVolumeTransform(); - // AXON testing scale + // Initial exploration of allowing scaling skeleton to match root + // prim bounding box. If enabled, would probably be controlled by + // an additional checkbox and default to off. Not enabled for + // initial release. // What should the scale be? What we really want is the ratio // between the scale at which the object was originally designed -- cgit v1.2.3 From 9f1482501348b36ef51b5eacfb6ddd62f83b814c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Dec 2017 14:04:23 +0000 Subject: SL-731 - diagnostic display cleanup for DebugAnimatedObjects --- indra/newview/llcontrolavatar.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 9b7118d9cb..2df06caa23 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -287,6 +287,7 @@ void LLControlAvatar::updateDebugText() addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str())); addDebugText(llformat("tris %d verts %d", total_tris, total_verts)); addDebugText(llformat("pxarea %s", LLStringOps::getReadableNumber(getPixelArea()).c_str())); +#if 0 std::string region_name = "no region"; if (mRootVolp->getRegion()) { @@ -300,10 +301,7 @@ void LLControlAvatar::updateDebugText() addDebugText(llformat("region %x %s skel %x %s", mRootVolp->getRegion(), region_name.c_str(), getRegion(), skel_region_name.c_str())); - //addDebugText(llformat("anim time %.1f (step %f factor %f)", - // mMotionController.getAnimTime(), - // mMotionController.getTimeStep(), - // mMotionController.getTimeFactor())); +#endif } LLVOAvatar::updateDebugText(); -- cgit v1.2.3 From c508259f3c15401da1843af261c5a38e85fbfe80 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 14 Dec 2017 15:38:38 +0000 Subject: SL-731 - added est tris to animated object debug text --- indra/newview/llcontrolavatar.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 2df06caa23..7270cad0da 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -242,6 +242,7 @@ void LLControlAvatar::updateDebugText() std::string lod_string; S32 total_tris = 0; S32 total_verts = 0; + S32 est_tris = 0; for (std::vector::iterator it = volumes.begin(); it != volumes.end(); ++it) { @@ -249,6 +250,7 @@ void LLControlAvatar::updateDebugText() S32 verts = 0; total_tris += volp->getTriangleCount(&verts); total_verts += verts; + est_tris += volp->getEstTrianglesMax(); lod_string += llformat("%d",volp->getLOD()); if (volp && volp->mDrawable) { @@ -285,7 +287,7 @@ void LLControlAvatar::updateDebugText() addDebugText(llformat("CAV obj %d anim %d active %s impost %d", total_linkset_count, animated_volume_count, active_string.c_str(), (S32) isImpostor())); addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str())); - addDebugText(llformat("tris %d verts %d", total_tris, total_verts)); + addDebugText(llformat("tris %d (est %d), verts %d", total_tris, est_tris, total_verts)); addDebugText(llformat("pxarea %s", LLStringOps::getReadableNumber(getPixelArea()).c_str())); #if 0 std::string region_name = "no region"; -- cgit v1.2.3 From 26add5700d88338b94ce891892948998b0468131 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 22 Jan 2018 22:08:06 +0000 Subject: MAINT-8159 - animation state management during link/unlink commands --- indra/newview/llcontrolavatar.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 7270cad0da..22d8f88420 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -367,8 +367,17 @@ void LLControlAvatar::updateAnimations() } } } - mSignaledAnimations = anims; + if (!mPlaying && anims.size()>0) + { + mPlaying = true; + if (!mRootVolp->isAnySelected()) + { + updateVolumeGeom(); + mRootVolp->recursiveMarkForUpdate(TRUE); + } + } + mSignaledAnimations = anims; processAnimationStateChanges(); } -- cgit v1.2.3 From 9af10a84cf0671d04e844299456d4bc48d1dec45 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 2 Feb 2018 20:32:43 +0000 Subject: MAINT-8239 - problems with some instances failing to load some joint positions. Added DumpXML and Reset Skeleton support for animated objects when debugging. --- indra/newview/llcontrolavatar.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 22d8f88420..e1715d567b 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -414,3 +414,16 @@ LLViewerObject* LLControlAvatar::lineSegmentIntersectRiggedAttachments(const LLV return hit; } + +// virtual +std::string LLControlAvatar::getFullname() const +{ + if (mRootVolp) + { + return "AO_" + mRootVolp->getID().getString(); + } + else + { + return "AO_no_root_vol"; + } +} -- cgit v1.2.3 From a3fd0801c3030ff9a5a6761c9618f381aa965983 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 26 Mar 2018 20:59:37 +0100 Subject: SL-897 - display for DebugAnimatedObjects now includes streaming cost triangle count --- indra/newview/llcontrolavatar.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index e1715d567b..a16fa3cd26 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -242,7 +242,9 @@ void LLControlAvatar::updateDebugText() std::string lod_string; S32 total_tris = 0; S32 total_verts = 0; - S32 est_tris = 0; + F32 est_tris = 0.f; + F32 est_streaming_tris = 0.f; + for (std::vector::iterator it = volumes.begin(); it != volumes.end(); ++it) { @@ -251,6 +253,7 @@ void LLControlAvatar::updateDebugText() total_tris += volp->getTriangleCount(&verts); total_verts += verts; est_tris += volp->getEstTrianglesMax(); + est_streaming_tris += volp->getEstTrianglesStreamingCost(); lod_string += llformat("%d",volp->getLOD()); if (volp && volp->mDrawable) { @@ -287,7 +290,7 @@ void LLControlAvatar::updateDebugText() addDebugText(llformat("CAV obj %d anim %d active %s impost %d", total_linkset_count, animated_volume_count, active_string.c_str(), (S32) isImpostor())); addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str())); - addDebugText(llformat("tris %d (est %d), verts %d", total_tris, est_tris, total_verts)); + addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts)); addDebugText(llformat("pxarea %s", LLStringOps::getReadableNumber(getPixelArea()).c_str())); #if 0 std::string region_name = "no region"; -- cgit v1.2.3 From af30a35dc2f4542ceba0eb33c232a77bf3598b69 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 27 Mar 2018 19:27:05 +0100 Subject: SL-897 - added animated object streaming cost to DebugAnimatedObjects display. --- indra/newview/llcontrolavatar.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index a16fa3cd26..a181d8be9a 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -244,6 +244,7 @@ void LLControlAvatar::updateDebugText() S32 total_verts = 0; F32 est_tris = 0.f; F32 est_streaming_tris = 0.f; + F32 streaming_cost = 0.f; for (std::vector::iterator it = volumes.begin(); it != volumes.end(); ++it) @@ -254,6 +255,7 @@ void LLControlAvatar::updateDebugText() total_verts += verts; est_tris += volp->getEstTrianglesMax(); est_streaming_tris += volp->getEstTrianglesStreamingCost(); + streaming_cost += volp->getStreamingCost(); lod_string += llformat("%d",volp->getLOD()); if (volp && volp->mDrawable) { @@ -287,8 +289,9 @@ void LLControlAvatar::updateDebugText() type_string += "-"; } } - addDebugText(llformat("CAV obj %d anim %d active %s impost %d", - total_linkset_count, animated_volume_count, active_string.c_str(), (S32) isImpostor())); + addDebugText(llformat("CAV obj %d anim %d active %s impost %d strcst %f", + total_linkset_count, animated_volume_count, + active_string.c_str(), (S32) isImpostor(), streaming_cost)); addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str())); addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts)); addDebugText(llformat("pxarea %s", LLStringOps::getReadableNumber(getPixelArea()).c_str())); -- cgit v1.2.3 From f954abd9dfbf8f7147e1f5b352c8eadc6a074555 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 20 Apr 2018 13:37:07 +0100 Subject: MAINT-8549, MAINT-8554 - improvements to animesh ARC, restrict joint position overrides to +/-5m --- indra/newview/llcontrolavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index a181d8be9a..e77c7615e9 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -294,7 +294,7 @@ void LLControlAvatar::updateDebugText() active_string.c_str(), (S32) isImpostor(), streaming_cost)); addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str())); addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts)); - addDebugText(llformat("pxarea %s", LLStringOps::getReadableNumber(getPixelArea()).c_str())); + addDebugText(llformat("pxarea %s rank %d", LLStringOps::getReadableNumber(getPixelArea()).c_str(), getVisibilityRank())); #if 0 std::string region_name = "no region"; if (mRootVolp->getRegion()) -- cgit v1.2.3 From 19ebe40974edc23b9ac00e80dc716e34cad5a65d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 27 Apr 2018 14:50:28 +0100 Subject: MAINT-8559 - consistent management of control skeleton state with animated objects --- indra/newview/llcontrolavatar.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index e77c7615e9..d655f2cd37 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -240,6 +240,7 @@ void LLControlAvatar::updateDebugText() std::string active_string; std::string type_string; std::string lod_string; + std::string animated_object_flag_string; S32 total_tris = 0; S32 total_verts = 0; F32 est_tris = 0.f; @@ -259,6 +260,15 @@ void LLControlAvatar::updateDebugText() lod_string += llformat("%d",volp->getLOD()); if (volp && volp->mDrawable) { + bool is_animated_flag = volp->getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG; + if (is_animated_flag) + { + animated_object_flag_string += "1"; + } + else + { + animated_object_flag_string += "0"; + } if (volp->mDrawable->isActive()) { active_string += "A"; @@ -269,7 +279,7 @@ void LLControlAvatar::updateDebugText() } if (volp->isRiggedMesh()) { - // Rigged/animateable mesh + // Rigged/animatable mesh type_string += "R"; } else if (volp->isMesh()) @@ -293,6 +303,7 @@ void LLControlAvatar::updateDebugText() total_linkset_count, animated_volume_count, active_string.c_str(), (S32) isImpostor(), streaming_cost)); addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str())); + addDebugText(llformat("flags %s", animated_object_flag_string.c_str())); addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts)); addDebugText(llformat("pxarea %s rank %d", LLStringOps::getReadableNumber(getPixelArea()).c_str(), getVisibilityRank())); #if 0 -- cgit v1.2.3 From 7ed17b5c2c11b9e57316c87b29524b88edb8f762 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 3 May 2018 22:42:02 +0100 Subject: MAINT-8608, MAINT-8539, MAINT-8615 - changes to make object animation info more persistent, tolerant to race conditions during initialization --- indra/newview/llcontrolavatar.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index d655f2cd37..f298a8884b 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -367,8 +367,9 @@ void LLControlAvatar::updateAnimations() for (std::vector::iterator vol_it = volumes.begin(); vol_it != volumes.end(); ++vol_it) { LLVOVolume *volp = *vol_it; - for (std::map::iterator anim_it = volp->mObjectSignaledAnimations.begin(); - anim_it != volp->mObjectSignaledAnimations.end(); + signaled_animation_map_t& signaled_animations = LLObjectSignaledAnimationMap::instance().getMap()[volp->getID()]; + for (std::map::iterator anim_it = signaled_animations.begin(); + anim_it != signaled_animations.end(); ++anim_it) { std::map::iterator found_anim_it = anims.find(anim_it->first); @@ -384,7 +385,7 @@ void LLControlAvatar::updateAnimations() } } } - if (!mPlaying && anims.size()>0) + if (!mPlaying) { mPlaying = true; if (!mRootVolp->isAnySelected()) -- cgit v1.2.3 From 2f209465dc1adc33b2135d685a88190e83952012 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 4 May 2018 15:04:42 +0100 Subject: MAINT-8608 - more on animation updates --- indra/newview/llcontrolavatar.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index f298a8884b..c977f3784f 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -367,6 +367,7 @@ void LLControlAvatar::updateAnimations() for (std::vector::iterator vol_it = volumes.begin(); vol_it != volumes.end(); ++vol_it) { LLVOVolume *volp = *vol_it; + LL_INFOS("AnimatedObjects") << "updating anim for vol " << volp->getID() << " root " << mRootVolp->getID() << LL_ENDL; signaled_animation_map_t& signaled_animations = LLObjectSignaledAnimationMap::instance().getMap()[volp->getID()]; for (std::map::iterator anim_it = signaled_animations.begin(); anim_it != signaled_animations.end(); @@ -383,6 +384,7 @@ void LLControlAvatar::updateAnimations() // Animation not already present, use this sequence id. anims[anim_it->first] = anim_it->second; } + LL_INFOS("AnimatedObjects") << "found anim for vol " << volp->getID() << " anim " << anim_it->first << " root " << mRootVolp->getID() << LL_ENDL; } } if (!mPlaying) -- cgit v1.2.3 From 2a48816717087e07eb3f3855798c5dd71f541ee5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 4 May 2018 21:18:13 +0100 Subject: MAINT-8608, MAINT-8539, MAINT-8615 - more animation state management - less log spam, more docs --- indra/newview/llcontrolavatar.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index c977f3784f..5a1add258c 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -355,7 +355,7 @@ void LLControlAvatar::updateAnimations() { if (!mRootVolp) { - LL_WARNS_ONCE("AnimatedObjects") << "No root vol" << LL_ENDL; + LL_WARNS_ONCE("AnimatedObjectsNotify") << "No root vol" << LL_ENDL; return; } @@ -367,7 +367,7 @@ void LLControlAvatar::updateAnimations() for (std::vector::iterator vol_it = volumes.begin(); vol_it != volumes.end(); ++vol_it) { LLVOVolume *volp = *vol_it; - LL_INFOS("AnimatedObjects") << "updating anim for vol " << volp->getID() << " root " << mRootVolp->getID() << LL_ENDL; + //LL_INFOS("AnimatedObjects") << "updating anim for vol " << volp->getID() << " root " << mRootVolp->getID() << LL_ENDL; signaled_animation_map_t& signaled_animations = LLObjectSignaledAnimationMap::instance().getMap()[volp->getID()]; for (std::map::iterator anim_it = signaled_animations.begin(); anim_it != signaled_animations.end(); @@ -384,7 +384,7 @@ void LLControlAvatar::updateAnimations() // Animation not already present, use this sequence id. anims[anim_it->first] = anim_it->second; } - LL_INFOS("AnimatedObjects") << "found anim for vol " << volp->getID() << " anim " << anim_it->first << " root " << mRootVolp->getID() << LL_ENDL; + LL_DEBUGS("AnimatedObjectsNotify") << "found anim for vol " << volp->getID() << " anim " << anim_it->first << " root " << mRootVolp->getID() << LL_ENDL; } } if (!mPlaying) -- cgit v1.2.3 From abcddc97cf01fb61bc4b77ab492c02e3985bb1e1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Jun 2018 19:39:10 +0100 Subject: SL-915, MAINT-8554 - WIP on managing dynamic avatar bounding box, using to constrain encroachment by animated objects --- indra/newview/llcontrolavatar.cpp | 78 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 5a1add258c..8291df7705 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -34,6 +34,10 @@ #include "llmeshrepository.h" #include "llviewerregion.h" +#if LL_WINDOWS + #pragma optimize("", off) +#endif + LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), mPlaying(false), @@ -64,6 +68,41 @@ void LLControlAvatar::initInstance() hideSkirt(); } +// AXON move to math +bool box_valid_and_non_zero(const LLVector3* box) +{ + if (!box[0].isFinite() || !box[1].isFinite()) + { + return false; + } + LLVector3 zero_vec; + zero_vec.clear(); + if ((box[0] != zero_vec) || (box[1] != zero_vec)) + { + return true; + } + return false; +} + +// AXON move to math +LLVector3 point_to_box_offset(LLVector3& pos, const LLVector3* box) +{ + LLVector3 offset; + for (S32 k=0; k<3; k++) + { + offset[k] = 0; + if (pos[k] < box[0][k]) + { + offset[k] = pos[k] - box[0][k]; + } + else if (pos[k] > box[1][k]) + { + offset[k] = pos[k] - box[1][k]; + } + } + return offset; +} + void LLControlAvatar::matchVolumeTransform() { if (mRootVolp) @@ -92,12 +131,47 @@ void LLControlAvatar::matchVolumeTransform() } else { - setPositionAgent(mRootVolp->getRenderPosition()); + + LLVector3 vol_pos = mRootVolp->getRenderPosition(); + LLVector3 pos_box_offset; + pos_box_offset.clear(); + + // Fix up position if needed to prevent visual encroachment + if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down + { + const F32 MAX_LEGAL_OFFSET = 2.0; + + // The goal here is to ensure that the extent of the avatar's + // bounding box does not wander too far from the + // official position of the corresponding volume. We + // do this by tracking the distance and applying a + // correction to the control avatar position if + // needed. + LLVector3 uncorrected_extents[2]; + uncorrected_extents[0] = getLastAnimExtents()[0] - mPositionConstraintFixup; + uncorrected_extents[1] = getLastAnimExtents()[1] - mPositionConstraintFixup; + pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); + F32 offset_dist = pos_box_offset.length(); + if (offset_dist > MAX_LEGAL_OFFSET) + { + F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); + pos_box_offset *= target_dist/offset_dist; + } + LL_DEBUGS("FixBox") << getFullname() << " fixup needed for offset " + << pos_box_offset[0] << "," << pos_box_offset[1] << "," << pos_box_offset[2] + << " current fixup " + << mPositionConstraintFixup[0] << "," << mPositionConstraintFixup[1] << "," << mPositionConstraintFixup[2] + << " dist " << offset_dist << LL_ENDL; + } + + mPositionConstraintFixup = pos_box_offset; + + setPositionAgent(vol_pos + mPositionConstraintFixup); LLQuaternion obj_rot = mRootVolp->getRotation(); LLQuaternion result_rot = obj_rot; setRotation(result_rot); mRoot->setWorldRotation(result_rot); - mRoot->setPosition(mRootVolp->getRenderPosition()); + mRoot->setPosition(vol_pos + mPositionConstraintFixup); } } } -- cgit v1.2.3 From edf6795edaa4ec822ac0e2bc906c71606b84b5c8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Jun 2018 21:49:24 +0100 Subject: SL-915, MAINT-8554 - cleanup/reorg, added encroachment fix info to DebugAnimatedObjects output --- indra/newview/llcontrolavatar.cpp | 55 ++++++++------------------------------- 1 file changed, 11 insertions(+), 44 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 8291df7705..36e728f26d 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -34,10 +34,6 @@ #include "llmeshrepository.h" #include "llviewerregion.h" -#if LL_WINDOWS - #pragma optimize("", off) -#endif - LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), mPlaying(false), @@ -68,41 +64,6 @@ void LLControlAvatar::initInstance() hideSkirt(); } -// AXON move to math -bool box_valid_and_non_zero(const LLVector3* box) -{ - if (!box[0].isFinite() || !box[1].isFinite()) - { - return false; - } - LLVector3 zero_vec; - zero_vec.clear(); - if ((box[0] != zero_vec) || (box[1] != zero_vec)) - { - return true; - } - return false; -} - -// AXON move to math -LLVector3 point_to_box_offset(LLVector3& pos, const LLVector3* box) -{ - LLVector3 offset; - for (S32 k=0; k<3; k++) - { - offset[k] = 0; - if (pos[k] < box[0][k]) - { - offset[k] = pos[k] - box[0][k]; - } - else if (pos[k] > box[1][k]) - { - offset[k] = pos[k] - box[1][k]; - } - } - return offset; -} - void LLControlAvatar::matchVolumeTransform() { if (mRootVolp) @@ -157,11 +118,11 @@ void LLControlAvatar::matchVolumeTransform() F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); pos_box_offset *= target_dist/offset_dist; } - LL_DEBUGS("FixBox") << getFullname() << " fixup needed for offset " - << pos_box_offset[0] << "," << pos_box_offset[1] << "," << pos_box_offset[2] - << " current fixup " - << mPositionConstraintFixup[0] << "," << mPositionConstraintFixup[1] << "," << mPositionConstraintFixup[2] - << " dist " << offset_dist << LL_ENDL; + //LL_DEBUGS("FixBox") << getFullname() << " fixup needed for offset " + // << pos_box_offset[0] << "," << pos_box_offset[1] << "," << pos_box_offset[2] + // << " current fixup " + // << mPositionConstraintFixup[0] << "," << mPositionConstraintFixup[1] << "," << mPositionConstraintFixup[2] + // << " dist " << offset_dist << LL_ENDL; } mPositionConstraintFixup = pos_box_offset; @@ -380,6 +341,12 @@ void LLControlAvatar::updateDebugText() addDebugText(llformat("flags %s", animated_object_flag_string.c_str())); addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts)); addDebugText(llformat("pxarea %s rank %d", LLStringOps::getReadableNumber(getPixelArea()).c_str(), getVisibilityRank())); + if (mPositionConstraintFixup.length() > 0.0f) + { + addDebugText(llformat("pos fix (%.1f %.1f %.1f)", + mPositionConstraintFixup[0], mPositionConstraintFixup[1], mPositionConstraintFixup[2])); + } + #if 0 std::string region_name = "no region"; if (mRootVolp->getRegion()) -- cgit v1.2.3 From c65aa5f34d63d6ec0af33035f4d5de94688eccee Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 15 Jun 2018 12:15:38 +0100 Subject: MAINT-8554 - animated object max encroach = 3.0 m --- indra/newview/llcontrolavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 36e728f26d..7537e91477 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -100,7 +100,7 @@ void LLControlAvatar::matchVolumeTransform() // Fix up position if needed to prevent visual encroachment if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down { - const F32 MAX_LEGAL_OFFSET = 2.0; + const F32 MAX_LEGAL_OFFSET = 3.0; // The goal here is to ensure that the extent of the avatar's // bounding box does not wander too far from the -- cgit v1.2.3 From f8ef8300ccdae12f1d6dc3911bec2e10cb1bb25c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 15 Jun 2018 18:36:59 +0100 Subject: MAINT-8554 - encroachment check fix --- indra/newview/llcontrolavatar.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 7537e91477..6bd7de12f3 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -95,7 +95,7 @@ void LLControlAvatar::matchVolumeTransform() LLVector3 vol_pos = mRootVolp->getRenderPosition(); LLVector3 pos_box_offset; - pos_box_offset.clear(); + LLVector3 box_offset; // Fix up position if needed to prevent visual encroachment if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down @@ -116,18 +116,21 @@ void LLControlAvatar::matchVolumeTransform() if (offset_dist > MAX_LEGAL_OFFSET) { F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); - pos_box_offset *= target_dist/offset_dist; + box_offset = (target_dist/offset_dist)*pos_box_offset; } - //LL_DEBUGS("FixBox") << getFullname() << " fixup needed for offset " - // << pos_box_offset[0] << "," << pos_box_offset[1] << "," << pos_box_offset[2] - // << " current fixup " - // << mPositionConstraintFixup[0] << "," << mPositionConstraintFixup[1] << "," << mPositionConstraintFixup[2] - // << " dist " << offset_dist << LL_ENDL; } - mPositionConstraintFixup = pos_box_offset; + mPositionConstraintFixup = box_offset; + + // Currently if you're doing something like playing an + // animation that moves the pelvis (on an avatar or + // animated object), the name tag and debug text will be + // left behind. Ideally setPosition() would follow the + // skeleton around in a smarter way, so name tags, + // complexity info and such line up better. Should defer + // this until avatars also get fixed. + setPositionAgent(vol_pos); - setPositionAgent(vol_pos + mPositionConstraintFixup); LLQuaternion obj_rot = mRootVolp->getRotation(); LLQuaternion result_rot = obj_rot; setRotation(result_rot); -- cgit v1.2.3 From 329fee97041f061c6508ff2a18dcc5ba49b657cc Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 29 Jun 2018 22:14:39 +0100 Subject: MAINT-8671 - animated object rotation fix based on bind shape matrix of root prim, where applicable. --- indra/newview/llcontrolavatar.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 6bd7de12f3..8c10ececb6 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -38,7 +38,8 @@ LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewer LLVOAvatar(id, pcode, regionp), mPlaying(false), mGlobalScale(1.0f), - mMarkedForDeath(false) + mMarkedForDeath(false), + mRootVolp(NULL) { mIsDummy = TRUE; mIsControlAvatar = true; @@ -129,13 +130,27 @@ void LLControlAvatar::matchVolumeTransform() // skeleton around in a smarter way, so name tags, // complexity info and such line up better. Should defer // this until avatars also get fixed. - setPositionAgent(vol_pos); LLQuaternion obj_rot = mRootVolp->getRotation(); - LLQuaternion result_rot = obj_rot; - setRotation(result_rot); - mRoot->setWorldRotation(result_rot); - mRoot->setPosition(vol_pos + mPositionConstraintFixup); + LLMatrix3 bind_mat; + + LLQuaternion bind_rot; +#define MATCH_BIND_SHAPE +#ifdef MATCH_BIND_SHAPE + // MAINT-8671 - based on a patch from Beq Janus + const LLMeshSkinInfo* skin_info = mRootVolp->getSkinInfo(); + if (skin_info) + { + LLMatrix3 bind_mat = skin_info->mBindShapeMatrix.getMat3(); + bind_mat.invert(); + bind_rot = bind_mat.quaternion(); + bind_rot.normalize(); + } +#endif + setRotation(bind_rot*obj_rot); + mRoot->setWorldRotation(bind_rot*obj_rot); + setPositionAgent(vol_pos); + mRoot->setPosition(vol_pos + mPositionConstraintFixup); } } } -- cgit v1.2.3 From e286d1743d3833e9dd299fd4f5473db686284690 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 2 Jul 2018 19:43:13 +0100 Subject: MAINT-8671 - change in bind shape -> quaternion math. --- indra/newview/llcontrolavatar.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 8c10ececb6..f828ed783e 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -141,7 +141,24 @@ void LLControlAvatar::matchVolumeTransform() const LLMeshSkinInfo* skin_info = mRootVolp->getSkinInfo(); if (skin_info) { + LL_DEBUGS("BindShape") << getFullname() << " bind shape " << skin_info->mBindShapeMatrix << LL_ENDL; LLMatrix3 bind_mat = skin_info->mBindShapeMatrix.getMat3(); + for (auto i = 0; i < 3; i++) + { + F32 len = 0.0f; + for (auto j = 0; j < 3; j++) + { + len += bind_mat.mMatrix[i][j] * bind_mat.mMatrix[i][j]; + } + if (len >= 0.0f) + { + len = sqrt(len); + for (auto j = 0; j < 3; j++) + { + bind_mat.mMatrix[i][j] /= len; + } + } + } bind_mat.invert(); bind_rot = bind_mat.quaternion(); bind_rot.normalize(); -- cgit v1.2.3 From 0b5bc866183c7b28aaea93f201e5010b90dd706d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 2 Jul 2018 19:56:56 +0100 Subject: MAINT-8671 - more bind shape fix --- indra/newview/llcontrolavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index f828ed783e..88152d2dc6 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -150,7 +150,7 @@ void LLControlAvatar::matchVolumeTransform() { len += bind_mat.mMatrix[i][j] * bind_mat.mMatrix[i][j]; } - if (len >= 0.0f) + if (len > 0.0f) { len = sqrt(len); for (auto j = 0; j < 3; j++) -- cgit v1.2.3 From 9be476e3bb4cde7b086581931ed39ac137207ffe Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 9 Jul 2018 22:30:50 +0100 Subject: MAINT-7926, MAINT-8400 - fixes related to bounding box and LOD calculations for rigged meshes in animated objects --- indra/newview/llcontrolavatar.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 88152d2dc6..93b178e0e9 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -316,7 +316,10 @@ void LLControlAvatar::updateDebugText() F32 est_tris = 0.f; F32 est_streaming_tris = 0.f; F32 streaming_cost = 0.f; - + std::string cam_dist_string = ""; + S32 cam_dist_count = 0; + F32 lod_radius = mRootVolp->mLODRadius; + for (std::vector::iterator it = volumes.begin(); it != volumes.end(); ++it) { @@ -351,6 +354,7 @@ void LLControlAvatar::updateDebugText() { // Rigged/animatable mesh type_string += "R"; + lod_radius = volp->mLODRadius; } else if (volp->isMesh()) { @@ -362,6 +366,12 @@ void LLControlAvatar::updateDebugText() // Any other prim type_string += "P"; } + if (cam_dist_count < 4) + { + cam_dist_string += LLStringOps::getReadableNumber(volp->mLODDistance) + "/" + + LLStringOps::getReadableNumber(volp->mLODAdjustedDistance) + " "; + cam_dist_count++; + } } else { @@ -376,6 +386,7 @@ void LLControlAvatar::updateDebugText() addDebugText(llformat("flags %s", animated_object_flag_string.c_str())); addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts)); addDebugText(llformat("pxarea %s rank %d", LLStringOps::getReadableNumber(getPixelArea()).c_str(), getVisibilityRank())); + addDebugText(llformat("lod_radius %s dists %s", LLStringOps::getReadableNumber(lod_radius).c_str(),cam_dist_string.c_str())); if (mPositionConstraintFixup.length() > 0.0f) { addDebugText(llformat("pos fix (%.1f %.1f %.1f)", -- cgit v1.2.3 From d389f681b19c39fc633edebafbc745f00dce9416 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 12 Jul 2018 18:10:19 +0100 Subject: MAINT-8863 - more diagnostics to pin down possible causes --- indra/newview/llcontrolavatar.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 93b178e0e9..6adb34c263 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -63,6 +63,8 @@ void LLControlAvatar::initInstance() updateJointLODs(); updateGeometry(mDrawable); hideSkirt(); + + mInitFlags |= 1<<4; } void LLControlAvatar::matchVolumeTransform() -- cgit v1.2.3 From 791979c553a09963f03239cecc90083fe3f8c657 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 8 Aug 2018 13:34:02 +0100 Subject: SL-928 - in mesh upload, warn if bind shape is non-identity and skin weights are enabled. --- indra/newview/llcontrolavatar.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 6adb34c263..83d42f6ccf 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -33,6 +33,7 @@ #include "llviewercontrol.h" #include "llmeshrepository.h" #include "llviewerregion.h" +#include "llskinningutil.h" LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), @@ -144,26 +145,7 @@ void LLControlAvatar::matchVolumeTransform() if (skin_info) { LL_DEBUGS("BindShape") << getFullname() << " bind shape " << skin_info->mBindShapeMatrix << LL_ENDL; - LLMatrix3 bind_mat = skin_info->mBindShapeMatrix.getMat3(); - for (auto i = 0; i < 3; i++) - { - F32 len = 0.0f; - for (auto j = 0; j < 3; j++) - { - len += bind_mat.mMatrix[i][j] * bind_mat.mMatrix[i][j]; - } - if (len > 0.0f) - { - len = sqrt(len); - for (auto j = 0; j < 3; j++) - { - bind_mat.mMatrix[i][j] /= len; - } - } - } - bind_mat.invert(); - bind_rot = bind_mat.quaternion(); - bind_rot.normalize(); + bind_rot = LLSkinningUtil::getUnscaledQuaternion(skin_info->mBindShapeMatrix); } #endif setRotation(bind_rot*obj_rot); -- cgit v1.2.3 From 795aedf4a922f17aac667afc0c368e7fe18b0e03 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 6 Sep 2018 19:47:51 +0100 Subject: SL-966 - size and pos limit calcs moved to sep method. Global scale option for testing of size limits. --- indra/newview/llcontrolavatar.cpp | 91 +++++++++++++++++++++++++-------------- 1 file changed, 59 insertions(+), 32 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 83d42f6ccf..fdef60612f 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -35,12 +35,16 @@ #include "llviewerregion.h" #include "llskinningutil.h" +const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f; +const F32 LLControlAvatar::MAX_LEGAL_SIZE = 16.0f; + LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), mPlaying(false), mGlobalScale(1.0f), mMarkedForDeath(false), - mRootVolp(NULL) + mRootVolp(NULL), + mScaleConstraintFixup(1.0) { mIsDummy = TRUE; mIsControlAvatar = true; @@ -68,6 +72,44 @@ void LLControlAvatar::initInstance() mInitFlags |= 1<<4; } +void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_scale_fixup) const +{ + new_pos_fixup = LLVector3(); + new_scale_fixup = 1.0f; + LLVector3 vol_pos = mRootVolp->getRenderPosition(); + + // Fix up position if needed to prevent visual encroachment + if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down + { + // The goal here is to ensure that the extent of the avatar's + // bounding box does not wander too far from the + // official position of the corresponding volume. We + // do this by tracking the distance and applying a + // correction to the control avatar position if + // needed. + LLVector3 uncorrected_extents[2]; + uncorrected_extents[0] = (getLastAnimExtents()[0] - mPositionConstraintFixup)/mScaleConstraintFixup; + uncorrected_extents[1] = (getLastAnimExtents()[1] - mPositionConstraintFixup)/mScaleConstraintFixup; + LLVector3 uncorrected_size = uncorrected_extents[1]-uncorrected_extents[0]; + F32 uncorrected_max_size = llmax(uncorrected_size[0],uncorrected_size[1],uncorrected_size[2]); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); + F32 offset_dist = pos_box_offset.length(); + if (offset_dist > MAX_LEGAL_OFFSET) + { + F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); + new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; + LL_INFOS("ConstraintFix") << "pos fix, offset_dist " << offset_dist << " pos fixup " + << new_pos_fixup << LL_ENDL; + } + if (uncorrected_max_size > MAX_LEGAL_SIZE) + { + new_scale_fixup = MAX_LEGAL_SIZE/uncorrected_max_size; + LL_INFOS("ConstraintFix") << "scale fix, uncorrected_size " << uncorrected_size << " fixup " + << mScaleConstraintFixup << LL_ENDL; + } + } +} + void LLControlAvatar::matchVolumeTransform() { if (mRootVolp) @@ -96,37 +138,16 @@ void LLControlAvatar::matchVolumeTransform() } else { - LLVector3 vol_pos = mRootVolp->getRenderPosition(); - LLVector3 pos_box_offset; - LLVector3 box_offset; - // Fix up position if needed to prevent visual encroachment - if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down - { - const F32 MAX_LEGAL_OFFSET = 3.0; - - // The goal here is to ensure that the extent of the avatar's - // bounding box does not wander too far from the - // official position of the corresponding volume. We - // do this by tracking the distance and applying a - // correction to the control avatar position if - // needed. - LLVector3 uncorrected_extents[2]; - uncorrected_extents[0] = getLastAnimExtents()[0] - mPositionConstraintFixup; - uncorrected_extents[1] = getLastAnimExtents()[1] - mPositionConstraintFixup; - pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); - F32 offset_dist = pos_box_offset.length(); - if (offset_dist > MAX_LEGAL_OFFSET) - { - F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); - box_offset = (target_dist/offset_dist)*pos_box_offset; - } - } + LLVector3 new_pos_fixup; + F32 new_scale_fixup; + getNewConstraintFixups(new_pos_fixup, new_scale_fixup); - mPositionConstraintFixup = box_offset; - - // Currently if you're doing something like playing an + mPositionConstraintFixup = new_pos_fixup; + mScaleConstraintFixup = new_scale_fixup; + + // FIXME: Currently if you're doing something like playing an // animation that moves the pelvis (on an avatar or // animated object), the name tag and debug text will be // left behind. Ideally setPosition() would follow the @@ -152,6 +173,9 @@ void LLControlAvatar::matchVolumeTransform() mRoot->setWorldRotation(bind_rot*obj_rot); setPositionAgent(vol_pos); mRoot->setPosition(vol_pos + mPositionConstraintFixup); + + F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale"); + setGlobalScale(global_scale * mScaleConstraintFixup); } } } @@ -371,10 +395,13 @@ void LLControlAvatar::updateDebugText() addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts)); addDebugText(llformat("pxarea %s rank %d", LLStringOps::getReadableNumber(getPixelArea()).c_str(), getVisibilityRank())); addDebugText(llformat("lod_radius %s dists %s", LLStringOps::getReadableNumber(lod_radius).c_str(),cam_dist_string.c_str())); - if (mPositionConstraintFixup.length() > 0.0f) + if (mPositionConstraintFixup.length() > 0.0f || mScaleConstraintFixup != 1.0f) { - addDebugText(llformat("pos fix (%.1f %.1f %.1f)", - mPositionConstraintFixup[0], mPositionConstraintFixup[1], mPositionConstraintFixup[2])); + addDebugText(llformat("pos fix (%.1f %.1f %.1f) scale %f", + mPositionConstraintFixup[0], + mPositionConstraintFixup[1], + mPositionConstraintFixup[2], + mScaleConstraintFixup)); } #if 0 -- cgit v1.2.3 From f8533d1fdb6dd6699deb8249e5f7e6ea70939dd4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2018 13:48:42 +0100 Subject: SL-966 - updated logic for size/pos constraints --- indra/newview/llcontrolavatar.cpp | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index fdef60612f..adad959412 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -87,25 +87,33 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ // do this by tracking the distance and applying a // correction to the control avatar position if // needed. - LLVector3 uncorrected_extents[2]; - uncorrected_extents[0] = (getLastAnimExtents()[0] - mPositionConstraintFixup)/mScaleConstraintFixup; - uncorrected_extents[1] = (getLastAnimExtents()[1] - mPositionConstraintFixup)/mScaleConstraintFixup; - LLVector3 uncorrected_size = uncorrected_extents[1]-uncorrected_extents[0]; - F32 uncorrected_max_size = llmax(uncorrected_size[0],uncorrected_size[1],uncorrected_size[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, uncorrected_extents); + const LLVector3 *extents = getLastAnimExtents(); + LLVector3 box_dims = extents[1]-extents[0]; + F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, getLastAnimExtents()); F32 offset_dist = pos_box_offset.length(); if (offset_dist > MAX_LEGAL_OFFSET) { F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); - new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; - LL_INFOS("ConstraintFix") << "pos fix, offset_dist " << offset_dist << " pos fixup " - << new_pos_fixup << LL_ENDL; + new_pos_fixup = mPositionConstraintFixup + (target_dist/offset_dist)*pos_box_offset; + LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " + << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - if (uncorrected_max_size > MAX_LEGAL_SIZE) + else if (offset_dist < MAX_LEGAL_OFFSET-1 && mPositionConstraintFixup.length()>0.01f) { - new_scale_fixup = MAX_LEGAL_SIZE/uncorrected_max_size; - LL_INFOS("ConstraintFix") << "scale fix, uncorrected_size " << uncorrected_size << " fixup " - << mScaleConstraintFixup << LL_ENDL; + new_pos_fixup = mPositionConstraintFixup * 0.9; + LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " + << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; + } + else + { + new_pos_fixup = mPositionConstraintFixup; + } + if (max_size/mScaleConstraintFixup > MAX_LEGAL_SIZE) + { + new_scale_fixup = mScaleConstraintFixup*MAX_LEGAL_SIZE/max_size; + LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, max_size " << max_size << " fixup " + << mScaleConstraintFixup << " -> " << new_scale_fixup << LL_ENDL; } } } -- cgit v1.2.3 From 55419ccd4368d8fd0766936ef52fa1d911a46962 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 7 Sep 2018 13:53:19 +0100 Subject: SL-966 - max size = 64 --- indra/newview/llcontrolavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index adad959412..54b1a0dcaf 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -36,7 +36,7 @@ #include "llskinningutil.h" const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f; -const F32 LLControlAvatar::MAX_LEGAL_SIZE = 16.0f; +const F32 LLControlAvatar::MAX_LEGAL_SIZE = 64.0f; LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), -- cgit v1.2.3 From e4e4ad3c09bdc06f738f60bbfd7899036ad6553f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 10 Sep 2018 20:13:35 +0100 Subject: SL-966 - animated object size/pos constraints cont, including some settings for debugging. additional options to anim_tool.py for making test animations --- indra/newview/llcontrolavatar.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 54b1a0dcaf..96cdb7f01d 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -74,6 +74,18 @@ void LLControlAvatar::initInstance() void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_scale_fixup) const { + + F32 max_legal_offset = MAX_LEGAL_OFFSET; + if (gSavedSettings.getControl("AnimatedObjectsMaxLegalOffset")) + { + max_legal_offset = gSavedSettings.getF32("AnimatedObjectsMaxLegalOffset"); + } + F32 max_legal_size = MAX_LEGAL_SIZE; + if (gSavedSettings.getControl("AnimatedObjectsMaxLegalSize")) + { + max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); + } + new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; LLVector3 vol_pos = mRootVolp->getRenderPosition(); @@ -90,16 +102,16 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ const LLVector3 *extents = getLastAnimExtents(); LLVector3 box_dims = extents[1]-extents[0]; F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, getLastAnimExtents()); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, extents); F32 offset_dist = pos_box_offset.length(); - if (offset_dist > MAX_LEGAL_OFFSET) + if (offset_dist > max_legal_offset) { - F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); + F32 target_dist = (offset_dist - max_legal_offset); new_pos_fixup = mPositionConstraintFixup + (target_dist/offset_dist)*pos_box_offset; LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - else if (offset_dist < MAX_LEGAL_OFFSET-1 && mPositionConstraintFixup.length()>0.01f) + else if (offset_dist < max_legal_offset-1 && mPositionConstraintFixup.length()>0.01f) { new_pos_fixup = mPositionConstraintFixup * 0.9; LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " @@ -109,9 +121,9 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { new_pos_fixup = mPositionConstraintFixup; } - if (max_size/mScaleConstraintFixup > MAX_LEGAL_SIZE) + if (max_size/mScaleConstraintFixup > max_legal_size) { - new_scale_fixup = mScaleConstraintFixup*MAX_LEGAL_SIZE/max_size; + new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, max_size " << max_size << " fixup " << mScaleConstraintFixup << " -> " << new_scale_fixup << LL_ENDL; } -- cgit v1.2.3 From 963945b3ab258ea445e1d9757fc5a89ce397ff7b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 25 Sep 2018 16:39:26 +0100 Subject: SL-1291 - fixed some issues with selection highlighting of objects rezzed while in build mode. Not clear whether this addresses the original issue, which isn't reproing --- indra/newview/llcontrolavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 96cdb7f01d..0efed8ab7c 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -508,7 +508,7 @@ void LLControlAvatar::updateAnimations() if (!mPlaying) { mPlaying = true; - if (!mRootVolp->isAnySelected()) + //if (!mRootVolp->isAnySelected()) { updateVolumeGeom(); mRootVolp->recursiveMarkForUpdate(TRUE); -- cgit v1.2.3 From 4d4255c27b45ed5e32fe7c4870e2ce3ed10cb140 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 27 Sep 2018 19:34:41 +0100 Subject: SL-1350 - keep control avatar rotation synced to corresponding root drawable --- indra/newview/llcontrolavatar.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 0efed8ab7c..a620f2abe9 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -175,7 +175,16 @@ void LLControlAvatar::matchVolumeTransform() // complexity info and such line up better. Should defer // this until avatars also get fixed. - LLQuaternion obj_rot = mRootVolp->getRotation(); + LLQuaternion obj_rot; + if (mRootVolp->mDrawable) + { + obj_rot = mRootVolp->mDrawable->getRotation(); + } + else + { + obj_rot = mRootVolp->getRotation(); + } + LLMatrix3 bind_mat; LLQuaternion bind_rot; -- cgit v1.2.3 From aacb7eb25fd4caceaafb145ed550e14cebeef665 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 1 Oct 2018 16:11:09 +0100 Subject: SL-9773 - treat animated object attachments the same as other rigged attachments for purposes of visibility in mouselook. --- indra/newview/llcontrolavatar.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index a620f2abe9..28c02b0434 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -574,3 +574,17 @@ std::string LLControlAvatar::getFullname() const return "AO_no_root_vol"; } } + +// virtual +bool LLControlAvatar::shouldRenderRigged() const +{ + if (mRootVolp && mRootVolp->isAttachment()) + { + LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor(); + if (attached_av) + { + return attached_av->shouldRenderRigged(); + } + } + return true; +} -- cgit v1.2.3 From 5bb0b393a9ee634db1fbbde2645a6374704e184c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 2 Oct 2018 22:02:42 +0100 Subject: SL-966 - behavior improvements and visualization, bonus removal of unrelated duplicate code in llappviewer.cpp --- indra/newview/llcontrolavatar.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 28c02b0434..18d6e6d6e7 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -35,6 +35,8 @@ #include "llviewerregion.h" #include "llskinningutil.h" +//#pragma optimize("", off) + const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f; const F32 LLControlAvatar::MAX_LEGAL_SIZE = 64.0f; @@ -111,9 +113,16 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - else if (offset_dist < max_legal_offset-1 && mPositionConstraintFixup.length()>0.01f) + else if (offset_dist < max_legal_offset-1) { - new_pos_fixup = mPositionConstraintFixup * 0.9; + if (mPositionConstraintFixup.length()>0.01f) + { + new_pos_fixup = mPositionConstraintFixup * 0.9; + } + else + { + new_pos_fixup = LLVector3(); + } LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } -- cgit v1.2.3 From 0fd67838cf011e81f18822f699e8a140d4f761ad Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2018 10:29:11 +0100 Subject: SL-966 - tweaks to scale/pos constraint logic --- indra/newview/llcontrolavatar.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 18d6e6d6e7..64f8423a66 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -102,34 +102,20 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ // correction to the control avatar position if // needed. const LLVector3 *extents = getLastAnimExtents(); + LLVector unshift_extents; + unshift_extents[0] = extents[0] - mPositionConstraintFixup; + unshift_extents[1] = extents[1] - mPositionConstraintFixup; LLVector3 box_dims = extents[1]-extents[0]; F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, extents); + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); F32 offset_dist = pos_box_offset.length(); if (offset_dist > max_legal_offset) { F32 target_dist = (offset_dist - max_legal_offset); - new_pos_fixup = mPositionConstraintFixup + (target_dist/offset_dist)*pos_box_offset; + new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } - else if (offset_dist < max_legal_offset-1) - { - if (mPositionConstraintFixup.length()>0.01f) - { - new_pos_fixup = mPositionConstraintFixup * 0.9; - } - else - { - new_pos_fixup = LLVector3(); - } - LL_DEBUGS("ConstraintFix") << getFullname() << " pos fixup reduced " - << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; - } - else - { - new_pos_fixup = mPositionConstraintFixup; - } if (max_size/mScaleConstraintFixup > max_legal_size) { new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; -- cgit v1.2.3 From 8078b30574fc0a317b8dc7aadfc09516d3638ab0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2018 13:11:50 +0100 Subject: SL-966 - bug fixes, added lerp control for algorithm tweaking --- indra/newview/llcontrolavatar.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 64f8423a66..96aaab80fa 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -87,6 +87,11 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); } + F32 lerp_weight = 0.5f; // hysteresis. 1.0 = immediately slam to new value, 0.0 = ignore new value + if (gSavedSettings.getControl("AnimatedObjectsPosLerp")) + { + lerp_weight = gSavedSettings.getF32("AnimatedObjectsPosLerp"); + } new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; @@ -102,7 +107,7 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ // correction to the control avatar position if // needed. const LLVector3 *extents = getLastAnimExtents(); - LLVector unshift_extents; + LLVector3 unshift_extents[2]; unshift_extents[0] = extents[0] - mPositionConstraintFixup; unshift_extents[1] = extents[1] - mPositionConstraintFixup; LLVector3 box_dims = extents[1]-extents[0]; @@ -116,6 +121,7 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } + new_pos_fixup = lerp_weight * new_pos_fixup + (1.0f - lerp_weight)*mPositionConstraintFixup; if (max_size/mScaleConstraintFixup > max_legal_size) { new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; -- cgit v1.2.3 From 2fc7dcf22f6c04614a5dfc09104e919220f30525 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 3 Oct 2018 20:48:57 +0100 Subject: SL-966 - added scale constraints for animated object attachments --- indra/newview/llcontrolavatar.cpp | 57 ++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 28 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 96aaab80fa..4b70d625d4 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -87,15 +87,10 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); } - F32 lerp_weight = 0.5f; // hysteresis. 1.0 = immediately slam to new value, 0.0 = ignore new value - if (gSavedSettings.getControl("AnimatedObjectsPosLerp")) - { - lerp_weight = gSavedSettings.getF32("AnimatedObjectsPosLerp"); - } new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; - LLVector3 vol_pos = mRootVolp->getRenderPosition(); + LLVector3 vol_pos = mRootVolp->getRenderPosition(); // Fix up position if needed to prevent visual encroachment if (box_valid_and_non_zero(getLastAnimExtents())) // wait for state to settle down @@ -111,22 +106,26 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ unshift_extents[0] = extents[0] - mPositionConstraintFixup; unshift_extents[1] = extents[1] - mPositionConstraintFixup; LLVector3 box_dims = extents[1]-extents[0]; - F32 max_size = llmax(box_dims[0],box_dims[1],box_dims[2]); - LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); - F32 offset_dist = pos_box_offset.length(); - if (offset_dist > max_legal_offset) - { - F32 target_dist = (offset_dist - max_legal_offset); - new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; - LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " - << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; - } - new_pos_fixup = lerp_weight * new_pos_fixup + (1.0f - lerp_weight)*mPositionConstraintFixup; - if (max_size/mScaleConstraintFixup > max_legal_size) + F32 box_size = llmax(box_dims[0],box_dims[1],box_dims[2]); + + if (!mRootVolp->isAttachment()) + { + LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); + F32 offset_dist = pos_box_offset.length(); + if (offset_dist > max_legal_offset || mPositionConstraintFixup != LLVector3()) + { + F32 target_dist = (offset_dist - max_legal_offset); + new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; + LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " + << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; + } + } + if (box_size/mScaleConstraintFixup > max_legal_size) { - new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size; - LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, max_size " << max_size << " fixup " - << mScaleConstraintFixup << " -> " << new_scale_fixup << LL_ENDL; + new_scale_fixup = mScaleConstraintFixup*max_legal_size/box_size; + LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, box_size " << box_size << " fixup " + << mScaleConstraintFixup << " max legal " << max_legal_size + << " -> new scale " << new_scale_fixup << LL_ENDL; } } } @@ -135,6 +134,12 @@ void LLControlAvatar::matchVolumeTransform() { if (mRootVolp) { + LLVector3 new_pos_fixup; + F32 new_scale_fixup; + getNewConstraintFixups(new_pos_fixup, new_scale_fixup); + mPositionConstraintFixup = new_pos_fixup; + mScaleConstraintFixup = new_scale_fixup; + if (mRootVolp->isAttachment()) { LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor(); @@ -151,6 +156,9 @@ void LLControlAvatar::matchVolumeTransform() mRoot->setWorldPosition(obj_pos + joint_pos); mRoot->setWorldRotation(obj_rot * joint_rot); setRotation(mRoot->getRotation()); + + F32 global_scale = gSavedSettings.getF32("AnimatedObjectsGlobalScale"); + setGlobalScale(global_scale * mScaleConstraintFixup); } else { @@ -161,13 +169,6 @@ void LLControlAvatar::matchVolumeTransform() { LLVector3 vol_pos = mRootVolp->getRenderPosition(); - LLVector3 new_pos_fixup; - F32 new_scale_fixup; - getNewConstraintFixups(new_pos_fixup, new_scale_fixup); - - mPositionConstraintFixup = new_pos_fixup; - mScaleConstraintFixup = new_scale_fixup; - // FIXME: Currently if you're doing something like playing an // animation that moves the pelvis (on an avatar or // animated object), the name tag and debug text will be -- cgit v1.2.3 From 9ad912b601425bef843bfc45e9d8075623c37584 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 10 Oct 2018 15:59:22 +0100 Subject: SL-9849 - animated object attachments get isImpostor() state from av they're attached to --- indra/newview/llcontrolavatar.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 4b70d625d4..15ed2073b4 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -590,3 +590,18 @@ bool LLControlAvatar::shouldRenderRigged() const } return true; } + +// virtual +BOOL LLControlAvatar::isImpostor() +{ + if (mRootVolp && mRootVolp->isAttachment()) + { + // Attached animated objects should match state of their attached av. + LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor(); + if (attached_av) + { + return attached_av->isImpostor(); + } + } + return LLVOAvatar::isImpostor(); +} -- cgit v1.2.3 From 3747e3dcc17148efa9ba2cd85faf68bef4f8dd27 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 11 Oct 2018 19:42:29 +0100 Subject: SL-9857 - constraint pos math fix --- indra/newview/llcontrolavatar.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 15ed2073b4..ed63414849 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -82,11 +82,14 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { max_legal_offset = gSavedSettings.getF32("AnimatedObjectsMaxLegalOffset"); } + max_legal_offset = llmax(max_legal_offset,0.f); + F32 max_legal_size = MAX_LEGAL_SIZE; if (gSavedSettings.getControl("AnimatedObjectsMaxLegalSize")) { max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize"); } + max_legal_size = llmax(max_legal_size, 1.f); new_pos_fixup = LLVector3(); new_scale_fixup = 1.0f; @@ -112,10 +115,13 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); F32 offset_dist = pos_box_offset.length(); - if (offset_dist > max_legal_offset || mPositionConstraintFixup != LLVector3()) + if (offset_dist > max_legal_offset && offset_dist > 0.f) { F32 target_dist = (offset_dist - max_legal_offset); new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; + } + if (new_pos_fixup != mPositionConstraintFixup) + { LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; } @@ -418,9 +424,9 @@ void LLControlAvatar::updateDebugText() type_string += "-"; } } - addDebugText(llformat("CAV obj %d anim %d active %s impost %d strcst %f", + addDebugText(llformat("CAV obj %d anim %d active %s impost %d upprd %d strcst %f", total_linkset_count, animated_volume_count, - active_string.c_str(), (S32) isImpostor(), streaming_cost)); + active_string.c_str(), (S32) isImpostor(), getUpdatePeriod(), streaming_cost)); addDebugText(llformat("types %s lods %s", type_string.c_str(), lod_string.c_str())); addDebugText(llformat("flags %s", animated_object_flag_string.c_str())); addDebugText(llformat("tris %d (est %.1f, streaming %.1f), verts %d", total_tris, est_tris, est_streaming_tris, total_verts)); -- cgit v1.2.3 From b920893fa4be1b5e61e938bda79147a9c5522726 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 11 Oct 2018 20:43:56 +0100 Subject: removed unused member variables that make xcode 10 unhappy --- indra/newview/llcontrolavatar.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index ed63414849..1eeeaa42ea 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -124,6 +124,10 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; + LL_DEBUGS("ConstraintFix") << "vol_pos " << vol_pos << LL_ENDL; + LL_DEBUGS("ConstraintFix") << "extents " << extents[0] << " " << extents[1] << LL_ENDL; + LL_DEBUGS("ConstraintFix") << "unshift_extents " << unshift_extents[0] << " " << unshift_extents[1] << LL_ENDL; + } } if (box_size/mScaleConstraintFixup > max_legal_size) -- cgit v1.2.3 From 0109a71d1ccf5f9bff9b454415ed67dd43b70157 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 12 Oct 2018 18:53:49 +0100 Subject: SL-9857 - suppress constraint adjustments immediately after region crossing --- indra/newview/llcontrolavatar.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'indra/newview/llcontrolavatar.cpp') diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 1eeeaa42ea..d3fd5813a0 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -40,13 +40,17 @@ const F32 LLControlAvatar::MAX_LEGAL_OFFSET = 3.0f; const F32 LLControlAvatar::MAX_LEGAL_SIZE = 64.0f; +//static +boost::signals2::connection LLControlAvatar::sRegionChangedSlot; + LLControlAvatar::LLControlAvatar(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp) : LLVOAvatar(id, pcode, regionp), mPlaying(false), mGlobalScale(1.0f), mMarkedForDeath(false), mRootVolp(NULL), - mScaleConstraintFixup(1.0) + mScaleConstraintFixup(1.0), + mRegionChanged(false) { mIsDummy = TRUE; mIsControlAvatar = true; @@ -146,7 +150,16 @@ void LLControlAvatar::matchVolumeTransform() { LLVector3 new_pos_fixup; F32 new_scale_fixup; - getNewConstraintFixups(new_pos_fixup, new_scale_fixup); + if (mRegionChanged) + { + new_scale_fixup = mScaleConstraintFixup; + new_pos_fixup = mPositionConstraintFixup; + mRegionChanged = false; + } + else + { + getNewConstraintFixups(new_pos_fixup, new_scale_fixup); + } mPositionConstraintFixup = new_pos_fixup; mScaleConstraintFixup = new_scale_fixup; @@ -615,3 +628,15 @@ BOOL LLControlAvatar::isImpostor() } return LLVOAvatar::isImpostor(); } + +//static +void LLControlAvatar::onRegionChanged() +{ + std::vector::iterator it = LLCharacter::sInstances.begin(); + for ( ; it != LLCharacter::sInstances.end(); ++it) + { + LLControlAvatar* cav = dynamic_cast(*it); + if (!cav) continue; + cav->mRegionChanged = true; + } +} -- cgit v1.2.3