Make colors for FPS display optional and themeable
parent
6410a25975
commit
6812d7a23a
|
|
@ -25423,6 +25423,17 @@ Change of this parameter will affect the layout of buttons in notification toast
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>FSStatusBarShowFPSColors</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>If enabled, display FPS number in a color based on the current status.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>FSExperimentalLostAttachmentsFix</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -604,44 +604,48 @@ void LLStatusBar::refresh()
|
|||
static LLCachedControl<bool> fsStatusBarShowFPS(gSavedSettings, "FSStatusBarShowFPS");
|
||||
if (fsStatusBarShowFPS && mFPSUpdateTimer.getElapsedTimeF32() > 1.f)
|
||||
{
|
||||
static LLCachedControl<bool> fsStatusBarShowFPSColors(gSavedSettings, "FSStatusBarShowFPSColors");
|
||||
static LLCachedControl<U32> max_fps(gSavedSettings, "FramePerSecondLimit");
|
||||
static LLCachedControl<bool> limit_fps_enabled(gSavedSettings, "FSLimitFramerate");
|
||||
static LLCachedControl<bool> vsync_enabled(gSavedSettings, "RenderVSyncEnable");
|
||||
|
||||
static const auto fps_below_limit_color = LLUIColorTable::instance().getColor("Yellow");
|
||||
static const auto fps_limit_reached_color = LLUIColorTable::instance().getColor("Green");
|
||||
static const auto vsync_limit_reached_color = LLUIColorTable::instance().getColor("Green");
|
||||
static const auto fps_uncapped_color = LLUIColorTable::instance().getColor("White");
|
||||
static const auto fps_unfocussed_color = LLUIColorTable::instance().getColor("Gray");
|
||||
static const auto fps_below_limit_color = LLUIColorTable::instance().getColor("FpsDisplayBelowLimitColor");
|
||||
static const auto fps_limit_reached_color = LLUIColorTable::instance().getColor("FpsDisplayFpsLimitReachedColor");
|
||||
static const auto vsync_limit_reached_color = LLUIColorTable::instance().getColor("FpsDisplayVSyncLimitReachedColor");
|
||||
static const auto fps_uncapped_color = LLUIColorTable::instance().getColor("FpsDisplayUncappedColor");
|
||||
static const auto fps_unfocussed_color = LLUIColorTable::instance().getColor("FpsDisplayUnfocussedColor");
|
||||
static auto current_fps_color = fps_uncapped_color;
|
||||
|
||||
mFPSUpdateTimer.reset();
|
||||
const auto fps = LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS);
|
||||
mFPSText->setText(llformat("%.1f", fps));
|
||||
|
||||
// if background, go grey, else go white unless we have a cap (checked next)
|
||||
auto fps_color{ fps_uncapped_color };
|
||||
auto window = gViewerWindow ? gViewerWindow->getWindow() : nullptr;
|
||||
if ((window && !window->getVisible()) || !gFocusMgr.getAppHasFocus())
|
||||
if (fsStatusBarShowFPSColors)
|
||||
{
|
||||
fps_color = fps_unfocussed_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
S32 vsync_freq{ -1 };
|
||||
if (window)
|
||||
// if background, go grey, else go white unless we have a cap (checked next)
|
||||
auto window = gViewerWindow ? gViewerWindow->getWindow() : nullptr;
|
||||
if ((window && !window->getVisible()) || !gFocusMgr.getAppHasFocus())
|
||||
{
|
||||
vsync_freq = window->getRefreshRate();
|
||||
fps_color = fps_unfocussed_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
S32 vsync_freq{ -1 };
|
||||
if (window)
|
||||
{
|
||||
vsync_freq = window->getRefreshRate();
|
||||
}
|
||||
|
||||
if (limit_fps_enabled && max_fps > 0)
|
||||
{
|
||||
fps_color = (fps >= max_fps - 1) ? fps_limit_reached_color : fps_below_limit_color;
|
||||
}
|
||||
// use vsync if enabled and the freq is lower than the max_fps
|
||||
if (vsync_enabled && vsync_freq > 0 && (!limit_fps_enabled || vsync_freq < (S32)max_fps))
|
||||
{
|
||||
fps_color = (fps >= vsync_freq - 1) ? vsync_limit_reached_color : fps_below_limit_color;
|
||||
if (limit_fps_enabled && max_fps > 0)
|
||||
{
|
||||
fps_color = (fps >= max_fps - 1) ? fps_limit_reached_color : fps_below_limit_color;
|
||||
}
|
||||
// use vsync if enabled and the freq is lower than the max_fps
|
||||
if (vsync_enabled && vsync_freq > 0 && (!limit_fps_enabled || vsync_freq < (S32)max_fps))
|
||||
{
|
||||
fps_color = (fps >= vsync_freq - 1) ? vsync_limit_reached_color : fps_below_limit_color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1410,4 +1410,19 @@
|
|||
<color
|
||||
name="NotecardCursorColor"
|
||||
reference="TextCursorColor" />
|
||||
<color
|
||||
name="FpsDisplayUncappedColor"
|
||||
reference="LabelTextColor" />
|
||||
<color
|
||||
name="FpsDisplayUnfocussedColor"
|
||||
reference="Gray" />
|
||||
<color
|
||||
name="FpsDisplayBelowLimitColor"
|
||||
reference="Yellow" />
|
||||
<color
|
||||
name="FpsDisplayFpsLimitReachedColor"
|
||||
reference="Green" />
|
||||
<color
|
||||
name="FpsDisplayVSyncLimitReachedColor"
|
||||
reference="Green" />
|
||||
</colors>
|
||||
|
|
|
|||
|
|
@ -1403,4 +1403,19 @@
|
|||
<color
|
||||
name="NotecardCursorColor"
|
||||
reference="TextCursorColor" />
|
||||
<color
|
||||
name="FpsDisplayUncappedColor"
|
||||
reference="LabelTextColor" />
|
||||
<color
|
||||
name="FpsDisplayUnfocussedColor"
|
||||
reference="Gray" />
|
||||
<color
|
||||
name="FpsDisplayBelowLimitColor"
|
||||
reference="Yellow" />
|
||||
<color
|
||||
name="FpsDisplayFpsLimitReachedColor"
|
||||
reference="Green" />
|
||||
<color
|
||||
name="FpsDisplayVSyncLimitReachedColor"
|
||||
reference="Green" />
|
||||
</colors>
|
||||
|
|
|
|||
|
|
@ -1378,4 +1378,19 @@
|
|||
<color
|
||||
name="NotecardCursorColor"
|
||||
reference="TextCursorColor" />
|
||||
<color
|
||||
name="FpsDisplayUncappedColor"
|
||||
reference="LabelTextColor" />
|
||||
<color
|
||||
name="FpsDisplayUnfocussedColor"
|
||||
reference="Gray" />
|
||||
<color
|
||||
name="FpsDisplayBelowLimitColor"
|
||||
reference="Yellow" />
|
||||
<color
|
||||
name="FpsDisplayFpsLimitReachedColor"
|
||||
reference="Green" />
|
||||
<color
|
||||
name="FpsDisplayVSyncLimitReachedColor"
|
||||
reference="Green" />
|
||||
</colors>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
<menu_item_check label="Kontostand anzeigen" name="FSShowCurrencyBalanceInStatusbar"/>
|
||||
<menu_item_check label="Mediensteuerung anzeigen" name="FSEnableVolumeControls"/>
|
||||
<menu_item_check label="Bilder pro Sekunde anzeigen" name="FSStatusBarShowFPS"/>
|
||||
<menu_item_check label="Farb-Indikator für Bilder pro Sekunde anzeigen" name="FSStatusBarShowFPSColors"/>
|
||||
<menu_item_check label="Datentransfer-Indikator anzeigen" name="ShowNetStats"/>
|
||||
<menu_item_check label="Koordinaten anzeigen" name="Coordinates"/>
|
||||
<menu_item_check label="Parzelleneigenschaften anzeigen" name="Parcel Properties"/>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
<button name="stream_toggle_btn" tool_tip="Audiostream der Parzelle starten/stoppen"/>
|
||||
<button name="media_toggle_btn" tool_tip="Alle Medien starten/stoppen (Musik, Video, Webseiten)"/>
|
||||
<button name="volume_btn" tool_tip="Steuerung der Gesamtlautstärke"/>
|
||||
<text name="FPSText" tool_tip="Bilder pro Sekunde">
|
||||
<text name="FPSText" tool_tip="Bilder pro Sekunde (klicken, um Begrenzung anzupassen)">
|
||||
200.0
|
||||
</text>
|
||||
</panel>
|
||||
|
|
|
|||
|
|
@ -118,6 +118,19 @@
|
|||
function="CheckControl"
|
||||
parameter="FSStatusBarShowFPS" />
|
||||
</menu_item_check>
|
||||
<menu_item_check
|
||||
label="Show Color Indicator for Frames per Second"
|
||||
name="FSStatusBarShowFPSColors">
|
||||
<on_click
|
||||
function="ToggleControl"
|
||||
parameter="FSStatusBarShowFPSColors" />
|
||||
<on_check
|
||||
function="CheckControl"
|
||||
parameter="FSStatusBarShowFPSColors" />
|
||||
<on_enable
|
||||
function="CheckControl"
|
||||
parameter="FSStatusBarShowFPS" />
|
||||
</menu_item_check>
|
||||
<menu_item_check
|
||||
label="Show Traffic Indicator"
|
||||
name="ShowNetStats">
|
||||
|
|
|
|||
Loading…
Reference in New Issue