STORM-1305 WIP Edit Sky floater: removed the old sun position slider, added hour marks to the new one.

master
Vadim ProductEngine 2011-06-30 01:19:14 +03:00
parent 76acc75437
commit 3be8ae9d42
2 changed files with 145 additions and 46 deletions

View File

@ -172,7 +172,6 @@ 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)); // 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));
@ -251,7 +250,6 @@ void LLFloaterEditSky::syncControls()
setColorSwatch("WLAmbient", param_mgr->mAmbient, WL_SUN_AMBIENT_SLIDER_SCALE);
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);
@ -535,36 +533,18 @@ 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
}
F32 time24 = sun_msldr->getCurSliderValue();
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_pos);
param_mgr->mCurParams.setSunAngle(F_TWO_PI * time24_to_sun_pos(time24));
param_mgr->mCurParams.setEastAngle(F_TWO_PI * east_sldr->getValueF32());
// set the sun vector

View File

@ -450,30 +450,10 @@
layout="topleft"
left_pad="60"
name="TODText"
top="10"
top="25"
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"
@ -490,12 +470,151 @@
show_text="false"
top_pad="0"
width="300" />
<text
type="string"
length="1"
border_visible="true"
follows="left|top|right"
font="SansSerif"
height="14"
layout="topleft"
left_delta="2"
name="WL12amHash"
top_pad="6"
width="6">
|
</text>
<text
type="string"
length="1"
border_visible="true"
follows="left|top|right"
font="SansSerif"
height="14"
layout="topleft"
left_pad="66"
name="WL6amHash"
top_delta="0"
width="6">
|
</text>
<text
type="string"
length="1"
border_visible="true"
follows="left|top|right"
font="SansSerif"
height="14"
layout="topleft"
left_pad="67"
name="WL12pmHash2"
top_delta="0"
width="6">
|
</text>
<text
type="string"
length="1"
border_visible="true"
follows="left|top|right"
font="SansSerif"
height="14"
layout="topleft"
left_pad="67"
name="WL6pmHash"
top_delta="0"
width="6">
|
</text>
<text
type="string"
length="1"
border_visible="true"
follows="left|top|right"
font="SansSerif"
height="14"
layout="topleft"
left_pad="67"
name="WL12amHash2"
top_delta="0"
width="6">
|
</text>
<text
type="string"
length="1"
border_visible="true"
follows="left|top|right"
height="16"
layout="topleft"
left_delta="-300"
name="WL12am"
top="74"
width="55">
12am
</text>
<text
type="string"
length="1"
border_visible="true"
follows="left|top|right"
height="16"
layout="topleft"
left_pad="20"
name="WL6am"
top_delta="0"
width="55">
6am
</text>
<text
type="string"
length="1"
border_visible="true"
follows="left|top|right"
height="16"
layout="topleft"
left_pad="15"
name="WL12pmHash"
top_delta="0"
width="55">
12pm
</text>
<text
type="string"
length="1"
border_visible="true"
follows="left|top|right"
height="16"
layout="topleft"
left_pad="18"
name="WL6pm"
top_delta="0"
width="55">
6pm
</text>
<text
type="string"
length="1"
border_visible="true"
follows="left|top|right"
height="16"
layout="topleft"
left_pad="15"
name="WL12am2"
top_delta="0"
width="55">
12am
</text>
<time
follows="left|top"
height="16"
label_width="0"
layout="topleft"
left_delta="80"
left_delta="-175"
name="WLDayTime"
top_pad="15"
value="6:00 AM"
@ -508,9 +627,9 @@
font="SansSerif"
height="16"
layout="topleft"
left_delta="-80"
left_delta="-106"
name="WLEastAngleText"
top_pad="40"
top_pad="24"
width="200">
East Angle
</text>