diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 7a6637c0a1989b246164047bf7d16ff593d75045..7d82ecf565cc3bc488c747b9426694783cbe1755 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -66,6 +66,7 @@ #include "llviewerstatsrecorder.h" #include "llvlmanager.h" #include "llvlcomposition.h" +#include "llvoavatarself.h" #include "llvocache.h" #include "llworld.h" #include "llspatialpartition.h" @@ -1485,22 +1486,27 @@ void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& if(drawablep && !drawablep->getParent()) { - if (drawablep->getVObj()->isSelected()) + LLViewerObject* v_obj = drawablep->getVObj(); + if (v_obj->isSelected() + || (v_obj->flagAnimSource() && isAgentAvatarValid() && gAgentAvatarp->hasMotionFromSource(v_obj->getID()))) { - // do not remove selected objects + // do not remove objects user is interacting with ((LLViewerOctreeEntryData*)drawablep)->setVisible(); return; } - LLViewerObject::const_child_list_t& child_list = drawablep->getVObj()->getChildren(); + LLViewerObject::const_child_list_t& child_list = v_obj->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); iter++) { LLViewerObject* child = *iter; if(child->mDrawable) { - if(!child->mDrawable->getEntry() || !child->mDrawable->getEntry()->hasVOCacheEntry() || child->isSelected()) + if( !child->mDrawable->getEntry() + || !child->mDrawable->getEntry()->hasVOCacheEntry() + || child->isSelected() + || (child->flagAnimSource() && isAgentAvatarValid() && gAgentAvatarp->hasMotionFromSource(child->getID()))) { - //do not remove parent if any of its children non-cacheable or selected + //do not remove parent if any of its children non-cacheable, animating or selected //especially for the case that an avatar sits on a cache-able object ((LLViewerOctreeEntryData*)drawablep)->setVisible(); return; diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 1e225553b8191ed3819607357dc6bcc47dc00caa..d01e7469368820cc7a673d7fa2aa196bbc45b82f 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -385,7 +385,7 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface private: void addToVOCacheTree(LLVOCacheEntry* entry); LLViewerObject* addNewObject(LLVOCacheEntry* entry); - void killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& delete_list); + void killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& delete_list); //adds entry into list if it is safe to move into cache void removeFromVOCacheTree(LLVOCacheEntry* entry); void killCacheEntry(LLVOCacheEntry* entry, bool for_rendering = false); //physically delete the cache entry void killInvisibleObjects(F32 max_time); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 904d08ac7327e5cf5b46772e9cdab9e8b27a5412..dfb9bb54e77bea968528c8b552727160000c8939 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5016,6 +5016,15 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) return LLCharacter::stopMotion(remap_id, stop_immediate); } +//----------------------------------------------------------------------------- +// hasMotionFromSource() +//----------------------------------------------------------------------------- +// virtual +bool LLVOAvatar::hasMotionFromSource(const LLUUID& source_id) +{ + return false; +} + //----------------------------------------------------------------------------- // stopMotionFromSource() //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 66a357ff62899ddef3476438363d81a55c891e8d..4d5e61690677b342c4d3785a939769d4d5ffec33 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -191,6 +191,7 @@ class LLVOAvatar : /*virtual*/ LLUUID remapMotionID(const LLUUID& id); /*virtual*/ BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f); /*virtual*/ BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE); + virtual bool hasMotionFromSource(const LLUUID& source_id); virtual void stopMotionFromSource(const LLUUID& source_id); virtual void requestStopMotion(LLMotion* motion); LLMotion* findMotion(const LLUUID& id) const; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 42a7c2e576c92189668dffb32994711fb36b0741..02494d509189699ba16c5bb7d5daed7f3147641e 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -748,6 +748,13 @@ void LLVOAvatarSelf::requestStopMotion(LLMotion* motion) gAgent.requestStopMotion(motion); } +// virtual +bool LLVOAvatarSelf::hasMotionFromSource(const LLUUID& source_id) +{ + AnimSourceIterator motion_it = mAnimationSources.find(source_id); + return motion_it != mAnimationSources.end(); +} + // virtual void LLVOAvatarSelf::stopMotionFromSource(const LLUUID& source_id) { @@ -757,6 +764,7 @@ void LLVOAvatarSelf::stopMotionFromSource(const LLUUID& source_id) mAnimationSources.erase(motion_it++); } + LLViewerObject* object = gObjectList.findObject(source_id); if (object) { diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index e03de9fa0bfc9794c0e5cf3409063663275832cc..ad73dd89b79bd665beacd08718d2e1b361a0ef8a 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -82,6 +82,7 @@ class LLVOAvatarSelf : // LLCharacter interface and related //-------------------------------------------------------------------- public: + /*virtual*/ bool hasMotionFromSource(const LLUUID& source_id); /*virtual*/ void stopMotionFromSource(const LLUUID& source_id); /*virtual*/ void requestStopMotion(LLMotion* motion); /*virtual*/ LLJoint* getJoint(const std::string &name);