summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2017-09-22 18:04:03 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2017-09-22 18:04:03 +0100
commita6068419e7fe1a5a0eda007b2e989769c0a92262 (patch)
tree8faf3e8004b6ec1e79d611a86e9c9c131f156702 /indra/newview/llselectmgr.cpp
parenta634d878098cff98b0622d492f5454a1bd41cff6 (diff)
SL-794, SL-790 - viewer-side enforcement in UI for various animated object limits that are also enforced on the server.
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rw-r--r--indra/newview/llselectmgr.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 3e8d8883e0..d3f240ac91 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -663,6 +663,10 @@ void LLSelectMgr::confirmUnlinkObjects(const LLSD& notification, const LLSD& res
// otherwise. this allows the handle_link method to more finely check
// the selection and give an error message when the uer has a
// reasonable expectation for the link to work, but it will fail.
+//
+// AXON - additional check that if the selection includes at least one
+// animated object, the total mesh triangle count cannot exceed the
+// designated limit.
bool LLSelectMgr::enableLinkObjects()
{
bool new_value = false;
@@ -687,6 +691,10 @@ bool LLSelectMgr::enableLinkObjects()
new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly);
}
}
+ if (!LLSelectMgr::getInstance()->getSelection()->checkAnimatedObjectEstTris())
+ {
+ new_value = false;
+ }
return new_value;
}
@@ -7421,6 +7429,27 @@ bool LLObjectSelection::applyToObjects(LLSelectedObjectFunctor* func)
return result;
}
+bool LLObjectSelection::checkAnimatedObjectEstTris()
+{
+ F32 est_tris = 0;
+ F32 max_tris = 0;
+ S32 anim_count = 0;
+ for (root_iterator iter = root_begin(); iter != root_end(); )
+ {
+ root_iterator nextiter = iter++;
+ LLViewerObject* object = (*nextiter)->getObject();
+ if (!object)
+ continue;
+ if (object->isAnimatedObject())
+ {
+ anim_count++;
+ }
+ est_tris += object->recursiveGetEstTrianglesHigh();
+ max_tris = llmax((F32)max_tris,(F32)object->getAnimatedObjectMaxTris());
+ }
+ return anim_count==0 || est_tris <= max_tris;
+}
+
bool LLObjectSelection::applyToRootObjects(LLSelectedObjectFunctor* func, bool firstonly)
{
bool result = firstonly ? false : true;