diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 0da2a655c7..dd63a81aae 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -457,6 +457,7 @@ void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh // return; //} +#if 0 // AXON MAINT-8554 - this may be overly restrictive for large models LLVector3 constrained_pos = LLVector3(llclamp(pos[0],-LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET), llclamp(pos[1],-LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET), llclamp(pos[2],-LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET)); @@ -465,6 +466,9 @@ void LLJoint::addAttachmentPosOverride( const LLVector3& pos, const LLUUID& mesh LL_DEBUGS("Avatar") << mesh_id << " joint " << getName() << " attachment pos override constrained to " << constrained_pos << " was " << pos << LL_ENDL; } +#else + LLVector3 constrained_pos = pos; +#endif LLVector3 before_pos; LLUUID before_mesh_id; diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index d655f2cd37..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,8 +367,10 @@ 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(); + //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(); ++anim_it) { std::map::iterator found_anim_it = anims.find(anim_it->first); @@ -382,9 +384,10 @@ void LLControlAvatar::updateAnimations() // Animation not already present, use this sequence id. anims[anim_it->first] = anim_it->second; } + LL_DEBUGS("AnimatedObjectsNotify") << "found anim for vol " << volp->getID() << " anim " << anim_it->first << " root " << mRootVolp->getID() << LL_ENDL; } } - if (!mPlaying && anims.size()>0) + if (!mPlaying) { mPlaying = true; if (!mRootVolp->isAnySelected()) diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index f45de25d81..02244769b9 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -82,4 +82,18 @@ public: }; +typedef std::map signaled_animation_map_t; +typedef std::map object_signaled_animation_map_t; + +// Stores information about previously requested animations, by object id. +class LLObjectSignaledAnimationMap: public LLSingleton +{ + LLSINGLETON_EMPTY_CTOR(LLObjectSignaledAnimationMap); + +public: + object_signaled_animation_map_t mMap; + + object_signaled_animation_map_t& getMap() { return mMap; } +}; + #endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 67f12c0e4a..c38a446a94 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4695,6 +4695,8 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) } } + +// AXON make logging less spammy after issues resolved, before release. void process_object_animation(LLMessageSystem *mesgsys, void **user_data) { LLUUID animation_id; @@ -4703,25 +4705,38 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid); - LL_DEBUGS("AnimatedObjects") << "Received animation state for object " << uuid << LL_ENDL; + LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for object " << uuid << LL_ENDL; + + signaled_animation_map_t signaled_anims; + S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); + LL_DEBUGS("AnimatedObjectsNotify") << "processing object animation requests, num_blocks " << num_blocks << " uuid " << uuid << LL_ENDL; + for( S32 i = 0; i < num_blocks; i++ ) + { + mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i); + mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i); + signaled_anims[animation_id] = anim_sequence_id; + LL_DEBUGS("AnimatedObjectsNotify") << "added signaled_anims animation request for object " + << uuid << " animation id " << animation_id << LL_ENDL; + } + LLObjectSignaledAnimationMap::instance().getMap()[uuid] = signaled_anims; LLViewerObject *objp = gObjectList.findObject(uuid); if (!objp) { - LL_WARNS("Messaging") << "Received animation state for unknown object " << uuid << LL_ENDL; + LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for unknown object " << uuid << LL_ENDL; return; } LLVOVolume *volp = dynamic_cast(objp); if (!volp) { - LL_WARNS("Messaging") << "Received animation state for non-volume object " << uuid << LL_ENDL; + LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for non-volume object " << uuid << LL_ENDL; return; } if (!volp->isAnimatedObject()) { - LL_WARNS("Messaging") << "Received animation state for non-animated object " << uuid << LL_ENDL; + LL_DEBUGS("AnimatedObjectsNotify") << "Received animation state for non-animated object " << uuid << LL_ENDL; return; } @@ -4729,13 +4744,10 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) LLControlAvatar *avatarp = volp->getControlAvatar(); if (!avatarp) { - LL_WARNS("Messaging") << "Received animation request for object with no control avatar, ignoring" << LL_ENDL; + LL_DEBUGS("AnimatedObjectsNotify") << "Received animation request for object with no control avatar, ignoring " << uuid << LL_ENDL; return; } - S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); - LL_DEBUGS("AnimatedObjects") << "processing object animation requests, num_blocks " << num_blocks << LL_ENDL; - if (!avatarp->mPlaying) { avatarp->mPlaying = true; @@ -4746,17 +4758,6 @@ void process_object_animation(LLMessageSystem *mesgsys, void **user_data) } } - volp->mObjectSignaledAnimations.clear(); - - for( S32 i = 0; i < num_blocks; i++ ) - { - mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i); - mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i); - volp->mObjectSignaledAnimations[animation_id] = anim_sequence_id; - LL_DEBUGS("AnimatedObjects") << "got object animation request for object " - << uuid << " animation id " << animation_id << LL_ENDL; - } - avatarp->updateAnimations(); } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e82a40c938..d69e92639f 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -3063,42 +3063,51 @@ LLControlAvatar *LLViewerObject::getControlAvatar() const return getRootEdit()->mControlAvatar.get(); } +// Manage the control avatar state of a given object. +// Any object can be flagged as animated, but for performance reasons +// we don't want to incur the overhead of managing a control avatar +// unless this would have some user-visible consequence. That is, +// there should be at least one rigged mesh in the linkset. Operations +// that change the state of a linkset, such as linking or unlinking +// prims, can also mean that a control avatar needs to be added or +// removed. At the end, if there is a control avatar, we make sure +// that its animation state is current. void LLViewerObject::updateControlAvatar() { LLViewerObject *root = getRootEdit(); - bool any_rigged_mesh = root->isRiggedMesh(); - - // Optimize - Only iterate the child list if needed: - // * if object root is rigged_mesh, iterating won't change anything at all - // * if it is an animated object, we need to check for any rigged mesh to - // determine the value of should_have_control_avatar for the first check - // for calling linkControlAvatar(). If it is not an animated object, - // then should_have_control_avatar is always false and the value of - // any_rigged_mesh doesn't matter at all bool is_animated_object = root->isAnimatedObject(); - if (!any_rigged_mesh && is_animated_object) - { - // - LLViewerObject::const_child_list_t& child_list = root->getChildren(); - for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin(); - iter != child_list.end(); ++iter) - { - const LLViewerObject* child = *iter; - any_rigged_mesh = any_rigged_mesh || child->isRiggedMesh(); - // Optimize - if (any_rigged_mesh) - { - break; - } - // - } - } // - bool has_control_avatar = getControlAvatar(); - // Optimize - //bool should_have_control_avatar = root->isAnimatedObject() && any_rigged_mesh; - bool should_have_control_avatar = is_animated_object && any_rigged_mesh; - // + if (!is_animated_object && !has_control_avatar) + { + return; + } + + bool should_have_control_avatar = false; + if (is_animated_object) + { + bool any_rigged_mesh = root->isRiggedMesh(); + + // Optimize - Only iterate the child list if needed + if (!any_rigged_mesh) + { + // + LLViewerObject::const_child_list_t& child_list = root->getChildren(); + for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); ++iter) + { + const LLViewerObject* child = *iter; + // Optimize + //any_rigged_mesh = any_rigged_mesh || child->isRiggedMesh(); + if (child->isRiggedMesh()) + { + any_rigged_mesh = true; + break; + } + // + } + } // + should_have_control_avatar = is_animated_object && any_rigged_mesh; + } if (should_have_control_avatar && !has_control_avatar) { @@ -3112,6 +3121,10 @@ void LLViewerObject::updateControlAvatar() LL_DEBUGS("AnimatedObjects") << vobj_name << " calling unlinkControlAvatar()" << LL_ENDL; root->unlinkControlAvatar(); } + if (getControlAvatar()) + { + getControlAvatar()->updateAnimations(); + } } void LLViewerObject::linkControlAvatar() @@ -3133,7 +3146,6 @@ void LLViewerObject::linkControlAvatar() if (cav) { cav->updateAttachmentOverrides(); - cav->updateAnimations(); if (!cav->mPlaying) { cav->mPlaying = true; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index ba5c92020e..fde2baf4d0 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -251,6 +251,8 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) LL_WARNS("AppInit", "Capabilities") << "Attempting to get capabilities for region that no longer exists!" << LL_ENDL; return; // this error condition is not recoverable. } + LL_DEBUGS("AppInit", "Capabilities") << "requesting seed caps for handle " << regionHandle + << " name " << regionp->getName() << LL_ENDL; std::string url = regionp->getCapability("Seed"); if (url.empty()) @@ -279,7 +281,8 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) buildCapabilityNames(capabilityNames); LL_INFOS("AppInit", "Capabilities") << "Requesting seed from " << url - << " (attempt #" << mSeedCapAttempts + 1 << ")" << LL_ENDL; + << " region name " << regionp->getName() + << " (attempt #" << mSeedCapAttempts + 1 << ")" << LL_ENDL; regionp = NULL; result = httpAdapter->postAndSuspend(httpRequest, url, capabilityNames); @@ -333,6 +336,8 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) #endif regionp->setCapabilitiesReceived(true); + LL_DEBUGS("AppInit", "Capabilities") << "received caps for handle " << regionHandle + << " region name " << regionp->getName() << LL_ENDL; if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState()) { diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 2b94c63b31..dc1a552065 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3888,7 +3888,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const { if (isAnimatedObject() && isRiggedMesh()) { - // AXON Scaling here is to make animated object vs + // Scaling here is to make animated object vs // non-animated object ARC proportional to the // corresponding calculations for streaming cost. num_triangles = (ANIMATED_OBJECT_COST_PER_KTRI * 0.001 * costs.getEstTrisForStreamingCost())/0.06; @@ -5446,6 +5446,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) bool is_mesh = vobj->isMesh(); F32 est_tris = vobj->getEstTrianglesMax(); + vobj->updateControlAvatar(); + LL_DEBUGS("AnimatedObjectsLinkset") << vobj_name << " rebuilding, isAttachment: " << (U32) vobj->isAttachment() << " is_mesh " << is_mesh << " est_tris " << est_tris @@ -5499,8 +5501,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) rigged = rigged || (vobj->isAnimatedObject() && vobj->isRiggedMesh() && vobj->getControlAvatar() && vobj->getControlAvatar()->mPlaying); - vobj->updateControlAvatar(); - bool bake_sunlight = LLPipeline::sBakeSunlight && drawablep->isStatic(); bool any_rigged_face = false; diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index b03550e6e8..75d5a21b16 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -285,8 +285,6 @@ public: virtual void onReparent(LLViewerObject *old_parent, LLViewerObject *new_parent); virtual void afterReparent(); - std::map mObjectSignaledAnimations; // requested state of Animation name/value - // Functions that deal with media, or media navigation // Update this object's media data with the given media data array