summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-06-29 23:48:36 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-06-29 23:48:36 +0300
commit76acc754370580e7e60ac2a929e165b79c24a7c3 (patch)
tree7f9279d50c44353ef41b26dca74a3ec38223fe7d
parent290423764dc48e70205cc0d28187d9d8fe3c8dff (diff)
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.
-rw-r--r--indra/newview/llfloatereditsky.cpp55
-rw-r--r--indra/newview/llfloatereditsky.h1
-rw-r--r--indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml222
3 files changed, 173 insertions, 105 deletions
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<LLMultiSliderCtrl>("WLSunPos")->addSlider(12.f);
+
return TRUE;
}
@@ -155,7 +172,9 @@ void LLFloaterEditSky::initCallbacks(void)
getChild<LLUICtrl>("WLAmbient")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &param_mgr.mAmbient));
// time of day
- getChild<LLUICtrl>("WLSunAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &param_mgr.mLightnorm));
+ getChild<LLUICtrl>("WLSunAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &param_mgr.mLightnorm)); // old slider
+ getChild<LLUICtrl>("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &param_mgr.mLightnorm)); // multi-slider
+ getChild<LLTimeCtrl>("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl
getChild<LLUICtrl>("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &param_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<LLUICtrl>("WLSunAngle")->setValue(sun_pos);
+ getChild<LLMultiSliderCtrl>("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<LLSliderCtrl>("WLSunAngle");
+ LLMultiSliderCtrl* sun_msldr = getChild<LLMultiSliderCtrl>("WLSunPos");
LLSliderCtrl* east_sldr = getChild<LLSliderCtrl>("WLEastAngle");
+ LLTimeCtrl* time_ctrl = getChild<LLTimeCtrl>("WLDayTime");
WLColorControl* color_ctrl = static_cast<WLColorControl *>(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<LLTimeCtrl>("WLDayTime")->getTime24();
+ getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
+ onSunMoved(getChild<LLUICtrl>("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">
<string name="title_new">Create a New Sky Preset</string>
<string name="title_edit">Edit Sky Preset</string>
@@ -66,12 +66,13 @@
<view_border
bevel_style="none"
follows="top|left"
- height="225"
+ height="203"
layout="topleft"
left="25"
name="panel_water_preset"
- top="100"
- width="850"/>
+ top="122"
+ visible="true"
+ width="790"/>
<tab_container
follows="left|top"
height="225"
@@ -81,16 +82,7 @@
name="WindLight Tabs"
tab_position="top"
top="101"
- width="854">
- <text
- follows="top|left|right"
- layout="topleft"
- name="water_preset_help"
- right="870"
- top_pad="4"
- width="100">
- Control Help
- </text>
+ width="794">
<panel
border="true"
bevel_style="none"
@@ -99,8 +91,8 @@
label="ATMOSPHERE"
layout="topleft"
left="1"
- mouse_opaque="false"
help_topic="sky_preset_atmosphere"
+ mouse_opaque="false"
name="Atmosphere"
top="60"
width="698">
@@ -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
</text>
<color_swatch
@@ -323,7 +315,7 @@
height="37"
label_height="0"
layout="topleft"
- left_delta="0"
+ left_delta="10"
name="WLSunlight"
top_pad="6"
width="60" />
@@ -334,46 +326,10 @@
font="SansSerif"
height="16"
layout="topleft"
- left_delta="0"
- name="TODText"
- top_pad="20"
- width="200">
- Sun/Moon Position
- </text>
- <icon
- height="20"
- image_name="icon_diurnal.tga"
- layout="topleft"
- left_delta="14"
- top_pad="10"
- name="SkyDayCycle"
- use_draw_context_alpha="false"
- width="148" />
- <slider
- control_name="WLSunAngle"
- follows="left|top"
- height="10"
- increment="0.001"
- initial_value="0.7"
- layout="topleft"
- left_delta="-8"
- name="WLSunAngle"
- top_pad="0"
- width="207" />
-
- <!--======== Tab Panel II. II conlumn of controls ========-->
-
- <text
- type="string"
- length="1"
- follows="left|top"
- font="SansSerif"
- height="16"
- layout="topleft"
- left_pad="55"
+ left_delta="-10"
name="WLAmbientText"
- top="25"
- width="200">
+ top_pad="20"
+ width="150">
Ambient
</text>
<color_swatch
@@ -382,38 +338,12 @@
height="37"
label_height="0"
layout="topleft"
- left_delta="0"
+ left_delta="10"
name="WLAmbient"
top_pad="6"
width="60" />
- <text
- type="string"
- length="1"
- follows="left|top"
- font="SansSerif"
- height="16"
- layout="topleft"
- left_delta="0"
- name="WLEastAngleText"
- top_pad="20"
- width="200">
- East Angle
- </text>
- <slider
- control_name="WLEastAngle"
- decimal_digits="2"
- follows="left|top"
- height="10"
- increment="0.01"
- initial_value="0.0"
- layout="topleft"
- left_delta="15"
- name="WLEastAngle"
- top_pad="6"
- width="200" />
-
- <!--======== Tab Panel II. III conlumn of controls ========-->
+ <!--======== Tab Panel II. II conlumn of controls ========-->
<text
type="string"
length="1"
@@ -421,7 +351,7 @@
font="SansSerif"
height="16"
layout="topleft"
- left_pad="55"
+ left_pad="100"
name="SunGlowText"
top="25"
width="200">
@@ -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
+ </text>
+ <slider
+ control_name="WLStarAlpha"
+ decimal_digits="2"
+ follows="top|left"
+ height="10"
+ increment="0.01"
+ initial_value="0"
+ layout="topleft"
+ left_delta="10"
+ max_val="2"
+ name="WLStarAlpha"
+ top_pad="6"
+ width="200" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-10"
name="SceneGammaText"
top_pad="20"
width="200">
@@ -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" />
-
+
+ <!--======== Tab Panel II. III conlumn of controls ========-->
+
<text
type="string"
length="1"
@@ -490,25 +448,85 @@
font="SansSerif"
height="16"
layout="topleft"
+ left_pad="60"
+ name="TODText"
+ top="10"
+ width="200">
+ Sun/Moon Position
+ </text>
+ <icon
+ height="20"
+ image_name="icon_diurnal.tga"
+ layout="topleft"
+ left_delta="14"
+ top_pad="10"
+ name="SkyDayCycle"
+ use_draw_context_alpha="false"
+ width="148" />
+ <slider
+ control_name="WLSunAngle"
+ follows="left|top"
+ height="10"
+ increment="0.001"
+ initial_value="0.7"
+ layout="topleft"
+ left_delta="-8"
+ name="WLSunAngle"
+ top_pad="0"
+ width="207" />
+ <multi_slider
+ can_edit_text="true"
+ control_name="WLSunPos"
+ decimal_digits="0"
+ follows="bottom"
+ height="10"
+ increment="0.0833333"
+ initial_value="0"
+ layout="topleft"
left_delta="0"
- name="WLStarText"
- top_pad="20"
+ max_sliders="1"
+ max_val="24"
+ name="WLSunPos"
+ show_text="false"
+ top_pad="0"
+ width="300" />
+ <time
+ follows="left|top"
+ height="16"
+ label_width="0"
+ layout="topleft"
+ left_delta="80"
+ name="WLDayTime"
+ top_pad="15"
+ value="6:00 AM"
+ width="75"/>
+
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ font="SansSerif"
+ height="16"
+ layout="topleft"
+ left_delta="-80"
+ name="WLEastAngleText"
+ top_pad="40"
width="200">
- Star Brightness
+ East Angle
</text>
<slider
- control_name="WLStarAlpha"
+ control_name="WLEastAngle"
decimal_digits="2"
- follows="top|left"
+ follows="left|top"
height="10"
increment="0.01"
- initial_value="0"
+ initial_value="0.0"
layout="topleft"
- left_delta="0"
- max_val="2"
- name="WLStarAlpha"
+ left_delta="10"
+ name="WLEastAngle"
top_pad="6"
width="200" />
+
</panel>
<panel
border="true"
@@ -613,7 +631,7 @@
layout="topleft"
left_pad="55"
name="WLCloudCoverageText"
- top="25"
+ top="15"
width="200">
Cloud Coverage
</text>
@@ -720,7 +738,7 @@
layout="topleft"
left_pad="55"
name="WLCloudScrollXText"
- top="25"
+ top="15"
width="150">
Cloud Scroll X
</text>
@@ -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"/>