From 580b35c8ea59187d5197e712022b706df3655f86 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 1 Apr 2019 20:22:25 +0300 Subject: SL-307 Display in-viewer all warning messages logged by the mesh uploader --- indra/llui/lltabcontainer.cpp | 4 ++++ indra/llui/lltabcontainer.h | 6 ++++++ indra/llui/lltextbase.cpp | 12 ++++++++++++ indra/llui/lltextbase.h | 2 ++ 4 files changed, 24 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 1b2f09cff5..0af97bfab2 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -217,6 +217,7 @@ LLTabContainer::Params::Params() last_tab("last_tab"), 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), tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0), use_ellipses("use_ellipses"), font_halign("halign") @@ -1090,6 +1091,9 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) p.pad_left( mLabelPadLeft ); p.pad_right(2); } + + // inits flash timer + p.button_flash_enable = mEnableTabsFlashing; // *TODO : It seems wrong not to use p in both cases considering the way p is initialized if (mCustomIconCtrlUsed) diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 4a5f08f5d3..a8cf380333 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -109,6 +109,11 @@ public: * Open tabs on hover in drag and drop situations */ Optional open_tabs_on_drag_and_drop; + + /** + * Open tabs on hover in drag and drop situations + */ + Optional enable_tabs_flashing; /** * Paddings for LLIconCtrl in case of LLCustomButtonIconCtrl usage(use_custom_icon_ctrl = true) @@ -308,6 +313,7 @@ private: bool mCustomIconCtrlUsed; bool mOpenTabsOnDragAndDrop; + bool mEnableTabsFlashing; S32 mTabIconCtrlPad; bool mUseTabEllipses; }; diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index c570285856..f4713e19ba 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2215,6 +2215,18 @@ void LLTextBase::needsReflow(S32 index) mReflowIndex = llmin(mReflowIndex, index); } +S32 LLTextBase::removeFirstLine() +{ + if (!mLineInfoList.empty()) + { + S32 length = getLineEnd(0); + deselect(); + removeStringNoUndo(0, length); + return length; + } + return 0; +} + void LLTextBase::appendLineBreakSegment(const LLStyle::Params& style_params) { segment_vec_t segments; diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 5fdde445ef..6913374bac 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -401,6 +401,7 @@ public: virtual void setText(const LLStringExplicit &utf8str , const LLStyle::Params& input_params = LLStyle::Params()); // uses default style virtual std::string getText() const; void setMaxTextLength(S32 length) { mMaxTextByteLength = length; } + S32 getMaxTextLength() { return mMaxTextByteLength; } // wide-char versions void setWText(const LLWString& text); @@ -429,6 +430,7 @@ public: S32 getLength() const { return getWText().length(); } S32 getLineCount() const { return mLineInfoList.size(); } + S32 removeFirstLine(); // returns removed length void addDocumentChild(LLView* view); void removeDocumentChild(LLView* view); -- cgit v1.3 From c5859778bc18ef8114b57b616675de15a8e177cb Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 17 Jan 2020 21:08:38 +0200 Subject: SL-379 WIP Joint overrides tab --- indra/llcharacter/lljoint.cpp | 4 +- indra/llcharacter/lljoint.h | 4 +- indra/llui/llscrolllistctrl.cpp | 3 +- indra/llui/llscrolllistctrl.h | 1 + indra/newview/CMakeLists.txt | 1 + indra/newview/llfloatermodelpreview.cpp | 141 ++++++++++++++++++++- indra/newview/llfloatermodelpreview.h | 8 +- indra/newview/lljointoverridedata.h | 52 ++++++++ indra/newview/llvoavatar.cpp | 50 ++++++++ indra/newview/llvoavatar.h | 26 ++-- .../skins/default/xui/en/floater_model_preview.xml | 116 +++++++++++++++++ 11 files changed, 383 insertions(+), 23 deletions(-) create mode 100644 indra/newview/lljointoverridedata.h (limited to 'indra/llui') diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index e2f512f86e..441ef1a352 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -510,7 +510,7 @@ void LLJoint::clearAttachmentPosOverrides() // getAllAttachmentPosOverrides() //-------------------------------------------------------------------- void LLJoint::getAllAttachmentPosOverrides(S32& num_pos_overrides, - std::set& distinct_pos_overrides) + std::set& distinct_pos_overrides) const { num_pos_overrides = m_attachmentPosOverrides.count(); LLVector3OverrideMap::map_type::const_iterator it = m_attachmentPosOverrides.getMap().begin(); @@ -524,7 +524,7 @@ void LLJoint::getAllAttachmentPosOverrides(S32& num_pos_overrides, // getAllAttachmentScaleOverrides() //-------------------------------------------------------------------- void LLJoint::getAllAttachmentScaleOverrides(S32& num_scale_overrides, - std::set& distinct_scale_overrides) + std::set& distinct_scale_overrides) const { num_scale_overrides = m_attachmentScaleOverrides.count(); LLVector3OverrideMap::map_type::const_iterator it = m_attachmentScaleOverrides.getMap().begin(); diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index 8112d246f2..6f69786f53 100644 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -287,9 +287,9 @@ public: void showAttachmentScaleOverrides(const std::string& av_info) const; void getAllAttachmentPosOverrides(S32& num_pos_overrides, - std::set& distinct_pos_overrides); + std::set& distinct_pos_overrides) const; void getAllAttachmentScaleOverrides(S32& num_scale_overrides, - std::set& distinct_scale_overrides); + std::set& distinct_scale_overrides) const; // These are used in checks of whether a pos/scale override is considered significant. bool aboveJointPosThreshold(const LLVector3& pos) const; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index f4028057e8..a564b5b2ce 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -132,6 +132,7 @@ LLScrollListCtrl::Params::Params() sort_ascending("sort_ascending", true), mouse_wheel_opaque("mouse_wheel_opaque", false), commit_on_keyboard_movement("commit_on_keyboard_movement", true), + commit_on_selection_change("commit_on_selection_change", false), heading_height("heading_height"), page_lines("page_lines", 0), background_visible("background_visible"), @@ -161,7 +162,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mMaxSelectable(0), mAllowKeyboardMovement(true), mCommitOnKeyboardMovement(p.commit_on_keyboard_movement), - mCommitOnSelectionChange(false), + mCommitOnSelectionChange(p.commit_on_selection_change), mSelectionChanged(false), mNeedsScroll(false), mCanSelect(true), diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index b35a8608e7..0d6ff67321 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -97,6 +97,7 @@ public: // behavioral flags Optional multi_select, commit_on_keyboard_movement, + commit_on_selection_change, mouse_wheel_opaque; // display flags diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 694e89ab99..7995e7ddf8 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1000,6 +1000,7 @@ set(viewer_HEADER_FILES llinventorymodelbackgroundfetch.h llinventoryobserver.h llinventorypanel.h + lljointoverridedata.h lljoystickbutton.h lllandmarkactions.h lllandmarklist.h diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 38b5fc271f..3e4d9020b7 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -404,9 +404,15 @@ BOOL LLFloaterModelPreview::postBuild() mUploadLogText = getChild("log_text"); mTabContainer = getChild("import_tab"); + // Disable Overrides tab untill it has something to show and set callbacks + LLPanel *panel = mTabContainer->getPanelByName("overrides_panel"); + S32 index = mTabContainer->getIndexForPanel(panel); + mTabContainer->enableTabButton(index, false); + panel->getChild("joints_list")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onJointListSelection, this)); + // Disable Logs tab untill it has something to show - LLPanel* panel = mTabContainer->getPanelByName("logs_panel"); - S32 index = mTabContainer->getIndexForPanel(panel); + panel = mTabContainer->getPanelByName("logs_panel"); + index = mTabContainer->getIndexForPanel(panel); mTabContainer->enableTabButton(index, false); if (LLConvexDecomposition::getInstance() != NULL) @@ -563,9 +569,12 @@ void LLFloaterModelPreview::onClickCalculateBtn() if (upload_joint_positions) { - // Diagnostic message showing list of joints for which joint offsets are defined. - // FIXME - given time, would be much better to put this in the UI, in updateStatusMessages(). - mModelPreview->getPreviewAvatar()->showAttachmentOverrides(); + // Todo: this probably should be enabled when checkbox enables, not on calculate + populateOverridesTab(); + } + else + { + disableOverridesTab(); } mUploadModelUrl.clear(); @@ -580,6 +589,89 @@ void LLFloaterModelPreview::onClickCalculateBtn() mUploadBtn->setEnabled(false); } +void populate_list_with_vectors(LLScrollListCtrl *list, const std::set &vector_set, const LLVector3 &active) +{ + if (vector_set.empty()) + { + return; + } + S32 count = 0; + LLScrollListCell::Params cell_params; + cell_params.font = LLFontGL::getFontSansSerif(); + // Start out right justifying numeric displays + cell_params.font_halign = LLFontGL::HCENTER; + + std::set::const_iterator iter = vector_set.begin(); + std::set::const_iterator end = vector_set.end(); + while (iter != end) + { + LLScrollListItem::Params item_params; + item_params.value = LLSD::Integer(count); + + cell_params.column = "override"; + if (*iter != active) + { + cell_params.value = ""; + } + else + { + cell_params.value = "active"; //todo: localize + } + + item_params.columns.add(cell_params); + + cell_params.column = "axis_x"; + cell_params.value = iter->mV[VX]; + item_params.columns.add(cell_params); + + cell_params.column = "axis_y"; + cell_params.value = iter->mV[VY]; + item_params.columns.add(cell_params); + + cell_params.column = "axis_z"; + cell_params.value = iter->mV[VZ]; + + item_params.columns.add(cell_params); + + list->addRow(item_params); + count++; + iter++; + } +} + +void LLFloaterModelPreview::onJointListSelection() +{ + LLPanel *panel = mTabContainer->getPanelByName("overrides_panel"); + LLScrollListCtrl *joints_list = panel->getChild("joints_list"); + LLScrollListCtrl *joints_pos = panel->getChild("pos_overrides_list"); + LLScrollListCtrl *joints_scale = panel->getChild("scale_overrides_list"); + LLTextBox *joint_pos_descr = panel->getChild("pos_overrides_descr"); + LLTextBox *joint_scale_descr = panel->getChild("scale_overrides_descr"); + + joints_pos->deleteAllItems(); + joints_scale->deleteAllItems(); + + LLScrollListItem *selected = joints_list->getFirstSelected(); + if (selected) + { + std::string label = selected->getValue().asString(); + LLJointOverrideData *data = &mJointOverrides[label]; + populate_list_with_vectors(joints_pos, data->mPosOverrides, data->mActivePosOverride); + populate_list_with_vectors(joints_scale, data->mScaleOverrides, data->mActiveScaleOverride); + + joint_pos_descr->setTextArg("[JOINT]", label); + joint_scale_descr->setTextArg("[JOINT]", label); + } + else + { + // temporary value (shouldn't happen) + std::string label = "mPelvis"; + joint_pos_descr->setTextArg("[JOINT]", label); + joint_scale_descr->setTextArg("[JOINT]", label); + } + +} + void LLFloaterModelPreview::onDescriptionKeystroke(LLUICtrl* ctrl) { // Workaround for SL-4186, server doesn't allow name changes after 'calculate' stage @@ -3861,7 +3953,7 @@ void LLModelPreview::addEmptyFace( LLModel* pTarget ) pTarget->setNumVolumeFaces( faceCnt+1 ); pTarget->setVolumeFaceData( faceCnt+1, pos, norm, tc, index, buff->getNumVerts(), buff->getNumIndices() ); -} +} //----------------------------------------------------------------------------- // render() @@ -4813,6 +4905,43 @@ void LLFloaterModelPreview::clearLogTab() mTabContainer->setTabPanelFlashing(panel, false); } +void LLFloaterModelPreview::populateOverridesTab() +{ + mJointOverrides.clear(); + attach_override_data_map_t attach_not_in_use; + mModelPreview->getPreviewAvatar()->getAttachmentOverrides(mJointOverrides, attach_not_in_use); + + if (mJointOverrides.empty()) + { + disableOverridesTab(); + return; + } + + LLPanel *panel = mTabContainer->getPanelByName("overrides_panel"); + S32 index = mTabContainer->getIndexForPanel(panel); + mTabContainer->enableTabButton(index, true); + + LLScrollListCtrl *joints_list = panel->getChild("joints_list"); + joints_list->deleteAllItems(); + + joint_override_data_map_t::iterator joint_iter = mJointOverrides.begin(); + joint_override_data_map_t::iterator joint_end = mJointOverrides.end(); + while (joint_iter != joint_end) + { + const std::string& listName = joint_iter->first; + joints_list->addSimpleElement(listName); + joint_iter++; + } + joints_list->selectFirstItem(); +} + +void LLFloaterModelPreview::disableOverridesTab() +{ + LLPanel *panel = mTabContainer->getPanelByName("overrides_panel"); + S32 index = mTabContainer->getIndexForPanel(panel); + mTabContainer->enableTabButton(index, false); +} + void LLFloaterModelPreview::onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url) { mModelPhysicsFee = result; diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 8f6ca49cb8..8988dd2565 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -30,6 +30,7 @@ #include "llfloaternamedesc.h" #include "lldynamictexture.h" +#include "lljointoverridedata.h" #include "llquaternion.h" #include "llmeshrepository.h" #include "llmodel.h" @@ -213,7 +214,8 @@ protected: LLSD mModelPhysicsFee; private: - void onClickCalculateBtn(); + void onClickCalculateBtn(); + void onJointListSelection(); void onLoDSourceCommit(S32 lod); @@ -225,6 +227,8 @@ private: void resetUploadOptions(); void clearLogTab(); + void populateOverridesTab(); + void disableOverridesTab(); void createSmoothComboBox(LLComboBox* combo_box, float min, float max); @@ -232,6 +236,8 @@ private: LLButton* mCalculateBtn; LLViewerTextEditor* mUploadLogText; LLTabContainer* mTabContainer; + + joint_override_data_map_t mJointOverrides; }; class LLMeshFilePicker : public LLFilePickerThread diff --git a/indra/newview/lljointoverridedata.h b/indra/newview/lljointoverridedata.h new file mode 100644 index 0000000000..55e1878eec --- /dev/null +++ b/indra/newview/lljointoverridedata.h @@ -0,0 +1,52 @@ +/** + * @file lljointoverridedata.h + * @brief Declaration of LLJointOverrideData and LLAttachmentOverrideData + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Second Life Viewer2020, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_JOINTOVERRIDEDATA_H +#define LL_JOINTOVERRIDEDATA_H + +//#include +//#include +//#include + + +struct LLJointOverrideData +{ + std::set mPosOverrides; + LLVector3 mActivePosOverride; + std::set mScaleOverrides; + LLVector3 mActiveScaleOverride; +}; + +struct LLAttachmentOverrideData +{ + std::set mPosOverrides; + LLVector3 mActivePosOverride; +}; + +typedef std::map joint_override_data_map_t; +typedef std::map attach_override_data_map_t; + +#endif // LL_JOINTOVERRIDEDATA_H + diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index ca1216b89d..7700109fa4 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6374,6 +6374,56 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const } } +//----------------------------------------------------------------------------- +// getAttachmentOverrides +//----------------------------------------------------------------------------- +void LLVOAvatar::getAttachmentOverrides(joint_override_data_map_t &joint_overrides, attach_override_data_map_t &attach_overrides) const +{ + LLVector3 pos, scale; + LLUUID mesh_id; + S32 count = 0; + + // Bones + for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin(); + iter != mSkeleton.end(); ++iter) + { + const LLJoint* pJoint = (*iter); + LLJointOverrideData data; + bool joint_override = false; + if (pJoint && pJoint->hasAttachmentPosOverride(pos, mesh_id)) + { + pJoint->getAllAttachmentPosOverrides(count, data.mPosOverrides); + data.mActivePosOverride = pos; + joint_override = true; + } + if (pJoint && pJoint->hasAttachmentScaleOverride(scale, mesh_id)) + { + pJoint->getAllAttachmentScaleOverrides(count, data.mPosOverrides); + data.mActiveScaleOverride = scale; + joint_override = true; + } + if (joint_override) + { + joint_overrides[pJoint->getName()] = data; + } + } + + // Attachment points + for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + const LLViewerJointAttachment *attachment_pt = (*iter).second; + if (attachment_pt && attachment_pt->hasAttachmentPosOverride(pos, mesh_id)) + { + LLAttachmentOverrideData data; + attachment_pt->getAllAttachmentPosOverrides(count, data.mPosOverrides); + data.mActivePosOverride = pos; + attach_overrides[attachment_pt->getName()] = data; + } + } +} + //----------------------------------------------------------------------------- // removeAttachmentOverridesForObject //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 00dccc5d12..53a1d48d72 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -36,23 +36,25 @@ #include #include "llavatarappearance.h" +#include "llavatarappearancedefines.h" +#include "llavatarrendernotifier.h" +#include "llcontrol.h" +#include "llcharacter.h" #include "llchat.h" #include "lldrawpoolalpha.h" -#include "llviewerobject.h" -#include "llcharacter.h" -#include "llcontrol.h" -#include "llviewerjointmesh.h" -#include "llviewerjointattachment.h" -#include "llrendertarget.h" -#include "llavatarappearancedefines.h" -#include "lltexglobalcolor.h" #include "lldriverparam.h" -#include "llviewertexlayer.h" -#include "material_codes.h" // LL_MCODE_END +#include "lljointoverridedata.h" +#include "llrendertarget.h" #include "llrigginginfo.h" +#include "lltexglobalcolor.h" +#include "llviewerjointmesh.h" +#include "llviewerjointattachment.h" +#include "llviewerobject.h" #include "llviewerstats.h" +#include "llviewertexlayer.h" #include "llvovolume.h" -#include "llavatarrendernotifier.h" + +#include "material_codes.h" // LL_MCODE_END extern const LLUUID ANIM_AGENT_BODY_NOISE; extern const LLUUID ANIM_AGENT_BREATHE_ROT; @@ -215,6 +217,8 @@ public: void rebuildAttachmentOverrides(); void updateAttachmentOverrides(); void showAttachmentOverrides(bool verbose = false) const; + void getAttachmentOverrides(joint_override_data_map_t& joint_overrides, + attach_override_data_map_t& attach_overrides) const; void getAttachmentOverrideNames(std::set& pos_names, std::set& scale_names) const; diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index f5be4bab10..b675a3e3be 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -1246,6 +1246,122 @@ value="0.0" width="80"/> + + + + Joints: + + + + Position overrides for joint '[JOINT]': + + + + + + + + + Scale overrides for joint '[JOINT]': + + + + + + + + Date: Fri, 27 Mar 2020 19:05:23 +0200 Subject: SL-307 Implemented ability to specify color and changed flashing color --- indra/llui/llbutton.cpp | 5 +++++ indra/llui/llbutton.h | 1 + indra/llui/lltabcontainer.cpp | 11 +++++++++++ indra/llui/lltabcontainer.h | 3 ++- indra/newview/llfloatermodelpreview.cpp | 5 ++++- indra/newview/skins/default/xui/en/floater_script_debug.xml | 3 ++- 6 files changed, 25 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 27444b7f5b..804204cce0 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -734,6 +734,11 @@ void LLButton::draw() { glow_color = highlighting_color; } + else + { + // will fade from highlight color + glow_color = flash_color; + } } } diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 7629ed1fea..572d36996c 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -205,6 +205,7 @@ public: void setFlashing( bool b, bool force_flashing = false ); BOOL getFlashing() const { return mFlashing; } LLFlashTimer* getFlashTimer() {return mFlashingTimer;} + void setFlashColor(const LLUIColor &color) { mFlashBgColor = color; }; void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } LLFontGL::HAlign getHAlign() const { return mHAlign; } diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 2a221fc19c..750a3aff9c 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -260,6 +260,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) mCustomIconCtrlUsed(p.use_custom_icon_ctrl), mOpenTabsOnDragAndDrop(p.open_tabs_on_drag_and_drop), mTabIconCtrlPad(p.tab_icon_ctrl_pad), + mEnableTabsFlashing(p.enable_tabs_flashing), mUseTabEllipses(p.use_ellipses) { static LLUICachedControl tabcntr_vert_tab_min_width ("UITabCntrVertTabMinWidth", 0); @@ -1641,6 +1642,16 @@ 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); diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 8f93f1c47d..5339bec3dd 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -111,7 +111,7 @@ public: Optional open_tabs_on_drag_and_drop; /** - * Open tabs on hover in drag and drop situations + * Enable tab flashing */ Optional enable_tabs_flashing; @@ -203,6 +203,7 @@ 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); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index e694340b16..f386e9e305 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1583,7 +1583,10 @@ void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash if (flash && mTabContainer->getCurrentPanel() != panel) { - mTabContainer->setTabPanelFlashing(panel, true); + // 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); } } diff --git a/indra/newview/skins/default/xui/en/floater_script_debug.xml b/indra/newview/skins/default/xui/en/floater_script_debug.xml index cd88048d6b..6c49cfa1a8 100644 --- a/indra/newview/skins/default/xui/en/floater_script_debug.xml +++ b/indra/newview/skins/default/xui/en/floater_script_debug.xml @@ -17,5 +17,6 @@ name="Preview Tabs" tab_position="bottom" top="16" - width="448" /> + width="448" + enable_tabs_flashing="true"/> -- cgit v1.3 From a0e91e9e505e747f876712fe8ec5c250b56e1dcf Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 24 Apr 2020 18:05:14 +0300 Subject: SL-307 Improvements to flashing color --- indra/llui/llbutton.cpp | 22 +++++++++++---------- indra/llui/lltabcontainer.cpp | 18 ++++++++--------- indra/llui/lltabcontainer.h | 3 ++- indra/newview/llfloatermodelpreview.cpp | 5 +---- .../textures/containers/TabTop_Right_Flashing.png | Bin 0 -> 252 bytes indra/newview/skins/default/textures/textures.xml | 1 + .../skins/default/xui/en/floater_model_preview.xml | 5 ++++- 7 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 indra/newview/skins/default/textures/containers/TabTop_Right_Flashing.png (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 804204cce0..9682c3bc10 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -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); } } diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 750a3aff9c..e6b43da8e5 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -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 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); diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 5339bec3dd..8f8cedb1b9 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -114,6 +114,7 @@ public: * Enable tab flashing */ Optional enable_tabs_flashing; + Optional 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; }; diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index ba67f297a0..1d3fb5bcfc 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -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); } } } diff --git a/indra/newview/skins/default/textures/containers/TabTop_Right_Flashing.png b/indra/newview/skins/default/textures/containers/TabTop_Right_Flashing.png new file mode 100644 index 0000000000..fd13bb699d Binary files /dev/null and b/indra/newview/skins/default/textures/containers/TabTop_Right_Flashing.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 624dca48d2..980dcf76bf 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -628,6 +628,7 @@ with the same filename but different name + diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index e8c64dfef7..66878f227b 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -90,7 +90,10 @@ width="635" name="import_tab" tab_position="top" - enable_tabs_flashing="true"> + enable_tabs_flashing="true" + tabs_flashing_color="MenuItemFlashBgColor"> +