aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterwater.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-08-29 10:38:03 -0700
committerMcCabe Maxsted2010-08-29 10:38:03 -0700
commit89315b7e2649015845b7649133a5a19cbba717ac (patch)
tree3e15770114259fa9d4e522e56ff042d44f0fe976 /linden/indra/newview/llfloaterwater.cpp
parentUpdated the artwork package to include the new windlight and waterlight notec... (diff)
downloadmeta-impy-89315b7e2649015845b7649133a5a19cbba717ac.zip
meta-impy-89315b7e2649015845b7649133a5a19cbba717ac.tar.gz
meta-impy-89315b7e2649015845b7649133a5a19cbba717ac.tar.bz2
meta-impy-89315b7e2649015845b7649133a5a19cbba717ac.tar.xz
Tidied up the sky/water editors (both use a flyout_button to save now). Still some non-trivial bugs to fix, specifically: #474 and #475. Both have repros
Diffstat (limited to 'linden/indra/newview/llfloaterwater.cpp')
-rw-r--r--linden/indra/newview/llfloaterwater.cpp118
1 files changed, 55 insertions, 63 deletions
diff --git a/linden/indra/newview/llfloaterwater.cpp b/linden/indra/newview/llfloaterwater.cpp
index f08beea..05bc001 100644
--- a/linden/indra/newview/llfloaterwater.cpp
+++ b/linden/indra/newview/llfloaterwater.cpp
@@ -160,9 +160,8 @@ void LLFloaterWater::initCallbacks(void) {
160 160
161 //childSetAction("WaterLoadPreset", onLoadPreset, comboBox); 161 //childSetAction("WaterLoadPreset", onLoadPreset, comboBox);
162 childSetAction("WaterNewPreset", onNewPreset, comboBox); 162 childSetAction("WaterNewPreset", onNewPreset, comboBox);
163 childSetAction("WaterSavePreset", onSavePreset, comboBox);
164 childSetAction("WaterSaveNotecard", onSaveNotecard, comboBox);
165 childSetAction("WaterDeletePreset", onDeletePreset, comboBox); 163 childSetAction("WaterDeletePreset", onDeletePreset, comboBox);
164 childSetCommitCallback("WaterSavePreset", onSavePreset, this);
166 165
167 // wave direction 166 // wave direction
168 childSetCommitCallback("WaterWave1DirX", onVector2ControlXMoved, &param_mgr->mWave1Dir); 167 childSetCommitCallback("WaterWave1DirX", onVector2ControlXMoved, &param_mgr->mWave1Dir);
@@ -623,39 +622,23 @@ void LLFloaterWater::onNewPreset(void* userData)
623 LLNotifications::instance().add("NewWaterPreset", LLSD(), LLSD(), newPromptCallback); 622 LLNotifications::instance().add("NewWaterPreset", LLSD(), LLSD(), newPromptCallback);
624} 623}
625 624
626void LLFloaterWater::onSavePreset(void* userData)
627{
628 // get the name
629 LLComboBox* comboBox = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo");
630
631 // don't save the empty name
632 if(comboBox->getSelectedItemLabel() == "")
633 {
634 return;
635 }
636
637 LLWaterParamManager::instance()->mCurParams.mName =
638 comboBox->getSelectedItemLabel();
639
640 // check to see if it's a default and shouldn't be overwritten
641 std::set<std::string>::iterator sIt = sDefaultPresets.find(
642 comboBox->getSelectedItemLabel());
643 if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("WaterEditPresets"))
644 {
645 LLNotifications::instance().add("WLNoEditDefault");
646 return;
647 }
648
649 LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback);
650}
651
652class KVFloaterWaterNotecardCreatedCallback : public LLInventoryCallback 625class KVFloaterWaterNotecardCreatedCallback : public LLInventoryCallback
653{ 626{
654public: 627public:
655 void fire(const LLUUID& inv_item); 628 void fire(const LLUUID& inv_item);
656}; 629};
657 630
658void LLFloaterWater::onSaveNotecard(void* userData) 631void KVFloaterWaterNotecardCreatedCallback::fire(const LLUUID& inv_item)
632{
633 LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
634 param_mgr->setParamSet(param_mgr->mCurParams.mName, param_mgr->mCurParams);
635 param_mgr->mParamList[param_mgr->mCurParams.mName].mInventoryID = inv_item;
636 param_mgr->mCurParams.mInventoryID = inv_item;
637 LL_INFOS("WindLight") << "Created inventory item " << inv_item << LL_ENDL;
638 param_mgr->savePresetToNotecard(param_mgr->mCurParams.mName);
639}
640
641void LLFloaterWater::onSavePreset(LLUICtrl* ctrl, void* userData)
659{ 642{
660 // get the name 643 // get the name
661 LLComboBox* comboBox = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo"); 644 LLComboBox* comboBox = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo");
@@ -665,47 +648,56 @@ void LLFloaterWater::onSaveNotecard(void* userData)
665 { 648 {
666 return; 649 return;
667 } 650 }
668 651
669 // Check if this is already a notecard. 652 if (ctrl->getValue().asString() == "save_disk_item")
670 if(LLWaterParamManager::instance()->mCurParams.mInventoryID.notNull())
671 { 653 {
672 LLNotifications::instance().add("KittyWLSaveNotecardAlert", LLSD(), LLSD(), saveNotecardCallback); 654 LLWaterParamManager::instance()->mCurParams.mName =
655 comboBox->getSelectedItemLabel();
656
657 // check to see if it's a default and shouldn't be overwritten
658 std::set<std::string>::iterator sIt = sDefaultPresets.find(
659 comboBox->getSelectedItemLabel());
660 if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("WaterEditPresets"))
661 {
662 LLNotifications::instance().add("WLNoEditDefault");
663 return;
664 }
665
666 LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback);
673 } 667 }
674 else 668 else if (ctrl->getValue().asString() == "save_inventory_item")
675 { 669 {
676 // Make sure we have a ".ww" extension. 670 // Check if this is already a notecard.
677 std::string name = comboBox->getSelectedItemLabel(); 671 if(LLWaterParamManager::instance()->mCurParams.mInventoryID.notNull())
678 if(name.length() > 2 && name.compare(name.length() - 3, 3, ".ww") != 0)
679 { 672 {
680 name += ".ww"; 673 LLNotifications::instance().add("KittyWLSaveNotecardAlert", LLSD(), LLSD(), saveNotecardCallback);
674 }
675 else
676 {
677 // Make sure we have a ".ww" extension.
678 std::string name = comboBox->getSelectedItemLabel();
679 if(name.length() > 2 && name.compare(name.length() - 3, 3, ".ww") != 0)
680 {
681 name += ".ww";
682 }
683 LLPointer<KVFloaterWaterNotecardCreatedCallback> cb = new KVFloaterWaterNotecardCreatedCallback();
684 // Create a notecard and then save it.
685 create_inventory_item(gAgent.getID(),
686 gAgent.getSessionID(),
687 LLUUID::null,
688 LLTransactionID::tnull,
689 name,
690 "Water settings (Imprudence compatible)",
691 LLAssetType::AT_NOTECARD,
692 LLInventoryType::IT_NOTECARD,
693 NOT_WEARABLE,
694 PERM_ITEM_UNRESTRICTED,
695 cb);
696
681 } 697 }
682 LLPointer<KVFloaterWaterNotecardCreatedCallback> cb = new KVFloaterWaterNotecardCreatedCallback();
683 // Create a notecard and then save it.
684 create_inventory_item(gAgent.getID(),
685 gAgent.getSessionID(),
686 LLUUID::null,
687 LLTransactionID::tnull,
688 name,
689 "Water settings (Kitty Viewer compatible)",
690 LLAssetType::AT_NOTECARD,
691 LLInventoryType::IT_NOTECARD,
692 NOT_WEARABLE,
693 PERM_ITEM_UNRESTRICTED,
694 cb);
695
696 } 698 }
697} 699}
698 700
699void KVFloaterWaterNotecardCreatedCallback::fire(const LLUUID& inv_item)
700{
701 LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
702 param_mgr->setParamSet(param_mgr->mCurParams.mName, param_mgr->mCurParams);
703 param_mgr->mParamList[param_mgr->mCurParams.mName].mInventoryID = inv_item;
704 param_mgr->mCurParams.mInventoryID = inv_item;
705 LL_INFOS("WindLight") << "Created inventory item " << inv_item << LL_ENDL;
706 param_mgr->savePresetToNotecard(param_mgr->mCurParams.mName);
707}
708
709bool LLFloaterWater::saveNotecardCallback(const LLSD& notification, const LLSD& response) 701bool LLFloaterWater::saveNotecardCallback(const LLSD& notification, const LLSD& response)
710{ 702{
711 S32 option = LLNotification::getSelectedOption(notification, response); 703 S32 option = LLNotification::getSelectedOption(notification, response);