From 76acc754370580e7e60ac2a929e165b79c24a7c3 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 29 Jun 2011 23:48:36 +0300 Subject: STORM-1305 WIP Edit Sky floater UI changes. * Implemented new layout (made the floater smaller, moved widgets around). * Implemented new sun phase slider, bound to 24h time. --- indra/newview/llfloatereditsky.cpp | 55 ++++- indra/newview/llfloatereditsky.h | 1 + .../default/xui/en/floater_edit_sky_preset.xml | 222 +++++++++++---------- 3 files changed, 173 insertions(+), 105 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp index 60b6fd7cf1..96289be31e 100644 --- a/indra/newview/llfloatereditsky.cpp +++ b/indra/newview/llfloatereditsky.cpp @@ -32,10 +32,12 @@ #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcombobox.h" +#include "llmultisliderctrl.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "llsliderctrl.h" #include "lltabcontainer.h" +#include "lltimectrl.h" // newview #include "llagent.h" @@ -47,6 +49,18 @@ static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f; static const F32 WL_BLUE_HORIZON_DENSITY_SCALE = 2.0f; static const F32 WL_CLOUD_SLIDER_SCALE = 1.0f; +static F32 sun_pos_to_time24(F32 sun_pos) +{ + return fmodf(sun_pos * 24.0f + 6, 24.0f); +} + +static F32 time24_to_sun_pos(F32 time24) +{ + F32 sun_pos = fmodf((time24 - 6) / 24.0f, 1.0f); + if (sun_pos < 0) ++sun_pos; + return sun_pos; +} + LLFloaterEditSky::LLFloaterEditSky(const LLSD &key) : LLFloater(key) , mSkyPresetNameEditor(NULL) @@ -66,6 +80,9 @@ BOOL LLFloaterEditSky::postBuild() initCallbacks(); + // Create the sun position scrubber on the slider. + getChild("WLSunPos")->addSlider(12.f); + return TRUE; } @@ -155,7 +172,9 @@ void LLFloaterEditSky::initCallbacks(void) getChild("WLAmbient")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, ¶m_mgr.mAmbient)); // time of day - getChild("WLSunAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, ¶m_mgr.mLightnorm)); + getChild("WLSunAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, ¶m_mgr.mLightnorm)); // old slider + getChild("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, ¶m_mgr.mLightnorm)); // multi-slider + getChild("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl getChild("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, ¶m_mgr.mLightnorm)); // Clouds @@ -231,7 +250,9 @@ void LLFloaterEditSky::syncControls() param_mgr->mAmbient = cur_params.getVector(param_mgr->mAmbient.mName, err); setColorSwatch("WLAmbient", param_mgr->mAmbient, WL_SUN_AMBIENT_SLIDER_SCALE); - childSetValue("WLSunAngle", param_mgr->mCurParams.getFloat("sun_angle",err) / F_TWO_PI); + F32 sun_pos = param_mgr->mCurParams.getFloat("sun_angle",err) / F_TWO_PI; + getChild("WLSunAngle")->setValue(sun_pos); + getChild("WLSunPos")->setCurSliderValue(sun_pos_to_time24(sun_pos), TRUE); childSetValue("WLEastAngle", param_mgr->mCurParams.getFloat("east_angle",err) / F_TWO_PI); // Clouds @@ -515,14 +536,35 @@ void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata) LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sun_sldr = getChild("WLSunAngle"); + LLMultiSliderCtrl* sun_msldr = getChild("WLSunPos"); LLSliderCtrl* east_sldr = getChild("WLEastAngle"); + LLTimeCtrl* time_ctrl = getChild("WLDayTime"); WLColorControl* color_ctrl = static_cast(userdata); + F32 sun_pos = 0.0f; // 0..1 + F32 time24 = 0.0f; // 0..24 + if (ctrl == sun_msldr) // new slider moved + { + time24 = sun_msldr->getCurSliderValue(); + sun_pos = time24_to_sun_pos(time24); + + sun_sldr->setValue(sun_pos); // update the old slider + } + else + { + sun_pos = sun_sldr->getValueF32(); + time24 = sun_pos_to_time24(sun_pos); + + sun_msldr->setCurSliderValue(time24, TRUE); // update the new slider + } + + time_ctrl->setTime24(time24); // sync the time ctrl with the new sun position + // get the two angles LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); - param_mgr->mCurParams.setSunAngle(F_TWO_PI * sun_sldr->getValueF32()); + param_mgr->mCurParams.setSunAngle(F_TWO_PI * sun_pos); param_mgr->mCurParams.setEastAngle(F_TWO_PI * east_sldr->getValueF32()); // set the sun vector @@ -537,6 +579,13 @@ void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata) param_mgr->propagateParameters(); } +void LLFloaterEditSky::onTimeChanged() +{ + F32 time24 = getChild("WLDayTime")->getTime24(); + getChild("WLSunPos")->setCurSliderValue(time24, TRUE); + onSunMoved(getChild("WLSunPos"), &LLWLParamManager::instance().mLightnorm); +} + void LLFloaterEditSky::onStarAlphaMoved(LLUICtrl* ctrl) { LLWLParamManager::getInstance()->mAnimator.deactivate(); diff --git a/indra/newview/llfloatereditsky.h b/indra/newview/llfloatereditsky.h index ff31476ee0..a06c4fc5fa 100644 --- a/indra/newview/llfloatereditsky.h +++ b/indra/newview/llfloatereditsky.h @@ -72,6 +72,7 @@ private: // lighting callbacks for sun void onSunMoved(LLUICtrl* ctrl, void* userdata); + void onTimeChanged(); // for handling when the star slider is moved to adjust the alpha void onStarAlphaMoved(LLUICtrl* ctrl); diff --git a/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml b/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml index 0ea32f61b8..a0a66ca1cd 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml @@ -7,7 +7,7 @@ help_topic="sky_preset" save_rect="true" title="Edit Sky Preset" - width="900"> + width="840"> Create a New Sky Preset Edit Sky Preset @@ -66,12 +66,13 @@ + top="122" + visible="true" + width="790"/> - - Control Help - + width="794"> @@ -311,10 +303,10 @@ font="SansSerif" height="16" layout="topleft" - left="40" + left="20" name="SLCText" top="25" - width="200"> + width="150"> Sun/Moon Color @@ -334,46 +326,10 @@ font="SansSerif" height="16" layout="topleft" - left_delta="0" - name="TODText" - top_pad="20" - width="200"> - Sun/Moon Position - - - - - - - + top_pad="20" + width="150"> Ambient - - East Angle - - - - + @@ -436,7 +366,7 @@ initial_value="0.1" label="Focus " layout="topleft" - left_delta="0" + left_delta="10" max_val="0.5" name="WLGlowB" top_pad="6" @@ -463,7 +393,33 @@ font="SansSerif" height="16" layout="topleft" - left_delta="0" + left_delta="-10" + name="WLStarText" + top_pad="20" + width="200"> + Star Brightness + + + @@ -477,12 +433,14 @@ increment="0.01" initial_value="2.0" layout="topleft" - left_delta="0" + left_delta="10" max_val="10" name="WLGamma" top_pad="6" width="200" /> - + + + + Sun/Moon Position + + + + + Cloud Coverage @@ -720,7 +738,7 @@ layout="topleft" left_pad="55" name="WLCloudScrollXText" - top="25" + top="15" width="150"> Cloud Scroll X @@ -793,7 +811,7 @@ height="10" label="Make this preset my new sky setting" layout="topleft" - left="430" + left="380" name="make_default_cb" top_pad="30" width="280"/> -- cgit v1.2.3