summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-05-21 17:07:36 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-05-23 11:46:50 +0300
commitc255174c561fcafcd114a787a9156e05347563d1 (patch)
treefded672f2cb71e842a7b3d49b0961c291d87dd85 /indra
parent741b79d63b97bb5e43f758fd93854317f0bdc65f (diff)
viewer#1400 Show LODs info in Build Tools
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterobjectweights.cpp96
-rw-r--r--indra/newview/llfloaterobjectweights.h19
-rw-r--r--indra/newview/skins/default/xui/en/floater_object_weights.xml110
3 files changed, 217 insertions, 8 deletions
diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp
index 090b0657d1..8e102ab3b2 100644
--- a/indra/newview/llfloaterobjectweights.cpp
+++ b/indra/newview/llfloaterobjectweights.cpp
@@ -36,6 +36,14 @@
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
+static const std::string lod_strings[4] =
+{
+ "lowest_lod",
+ "low_lod",
+ "medium_lod",
+ "high_lod",
+};
+
// virtual
bool LLCrossParcelFunctor::apply(LLViewerObject* obj)
{
@@ -75,7 +83,10 @@ LLFloaterObjectWeights::LLFloaterObjectWeights(const LLSD& key)
mSelectedOnLand(NULL),
mRezzedOnLand(NULL),
mRemainingCapacity(NULL),
- mTotalCapacity(NULL)
+ mTotalCapacity(NULL),
+ mLodLevel(nullptr),
+ mTrianglesShown(nullptr),
+ mPixelArea(nullptr)
{
}
@@ -99,6 +110,10 @@ BOOL LLFloaterObjectWeights::postBuild()
mRemainingCapacity = getChild<LLTextBox>("remaining_capacity");
mTotalCapacity = getChild<LLTextBox>("total_capacity");
+ mLodLevel = getChild<LLTextBox>("lod_level");
+ mTrianglesShown = getChild<LLTextBox>("triangles_shown");
+ mPixelArea = getChild<LLTextBox>("pixel_area");
+
return TRUE;
}
@@ -135,6 +150,69 @@ void LLFloaterObjectWeights::setErrorStatus(S32 status, const std::string& reaso
toggleWeightsLoadingIndicators(false);
}
+void LLFloaterObjectWeights::draw()
+{
+ // Normally it's a bad idea to set text and visibility inside draw
+ // since it can cause rect updates go to different, already drawn elements,
+ // but floater is very simple and these elements are supposed to be isolated
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
+ if (selection->isEmpty())
+ {
+ const std::string text = getString("nothing_selected");
+ mLodLevel->setText(text);
+ mTrianglesShown->setText(text);
+ mPixelArea->setText(text);
+
+ toggleRenderLoadingIndicators(false);
+ }
+ else
+ {
+ S32 object_lod = -1;
+ bool multiple_lods = false;
+ S32 total_tris = 0;
+ S32 pixel_area = 0;
+ for (LLObjectSelection::valid_root_iterator iter = selection->valid_root_begin();
+ iter != selection->valid_root_end(); ++iter)
+ {
+ LLViewerObject* object = (*iter)->getObject();
+ S32 lod = object->getLOD();
+ if (object_lod < 0)
+ {
+ object_lod = lod;
+ }
+ else if (object_lod != lod)
+ {
+ multiple_lods = true;
+ }
+
+ if (object->isRootEdit())
+ {
+ total_tris += object->recursiveGetTriangleCount();
+ pixel_area += object->getPixelArea();
+ }
+ }
+
+ if (multiple_lods)
+ {
+ mLodLevel->setText(getString("multiple_lods"));
+ toggleRenderLoadingIndicators(false);
+ }
+ else if (object_lod < 0)
+ {
+ // nodes are waiting for data
+ toggleRenderLoadingIndicators(true);
+ }
+ else
+ {
+ mLodLevel->setText(getString(lod_strings[object_lod]));
+ toggleRenderLoadingIndicators(false);
+ }
+ mTrianglesShown->setText(llformat("%d", total_tris));
+ mPixelArea->setText(llformat("%d", pixel_area));
+ }
+ LLFloater::draw();
+}
+
void LLFloaterObjectWeights::updateLandImpacts(const LLParcel* parcel)
{
if (!parcel || LLSelectMgr::getInstance()->getSelection()->isEmpty())
@@ -252,6 +330,17 @@ void LLFloaterObjectWeights::toggleLandImpactsLoadingIndicators(bool visible)
mTotalCapacity->setVisible(!visible);
}
+void LLFloaterObjectWeights::toggleRenderLoadingIndicators(bool visible)
+{
+ childSetVisible("lod_level_loading_indicator", visible);
+ childSetVisible("triangles_shown_loading_indicator", visible);
+ childSetVisible("pixel_area_loading_indicator", visible);
+
+ mLodLevel->setVisible(!visible);
+ mTrianglesShown->setVisible(!visible);
+ mPixelArea->setVisible(!visible);
+}
+
void LLFloaterObjectWeights::updateIfNothingSelected()
{
const std::string text = getString("nothing_selected");
@@ -269,6 +358,11 @@ void LLFloaterObjectWeights::updateIfNothingSelected()
mRemainingCapacity->setText(text);
mTotalCapacity->setText(text);
+ mLodLevel->setText(text);
+ mTrianglesShown->setText(text);
+ mPixelArea->setText(text);
+
toggleWeightsLoadingIndicators(false);
toggleLandImpactsLoadingIndicators(false);
+ toggleRenderLoadingIndicators(false);
}
diff --git a/indra/newview/llfloaterobjectweights.h b/indra/newview/llfloaterobjectweights.h
index 10e790f5aa..5d67a12f13 100644
--- a/indra/newview/llfloaterobjectweights.h
+++ b/indra/newview/llfloaterobjectweights.h
@@ -58,21 +58,24 @@ public:
LLFloaterObjectWeights(const LLSD& key);
~LLFloaterObjectWeights();
- /*virtual*/ BOOL postBuild();
+ BOOL postBuild() override;
- /*virtual*/ void onOpen(const LLSD& key);
+ void onOpen(const LLSD& key) override;
- /*virtual*/ void onWeightsUpdate(const SelectionCost& selection_cost);
- /*virtual*/ void setErrorStatus(S32 status, const std::string& reason);
+ void onWeightsUpdate(const SelectionCost& selection_cost) override;
+ void setErrorStatus(S32 status, const std::string& reason) override;
+
+ void draw() override;
void updateLandImpacts(const LLParcel* parcel);
- void refresh();
+ void refresh() override;
private:
- /*virtual*/ void generateTransactionID();
+ void generateTransactionID() override;
void toggleWeightsLoadingIndicators(bool visible);
void toggleLandImpactsLoadingIndicators(bool visible);
+ void toggleRenderLoadingIndicators(bool visible);
void updateIfNothingSelected();
@@ -88,6 +91,10 @@ private:
LLTextBox *mRezzedOnLand;
LLTextBox *mRemainingCapacity;
LLTextBox *mTotalCapacity;
+
+ LLTextBox *mLodLevel;
+ LLTextBox *mTrianglesShown;
+ LLTextBox *mPixelArea;
};
#endif //LL_LLFLOATEROBJECTWEIGHTS_H
diff --git a/indra/newview/skins/default/xui/en/floater_object_weights.xml b/indra/newview/skins/default/xui/en/floater_object_weights.xml
index 5e4b017590..709fbdd27e 100644
--- a/indra/newview/skins/default/xui/en/floater_object_weights.xml
+++ b/indra/newview/skins/default/xui/en/floater_object_weights.xml
@@ -2,7 +2,7 @@
<floater
can_close="true"
can_tear_off="false"
- height="289"
+ height="372"
help_topic="object_weights"
layout="topleft"
name="object_weights"
@@ -13,6 +13,21 @@
<floater.string
name="nothing_selected"
value="--"/>
+ <floater.string
+ name="lowest_lod"
+ value="Lowest"/>
+ <floater.string
+ name="low_lod"
+ value="Low"/>
+ <floater.string
+ name="medium_lod"
+ value="Medium"/>
+ <floater.string
+ name="high_lod"
+ value="High"/>
+ <floater.string
+ name="multiple_lods"
+ value="Multiple"/>
<text
follows="left|top"
@@ -320,4 +335,97 @@
top_delta="0"
value="Total capacity"
width="130" />
+
+
+ <text
+ follows="left|top"
+ height="16"
+ layout="topleft"
+ left="10"
+ name="rendering_info_text"
+ text_color="EmphasisColor"
+ top_pad="10"
+ value="RENDERING INFO"
+ width="180" />
+ <text
+ follows="left|top"
+ halign="right"
+ height="16"
+ layout="topleft"
+ left="10"
+ name="lod_level"
+ top_pad="3"
+ value="--"
+ width="40" />
+ <loading_indicator
+ follows="left|top"
+ height="16"
+ layout="topleft"
+ left="34"
+ name="lod_level_loading_indicator"
+ top_delta="0"
+ width="16" />
+ <text
+ follows="left|top"
+ height="16"
+ layout="topleft"
+ left_pad="10"
+ name="lod_level_label"
+ top_delta="0"
+ value="LOD (Level of detail)"
+ width="130" />
+ <text
+ follows="left|top"
+ halign="right"
+ height="16"
+ layout="topleft"
+ left="10"
+ name="triangles_shown"
+ top_pad="3"
+ value="--"
+ width="40" />
+ <loading_indicator
+ follows="left|top"
+ height="16"
+ layout="topleft"
+ left="34"
+ name="triangles_shown_loading_indicator"
+ top_delta="0"
+ width="16" />
+ <text
+ follows="left|top"
+ height="16"
+ layout="topleft"
+ left_pad="10"
+ name="triangles_shown_label"
+ top_delta="0"
+ value="Triangles Shown"
+ width="130" />
+ <text
+ follows="left|top"
+ halign="right"
+ height="16"
+ layout="topleft"
+ left="10"
+ name="pixel_area"
+ top_pad="3"
+ value="--"
+ width="40" />
+ <loading_indicator
+ follows="left|top"
+ height="16"
+ layout="topleft"
+ left="34"
+ name="pixel_area_loading_indicator"
+ top_delta="0"
+ width="16" />
+ <text
+ follows="left|top"
+ height="16"
+ layout="topleft"
+ left_pad="10"
+ name="pixel_area_label"
+ top_delta="0"
+ value="Pixel Area"
+ width="130" />
</floater>