From 9480ee9a4dbb5247029ec840a58e40db9c43f69a Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 31 Aug 2018 16:05:06 +0300 Subject: MAINT-9064 Fix crash caused by new shader calls --- indra/newview/lldrawpoolwlsky.cpp | 71 +++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 37 deletions(-) (limited to 'indra') diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 4bf47f4fd6..2ae361eb4d 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -389,23 +389,23 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() if (can_use_vertex_shaders) { sun_shader->bind(); - } - if (tex_a && (!tex_b || (tex_a == tex_b))) - { - // Bind current and next sun textures - sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (tex_b && !tex_a) - { - sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (tex_b != tex_a) - { - sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); - sun_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); + if (tex_a && (!tex_b || (tex_a == tex_b))) + { + // Bind current and next sun textures + sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); + blend_factor = 0; + } + else if (tex_b && !tex_a) + { + sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); + blend_factor = 0; + } + else if (tex_b != tex_a) + { + sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); + sun_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); + } } LLColor4 color(gSky.mVOSkyp->getSun().getInterpColor()); @@ -439,29 +439,26 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() LLColor4 color(gSky.mVOSkyp->getMoon().getInterpColor()); if (can_use_vertex_shaders) - { - moon_shader->bind(); - } - - if (tex_a && (!tex_b || (tex_a == tex_b))) - { - // Bind current and next sun textures - moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (tex_b && !tex_a) { - moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (tex_b != tex_a) - { - moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); - moon_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); - } + moon_shader->bind(); + + if (tex_a && (!tex_b || (tex_a == tex_b))) + { + // Bind current and next sun textures + moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); + blend_factor = 0; + } + else if (tex_b && !tex_a) + { + moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); + blend_factor = 0; + } + else if (tex_b != tex_a) + { + moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); + moon_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); + } - if (can_use_vertex_shaders) - { moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV); moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); } -- cgit v1.2.3 From c46b70c25770a7421486498df6a280c00bae5a2d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 31 Aug 2018 16:33:57 +0100 Subject: Null out shader pointers after passes are complete (prevents them being non-null and masking crashes when graphics prefs change). --- indra/newview/lldrawpoolwlsky.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 4bf47f4fd6..9defc33e30 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -91,6 +91,10 @@ void LLDrawPoolWLSky::beginRenderPass( S32 pass ) void LLDrawPoolWLSky::endRenderPass( S32 pass ) { + sky_shader = nullptr; + cloud_shader = nullptr; + sun_shader = nullptr; + moon_shader = nullptr; } void LLDrawPoolWLSky::beginDeferredPass(S32 pass) @@ -111,7 +115,10 @@ void LLDrawPoolWLSky::beginDeferredPass(S32 pass) void LLDrawPoolWLSky::endDeferredPass(S32 pass) { - + sky_shader = nullptr; + cloud_shader = nullptr; + sun_shader = nullptr; + moon_shader = nullptr; } void LLDrawPoolWLSky::renderFsSky(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const -- cgit v1.2.3 From 3b10414c632e73d66d2840ddcd474a79fa120540 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 31 Aug 2018 11:47:18 -0700 Subject: Adding optional flags to settings objects. --- indra/llinventory/llsettingsbase.cpp | 38 ++++++++++++++++++++++++++-- indra/llinventory/llsettingsbase.h | 48 +++++++++++++++++++++++++++++++++++- indra/llinventory/llsettingssky.cpp | 1 + indra/newview/llenvironment.cpp | 4 +++ 4 files changed, 88 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 938f614fc9..5283a8dc8a 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -54,6 +54,10 @@ const std::string LLSettingsBase::SETTING_NAME("name"); const std::string LLSettingsBase::SETTING_HASH("hash"); const std::string LLSettingsBase::SETTING_TYPE("type"); const std::string LLSettingsBase::SETTING_ASSETID("asset_id"); +const std::string LLSettingsBase::SETTING_FLAGS("flags"); + +const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0); +const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1); //========================================================================= LLSettingsBase::LLSettingsBase(): @@ -239,13 +243,23 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F // case LLSD::TypeBinary: // case LLSD::TypeDate: default: - /* TODO: If the UUID points to an image ID, blend the images. */ // atomic or unknown data types. Lerping between them does not make sense so switch at the break. newSettings[key_name] = (mix > BREAK_POINT) ? other_value : value; break; } } + // Special handling cases + // Flags + if (settings.has(SETTING_FLAGS)) + { + U32 flags = (U32)settings[SETTING_FLAGS].asInteger(); + if (other.has(SETTING_FLAGS)) + flags |= (U32)other[SETTING_FLAGS].asInteger(); + + newSettings[SETTING_FLAGS] = LLSD::Integer(flags); + } + // Now add anything that is in other but not in the settings for (LLSD::map_const_iterator it = other.beginMap(); it != other.endMap(); ++it) { @@ -262,6 +276,19 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F return newSettings; } +LLSettingsBase::stringset_t LLSettingsBase::getSkipInterpolateKeys() const +{ + static stringset_t skipSet; + + if (skipSet.empty()) + { + skipSet.insert(SETTING_FLAGS); + skipSet.insert(SETTING_HASH); + } + + return skipSet; +} + LLSD LLSettingsBase::getSettings() const { return mSettings; @@ -311,6 +338,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); static Validator validateAssetId(SETTING_ASSETID, false, LLSD::TypeUUID); + static Validator validateFlags(SETTING_FLAGS, false, LLSD::TypeInteger); stringset_t validated; stringset_t strip; bool isValid(true); @@ -353,6 +381,13 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } validated.insert(validateType.getName()); + if (!validateFlags.verify(settings)) + { + errors.append(LLSD::String("Unable to validate 'flags'.")); + isValid = false; + } + validated.insert(validateFlags.getName()); + // Fields for specific settings. for (validation_list_t::iterator itv = validations.begin(); itv != validations.end(); ++itv) { @@ -415,7 +450,6 @@ bool LLSettingsBase::Validator::verify(LLSD &data) { if (!mDefault.isUndefined()) { - LL_INFOS("SETTINGS") << "Inserting missing default for '" << mName << "'." << LL_ENDL; data[mName] = mDefault; return true; } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 7884240ae3..a90cec6323 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -70,6 +70,10 @@ public: static const std::string SETTING_HASH; static const std::string SETTING_TYPE; static const std::string SETTING_ASSETID; + static const std::string SETTING_FLAGS; + + static const U32 FLAG_NOCOPY; + static const U32 FLAG_NOMOD; typedef std::map parammapping_t; @@ -113,6 +117,48 @@ public: return LLUUID(); } + inline U32 getFlags() const + { + if (mSettings.has(SETTING_FLAGS)) + return static_cast(mSettings[SETTING_FLAGS].asInteger()); + return 0; + } + + inline void setFlags(U32 value) + { + setLLSD(SETTING_FLAGS, LLSD::Integer(value)); + } + + inline bool getFlag(U32 flag) const + { + if (mSettings.has(SETTING_FLAGS)) + return ((U32)mSettings[SETTING_FLAGS].asInteger() & flag) == flag; + return false; + } + + inline void setFlag(U32 flag) + { + U32 flags((mSettings.has(SETTING_FLAGS)) ? (U32)mSettings[SETTING_FLAGS].asInteger() : 0); + + flags |= flag; + + if (flags) + mSettings[SETTING_FLAGS] = LLSD::Integer(flags); + else + mSettings.erase(SETTING_FLAGS); + } + + inline void clearFlag(U32 flag) + { + U32 flags((mSettings.has(SETTING_FLAGS)) ? (U32)mSettings[SETTING_FLAGS].asInteger() : 0); + + flags &= ~flag; + + if (flags) + mSettings[SETTING_FLAGS] = LLSD::Integer(flags); + else + mSettings.erase(SETTING_FLAGS); + } virtual void replaceSettings(LLSD settings) { @@ -270,7 +316,7 @@ protected: /// when lerping between settings, some may require special handling. /// Get a list of these key to be skipped by the default settings lerp. /// (handling should be performed in the override of lerpSettings. - virtual stringset_t getSkipInterpolateKeys() const { return stringset_t(); } + virtual stringset_t getSkipInterpolateKeys() const; // A list of settings that represent quaternions and should be slerped // rather than lerped. diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index dbf9117882..0203e5067a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -435,6 +435,7 @@ LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const if (skipSet.empty()) { + skipSet = LLSettingsBase::getSkipInterpolateKeys(); skipSet.insert(SETTING_RAYLEIGH_CONFIG); skipSet.insert(SETTING_MIE_CONFIG); skipSet.insert(SETTING_ABSORPTION_CONFIG); diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 6e19df0a94..3a1aec6319 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -444,11 +444,15 @@ F32 LLEnvironment::getWaterHeight() const bool LLEnvironment::getIsSunUp() const { + if (!mCurrentEnvironment || !mCurrentEnvironment->getSky()) + return false; return mCurrentEnvironment->getSky()->getIsSunUp(); } bool LLEnvironment::getIsMoonUp() const { + if (!mCurrentEnvironment || !mCurrentEnvironment->getSky()) + return false; return mCurrentEnvironment->getSky()->getIsMoonUp(); } -- cgit v1.2.3 From fa2b53385eb27fc1c42016a48267f92f7f9567a8 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 31 Aug 2018 14:25:07 -0700 Subject: Better code for finding a file when loading legacy windlights --- indra/newview/llsettingsvo.cpp | 89 ++++++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 38 deletions(-) (limited to 'indra') diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 12f487398f..6426e95f6c 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -67,7 +67,7 @@ namespace { LLSD ensure_array_4(LLSD in, F32 fill); - LLSD read_legacy_preset_data(const std::string& path); + LLSD read_legacy_preset_data(const std::string &name, const std::string& path); //------------------------------------------------------------------------- class LLSettingsInventoryCB : public LLInventoryCallback @@ -440,30 +440,13 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n return skyp; } -namespace -{ - // This is a disturbing hack - std::string legacy_name_to_filename(const std::string &name) - { - std::string fixedname(LLURI::escape(name)); - - boost::algorithm::replace_all(fixedname, "-", "%2D"); - return fixedname; - } -} - LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPresetFile(const std::string &name, const std::string &path) { - std::string full_path(path); - std::string full_name(legacy_name_to_filename(name)); - full_name += ".xml"; - - gDirUtilp->append(full_path, full_name); - LLSD legacy_data = read_legacy_preset_data(full_path); + LLSD legacy_data = read_legacy_preset_data(name, path); if (!legacy_data) { - LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << full_path << LL_ENDL; + LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << path << LL_ENDL; return ptr_t(); } @@ -707,16 +690,11 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPresetFile(const std::string &name, const std::string &path) { - std::string full_path(path); - std::string full_name(legacy_name_to_filename(name)); - full_name += ".xml"; - - gDirUtilp->append(full_path, full_name); - LLSD legacy_data = read_legacy_preset_data(full_path); + LLSD legacy_data = read_legacy_preset_data(name, path); if (!legacy_data) { - LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << full_path << LL_ENDL; + LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << path << LL_ENDL; return ptr_t(); } @@ -961,16 +939,11 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPresetFile(const std::string &name, const std::string &path) { - std::string full_path(path); - std::string full_name(legacy_name_to_filename(name)); - full_name += ".xml"; - - gDirUtilp->append(full_path, full_name); - LLSD legacy_data = read_legacy_preset_data(full_path); + LLSD legacy_data = read_legacy_preset_data(name, path); if (!legacy_data) { - LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << full_path << LL_ENDL; + LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << path << LL_ENDL; return ptr_t(); } @@ -1261,15 +1234,55 @@ namespace return out; } + // This is a disturbing hack + std::string legacy_name_to_filename(const std::string &name, bool convertdash = false) + { + std::string fixedname(LLURI::escape(name)); + + if (convertdash) + boost::algorithm::replace_all(fixedname, "-", "%2D"); + + return fixedname; + } + //--------------------------------------------------------------------- - LLSD read_legacy_preset_data(const std::string& path) + LLSD read_legacy_preset_data(const std::string &name, const std::string& path) { llifstream xml_file; -// std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true)); - xml_file.open(path.c_str()); + std::string full_path(path); + std::string full_name(name); + full_name += ".xml"; + gDirUtilp->append(full_path, full_name); + + xml_file.open(full_path.c_str()); if (!xml_file) - return LLSD(); + { + std::string bad_path(full_path); + full_path = path; + full_name = legacy_name_to_filename(name); + full_name += ".xml"; + gDirUtilp->append(full_path, full_name); + + LL_INFOS("LEGACYSETTING") << "Could not open \"" << bad_path << "\" trying escaped \"" << full_path << "\"" << LL_ENDL; + + xml_file.open(full_path.c_str()); + if (!xml_file) + { + LL_WARNS("LEGACYSETTING") << "Unable to open legacy windlight \"" << name << "\" from " << path << LL_ENDL; + + full_path = path; + full_name = legacy_name_to_filename(name, true); + full_name += ".xml"; + gDirUtilp->append(full_path, full_name); + xml_file.open(full_path.c_str()); + if (!xml_file) + { + LL_WARNS("LEGACYSETTING") << "Unable to open legacy windlight \"" << name << "\" from " << path << LL_ENDL; + return LLSD(); + } + } + } LLSD params_data; LLPointer parser = new LLSDXMLParser(); -- cgit v1.2.3 From a32a4dc6369dd076eb75e648674843bd16a9258e Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 3 Sep 2018 15:20:53 +0300 Subject: MAINT-9068 FIXED EEP closing Day Cycle editor by clicking Cancel makes the environment static --- indra/newview/llfloatereditextdaycycle.cpp | 7 +++++-- indra/newview/llfloaterfixedenvironment.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 6abb698785..a1689ed04c 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -343,8 +343,11 @@ void LLFloaterEditExtDayCycle::onClose(bool app_quitting) void LLFloaterEditExtDayCycle::onFocusReceived() { - updateEditEnvironment(); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); + if (isInVisibleChain()) + { + updateEditEnvironment(); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); + } } void LLFloaterEditExtDayCycle::onFocusLost() diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index ece4898935..82f056710e 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -147,8 +147,11 @@ void LLFloaterFixedEnvironment::onClose(bool app_quitting) void LLFloaterFixedEnvironment::onFocusReceived() { - updateEditEnvironment(); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); + if (isInVisibleChain()) + { + updateEditEnvironment(); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); + } } void LLFloaterFixedEnvironment::onFocusLost() -- cgit v1.2.3 From a4c49904c67e123df0d8e1f68714cf13acfa1ffc Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 3 Sep 2018 19:32:22 +0300 Subject: MAINT-8989 Menu updates button instead of executing command --- indra/newview/llfloatereditextdaycycle.cpp | 2 +- indra/newview/llfloaterfixedenvironment.cpp | 2 +- indra/newview/llflyoutcombobtn.cpp | 36 ++++++++++++--- indra/newview/llflyoutcombobtn.h | 8 +++- .../default/xui/en/floater_edit_ext_day_cycle.xml | 2 +- .../skins/default/xui/en/menu_save_settings.xml | 54 ++++++++++++++-------- 6 files changed, 76 insertions(+), 28 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 6abb698785..f8c6e135c0 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -173,7 +173,7 @@ BOOL LLFloaterEditExtDayCycle::postBuild() mImportButton = getChild(BTN_IMPORT, true); mLoadFrame = getChild(BTN_LOADFRAME, true); - mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BTN_SAVE, BTN_FLYOUT, XML_FLYOUTMENU_FILE); + mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BTN_SAVE, BTN_FLYOUT, XML_FLYOUTMENU_FILE, false); mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); getChild(BTN_CANCEL, true)->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onClickCloseBtn(); }); diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index ece4898935..3fc5a03d3a 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -108,7 +108,7 @@ BOOL LLFloaterFixedEnvironment::postBuild() getChild(BUTTON_NAME_CANCEL)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onClickCloseBtn(); }); getChild(BUTTON_NAME_LOAD)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonLoad(); }); - mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BUTTON_NAME_COMMIT, BUTTON_NAME_FLYOUT, XML_FLYOUTMENU_FILE); + mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BUTTON_NAME_COMMIT, BUTTON_NAME_FLYOUT, XML_FLYOUTMENU_FILE, false); mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); mFlyoutControl->setMenuItemVisible(ACTION_COMMIT, false); diff --git a/indra/newview/llflyoutcombobtn.cpp b/indra/newview/llflyoutcombobtn.cpp index d1a8b46c92..b008ee13be 100644 --- a/indra/newview/llflyoutcombobtn.cpp +++ b/indra/newview/llflyoutcombobtn.cpp @@ -29,14 +29,21 @@ #include "llflyoutcombobtn.h" #include "llviewermenu.h" -LLFlyoutComboBtnCtrl::LLFlyoutComboBtnCtrl(LLPanel* parent, const std::string &action_button, const std::string &flyout_button, const std::string &menu_file) : - mParent(parent), +LLFlyoutComboBtnCtrl::LLFlyoutComboBtnCtrl(LLPanel* parent, + const std::string &action_button, + const std::string &flyout_button, + const std::string &menu_file, + bool apply_immediately) : + mParent(parent), mActionButton(action_button), - mFlyoutButton(flyout_button) + mFlyoutButton(flyout_button), + mApplyImmediately(apply_immediately) { - // register action mapping before creating menu - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar; + // register action mapping before creating menu + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar; save_registar.add("FlyoutCombo.Button.Action", [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutItemSelected(ctrl, data); }); + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enabled_rgistar; + enabled_rgistar.add("FlyoutCombo.Button.Check", [this](LLUICtrl *ctrl, const LLSD &data) { return onFlyoutItemCheck(ctrl, data); }); mParent->childSetAction(flyout_button, [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutButton(ctrl, data); }); mParent->childSetAction(action_button, [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutAction(ctrl, data); }); @@ -119,7 +126,24 @@ void LLFlyoutComboBtnCtrl::onFlyoutItemSelected(LLUICtrl *ctrl, const LLSD &data LLMenuItemGL *pmenuitem = static_cast(ctrl); setSelectedItem(pmenuitem); - onFlyoutAction(pmenuitem, data); + if (mApplyImmediately) + { + onFlyoutAction(pmenuitem, data); + } +} + +bool LLFlyoutComboBtnCtrl::onFlyoutItemCheck(LLUICtrl *ctrl, const LLSD &data) +{ + if (mApplyImmediately) + { + return false; + } + else + { + LLMenuItemGL *pmenuitem = static_cast(ctrl); + + return pmenuitem->getName() == mSelectedName; + } } void LLFlyoutComboBtnCtrl::onFlyoutAction(LLUICtrl *ctrl, const LLSD &data) diff --git a/indra/newview/llflyoutcombobtn.h b/indra/newview/llflyoutcombobtn.h index 741ad03a37..b0dd4abadf 100644 --- a/indra/newview/llflyoutcombobtn.h +++ b/indra/newview/llflyoutcombobtn.h @@ -37,7 +37,11 @@ class LLFlyoutComboBtnCtrl { LOG_CLASS(LLFlyoutComboBtnCtrl); public: - LLFlyoutComboBtnCtrl(LLPanel* parent, const std::string &action_button, const std::string &flyout_button, const std::string &menu_file); + LLFlyoutComboBtnCtrl(LLPanel* parent, + const std::string &action_button, + const std::string &flyout_button, + const std::string &menu_file, + bool apply_immediately = true); void setMenuItemEnabled(const std::string &item, bool enabled); void setShownBtnEnabled(bool enabled); @@ -52,6 +56,7 @@ public: protected: void onFlyoutButton(LLUICtrl *, const LLSD &); void onFlyoutItemSelected(LLUICtrl *, const LLSD &); + bool onFlyoutItemCheck(LLUICtrl *, const LLSD &); void onFlyoutAction(LLUICtrl *, const LLSD &); void setSelectedItem(LLMenuItemGL *pitem); @@ -63,6 +68,7 @@ private: std::string mFlyoutButton; std::string mSelectedName; + bool mApplyImmediately; LLUICtrl::commit_signal_t mActionSignal; }; diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml index e553948d9d..c8843db28b 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml @@ -538,7 +538,7 @@ Select a key frame from the timeline above to edit settings. left="5" top_pad="0" name="save_btn" - width="150" /> + width="156" />