fix for SH-3624: Object deletion does not work

master
Xiaohong Bao 2012-12-18 23:16:50 -07:00
parent c66c8d32c7
commit 4e22f3e3ef
8 changed files with 33 additions and 40 deletions

View File

@ -1099,11 +1099,6 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat
{
part->put(this);
}
if(mDrawable->getEntry()->hasVOCacheEntry())
{
((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->setBridgeChild();
}
}
LLSpatialBridge::~LLSpatialBridge()

View File

@ -323,6 +323,22 @@ void LLViewerObject::deleteTEImages()
mTEImages = NULL;
}
//if enabled, add this object to vo cache tree when removed from rendering.
void LLViewerObject::EnableToCacheTree(bool enabled)
{
if(mDrawable.notNull() && mDrawable->getEntry() && mDrawable->getEntry()->hasVOCacheEntry())
{
if(enabled)
{
((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->addState(LLVOCacheEntry::ADD_TO_CACHE_TREE);
}
else
{
((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->clearState(LLVOCacheEntry::ADD_TO_CACHE_TREE);
}
}
}
void LLViewerObject::markDead()
{
if (!mDead)

View File

@ -132,6 +132,7 @@ public:
BOOL isDead() const {return mDead;}
BOOL isOrphaned() const { return mOrphaned; }
BOOL isParticleSource() const;
void EnableToCacheTree(bool enabled);
virtual LLVOAvatar* asAvatar();

View File

@ -1326,7 +1326,7 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep)
}
}
BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
BOOL LLViewerObjectList::killObject(LLViewerObject *objectp, bool cache_enabled)
{
// Don't ever kill gAgentAvatarp, just force it to the agent's region
// unless region is NULL which is assumed to mean you are logging out.
@ -1341,6 +1341,7 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
if (objectp)
{
objectp->EnableToCacheTree(cache_enabled); //enable to add to VO cache tree if set.
objectp->markDead(); // does the right thing if object already dead
return TRUE;
}

View File

@ -72,7 +72,7 @@ public:
LLViewerObject *replaceObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); // TomY: hack to switch VO instances on the fly
BOOL killObject(LLViewerObject *objectp);
BOOL killObject(LLViewerObject *objectp, bool cache_enabled = false);
void killObjects(LLViewerRegion *regionp); // Kill all objects owned by a particular region.
void killAllObjects();
void removeDrawable(LLDrawable* drawablep);

View File

@ -894,6 +894,10 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry)
{
return;
}
if(!entry->hasState(LLVOCacheEntry::ADD_TO_CACHE_TREE))
{
return; //can not add to vo cache tree.
}
mImpl->mVOCachePartition->addEntry(entry->getEntry());
}
@ -1132,7 +1136,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time)
}
for(S32 i = 0; i < delete_list.size(); i++)
{
gObjectList.killObject(delete_list[i]->getVObj());
gObjectList.killObject(delete_list[i]->getVObj(), true);
}
delete_list.clear();

View File

@ -64,18 +64,6 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &
mBuffer = new U8[dp.getBufferSize()];
mDP.assignBuffer(mBuffer, dp.getBufferSize());
mDP = dp;
if(dp.getBufferSize() > 0)
{
U32 parent_id = 0;
dp.reset();
dp.unpackU32(parent_id, "ParentID");
dp.reset();
if(parent_id > 0)
{
mState |= CHILD; //is a child
}
}
}
LLVOCacheEntry::LLVOCacheEntry()
@ -224,16 +212,6 @@ void LLVOCacheEntry::setOctreeEntry(LLViewerOctreeEntry* entry)
LLViewerOctreeEntryData::setOctreeEntry(entry);
}
void LLVOCacheEntry::setBridgeChild()
{
mState |= BRIDGE_CHILD;
}
void LLVOCacheEntry::clearBridgeChild()
{
mState &= ~BRIDGE_CHILD;
}
void LLVOCacheEntry::copyTo(LLVOCacheEntry* new_entry)
{
//copy LLViewerOctreeEntry

View File

@ -51,8 +51,7 @@ public:
enum
{
CHILD = 0x00010000, //has parent
BRIDGE_CHILD = 0x00020000 //is a child of a spatial bridge.
ADD_TO_CACHE_TREE = 0x00010000, //has parent
};
struct CompareVOCacheEntry
@ -85,14 +84,13 @@ public:
LLVOCacheEntry();
void setState(U32 state);
bool isState(U32 state) {return (mState & 0xffff) == state;}
U32 getState() const {return (mState & 0xffff);}
U32 getFullState() const {return mState;}
void setBridgeChild();
void clearBridgeChild();
bool isBridgeChild() {return mState & BRIDGE_CHILD;}
void clearState(U32 state) {mState &= ~state;}
void addState(U32 state) {mState |= state;}
bool isState(U32 state) {return (mState & 0xffff) == state;}
bool hasState(U32 state) {return mState & state;}
U32 getState() const {return (mState & 0xffff);}
U32 getFullState() const {return mState;}
U32 getLocalID() const { return mLocalID; }
U32 getCRC() const { return mCRC; }
S32 getHitCount() const { return mHitCount; }