SH-840 Convert resource cost physics cost to prim count

meow-7.2.2
leyla_linden 2011-02-09 10:53:38 -08:00
parent b30bf98531
commit d0bf3079d7
2 changed files with 127 additions and 54 deletions

View File

@ -414,63 +414,97 @@ void LLFloaterTools::refresh()
// Refresh object and prim count labels
LLLocale locale(LLLocale::USER_LOCALE);
// Get the number of objects selected
std::string root_object_count_string;
std::string object_count_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);
LLResMgr::getInstance()->getIntegerString(
root_object_count_string,
LLSelectMgr::getInstance()->getSelection()->getRootObjectCount());
LLResMgr::getInstance()->getIntegerString(
object_count_string,
LLSelectMgr::getInstance()->getSelection()->getObjectCount());
// 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);
}
getChildView("linked_set_count")->setVisible(false);
getChildView("linked_set_cost")->setVisible(false);
getChildView("object_count")->setVisible(false);
getChildView("object_cost")->setVisible(false);
getChildView("obj_count")->setVisible(true);
getChildView("prim_count")->setVisible(true);
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)
// 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
{
std::string prim_cost_string;
LLResMgr::getInstance()->getIntegerString(prim_cost_string, calcRenderCost());
getChild<LLUICtrl>("RenderingCost")->setTextArg("[COUNT]", prim_cost_string);
// 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();
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);
getChildView("linked_set_count")->setVisible(true);
getChildView("linked_set_cost")->setVisible(true);
getChildView("object_count")->setVisible(true);
getChildView("object_cost")->setVisible(true);
getChildView("obj_count")->setVisible(false);
getChildView("prim_count")->setVisible(false);
}
// 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);
bool enable_mesh = gSavedSettings.getBOOL("MeshEnabled") &&
!gAgent.getRegion()->getCapability("GetMesh").empty();
getChildView("linked_set_count")->setVisible(enable_mesh);
getChildView("linked_set_cost")->setVisible(enable_mesh);
getChildView("object_count")->setVisible(enable_mesh);
getChildView("object_cost")->setVisible(enable_mesh);
// Refresh child tabs
mPanelPermissions->refresh();
mPanelObject->refresh();
@ -753,8 +787,20 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
getChildView("Strength:")->setVisible( land_visible);
}
getChildView("obj_count")->setVisible( !land_visible);
getChildView("prim_count")->setVisible( !land_visible);
if (gAgent.getRegion()->getCapability("GetMesh").empty())
{
getChildView("obj_count")->setVisible( !land_visible);
getChildView("prim_count")->setVisible( !land_visible);
getChildView("RenderingCost")->setVisible( !land_visible && sShowObjectCost);
}
else
{
getChildView("linked_set_count")->setVisible( !land_visible);
getChildView("linked_set_cost")->setVisible( !land_visible);
getChildView("object_count")->setVisible( !land_visible);
getChildView("object_cost")->setVisible( !land_visible);
getChildView("RenderingCost")->setVisible( !land_visible && sShowObjectCost);
}
mTab->setVisible(!land_visible);
mPanelLandInfo->setVisible(land_visible);
}

View File

@ -722,6 +722,33 @@
<button.commit_callback
function="BuildTool.applyToSelection"/>
</button>
<text
text_color="LtGray_50"
type="string"
length="1"
height="10"
follows="left|top"
halign="right"
layout="topleft"
right="-10"
name="obj_count"
top_pad="5"
width="143">
Objects: [COUNT]
</text>
<text
text_color="LtGray_50"
type="string"
length="1"
height="10"
follows="left|top"
halign="right"
layout="topleft"
right="-10"
name="prim_count"
width="143">
Prims: [COUNT]
</text>
<text
text_color="LtGray_50"
type="string"
@ -732,7 +759,7 @@
layout="topleft"
right="-100"
name="linked_set_count"
top_pad="5"
top="144"
width="80">
Linked Sets: [COUNT]
</text>