diff options
Diffstat (limited to 'linden/indra/newview/lldrawable.cpp')
-rw-r--r-- | linden/indra/newview/lldrawable.cpp | 88 |
1 files changed, 63 insertions, 25 deletions
diff --git a/linden/indra/newview/lldrawable.cpp b/linden/indra/newview/lldrawable.cpp index 71c9ebb..0f89585 100644 --- a/linden/indra/newview/lldrawable.cpp +++ b/linden/indra/newview/lldrawable.cpp | |||
@@ -384,9 +384,14 @@ void LLDrawable::makeActive() | |||
384 | gPipeline.setActive(this, TRUE); | 384 | gPipeline.setActive(this, TRUE); |
385 | 385 | ||
386 | //all child objects must also be active | 386 | //all child objects must also be active |
387 | for (U32 i = 0; i < getChildCount(); i++) | 387 | llassert_always(mVObjp); |
388 | |||
389 | LLViewerObject::const_child_list_t& child_list = mVObjp->getChildren(); | ||
390 | for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); | ||
391 | iter != child_list.end(); iter++) | ||
388 | { | 392 | { |
389 | LLDrawable* drawable = getChild(i); | 393 | LLViewerObject* child = *iter; |
394 | LLDrawable* drawable = child->mDrawable; | ||
390 | if (drawable) | 395 | if (drawable) |
391 | { | 396 | { |
392 | drawable->makeActive(); | 397 | drawable->makeActive(); |
@@ -430,11 +435,13 @@ void LLDrawable::makeStatic(BOOL warning_enabled) | |||
430 | { | 435 | { |
431 | LL_WARNS_ONCE("Drawable") << "Drawable becomes static with active parent!" << LL_ENDL; | 436 | LL_WARNS_ONCE("Drawable") << "Drawable becomes static with active parent!" << LL_ENDL; |
432 | } | 437 | } |
433 | 438 | ||
434 | S32 child_count = mVObjp->mChildList.size(); | 439 | LLViewerObject::const_child_list_t& child_list = mVObjp->getChildren(); |
435 | for (S32 child_num = 0; child_num < child_count; child_num++) | 440 | for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); |
441 | iter != child_list.end(); iter++) | ||
436 | { | 442 | { |
437 | LLDrawable* child_drawable = mVObjp->mChildList[child_num]->mDrawable; | 443 | LLViewerObject* child = *iter; |
444 | LLDrawable* child_drawable = child->mDrawable; | ||
438 | if (child_drawable) | 445 | if (child_drawable) |
439 | { | 446 | { |
440 | if (child_drawable->getParent() != this) | 447 | if (child_drawable->getParent() != this) |
@@ -1179,11 +1186,23 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* | |||
1179 | av = objparent->mDrawable; | 1186 | av = objparent->mDrawable; |
1180 | LLSpatialGroup* group = av->getSpatialGroup(); | 1187 | LLSpatialGroup* group = av->getSpatialGroup(); |
1181 | 1188 | ||
1182 | BOOL impostor = objparent->isAvatar() && ((LLVOAvatar*) objparent)->isImpostor(); | 1189 | BOOL impostor = FALSE; |
1183 | BOOL loaded = objparent->isAvatar() && ((LLVOAvatar*) objparent)->isFullyLoaded(); | 1190 | BOOL loaded = FALSE; |
1184 | 1191 | if (objparent->isAvatar()) | |
1192 | { | ||
1193 | LLVOAvatar* avatarp = (LLVOAvatar*) objparent; | ||
1194 | if (avatarp->isVisible()) | ||
1195 | { | ||
1196 | impostor = objparent->isAvatar() && ((LLVOAvatar*) objparent)->isImpostor(); | ||
1197 | loaded = objparent->isAvatar() && ((LLVOAvatar*) objparent)->isFullyLoaded(); | ||
1198 | } | ||
1199 | else | ||
1200 | { | ||
1201 | return; | ||
1202 | } | ||
1203 | } | ||
1204 | |||
1185 | if (!group || | 1205 | if (!group || |
1186 | av->getSpatialGroup()->mDistance > LLVOAvatar::sRenderDistance || | ||
1187 | LLDrawable::getCurrentFrame() - av->mVisible > 1 || | 1206 | LLDrawable::getCurrentFrame() - av->mVisible > 1 || |
1188 | impostor || | 1207 | impostor || |
1189 | !loaded) | 1208 | !loaded) |
@@ -1214,9 +1233,16 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* | |||
1214 | if (for_select) | 1233 | if (for_select) |
1215 | { | 1234 | { |
1216 | results->push_back(mDrawable); | 1235 | results->push_back(mDrawable); |
1217 | for (U32 i = 0; i < mDrawable->getChildCount(); i++) | 1236 | if (mDrawable->getVObj()) |
1218 | { | 1237 | { |
1219 | results->push_back(mDrawable->getChild(i)); | 1238 | LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren(); |
1239 | for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); | ||
1240 | iter != child_list.end(); iter++) | ||
1241 | { | ||
1242 | LLViewerObject* child = *iter; | ||
1243 | LLDrawable* drawable = child->mDrawable; | ||
1244 | results->push_back(drawable); | ||
1245 | } | ||
1220 | } | 1246 | } |
1221 | } | 1247 | } |
1222 | else | 1248 | else |
@@ -1240,18 +1266,24 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in) | |||
1240 | 1266 | ||
1241 | mDrawable->updateDistance(camera); | 1267 | mDrawable->updateDistance(camera); |
1242 | 1268 | ||
1243 | for (U32 i = 0; i < mDrawable->getChildCount(); ++i) | 1269 | if (mDrawable->getVObj()) |
1244 | { | 1270 | { |
1245 | LLDrawable* child = mDrawable->getChild(i); | 1271 | LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren(); |
1246 | if (!child) | 1272 | for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); |
1273 | iter != child_list.end(); iter++) | ||
1247 | { | 1274 | { |
1248 | llwarns << "Corrupt drawable found while updating spatial bridge distance." << llendl; | 1275 | LLViewerObject* child = *iter; |
1249 | continue; | 1276 | LLDrawable* drawable = child->mDrawable; |
1250 | } | 1277 | if (!drawable) |
1278 | { | ||
1279 | llwarns << "Corrupt drawable found while updating spatial bridge distance." << llendl; | ||
1280 | continue; | ||
1281 | } | ||
1251 | 1282 | ||
1252 | if (!child->isAvatar()) | 1283 | if (!drawable->isAvatar()) |
1253 | { | 1284 | { |
1254 | child->updateDistance(camera); | 1285 | drawable->updateDistance(camera); |
1286 | } | ||
1255 | } | 1287 | } |
1256 | } | 1288 | } |
1257 | } | 1289 | } |
@@ -1287,12 +1319,18 @@ void LLSpatialBridge::cleanupReferences() | |||
1287 | if (mDrawable) | 1319 | if (mDrawable) |
1288 | { | 1320 | { |
1289 | mDrawable->setSpatialGroup(NULL); | 1321 | mDrawable->setSpatialGroup(NULL); |
1290 | for (U32 i = 0; i < mDrawable->getChildCount(); i++) | 1322 | if (mDrawable->getVObj()) |
1291 | { | 1323 | { |
1292 | LLDrawable* drawable = mDrawable->getChild(i); | 1324 | LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren(); |
1293 | if (drawable) | 1325 | for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); |
1326 | iter != child_list.end(); iter++) | ||
1294 | { | 1327 | { |
1295 | drawable->setSpatialGroup(NULL); | 1328 | LLViewerObject* child = *iter; |
1329 | LLDrawable* drawable = child->mDrawable; | ||
1330 | if (drawable) | ||
1331 | { | ||
1332 | drawable->setSpatialGroup(NULL); | ||
1333 | } | ||
1296 | } | 1334 | } |
1297 | } | 1335 | } |
1298 | 1336 | ||