Harmless Alchemy sync

CachedControls, autos, cleaner loops, remove overkill dynamic cast,
and override and final
This commit is contained in:
Liru Færs
2020-01-04 21:43:10 -05:00
parent dec0bff972
commit e81affce51
4 changed files with 93 additions and 111 deletions

View File

@@ -1620,7 +1620,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
retval |= checkMediaURL(media_url);
//
// Unpack particle system data
// Unpack particle system data (legacy)
//
if (value & 0x8)
{
@@ -2188,23 +2188,22 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
mStatic = FALSE;
}
// BUG: This code leads to problems during group rotate and any scale operation.
// Small discepencies between the simulator and viewer representations cause the
// selection center to creep, leading to objects moving around the wrong center.
//
// Removing this, however, means that if someone else drags an object you have
// selected, your selection center and dialog boxes will be wrong. It also means
// that higher precision information on selected objects will be ignored.
//
// I believe the group rotation problem is fixed. JNC 1.21.2002
//
// BUG: This code leads to problems during group rotate and any scale operation.
// Small discepencies between the simulator and viewer representations cause the
// selection center to creep, leading to objects moving around the wrong center.
//
// Removing this, however, means that if someone else drags an object you have
// selected, your selection center and dialog boxes will be wrong. It also means
// that higher precision information on selected objects will be ignored.
//
// I believe the group rotation problem is fixed. JNC 1.21.2002
//
// Additionally, if any child is selected, need to update the dialogs and selection
// center.
BOOL needs_refresh = mUserSelected;
for (child_list_t::iterator iter = mChildList.begin();
iter != mChildList.end(); iter++)
for (auto& iter : mChildList)
{
LLViewerObject* child = *iter;
LLViewerObject* child = iter;
needs_refresh = needs_refresh || child->mUserSelected;
}
@@ -2952,10 +2951,9 @@ void LLViewerObject::updateControlAvatar()
{
bool any_rigged_mesh = root->isRiggedMesh();
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)
for (const auto& iter : child_list)
{
const LLViewerObject* child = *iter;
const LLViewerObject* child = iter;
any_rigged_mesh = any_rigged_mesh || child->isRiggedMesh();
}
should_have_control_avatar = is_animated_object && any_rigged_mesh;
@@ -3136,6 +3134,7 @@ void LLViewerObject::unlinkControlAvatar()
if (mControlAvatar)
{
mControlAvatar->markForDeath();
mControlAvatar->mRootVolp = NULL;
mControlAvatar = NULL;
}
}
@@ -3269,7 +3268,7 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS
LLInventoryObject::object_list_t::iterator end = object->mInventory->end();
std::list<LLUUID>& pending_lst = object->mPendingInventoryItemsIDs;
for (; it != end && pending_lst.size(); ++it)
for (; it != end && !pending_lst.empty(); ++it)
{
LLViewerInventoryItem* item = dynamic_cast<LLViewerInventoryItem*>(it->get());
if(item && item->getType() != LLAssetType::AT_CATEGORY)
@@ -3292,7 +3291,7 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS
}
else
{
// This Occurs When to requests were made, and the first one
// This Occurs When two requests were made, and the first one
// has already handled it.
LL_DEBUGS() << "Problem loading task inventory. Return code: "
<< error_code << LL_ENDL;
@@ -3412,11 +3411,6 @@ void LLViewerObject::removeInventory(const LLUUID& item_id)
msg->sendReliable(mRegionp->getHost());
deleteInventoryItem(item_id);
++mInventorySerialNum;
// The viewer object should not refresh UI since this is a utility
// function. The UI functionality that called this method should
// refresh the views if necessary.
//gBuildView->refresh();
}
bool LLViewerObject::isTextureInInventory(LLViewerInventoryItem* item)
@@ -3531,7 +3525,7 @@ void LLViewerObject::getInventoryContents(LLInventoryObject::object_list_t& obje
LLInventoryObject* LLViewerObject::getInventoryRoot()
{
if (!mInventory || !mInventory->size())
if (!mInventory || mInventory->empty())
{
return NULL;
}
@@ -3587,8 +3581,8 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent)
return;
}
LLVector3 viewer_pos_agent = gAgentCamera.getCameraPositionAgent();
LLVector3 pos_agent = getRenderPosition();
const LLVector3& viewer_pos_agent = gAgentCamera.getCameraPositionAgent();
const LLVector3& pos_agent = getRenderPosition();
F32 dx = viewer_pos_agent.mV[VX] - pos_agent.mV[VX];
F32 dy = viewer_pos_agent.mV[VY] - pos_agent.mV[VY];
@@ -3602,7 +3596,7 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent)
// to try to get a min distance from face, subtract min_scale/2 from the range.
// This means we'll load too much detail sometimes, but that's better than not enough
// I don't think there's a better way to do this without calculating distance per-poly
F32 range = sqrt(dx*dx + dy*dy + dz*dz) - min_scale/2;
F32 range = sqrt(dx*dx + dy*dy + dz*dz) - min_scale/2.f;
LLViewerCamera* camera = LLViewerCamera::getInstance();
if (range < 0.001f || isHUDAttachment()) // range == zero
@@ -3781,10 +3775,9 @@ F32 LLViewerObject::getLinksetPhysicsCost()
F32 LLViewerObject::recursiveGetEstTrianglesMax() const
{
F32 est_tris = getEstTrianglesMax();
for (child_list_t::const_iterator iter = mChildList.begin();
iter != mChildList.end(); iter++)
for (const auto& iter : mChildList)
{
const LLViewerObject* child = *iter;
const LLViewerObject* child = iter;
if (!child->isAvatar())
{
est_tris += child->recursiveGetEstTrianglesMax();
@@ -3852,10 +3845,9 @@ U32 LLViewerObject::recursiveGetTriangleCount(S32* vcount) const
{
S32 total_tris = getTriangleCount(vcount);
LLViewerObject::const_child_list_t& child_list = getChildren();
for (LLViewerObject::const_child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); ++iter)
for (const auto& iter : child_list)
{
LLViewerObject* childp = *iter;
LLViewerObject* childp = iter;
if (childp)
{
total_tris += childp->getTriangleCount(vcount);
@@ -3882,13 +3874,11 @@ F32 LLViewerObject::recursiveGetScaledSurfaceArea() const
const LLVector3& scale = volume->getScale();
area += volume->getVolume()->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]);
}
LLViewerObject::const_child_list_t children = volume->getChildren();
for (LLViewerObject::const_child_list_t::const_iterator child_iter = children.begin();
child_iter != children.end();
++child_iter)
LLViewerObject::const_child_list_t const& children = volume->getChildren();
for (const auto& child_iter : children)
{
LLViewerObject* child_obj = *child_iter;
LLVOVolume *child = dynamic_cast<LLVOVolume*>( child_obj );
LLViewerObject* child_obj = child_iter;
LLVOVolume *child = child_obj ? child_obj->asVolume() : nullptr;
if (child && child->getVolume())
{
const LLVector3& scale = child->getScale();
@@ -3899,6 +3889,7 @@ F32 LLViewerObject::recursiveGetScaledSurfaceArea() const
}
return area;
}
void LLViewerObject::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
{
if(mDrawable.isNull())