SL-307 Improvements to flashing color

meow-7.2.2
Andrey Kleshchev 2020-04-24 18:05:14 +03:00
parent 0bc76461fa
commit a0e91e9e50
7 changed files with 28 additions and 26 deletions

View File

@ -643,7 +643,8 @@ void LLButton::draw()
LLColor4 highlighting_color = LLColor4::white;
LLColor4 glow_color = LLColor4::white;
LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA;
LLUIImage* imagep = NULL;
LLUIImage* imagep = NULL;
LLUIImage* image_glow = NULL;
// Cancel sticking of color, if the button is pressed,
// or when a flashing of the previously selected button is ended
@ -710,17 +711,18 @@ void LLButton::draw()
imagep = mImageDisabled;
}
image_glow = imagep;
if (mFlashing)
{
// if button should flash and we have icon for flashing, use it as image for button
if(flash && mImageFlash)
if (flash && mImageFlash)
{
// setting flash to false to avoid its further influence on glow
flash = false;
imagep = mImageFlash;
// if button should flash and we have icon for flashing, use it as image for button
image_glow = mImageFlash;
}
// else use usual flashing via flash_color
else if (mFlashingTimer)
// provide fade-in and fade-out via flash_color
if (mFlashingTimer)
{
LLColor4 flash_color = mFlashBgColor.get();
use_glow_effect = TRUE;
@ -811,7 +813,7 @@ void LLButton::draw()
if (mCurGlowStrength > 0.01f)
{
gGL.setSceneBlendType(glow_type);
imagep->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), glow_color % (mCurGlowStrength * alpha));
image_glow->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), glow_color % (mCurGlowStrength * alpha));
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}
@ -822,7 +824,7 @@ void LLButton::draw()
if (mCurGlowStrength > 0.01f)
{
gGL.setSceneBlendType(glow_type);
imagep->drawSolid(0, y, glow_color % (mCurGlowStrength * alpha));
image_glow->drawSolid(0, y, glow_color % (mCurGlowStrength * alpha));
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}

View File

@ -221,6 +221,7 @@ LLTabContainer::Params::Params()
use_custom_icon_ctrl("use_custom_icon_ctrl", false),
open_tabs_on_drag_and_drop("open_tabs_on_drag_and_drop", false),
enable_tabs_flashing("enable_tabs_flashing", false),
tabs_flashing_color("tabs_flashing_color"),
tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0),
use_ellipses("use_ellipses"),
font_halign("halign")
@ -261,6 +262,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p)
mOpenTabsOnDragAndDrop(p.open_tabs_on_drag_and_drop),
mTabIconCtrlPad(p.tab_icon_ctrl_pad),
mEnableTabsFlashing(p.enable_tabs_flashing),
mTabsFlashingColor(p.tabs_flashing_color),
mUseTabEllipses(p.use_ellipses)
{
static LLUICachedControl<S32> tabcntr_vert_tab_min_width ("UITabCntrVertTabMinWidth", 0);
@ -282,6 +284,11 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p)
mMinTabWidth = tabcntr_vert_tab_min_width;
}
if (p.tabs_flashing_color.isProvided())
{
mEnableTabsFlashing = true;
}
initButtons( );
}
@ -1107,6 +1114,7 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel)
// inits flash timer
p.button_flash_enable = mEnableTabsFlashing;
p.flash_color = mTabsFlashingColor;
// *TODO : It seems wrong not to use p in both cases considering the way p is initialized
if (mCustomIconCtrlUsed)
@ -1642,16 +1650,6 @@ void LLTabContainer::setTabPanelFlashing(LLPanel* child, BOOL state )
}
}
void LLTabContainer::setTabPanelFlashing(LLPanel* child, BOOL state, LLUIColor color)
{
LLTabTuple* tuple = getTabByPanel(child);
if (tuple)
{
tuple->mButton->setFlashColor(color);
tuple->mButton->setFlashing(state);
}
}
void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const LLColor4& color)
{
LLTabTuple* tuple = getTabByPanel(child);

View File

@ -114,6 +114,7 @@ public:
* Enable tab flashing
*/
Optional<bool> enable_tabs_flashing;
Optional<LLUIColor> tabs_flashing_color;
/**
* Paddings for LLIconCtrl in case of LLCustomButtonIconCtrl usage(use_custom_icon_ctrl = true)
@ -203,7 +204,6 @@ public:
BOOL getTabPanelFlashing(LLPanel* child);
void setTabPanelFlashing(LLPanel* child, BOOL state);
void setTabPanelFlashing(LLPanel* child, BOOL state, LLUIColor color);
void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white);
void setTabImage(LLPanel* child, const LLUUID& img_id, const LLColor4& color = LLColor4::white);
void setTabImage(LLPanel* child, LLIconCtrl* icon);
@ -317,6 +317,7 @@ private:
bool mCustomIconCtrlUsed;
bool mOpenTabsOnDragAndDrop;
bool mEnableTabsFlashing;
LLUIColor mTabsFlashingColor;
S32 mTabIconCtrlPad;
bool mUseTabEllipses;
};

View File

@ -1519,10 +1519,7 @@ void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash
LLPanel* panel = mTabContainer->getPanelByName("logs_panel");
if (mTabContainer->getCurrentPanel() != panel)
{
// This will makes colors pale due to "glow_type = LLRender::BT_ALPHA"
// So instead of using "MenuItemFlashBgColor" added stronger color
static LLUIColor sFlashBgColor(LLColor4U(255, 99, 0));
mTabContainer->setTabPanelFlashing(panel, true, sFlashBgColor);
mTabContainer->setTabPanelFlashing(panel, true);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

View File

@ -628,6 +628,7 @@ with the same filename but different name
<texture name="TabTop_Right_Off" file_name="containers/TabTop_Right_Off.png" preload="false" scale.left="8" scale.top="8" scale.right="62" scale.bottom="9" />
<texture name="TabTop_Right_Selected" file_name="containers/TabTop_Right_Selected.png" preload="false" scale.left="8" scale.top="8" scale.right="62" scale.bottom="9" />
<texture name="TabTop_Right_Flashing" file_name="containers/TabTop_Right_Flashing.png" preload="false" scale.left="8" scale.top="8" scale.right="62" scale.bottom="9" />
<texture name="TabTop_Middle_Off" file_name="containers/TabTop_Middle_Off.png" preload="false" scale.left="8" scale.top="8" scale.right="120" scale.bottom="9" />
<texture name="TabTop_Middle_Selected" file_name="containers/TabTop_Middle_Selected.png" preload="false" scale.left="8" scale.top="8" scale.right="96" scale.bottom="9" />
<texture name="TabTop_Left_Off" file_name="containers/TabTop_Left_Off.png" preload="false" scale.left="8" scale.top="8" scale.right="120" scale.bottom="9" />

View File

@ -90,7 +90,10 @@
width="635"
name="import_tab"
tab_position="top"
enable_tabs_flashing="true">
enable_tabs_flashing="true"
tabs_flashing_color="MenuItemFlashBgColor">
<last_tab
tab_top_image_flash="TabTop_Right_Flashing"/> <!-- for log tab -->
<!-- LOD PANEL -->
<panel
help_topic="upload_model_lod"