summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lldrawable.cpp')
-rw-r--r--indra/newview/lldrawable.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 4efd2bf4b8..563b9b9cab 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -969,6 +969,12 @@ void LLDrawable::updateUVMinMax()
{
}
+LLSpatialGroup* LLDrawable::getSpatialGroup() const
+{
+ llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1);
+ return mSpatialGroupp;
+}
+
void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp)
{
/*if (mSpatialGroupp && (groupp != mSpatialGroupp))
@@ -991,6 +997,8 @@ void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp)
}
mSpatialGroupp = groupp;
+
+ llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1);
}
LLSpatialPartition* LLDrawable::getSpatialPartition()
@@ -1501,7 +1509,13 @@ void LLSpatialBridge::cleanupReferences()
LLDrawable::cleanupReferences();
if (mDrawable)
{
- mDrawable->setSpatialGroup(NULL);
+ LLSpatialGroup* group = mDrawable->getSpatialGroup();
+ if (group)
+ {
+ group->mOctreeNode->remove(mDrawable);
+ mDrawable->setSpatialGroup(NULL);
+ }
+
if (mDrawable->getVObj())
{
LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
@@ -1512,7 +1526,12 @@ void LLSpatialBridge::cleanupReferences()
LLDrawable* drawable = child->mDrawable;
if (drawable)
{
- drawable->setSpatialGroup(NULL);
+ LLSpatialGroup* group = drawable->getSpatialGroup();
+ if (group)
+ {
+ group->mOctreeNode->remove(drawable);
+ drawable->setSpatialGroup(NULL);
+ }
}
}
}