diff options
author | Rider Linden <rider@lindenlab.com> | 2018-06-06 17:10:58 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-06-06 17:10:58 -0700 |
commit | bff5049b9262e703c3ae583962552ea416212e8b (patch) | |
tree | 1131b55f7d14e3086841107b4ee4827eb8f683df /indra | |
parent | 5b4eb9fb93af87cbbe163ad6f87d98362a963389 (diff) |
Various editor fixes. Start adding a settings picker.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 2 | ||||
-rw-r--r-- | indra/llinventory/llsettingsbase.h | 1 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 39 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.h | 1 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 292 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.h | 55 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml | 528 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_settings_picker.xml | 11 |
9 files changed, 516 insertions, 416 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 76b1e0b2a6..b677eb36df 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -38,6 +38,8 @@ namespace const LLSettingsBase::TrackPosition BREAK_POINT = 0.5; } +const LLSettingsBase::TrackPosition LLSettingsBase::INVALID_TRACKPOS(-1.0); + //========================================================================= std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings) { diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 0920af4726..4ebec4a99d 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -61,6 +61,7 @@ public: typedef F64Seconds Seconds; typedef F64 BlendFactor; typedef F32 TrackPosition; // 32-bit as these are stored in LLSD as such + static const TrackPosition INVALID_TRACKPOS; static const std::string SETTING_ID; static const std::string SETTING_NAME; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index e000b8f03f..807d8218a1 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -530,6 +530,14 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::TrackPo CycleTrack_t::iterator iter = track.find(old_frame); if (iter != track.end()) { + /*TODO check that we are not moving too close to another keyframe */ +// CycleTrack_t::value_type existing = getSettingsNearKeyfarme(new_frame, trackno, 2.5f); +// if ((*iter).first != existing.first) +// { +// LL_WARNS("DAYCYCLE") << "Track too close to existing track. Not moving." << LL_ENDL; +// return false; +// } + LLSettingsBase::ptr_t base = iter->second; track.erase(iter); track[llclamp(new_frame, 0.0f, 1.0f)] = base; @@ -624,6 +632,37 @@ LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(const LLSettingsBase: return LLSettingsBase::ptr_t(); } +LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyfarme(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const +{ + if ((track < 0) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to get track (#" << track << ") out of range!" << LL_ENDL; + return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); + } + + if (mDayTracks[track].empty()) + { + LL_INFOS("DAYCYCLE") << "Empty track" << LL_ENDL; + return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); + } + + TrackPosition startframe(keyframe - fudge); + if (startframe < 0.0f) + startframe = 1.0f + startframe; + + CycleTrack_t::iterator it = get_wrapping_atafter(const_cast<CycleTrack_t &>(mDayTracks[track]), startframe); + + F32 dist = get_wrapping_distance(startframe, (*it).first); + + LL_WARNS("LAPRAS") << "[" << startframe << " ... " << keyframe << " -> " << (*it).first << "@" << dist << LL_ENDL; + + + if (dist <= (fudge * 2.0f)) + return (*it); + + return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); +} + void LLSettingsDay::clearTrack(S32 track) { if ((track < 0) || (track >= TRACK_MAX)) diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index cc6e27b296..5aa6e91183 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -100,6 +100,7 @@ public: LLSettingsSkyPtr_t getSkyAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const; void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::TrackPosition& keyframe, S32 track); LLSettingsBase::ptr_t getSettingsAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const; + CycleTrack_t::value_type getSettingsNearKeyfarme(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const; void clearTrack(S32 track); //--------------------------------------------------------------------- diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 34e49c73d0..506e03fddc 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -68,6 +68,31 @@ namespace { "sky4_track", }; + const std::string ICN_LOCK_EDIT("icn_lock_edit"); + const std::string BTN_SAVE("save_btn"); + const std::string BTN_FLYOUT("btn_flyout"); + const std::string BTN_CANCEL("cancel_btn"); + const std::string BTN_ADDFRAME("add_frame"); + const std::string BTN_DELFRAME("delete_frame"); + const std::string BTN_IMPORT("btn_import"); + const std::string BTN_LOADFRAME("btn_load_frame"); + const std::string SLDR_TIME("WLTimeSlider"); + const std::string SLDR_KEYFRAMES("WLDayCycleFrames"); + const std::string VIEW_SKY_SETTINGS("frame_settings_sky"); + const std::string VIEW_WATER_SETTINGS("frame_settings_water"); + const std::string LBL_CURRENT_TIME("current_time"); + const std::string TXT_DAY_NAME("day_cycle_name"); + const std::string TABS_SKYS("sky_tabs"); + const std::string TABS_WATER("water_tabs"); + + const std::string EVNT_DAYTRACK("DayCycle.Track"); + const std::string EVNT_PLAY("DayCycle.PlayActions"); + + const std::string ACTION_PLAY("play"); + const std::string ACTION_PAUSE("pause"); + const std::string ACTION_FORWARD("forward"); + const std::string ACTION_BACK("back"); + // For flyout const std::string XML_FLYOUTMENU_FILE("menu_save_settings.xml"); // From menu_save_settings.xml, consider moving into flyout since it should be supported by flyout either way @@ -90,16 +115,16 @@ const std::string LLFloaterEditExtDayCycle::KEY_DAY_LENGTH("day_length"); //========================================================================= LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) : LLFloater(key), - mFlyoutControl(NULL), - mCancelButton(NULL), + mFlyoutControl(nullptr), mDayLength(0), mCurrentTrack(4), - mTimeSlider(NULL), - mFramesSlider(NULL), - mCurrentTimeLabel(NULL), + mTimeSlider(nullptr), + mFramesSlider(nullptr), + mCurrentTimeLabel(nullptr), mImportButton(nullptr), mInventoryId(), mInventoryItem(nullptr), + mLoadFrame(nullptr), mSkyBlender(), mWaterBlender(), mScratchSky(), @@ -107,8 +132,8 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) : mIsPlaying(false) { - mCommitCallbackRegistrar.add("DayCycle.Track", [this](LLUICtrl *ctrl, const LLSD &data) { onTrackSelectionCallback(data); }); - mCommitCallbackRegistrar.add("DayCycle.PlayActions", [this](LLUICtrl *ctrl, const LLSD &data) { onPlayActionCallback(data); }); + mCommitCallbackRegistrar.add(EVNT_DAYTRACK, [this](LLUICtrl *ctrl, const LLSD &data) { onTrackSelectionCallback(data); }); + mCommitCallbackRegistrar.add(EVNT_PLAY, [this](LLUICtrl *ctrl, const LLSD &data) { onPlayActionCallback(data); }); mScratchSky = LLSettingsVOSky::buildDefaultSky(); mScratchWater = LLSettingsVOWater::buildDefaultWater(); @@ -124,26 +149,27 @@ LLFloaterEditExtDayCycle::~LLFloaterEditExtDayCycle() // virtual BOOL LLFloaterEditExtDayCycle::postBuild() { - getChild<LLLineEditor>("day_cycle_name")->setKeystrokeCallback(boost::bind(&LLFloaterEditExtDayCycle::onCommitName, this, _1, _2), NULL); - - mCancelButton = getChild<LLButton>("cancel_btn", true); - mAddFrameButton = getChild<LLButton>("add_frame", true); - mDeleteFrameButton = getChild<LLButton>("delete_frame", true); - mTimeSlider = getChild<LLMultiSliderCtrl>("WLTimeSlider"); - mFramesSlider = getChild<LLMultiSliderCtrl>("WLDayCycleFrames"); - mSkyTabLayoutContainer = getChild<LLView>("frame_settings_sky", true); - mWaterTabLayoutContainer = getChild<LLView>("frame_settings_water", true); - mCurrentTimeLabel = getChild<LLTextBox>("current_time", true); - mImportButton = getChild<LLButton>("btn_import", true); - - mFlyoutControl = new LLFlyoutComboBtnCtrl(this, "save_btn", "btn_flyout", XML_FLYOUTMENU_FILE); + getChild<LLLineEditor>(TXT_DAY_NAME)->setKeystrokeCallback(boost::bind(&LLFloaterEditExtDayCycle::onCommitName, this, _1, _2), NULL); + + mAddFrameButton = getChild<LLButton>(BTN_ADDFRAME, true); + mDeleteFrameButton = getChild<LLButton>(BTN_DELFRAME, true); + mTimeSlider = getChild<LLMultiSliderCtrl>(SLDR_TIME); + mFramesSlider = getChild<LLMultiSliderCtrl>(SLDR_KEYFRAMES); + mSkyTabLayoutContainer = getChild<LLView>(VIEW_SKY_SETTINGS, true); + mWaterTabLayoutContainer = getChild<LLView>(VIEW_WATER_SETTINGS, true); + mCurrentTimeLabel = getChild<LLTextBox>(LBL_CURRENT_TIME, true); + mImportButton = getChild<LLButton>(BTN_IMPORT, true); + mLoadFrame = getChild<LLButton>(BTN_LOADFRAME, true); + + mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BTN_SAVE, BTN_FLYOUT, XML_FLYOUTMENU_FILE); mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); - mCancelButton->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onBtnCancel(); }); + getChild<LLButton>(BTN_CANCEL, true)->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onBtnCancel(); }); mTimeSlider->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onTimeSliderMoved(); }); mAddFrameButton->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onAddTrack(); }); mDeleteFrameButton->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onRemoveTrack(); }); mImportButton->setCommitCallback([this](LLUICtrl *, const LLSD &){ onButtonImport(); }); + mLoadFrame->setCommitCallback([this](LLUICtrl *, const LLSD &){ onButtonLoadFrame(); }); mFramesSlider->setCommitCallback([this](LLUICtrl *, const LLSD &data) { onFrameSliderCallback(data); }); mFramesSlider->setDoubleClickCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask){ onFrameSliderDoubleClick(x, y, mask); }); @@ -162,7 +188,6 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT); LLEnvironment::instance().updateEnvironment(); - mEditingEnv = LLEnvironment::ENV_NONE; mEditDay.reset(); if (key.has(KEY_INVENTORY_ID)) { @@ -259,7 +284,7 @@ void LLFloaterEditExtDayCycle::refresh() { if (mEditDay) { - LLLineEditor* name_field = getChild<LLLineEditor>("day_cycle_name"); + LLLineEditor* name_field = getChild<LLLineEditor>(TXT_DAY_NAME); name_field->setText(mEditDay->getName()); } @@ -308,29 +333,35 @@ void LLFloaterEditExtDayCycle::onButtonImport() doImportFromDisk(); } +void LLFloaterEditExtDayCycle::onButtonLoadFrame() +{ + +} + void LLFloaterEditExtDayCycle::onAddTrack() { // todo: 2.5% safety zone std::string sldr_key = mFramesSlider->getCurSlider(); LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); LLSettingsBase::ptr_t setting; - if (mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack) != nullptr) + if ((mEditDay->getSettingsNearKeyfarme(frame, mCurrentTrack, FRAME_SLOP_FACTOR)).second) { + LL_WARNS("SETTINGS") << "Attempt to add new frame too close to existing frame." << LL_ENDL; return; } if (mCurrentTrack == LLSettingsDay::TRACK_WATER) { // scratch water should always have the current water settings. - setting = mScratchWater->buildClone(); - LLSettingsWater::ptr_t water((LLSettingsWater*)setting.get()); - mEditDay->setWaterAtKeyframe(water, frame); + LLSettingsWater::ptr_t water(mScratchWater->buildClone()); + setting = water; + mEditDay->setWaterAtKeyframe( std::static_pointer_cast<LLSettingsWater>(setting), frame); } else { // scratch sky should always have the current sky settings. - setting = mScratchSky->buildClone(); - LLSettingsSky::ptr_t sky((LLSettingsSky*)setting.get()); + LLSettingsSky::ptr_t sky(mScratchSky->buildClone()); + setting = sky; mEditDay->setSkyAtKeyframe(sky, frame, mCurrentTrack); } @@ -364,22 +395,22 @@ void LLFloaterEditExtDayCycle::onPlayActionCallback(const LLSD& user_data) { std::string action = user_data.asString(); F32 frame = mTimeSlider->getCurSliderValue(); - if (action == "play") + if (action == ACTION_PLAY) { startPlay(); } - else if (action == "pause") + else if (action == ACTION_PAUSE) { stopPlay(); } else if (mSliderKeyMap.size() != 0) { F32 new_frame = 0; - if (action == "forward") + if (action == ACTION_FORWARD) { new_frame = mEditDay->getUpperBoundFrame(mCurrentTrack, frame); } - else if (action == "back") + else if (action == ACTION_BACK) { new_frame = mEditDay->getLowerBoundFrame(mCurrentTrack, frame - (mTimeSlider->getIncrement() / 2)); } @@ -397,6 +428,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data) LL_WARNS("LAPRAS") << "Current slider set to \"" << curslider << "\"" << LL_ENDL; F32 sliderpos(0.0); + if (curslider.empty()) { S32 x(0), y(0); @@ -407,78 +439,55 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data) else { sliderpos = mFramesSlider->getCurSliderValue(); + + keymap_t::iterator it = mSliderKeyMap.find(curslider); + if (it != mSliderKeyMap.end()) + { + // if (gKeyboard->currentMask(TRUE) == MASK_SHIFT) + // { + // LL_DEBUGS() << "Copying frame from " << iter->second.mFrame << " to " << new_frame << LL_ENDL; + // LLSettingsBase::ptr_t new_settings; + // + // // mEditDay still remembers old position, add copy at new position + // if (mCurrentTrack == LLSettingsDay::TRACK_WATER) + // { + // LLSettingsWaterPtr_t water_ptr = std::dynamic_pointer_cast<LLSettingsWater>(iter->second.pSettings)->buildClone(); + // mEditDay->setWaterAtKeyframe(water_ptr, new_frame); + // new_settings = water_ptr; + // } + // else + // { + // LLSettingsSkyPtr_t sky_ptr = std::dynamic_pointer_cast<LLSettingsSky>(iter->second.pSettings)->buildClone(); + // mEditDay->setSkyAtKeyframe(sky_ptr, new_frame, mCurrentTrack); + // new_settings = sky_ptr; + // } + // + // // mSliderKeyMap still remembers old position, for simplicity, just move it to be identical to slider + // F32 old_frame = iter->second.mFrame; + // iter->second.mFrame = new_frame; + // // slider already moved old frame, create new one in old place + // addSliderFrame(old_frame, new_settings, false /*because we are going to reselect new one*/); + // // reselect new frame + // mFramesSlider->setCurSlider(iter->first); + // } + // else + // { + LL_WARNS("LAPRAS") << "Moving frame from " << (*it).second.mFrame << " to " << sliderpos << LL_ENDL; + if (mEditDay->moveTrackKeyframe(mCurrentTrack, (*it).second.mFrame, sliderpos)) + { + (*it).second.mFrame = sliderpos; + } + else + { + mFramesSlider->setCurSliderValue((*it).second.mFrame); + } + } + } + + mTimeSlider->setCurSliderValue(sliderpos); -// if (mSliderKeyMap.size() == 0) -// { -// mLastFrameSlider.clear(); -// return; -// } -// // make sure we have a slider -// const std::string& cur_sldr = mFramesSlider->getCurSlider(); -// if (cur_sldr.empty()) -// { -// mLastFrameSlider.clear(); -// return; -// } -// -// F32 new_frame = mFramesSlider->getCurSliderValue(); -// // todo: add safety 2.5% checks -// keymap_t::iterator iter = mSliderKeyMap.find(cur_sldr); -// if (iter != mSliderKeyMap.end() && mEditDay->getSettingsAtKeyframe(new_frame, mCurrentTrack).get() == NULL) -// { -// if (gKeyboard->currentMask(TRUE) == MASK_SHIFT) -// { -// LL_DEBUGS() << "Copying frame from " << iter->second.mFrame << " to " << new_frame << LL_ENDL; -// LLSettingsBase::ptr_t new_settings; -// -// // mEditDay still remembers old position, add copy at new position -// if (mCurrentTrack == LLSettingsDay::TRACK_WATER) -// { -// LLSettingsWaterPtr_t water_ptr = std::dynamic_pointer_cast<LLSettingsWater>(iter->second.pSettings)->buildClone(); -// mEditDay->setWaterAtKeyframe(water_ptr, new_frame); -// new_settings = water_ptr; -// } -// else -// { -// LLSettingsSkyPtr_t sky_ptr = std::dynamic_pointer_cast<LLSettingsSky>(iter->second.pSettings)->buildClone(); -// mEditDay->setSkyAtKeyframe(sky_ptr, new_frame, mCurrentTrack); -// new_settings = sky_ptr; -// } -// -// // mSliderKeyMap still remembers old position, for simplicity, just move it to be identical to slider -// F32 old_frame = iter->second.mFrame; -// iter->second.mFrame = new_frame; -// // slider already moved old frame, create new one in old place -// addSliderFrame(old_frame, new_settings, false /*because we are going to reselect new one*/); -// // reselect new frame -// mFramesSlider->setCurSlider(iter->first); -// } -// else -// { -// LL_DEBUGS() << "Moving frame from " << iter->second.mFrame << " to " << new_frame << LL_ENDL; -// if (mEditDay->moveTrackKeyframe(mCurrentTrack, iter->second.mFrame, new_frame)) -// { -// iter->second.mFrame = new_frame; -// } -// } -// } -// -// mTimeSlider->setCurSliderValue(new_frame); -// -// if (mLastFrameSlider != cur_sldr) -// { -// // technically should not be possible for both frame and slider to change -// // but for safety, assume that they can change independently and both -// mLastFrameSlider = cur_sldr; -// updateTabs(); -// } -// else -// { -// updateButtons(); -// updateTimeAndLabel(); -// } } void LLFloaterEditExtDayCycle::onFrameSliderDoubleClick(S32 x, S32 y, MASK mask) @@ -592,7 +601,7 @@ void LLFloaterEditExtDayCycle::updateTabs() void LLFloaterEditExtDayCycle::updateWaterTabs(const LLSettingsWaterPtr_t &p_water) { - LLView* tab_container = mWaterTabLayoutContainer->getChild<LLView>("water_tabs"); //can't extract panels directly, since it is in 'tuple' + LLView* tab_container = mWaterTabLayoutContainer->getChild<LLView>(TABS_WATER); //can't extract panels directly, since it is in 'tuple' LLPanelSettingsWaterMainTab* panel = dynamic_cast<LLPanelSettingsWaterMainTab*>(tab_container->getChildView("water_panel")); if (panel) { @@ -602,7 +611,7 @@ void LLFloaterEditExtDayCycle::updateWaterTabs(const LLSettingsWaterPtr_t &p_wat void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky) { - LLView* tab_container = mSkyTabLayoutContainer->getChild<LLView>("sky_tabs"); //can't extract panels directly, since they are in 'tuple' + LLView* tab_container = mSkyTabLayoutContainer->getChild<LLView>(TABS_SKYS); //can't extract panels directly, since they are in 'tuple' LLPanelSettingsSky* panel; panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("atmosphere_panel")); @@ -624,7 +633,7 @@ void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky) void LLFloaterEditExtDayCycle::setWaterTabsEnabled(BOOL enable) { - LLView* tab_container = mWaterTabLayoutContainer->getChild<LLView>("water_tabs"); //can't extract panels directly, since it is in 'tuple' + LLView* tab_container = mWaterTabLayoutContainer->getChild<LLView>(TABS_WATER); //can't extract panels directly, since it is in 'tuple' LLPanelSettingsWaterMainTab* panel = dynamic_cast<LLPanelSettingsWaterMainTab*>(tab_container->getChildView("water_panel")); if (panel) { @@ -635,7 +644,7 @@ void LLFloaterEditExtDayCycle::setWaterTabsEnabled(BOOL enable) void LLFloaterEditExtDayCycle::setSkyTabsEnabled(BOOL enable) { - LLView* tab_container = mSkyTabLayoutContainer->getChild<LLView>("sky_tabs"); //can't extract panels directly, since they are in 'tuple' + LLView* tab_container = mSkyTabLayoutContainer->getChild<LLView>(TABS_SKYS); //can't extract panels directly, since they are in 'tuple' LLPanelSettingsSky* panel; panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("atmosphere_panel")); @@ -662,7 +671,7 @@ void LLFloaterEditExtDayCycle::updateButtons() { LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); LLSettingsBase::ptr_t settings = mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack); - bool can_add = settings.get() == NULL; + bool can_add = static_cast<bool>(settings); mAddFrameButton->setEnabled(can_add); mDeleteFrameButton->setEnabled(!can_add); } @@ -815,7 +824,6 @@ void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::pt void LLFloaterEditExtDayCycle::loadLiveEnvironment(LLEnvironment::EnvSelection_t env) { - mEditingEnv = env; for (S32 idx = static_cast<S32>(env); idx <= LLEnvironment::ENV_DEFAULT; ++idx) { LLSettingsDay::ptr_t day = LLEnvironment::instance().getEnvironmentDay(static_cast<LLEnvironment::EnvSelection_t>(idx)); @@ -855,75 +863,73 @@ void LLFloaterEditExtDayCycle::updateEditEnvironment(void) void LLFloaterEditExtDayCycle::syncronizeTabs() { // This should probably get moved into "updateTabs" - LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); bool canedit(false); - LLSettingsWater::ptr_t psettingWater; - LLTabContainer * tabs = mWaterTabLayoutContainer->getChild<LLTabContainer>("water_tabs"); + LLSettingsWater::ptr_t psettingW; + LLTabContainer * tabs = mWaterTabLayoutContainer->getChild<LLTabContainer>(TABS_WATER); if (mCurrentTrack == LLSettingsDay::TRACK_WATER) { - canedit = true; - psettingWater = std::static_pointer_cast<LLSettingsWater>(mEditDay->getSettingsAtKeyframe(frame, LLSettingsDay::TRACK_WATER)); - if (!psettingWater) + canedit = !mIsPlaying; + LLSettingsDay::CycleTrack_t::value_type found = mEditDay->getSettingsNearKeyfarme(frame, LLSettingsDay::TRACK_WATER, FRAME_SLOP_FACTOR); + psettingW = std::static_pointer_cast<LLSettingsWater>(found.second); + if (!psettingW) { canedit = false; - psettingWater = mScratchWater; + psettingW = mScratchWater; } + + getChild<LLUICtrl>(ICN_LOCK_EDIT)->setVisible(!canedit); } else { - psettingWater = mScratchWater; + psettingW = mScratchWater; } - S32 count = tabs->getTabCount(); - for (S32 idx = 0; idx < count; ++idx) - { - LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tabs->getPanelByIndex(idx)); - if (panel) - { - panel->setSettings(psettingWater); - panel->setEnabled(canedit); - panel->setAllChildrenEnabled(canedit); - panel->refresh(); - } - } - - LLSettingsSky::ptr_t psettingSky; + setTabsData(tabs, psettingW, canedit); + LLSettingsSky::ptr_t psettingS; canedit = false; - tabs = mSkyTabLayoutContainer->getChild<LLTabContainer>("sky_tabs"); + tabs = mSkyTabLayoutContainer->getChild<LLTabContainer>(TABS_SKYS); if (mCurrentTrack != LLSettingsDay::TRACK_WATER) { - canedit = true; - psettingSky = std::static_pointer_cast<LLSettingsSky>(mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack)); - if (!psettingSky) + canedit = !mIsPlaying; + LLSettingsDay::CycleTrack_t::value_type found = mEditDay->getSettingsNearKeyfarme(frame, mCurrentTrack, FRAME_SLOP_FACTOR); + psettingS = std::static_pointer_cast<LLSettingsSky>(found.second); + if (!psettingS) { canedit = false; - psettingSky = mScratchSky; + psettingS = mScratchSky; } + + getChild<LLUICtrl>(ICN_LOCK_EDIT)->setVisible(!canedit); } else { - psettingSky = mScratchSky; + psettingS = mScratchSky; } - count = tabs->getTabCount(); + setTabsData(tabs, psettingS, canedit); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, psettingS, psettingW); +} + +void LLFloaterEditExtDayCycle::setTabsData(LLTabContainer * tabcontainer, const LLSettingsBase::ptr_t &settings, bool editable) +{ + S32 count = tabcontainer->getTabCount(); for (S32 idx = 0; idx < count; ++idx) { - LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tabs->getPanelByIndex(idx)); + LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tabcontainer->getPanelByIndex(idx)); if (panel) { - panel->setSettings(psettingSky); - panel->setEnabled(canedit); - panel->setAllChildrenEnabled(canedit); + panel->setSettings(settings); + panel->setEnabled(editable); panel->refresh(); + panel->setAllChildrenEnabled(editable); } } - - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, psettingSky, psettingWater); } + void LLFloaterEditExtDayCycle::reblendSettings() { F64 position = mTimeSlider->getCurSliderValue(); diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index fc0b4f5106..ea9f1e1882 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -40,6 +40,7 @@ class LLLineEditor; class LLMultiSliderCtrl; class LLTextBox; class LLTimeCtrl; +class LLTabContainer; class LLInventoryItem; @@ -83,6 +84,7 @@ private: void onButtonApply(LLUICtrl *ctrl, const LLSD &data); void onBtnCancel(); void onButtonImport(); + void onButtonLoadFrame(); void onAddTrack(); void onRemoveTrack(); void onCommitName(class LLLineEditor* caller, void* user_data); @@ -130,46 +132,41 @@ private: void syncronizeTabs(); void reblendSettings(); - // **RIDER** + void setTabsData(LLTabContainer * tabcontainer, const LLSettingsBase::ptr_t &settings, bool editable); // play functions void startPlay(); void stopPlay(); static void onIdlePlay(void *); - LLSettingsDay::ptr_t mEditDay; // edited copy - LLSettingsDay::Seconds mDayLength; - U32 mCurrentTrack; - std::string mLastFrameSlider; - - LLButton* mCancelButton; - LLButton* mAddFrameButton; - LLButton* mDeleteFrameButton; - LLButton* mImportButton; - - LLMultiSliderCtrl* mTimeSlider; - LLMultiSliderCtrl* mFramesSlider; - LLView* mSkyTabLayoutContainer; - LLView* mWaterTabLayoutContainer; - LLTextBox* mCurrentTimeLabel; + LLSettingsDay::ptr_t mEditDay; // edited copy + LLSettingsDay::Seconds mDayLength; + U32 mCurrentTrack; + std::string mLastFrameSlider; + + LLButton* mAddFrameButton; + LLButton* mDeleteFrameButton; + LLButton* mImportButton; + LLButton* mLoadFrame; + LLMultiSliderCtrl* mTimeSlider; + LLMultiSliderCtrl* mFramesSlider; + LLView* mSkyTabLayoutContainer; + LLView* mWaterTabLayoutContainer; + LLTextBox* mCurrentTimeLabel; + LLUUID mInventoryId; + LLInventoryItem * mInventoryItem; + LLFlyoutComboBtnCtrl * mFlyoutControl; - // **RIDER** - LLUUID mInventoryId; - LLInventoryItem * mInventoryItem; - LLEnvironment::EnvSelection_t mEditingEnv; LLTrackBlenderLoopingManual::ptr_t mSkyBlender; LLTrackBlenderLoopingManual::ptr_t mWaterBlender; - LLSettingsSky::ptr_t mScratchSky; - LLSettingsWater::ptr_t mScratchWater; - // **RIDER** - - LLFlyoutComboBtnCtrl * mFlyoutControl; + LLSettingsSky::ptr_t mScratchSky; + LLSettingsWater::ptr_t mScratchWater; - LLFrameTimer mPlayTimer; - F32 mPlayStartFrame; // an env frame - bool mIsPlaying; + LLFrameTimer mPlayTimer; + F32 mPlayStartFrame; // an env frame + bool mIsPlaying; - edit_commit_signal_t mCommitSignal; + edit_commit_signal_t mCommitSignal; // For map of sliders to parameters class FrameData diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 528987f3bf..78c868c6f4 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -253,6 +253,9 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInspect>); LLFloaterReg::add("item_properties", "floater_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterItemProperties>); + +// LLFloaterReg::add("floater_settings_picker", "floater_settings_picker.xml" , (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterItemProperties>); + LLInspectAvatarUtil::registerFloater(); LLInspectGroupUtil::registerFloater(); LLInspectObjectUtil::registerFloater(); 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 86c580f354..a1140b2532 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 @@ -41,7 +41,7 @@ left="15" top="5" width="105"> - Day Cycle Name: + Day Cycle Name: </text> <line_editor follows="top|left" @@ -89,8 +89,8 @@ name="sky4_track" width="100"> <button.commit_callback - function="DayCycle.Track" - parameter="4" /> + function="DayCycle.Track" + parameter="4" /> </button> <button follows="left|top" @@ -102,8 +102,8 @@ name="sky3_track" width="100"> <button.commit_callback - function="DayCycle.Track" - parameter="3" /> + function="DayCycle.Track" + parameter="3" /> </button> <button follows="left|top" @@ -115,8 +115,8 @@ name="sky2_track" width="100"> <button.commit_callback - function="DayCycle.Track" - parameter="2" /> + function="DayCycle.Track" + parameter="2" /> </button> <button follows="left|top" @@ -128,8 +128,8 @@ name="sky1_track" width="100"> <button.commit_callback - function="DayCycle.Track" - parameter="1" /> + function="DayCycle.Track" + parameter="1" /> </button> <button follows="left|top" @@ -141,8 +141,8 @@ name="water_track" width="100"> <button.commit_callback - function="DayCycle.Track" - parameter="0" /> + function="DayCycle.Track" + parameter="0" /> </button> </panel> <panel name="timeline" @@ -154,249 +154,289 @@ min_width="595" left_pad="0" visible="true"> - <!-- Todo: These 5 tests might be subjected to a change to be dynamically generated, consider using layout_stack to get dynamic width adjustment--> + <!-- Todo: These 5 tests might be subjected to a change to be dynamically generated, consider using layout_stack to get dynamic width adjustment--> <text - follows="left|top" - height="15" - layout="topleft" - left="10" - name="p0" - top_pad="5" - value="0%[DSC]" - width="80" /> + follows="left|top" + height="15" + layout="topleft" + left="10" + name="p0" + top_pad="5" + value="0%[DSC]" + width="80" /> <text - follows="left|top|right" - height="15" - layout="topleft" - left_pad="39" - name="p1" - top_delta="0" - value="25%[DSC]" - width="80" /> + follows="left|top|right" + height="15" + layout="topleft" + left_pad="39" + name="p1" + top_delta="0" + value="25%[DSC]" + width="80" /> <text - follows="left|top|right" - height="15" - layout="topleft" - left_pad="39" - name="p2" - top_delta="0" - value="50%[DSC]" - width="80" /> + follows="left|top|right" + height="15" + layout="topleft" + left_pad="39" + name="p2" + top_delta="0" + value="50%[DSC]" + width="80" /> <text - follows="left|top|right" - height="15" - layout="topleft" - left_pad="39" - name="p3" - top_delta="0" - value="75%[DSC]" - width="80" /> + follows="left|top|right" + height="15" + layout="topleft" + left_pad="39" + name="p3" + top_delta="0" + value="75%[DSC]" + width="80" /> <text - follows="left|top|right" - height="15" - layout="topleft" - left_pad="39" - name="p4" - top_delta="0" - value="100%[DSC]" - width="80" /> + follows="left|top|right" + height="15" + layout="topleft" + left_pad="39" + name="p4" + top_delta="0" + value="100%[DSC]" + width="80" /> <multi_slider - decimal_digits="0" - draw_track="false" - follows="bottom" - height="10" - increment="0.01" - initial_value="0" - layout="topleft" - left="10" - max_sliders="1" - max_val="1" - name="WLTimeSlider" - show_text="false" - top_pad="0" - use_triangle="true" - width="525" /> + decimal_digits="0" + draw_track="false" + follows="bottom" + height="10" + increment="0.01" + initial_value="0" + layout="topleft" + left="10" + max_sliders="1" + max_val="1" + name="WLTimeSlider" + show_text="false" + top_pad="0" + use_triangle="true" + width="525" /> <multi_slider - decimal_digits="0" - follows="bottom" - height="10" - increment="0.01" - initial_value="0" - layout="topleft" - left="10" - max_sliders="20" - max_val="1" - name="WLDayCycleFrames" - show_text="false" - top_pad="15" - width="525" /> + decimal_digits="0" + follows="bottom" + height="10" + increment="0.01" + initial_value="0" + layout="topleft" + left="10" + max_sliders="20" + max_val="1" + name="WLDayCycleFrames" + show_text="false" + top_pad="15" + width="525" /> <text - follows="left|bottom" - height="20" - layout="topleft" - left_pad="0" - name="current_time" - value="[PRCNT]%[DSC]" - top_delta="-5" - width="70" /> + follows="left|bottom" + height="20" + layout="topleft" + left_pad="0" + name="current_time" + value="[PRCNT]%[DSC]" + top_delta="-5" + width="70" /> <layout_stack - name="progress_control" - follows="top|left" - height="25" - width="83" - layout="topleft" - animate="false" - left="225" - top_pad="40" - orientation="horizontal"> + name="progress_control" + follows="top|left" + height="25" + width="83" + layout="topleft" + animate="false" + left="225" + top_pad="40" + orientation="horizontal"> <layout_panel - name="skip_back" - mouse_opaque="false" - auto_resize="false" - layout="topleft" - top="0" - height="25" - min_width="25" - width="25"> + name="skip_back" + mouse_opaque="false" + auto_resize="false" + layout="topleft" + top="0" + height="25" + min_width="25" + width="25"> <button - name="skip_back_btn" - follows="top" - image_overlay="SkipBackward_Off" - image_disabled="PushButton_Disabled" - image_disabled_selected="PushButton_Disabled" - image_selected="PushButton_Selected" - image_unselected="PushButton_Off" - hover_glow_amount="0.15" - auto_resize="false" - width="25" - height="25" - layout="topleft" - tool_tip="Step back" - top="0" - left="0"> + name="skip_back_btn" + follows="top" + image_overlay="SkipBackward_Off" + image_disabled="PushButton_Disabled" + image_disabled_selected="PushButton_Disabled" + image_selected="PushButton_Selected" + image_unselected="PushButton_Off" + hover_glow_amount="0.15" + auto_resize="false" + width="25" + height="25" + layout="topleft" + tool_tip="Step back" + top="0" + left="0"> <button.commit_callback - function="DayCycle.PlayActions" - parameter="back" /> + function="DayCycle.PlayActions" + parameter="back" /> </button> </layout_panel> <layout_panel - name="play_layout" - mouse_opaque="false" - auto_resize="false" - layout="topleft" - top="0" - height="25" - min_width="25" - width="25"> + name="play_layout" + mouse_opaque="false" + auto_resize="false" + layout="topleft" + top="0" + height="25" + min_width="25" + width="25"> <button - name="play_btn" - follows="top" - image_overlay="Play_Off" - image_disabled="PushButton_Disabled" - image_disabled_selected="PushButton_Disabled" - image_selected="PushButton_Selected" - image_unselected="PushButton_Off" - hover_glow_amount="0.15" - auto_resize="false" - layout="topleft" - height="25" - width="25" - left="0" - top="0"> + name="play_btn" + follows="top" + image_overlay="Play_Off" + image_disabled="PushButton_Disabled" + image_disabled_selected="PushButton_Disabled" + image_selected="PushButton_Selected" + image_unselected="PushButton_Off" + hover_glow_amount="0.15" + auto_resize="false" + layout="topleft" + height="25" + width="25" + left="0" + top="0"> <button.commit_callback - function="DayCycle.PlayActions" - parameter="play" /> + function="DayCycle.PlayActions" + parameter="play" /> </button> </layout_panel> <layout_panel - name="pause_layout" - mouse_opaque="false" - auto_resize="false" - layout="topleft" - top="0" - height="25" - min_width="25" - width="25" - visible="false"> + name="pause_layout" + mouse_opaque="false" + auto_resize="false" + layout="topleft" + top="0" + height="25" + min_width="25" + width="25" + visible="false"> <button - name="pause_btn" - follows="top" - image_overlay="Pause_Off" - image_disabled="PushButton_Disabled" - image_disabled_selected="PushButton_Disabled" - image_selected="PushButton_Selected" - image_unselected="PushButton_Off" - hover_glow_amount="0.15" - auto_resize="false" - layout="topleft" - height="25" - width="25" - left="0" - top="0"> + name="pause_btn" + follows="top" + image_overlay="Pause_Off" + image_disabled="PushButton_Disabled" + image_disabled_selected="PushButton_Disabled" + image_selected="PushButton_Selected" + image_unselected="PushButton_Off" + hover_glow_amount="0.15" + auto_resize="false" + layout="topleft" + height="25" + width="25" + left="0" + top="0"> <button.commit_callback - function="DayCycle.PlayActions" - parameter="pause" /> + function="DayCycle.PlayActions" + parameter="pause" /> </button> </layout_panel> <layout_panel - name="skip_forward" - mouse_opaque="false" - auto_resize="false" - layout="topleft" - top="0" - height="25" - min_width="25" - width="25"> + name="skip_forward" + mouse_opaque="false" + auto_resize="false" + layout="topleft" + top="0" + height="25" + min_width="25" + width="25"> <button - name="skip_forward_btn" - follows="top" - image_overlay="SkipForward_Off" - image_disabled="PushButton_Disabled" - image_disabled_selected="PushButton_Disabled" - image_selected="PushButton_Selected" - image_unselected="PushButton_Off" - hover_glow_amount="0.15" - width="25" - height="25" - layout="topleft" - tool_tip="Step forward" - top="0"> + name="skip_forward_btn" + follows="top" + image_overlay="SkipForward_Off" + image_disabled="PushButton_Disabled" + image_disabled_selected="PushButton_Disabled" + image_selected="PushButton_Selected" + image_unselected="PushButton_Off" + hover_glow_amount="0.15" + width="25" + height="25" + layout="topleft" + tool_tip="Step forward" + top="0"> <button.commit_callback - function="DayCycle.PlayActions" - parameter="forward" /> + function="DayCycle.PlayActions" + parameter="forward" /> </button> </layout_panel> </layout_stack> <button - follows="top|left" - height="23" - width="90" - label="Add Frame" - left_pad="175" - top_delta="-12" - name="add_frame" /> + follows="top|left" + height="23" + width="90" + label="Add Frame" + left_pad="175" + top_delta="-12" + name="add_frame" /> <button - follows="left|top" - height="23" - width="90" - label="Delete Frame" - top_pad="0" - left_delta="0" - name="delete_frame" /> + follows="left|top" + height="23" + width="90" + label="Delete Frame" + top_pad="0" + left_delta="0" + name="delete_frame" /> </panel> </layout_panel> + <layout_panel name="frame_edit_controls" + auto_resize="false" + user_resize="true" + height="30" + width="700" + min_height="30" + visible="true"> + <!--bg_alpha_color="blue" + background_visible="true" --> + <icon + border="1" + bevel_style="out" + name="icn_lock_edit" + layout="bottomleft" + follows="bottom" + image_name="Locked_Icon" + bottom="4" + left="5" + height="15" + width="15" + tab_stop="false" + visible="false" + tool_tip="Select a key frame above to edit settings"/> + <button + name="btn_load_frame" + follows="top" + image_overlay="Command_Inventory_Icon" + image_disabled="PushButton_Disabled" + image_disabled_selected="PushButton_Disabled" + image_selected="PushButton_Selected" + image_unselected="PushButton_Off" + hover_glow_amount="0.15" + auto_resize="false" + layout="topleft" + height="30" + width="30" + left="25" + top="1" + tool_tip="Replace frame with settings from inventory"/> + </layout_panel> <layout_panel name="frame_settings_water" auto_resize="false" user_resize="true" - height="386" + height="351" width="700" min_height="0" visible="false"> @@ -413,20 +453,20 @@ top_pad="0" width="700"> <panel - border="true" - class="panel_settings_water" - filename="panel_settings_water.xml" - label="Water" - layout="topleft" - left_delta="0" - top_pad="5" - name="water_panel"/> + border="true" + class="panel_settings_water" + filename="panel_settings_water.xml" + label="Water" + layout="topleft" + left_delta="0" + top_pad="5" + name="water_panel"/> </tab_container> </layout_panel> <layout_panel name="frame_settings_sky" auto_resize="false" user_resize="true" - height="386" + height="351" width="700" min_height="0" visible="true"> @@ -444,32 +484,32 @@ top_pad="0" width="700"> <panel - border="true" - class="panel_settings_atmos" - filename="panel_settings_sky_atmos.xml" - label="Atmosphere & Lighting" - layout="topleft" - left_delta="0" - top_pad="5" - name="atmosphere_panel" /> + border="true" + class="panel_settings_atmos" + filename="panel_settings_sky_atmos.xml" + label="Atmosphere & Lighting" + layout="topleft" + left_delta="0" + top_pad="5" + name="atmosphere_panel" /> <panel - border="true" - class="panel_settings_cloud" - filename="panel_settings_sky_clouds.xml" - label="Clouds" - layout="topleft" - left_delta="0" - top_pad="5" - name="clouds_panel" /> + border="true" + class="panel_settings_cloud" + filename="panel_settings_sky_clouds.xml" + label="Clouds" + layout="topleft" + left_delta="0" + top_pad="5" + name="clouds_panel" /> <panel - border="true" - class="panel_settings_sunmoon" - filename="panel_settings_sky_sunmoon.xml" - label="Sun & Moon" - layout="topleft" - left_delta="0" - top_pad="5" - name="moon_panel" /> + border="true" + class="panel_settings_sunmoon" + filename="panel_settings_sky_sunmoon.xml" + label="Sun & Moon" + layout="topleft" + left_delta="0" + top_pad="5" + name="moon_panel" /> </tab_container> </layout_panel> <layout_panel name="buttons" @@ -486,7 +526,7 @@ left="5" top_pad="0" name="save_btn" - width="100" /> + width="150" /> <button follows="top|left" @@ -510,7 +550,7 @@ layout="topleft" left_pad="10" name="cancel_btn" - width="100" /> + width="150" /> </layout_panel> </layout_stack> diff --git a/indra/newview/skins/default/xui/en/floater_settings_picker.xml b/indra/newview/skins/default/xui/en/floater_settings_picker.xml new file mode 100644 index 0000000000..75bef9f680 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_settings_picker.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + height="602" + layout="topleft" + name="floater_settings_picker" + help_topic="" + save_rect="true" + title="Settings Selector" + width="705"> + +</floater> |