summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatertools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatertools.cpp')
-rw-r--r--indra/newview/llfloatertools.cpp154
1 files changed, 112 insertions, 42 deletions
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index 364fbad193..73c1f99fa0 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -32,6 +32,7 @@
#include "llcoord.h"
//#include "llgl.h"
+#include "llagent.h"
#include "llagentcamera.h"
#include "llbutton.h"
#include "llcheckboxctrl.h"
@@ -420,27 +421,83 @@ void LLFloaterTools::refresh()
// Refresh object and prim count labels
LLLocale locale(LLLocale::USER_LOCALE);
- std::string obj_count_string;
- LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount());
- getChild<LLUICtrl>("obj_count")->setTextArg("[COUNT]", obj_count_string);
- std::string prim_count_string;
- LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount());
- getChild<LLUICtrl>("prim_count")->setTextArg("[COUNT]", prim_count_string);
-
- // calculate selection rendering cost
- if (sShowObjectCost)
- {
- std::string prim_cost_string;
- LLResMgr::getInstance()->getIntegerString(prim_cost_string, calcRenderCost());
- getChild<LLUICtrl>("RenderingCost")->setTextArg("[COUNT]", prim_cost_string);
+
+ if ((gAgent.getRegion() && gAgent.getRegion()->getCapability("GetMesh").empty()) || !gSavedSettings.getBOOL("MeshEnabled"))
+ {
+ std::string obj_count_string;
+ LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount());
+ getChild<LLUICtrl>("obj_count")->setTextArg("[COUNT]", obj_count_string);
+ std::string prim_count_string;
+ LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount());
+ getChild<LLUICtrl>("prim_count")->setTextArg("[COUNT]", prim_count_string);
+
+ // calculate selection rendering cost
+ if (sShowObjectCost)
+ {
+ std::string prim_cost_string;
+ LLResMgr::getInstance()->getIntegerString(prim_cost_string, calcRenderCost());
+ getChild<LLUICtrl>("RenderingCost")->setTextArg("[COUNT]", prim_cost_string);
+ }
+
+ // disable the object and prim counts if nothing selected
+ bool have_selection = ! LLSelectMgr::getInstance()->getSelection()->isEmpty();
+ getChildView("obj_count")->setEnabled(have_selection);
+ getChildView("prim_count")->setEnabled(have_selection);
+ getChildView("RenderingCost")->setEnabled(have_selection && sShowObjectCost);
}
+ else
+ {
+ // Get the number of objects selected
+ std::string root_object_count_string;
+ std::string object_count_string;
+
+ LLResMgr::getInstance()->getIntegerString(
+ root_object_count_string,
+ LLSelectMgr::getInstance()->getSelection()->getRootObjectCount());
+ LLResMgr::getInstance()->getIntegerString(
+ object_count_string,
+ LLSelectMgr::getInstance()->getSelection()->getObjectCount());
+
+ F32 obj_cost =
+ LLSelectMgr::getInstance()->getSelection()->getSelectedObjectCost();
+ F32 link_cost =
+ LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetCost();
+ F32 obj_physics_cost =
+ LLSelectMgr::getInstance()->getSelection()->getSelectedPhysicsCost();
+ F32 link_physics_cost =
+ LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetPhysicsCost();
+
+ // Update the text for the counts
+ childSetTextArg(
+ "linked_set_count",
+ "[COUNT]",
+ root_object_count_string);
+ childSetTextArg("object_count", "[COUNT]", object_count_string);
+
+ // Update the text for the resource costs
+ childSetTextArg("linked_set_cost","[COST]",llformat("%.1f", link_cost));
+ childSetTextArg("object_cost", "[COST]", llformat("%.1f", obj_cost));
+ childSetTextArg("linked_set_cost","[PHYSICS]",llformat("%.1f", link_physics_cost));
+ childSetTextArg("object_cost", "[PHYSICS]", llformat("%.1f", obj_physics_cost));
+
+ // Display rendering cost if needed
+ if (sShowObjectCost)
+ {
+ std::string prim_cost_string;
+ LLResMgr::getInstance()->getIntegerString(prim_cost_string, calcRenderCost());
+ getChild<LLUICtrl>("RenderingCost")->setTextArg("[COUNT]", prim_cost_string);
+ }
- // disable the object and prim counts if nothing selected
- bool have_selection = ! LLSelectMgr::getInstance()->getSelection()->isEmpty();
- getChildView("obj_count")->setEnabled(have_selection);
- getChildView("prim_count")->setEnabled(have_selection);
- getChildView("RenderingCost")->setEnabled(have_selection && sShowObjectCost);
+ // disable the object and prim counts if nothing selected
+ bool have_selection = ! LLSelectMgr::getInstance()->getSelection()->isEmpty();
+ childSetEnabled("linked_set_count", have_selection);
+ childSetEnabled("object_count", have_selection);
+ childSetEnabled("linked_set_cost", have_selection);
+ childSetEnabled("object_cost", have_selection);
+ getChildView("RenderingCost")->setEnabled(have_selection && sShowObjectCost);
+ }
+
// Refresh child tabs
mPanelPermissions->refresh();
@@ -730,8 +787,18 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
getChildView("Strength:")->setVisible( land_visible);
}
- getChildView("obj_count")->setVisible( !land_visible);
- getChildView("prim_count")->setVisible( !land_visible);
+ bool show_mesh_cost = gAgent.getRegion() &&
+ !gAgent.getRegion()->getCapability("GetMesh").empty() &&
+ gSavedSettings.getBOOL("MeshEnabled");
+
+ getChildView("obj_count")->setVisible( !land_visible && !show_mesh_cost);
+ getChildView("prim_count")->setVisible( !land_visible && !show_mesh_cost);
+ getChildView("linked_set_count")->setVisible( !land_visible && show_mesh_cost);
+ getChildView("linked_set_cost")->setVisible( !land_visible && show_mesh_cost);
+ getChildView("object_count")->setVisible( !land_visible && show_mesh_cost);
+ getChildView("object_cost")->setVisible( !land_visible && show_mesh_cost);
+ getChildView("RenderingCost")->setVisible( !land_visible && sShowObjectCost);
+
mTab->setVisible(!land_visible);
mPanelLandInfo->setVisible(land_visible);
}
@@ -988,30 +1055,33 @@ void LLFloaterTools::onClickGridOptions()
S32 LLFloaterTools::calcRenderCost()
{
- S32 cost = 0;
- std::set<LLUUID> textures;
-
- for (LLObjectSelection::iterator selection_iter = LLSelectMgr::getInstance()->getSelection()->begin();
- selection_iter != LLSelectMgr::getInstance()->getSelection()->end();
- ++selection_iter)
- {
- LLSelectNode *select_node = *selection_iter;
- if (select_node)
- {
- LLVOVolume *viewer_volume = (LLVOVolume*)select_node->getObject();
- if (viewer_volume)
- {
- cost += viewer_volume->getRenderCost(textures);
- cost += textures.size() * LLVOVolume::ARC_TEXTURE_COST;
- textures.clear();
- }
- }
- }
-
-
- return cost;
+ S32 cost = 0;
+ std::set<LLUUID> textures;
+
+ for (LLObjectSelection::iterator selection_iter = LLSelectMgr::getInstance()->getSelection()->begin();
+ selection_iter != LLSelectMgr::getInstance()->getSelection()->end();
+ ++selection_iter)
+ {
+ LLSelectNode *select_node = *selection_iter;
+ if (select_node)
+ {
+ LLViewerObject *vobj = select_node->getObject();
+ if (vobj->getVolume())
+ {
+ LLVOVolume* volume = (LLVOVolume*) vobj;
+
+ cost += volume->getRenderCost(textures);
+ cost += textures.size() * LLVOVolume::ARC_TEXTURE_COST;
+ textures.clear();
+ }
+ }
+ }
+
+
+ return cost;
}
+
// static
void LLFloaterTools::setEditTool(void* tool_pointer)
{