diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloaterwater.cpp | 85 |
1 files changed, 77 insertions, 8 deletions
diff --git a/linden/indra/newview/llfloaterwater.cpp b/linden/indra/newview/llfloaterwater.cpp index 730c139..32c2b75 100644 --- a/linden/indra/newview/llfloaterwater.cpp +++ b/linden/indra/newview/llfloaterwater.cpp | |||
@@ -169,7 +169,11 @@ void LLFloaterWater::initCallbacks(void) { | |||
169 | 169 | ||
170 | LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap"); | 170 | LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap"); |
171 | textCtrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); | 171 | textCtrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); |
172 | childSetCommitCallback("WaterNormalMap", onNormalMapPicked, NULL); | 172 | childSetCommitCallback("WaterNormalMap", onNormalMapPicked, NULL); |
173 | |||
174 | // next/prev buttons | ||
175 | childSetAction("next", onClickNext, this); | ||
176 | childSetAction("prev", onClickPrev, this); | ||
173 | } | 177 | } |
174 | 178 | ||
175 | void LLFloaterWater::onClickHelp(void* data) | 179 | void LLFloaterWater::onClickHelp(void* data) |
@@ -234,6 +238,12 @@ void LLFloaterWater::syncMenu() | |||
234 | 238 | ||
235 | LLWaterParamSet & current_params = param_mgr->mCurParams; | 239 | LLWaterParamSet & current_params = param_mgr->mCurParams; |
236 | 240 | ||
241 | LLComboBox* comboBox = getChild<LLComboBox>("WaterPresetsCombo"); | ||
242 | if (comboBox->getSelectedItemLabel() != current_params.mName) | ||
243 | { | ||
244 | comboBox->setSimple(current_params.mName); | ||
245 | } | ||
246 | |||
237 | // blue horizon | 247 | // blue horizon |
238 | param_mgr->mFogColor = current_params.getVector4(param_mgr->mFogColor.mName, err); | 248 | param_mgr->mFogColor = current_params.getVector4(param_mgr->mFogColor.mName, err); |
239 | 249 | ||
@@ -303,14 +313,26 @@ LLFloaterWater* LLFloaterWater::instance() | |||
303 | } | 313 | } |
304 | void LLFloaterWater::show() | 314 | void LLFloaterWater::show() |
305 | { | 315 | { |
306 | LLFloaterWater* water = instance(); | 316 | if (!sWaterMenu) |
307 | water->syncMenu(); | 317 | { |
308 | 318 | LLFloaterWater* water = instance(); | |
309 | // comment in if you want the menu to rebuild each time | 319 | water->syncMenu(); |
310 | //LLUICtrlFactory::getInstance()->buildFloater(water, "floater_water.xml"); | ||
311 | //water->initCallbacks(); | ||
312 | 320 | ||
313 | water->open(); | 321 | // comment in if you want the menu to rebuild each time |
322 | //LLUICtrlFactory::getInstance()->buildFloater(water, "floater_water.xml"); | ||
323 | //water->initCallbacks(); | ||
324 | } | ||
325 | else | ||
326 | { | ||
327 | if (sWaterMenu->getVisible()) | ||
328 | { | ||
329 | sWaterMenu->close(); | ||
330 | } | ||
331 | else | ||
332 | { | ||
333 | sWaterMenu->open(); | ||
334 | } | ||
335 | } | ||
314 | } | 336 | } |
315 | 337 | ||
316 | bool LLFloaterWater::isOpen() | 338 | bool LLFloaterWater::isOpen() |
@@ -726,3 +748,50 @@ void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl, void * userData) | |||
726 | sWaterMenu->syncMenu(); | 748 | sWaterMenu->syncMenu(); |
727 | } | 749 | } |
728 | 750 | ||
751 | void LLFloaterWater::onClickNext(void* user_data) | ||
752 | { | ||
753 | LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); | ||
754 | LLWaterParamSet& currentParams = param_mgr->mCurParams; | ||
755 | |||
756 | // find place of current param | ||
757 | std::map<std::string, LLWaterParamSet>::iterator mIt = | ||
758 | param_mgr->mParamList.find(currentParams.mName); | ||
759 | |||
760 | // if at the end, loop | ||
761 | std::map<std::string, LLWaterParamSet>::iterator last = param_mgr->mParamList.end(); --last; | ||
762 | if(mIt == last) | ||
763 | { | ||
764 | mIt = param_mgr->mParamList.begin(); | ||
765 | } | ||
766 | else | ||
767 | { | ||
768 | mIt++; | ||
769 | } | ||
770 | /*param_mgr->mAnimator.mIsRunning = false; | ||
771 | param_mgr->mAnimator.mUseLindenTime = false;*/ | ||
772 | param_mgr->loadPreset(mIt->first, true); | ||
773 | } | ||
774 | |||
775 | void LLFloaterWater::onClickPrev(void* user_data) | ||
776 | { | ||
777 | LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); | ||
778 | LLWaterParamSet & currentParams = param_mgr->mCurParams; | ||
779 | |||
780 | // find place of current param | ||
781 | std::map<std::string, LLWaterParamSet>::iterator mIt = | ||
782 | param_mgr->mParamList.find(currentParams.mName); | ||
783 | |||
784 | // if at the beginning, loop | ||
785 | if(mIt == param_mgr->mParamList.begin()) | ||
786 | { | ||
787 | std::map<std::string, LLWaterParamSet>::iterator last = param_mgr->mParamList.end(); --last; | ||
788 | mIt = last; | ||
789 | } | ||
790 | else | ||
791 | { | ||
792 | mIt--; | ||
793 | } | ||
794 | /*param_mgr->mAnimator.mIsRunning = false; | ||
795 | param_mgr->mAnimator.mUseLindenTime = false;*/ | ||
796 | param_mgr->loadPreset(mIt->first, true); | ||
797 | } | ||