diff options
author | McCabe Maxsted | 2010-08-29 10:38:03 -0700 |
---|---|---|
committer | McCabe Maxsted | 2010-08-29 10:38:03 -0700 |
commit | 89315b7e2649015845b7649133a5a19cbba717ac (patch) | |
tree | 3e15770114259fa9d4e522e56ff042d44f0fe976 /linden/indra/newview/llfloaterwindlight.cpp | |
parent | Updated the artwork package to include the new windlight and waterlight notec... (diff) | |
download | meta-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 '')
-rw-r--r-- | linden/indra/newview/llfloaterwindlight.cpp | 116 |
1 files changed, 54 insertions, 62 deletions
diff --git a/linden/indra/newview/llfloaterwindlight.cpp b/linden/indra/newview/llfloaterwindlight.cpp index 8cdc634..ae94d3a 100644 --- a/linden/indra/newview/llfloaterwindlight.cpp +++ b/linden/indra/newview/llfloaterwindlight.cpp | |||
@@ -225,9 +225,8 @@ void LLFloaterWindLight::initCallbacks(void) { | |||
225 | 225 | ||
226 | //childSetAction("WLLoadPreset", onLoadPreset, comboBox); | 226 | //childSetAction("WLLoadPreset", onLoadPreset, comboBox); |
227 | childSetAction("WLNewPreset", onNewPreset, comboBox); | 227 | childSetAction("WLNewPreset", onNewPreset, comboBox); |
228 | childSetAction("WLSavePreset", onSavePreset, comboBox); | ||
229 | childSetAction("WLSaveNotecard", onSaveNotecard, comboBox); | ||
230 | childSetAction("WLDeletePreset", onDeletePreset, comboBox); | 228 | childSetAction("WLDeletePreset", onDeletePreset, comboBox); |
229 | childSetCommitCallback("WLSavePreset", onSavePreset, this); | ||
231 | 230 | ||
232 | comboBox->setCommitCallback(onChangePresetName); | 231 | comboBox->setCommitCallback(onChangePresetName); |
233 | 232 | ||
@@ -816,39 +815,23 @@ void LLFloaterWindLight::onNewPreset(void* userData) | |||
816 | LLNotifications::instance().add("NewSkyPreset", LLSD(), LLSD(), newPromptCallback); | 815 | LLNotifications::instance().add("NewSkyPreset", LLSD(), LLSD(), newPromptCallback); |
817 | } | 816 | } |
818 | 817 | ||
819 | void LLFloaterWindLight::onSavePreset(void* userData) | ||
820 | { | ||
821 | // get the name | ||
822 | LLComboBox* comboBox = sWindLight->getChild<LLComboBox>( | ||
823 | "WLPresetsCombo"); | ||
824 | |||
825 | // don't save the empty name | ||
826 | if(comboBox->getSelectedItemLabel() == "") | ||
827 | { | ||
828 | return; | ||
829 | } | ||
830 | |||
831 | // check to see if it's a default and shouldn't be overwritten | ||
832 | std::set<std::string>::iterator sIt = sDefaultPresets.find( | ||
833 | comboBox->getSelectedItemLabel()); | ||
834 | if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets")) | ||
835 | { | ||
836 | LLNotifications::instance().add("WLNoEditDefault"); | ||
837 | return; | ||
838 | } | ||
839 | |||
840 | LLWLParamManager::instance()->mCurParams.mName = | ||
841 | comboBox->getSelectedItemLabel(); | ||
842 | |||
843 | LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); | ||
844 | } | ||
845 | class KVFloaterWindLightNotecardCreatedCallback : public LLInventoryCallback | 818 | class KVFloaterWindLightNotecardCreatedCallback : public LLInventoryCallback |
846 | { | 819 | { |
847 | public: | 820 | public: |
848 | void fire(const LLUUID& inv_item); | 821 | void fire(const LLUUID& inv_item); |
849 | }; | 822 | }; |
850 | 823 | ||
851 | void LLFloaterWindLight::onSaveNotecard(void* userData) | 824 | void KVFloaterWindLightNotecardCreatedCallback::fire(const LLUUID& inv_item) |
825 | { | ||
826 | LLWLParamManager * param_mgr = LLWLParamManager::instance(); | ||
827 | param_mgr->setParamSet(param_mgr->mCurParams.mName, param_mgr->mCurParams); | ||
828 | param_mgr->mParamList[param_mgr->mCurParams.mName].mInventoryID = inv_item; | ||
829 | param_mgr->mCurParams.mInventoryID = inv_item; | ||
830 | LL_INFOS("WindLight") << "Created inventory item " << inv_item << LL_ENDL; | ||
831 | param_mgr->savePresetToNotecard(param_mgr->mCurParams.mName); | ||
832 | } | ||
833 | |||
834 | void LLFloaterWindLight::onSavePreset(LLUICtrl* ctrl, void* userData) | ||
852 | { | 835 | { |
853 | // get the name | 836 | // get the name |
854 | LLComboBox* comboBox = sWindLight->getChild<LLComboBox>( | 837 | LLComboBox* comboBox = sWindLight->getChild<LLComboBox>( |
@@ -859,47 +842,56 @@ void LLFloaterWindLight::onSaveNotecard(void* userData) | |||
859 | { | 842 | { |
860 | return; | 843 | return; |
861 | } | 844 | } |
862 | 845 | ||
863 | // Check if this is already a notecard. | 846 | if (ctrl->getValue().asString() == "save_disk_item") |
864 | if(LLWLParamManager::instance()->mCurParams.mInventoryID.notNull()) | ||
865 | { | 847 | { |
866 | LLNotifications::instance().add("KittyWLSaveNotecardAlert", LLSD(), LLSD(), saveNotecardCallback); | 848 | // check to see if it's a default and shouldn't be overwritten |
849 | std::set<std::string>::iterator sIt = sDefaultPresets.find( | ||
850 | comboBox->getSelectedItemLabel()); | ||
851 | if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets")) | ||
852 | { | ||
853 | LLNotifications::instance().add("WLNoEditDefault"); | ||
854 | return; | ||
855 | } | ||
856 | |||
857 | LLWLParamManager::instance()->mCurParams.mName = | ||
858 | comboBox->getSelectedItemLabel(); | ||
859 | |||
860 | LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); | ||
867 | } | 861 | } |
868 | else | 862 | else if (ctrl->getValue().asString() == "save_inventory_item") |
869 | { | 863 | { |
870 | // Make sure we have a ".wl" extension. | 864 | // Check if this is already a notecard. |
871 | std::string name = comboBox->getSelectedItemLabel(); | 865 | if(LLWLParamManager::instance()->mCurParams.mInventoryID.notNull()) |
872 | if(name.length() > 2 && name.compare(name.length() - 3, 3, ".wl") != 0) | ||
873 | { | 866 | { |
874 | name += ".wl"; | 867 | LLNotifications::instance().add("KittyWLSaveNotecardAlert", LLSD(), LLSD(), saveNotecardCallback); |
868 | } | ||
869 | else | ||
870 | { | ||
871 | // Make sure we have a ".wl" extension. | ||
872 | std::string name = comboBox->getSelectedItemLabel(); | ||
873 | if(name.length() > 2 && name.compare(name.length() - 3, 3, ".wl") != 0) | ||
874 | { | ||
875 | name += ".wl"; | ||
876 | } | ||
877 | LLPointer<KVFloaterWindLightNotecardCreatedCallback> cb = new KVFloaterWindLightNotecardCreatedCallback(); | ||
878 | // Create a notecard and then save it. | ||
879 | create_inventory_item(gAgent.getID(), | ||
880 | gAgent.getSessionID(), | ||
881 | LLUUID::null, | ||
882 | LLTransactionID::tnull, | ||
883 | name, | ||
884 | "WindLight settings (Imprudence compatible)", | ||
885 | LLAssetType::AT_NOTECARD, | ||
886 | LLInventoryType::IT_NOTECARD, | ||
887 | NOT_WEARABLE, | ||
888 | PERM_ITEM_UNRESTRICTED, | ||
889 | cb); | ||
890 | |||
875 | } | 891 | } |
876 | LLPointer<KVFloaterWindLightNotecardCreatedCallback> cb = new KVFloaterWindLightNotecardCreatedCallback(); | ||
877 | // Create a notecard and then save it. | ||
878 | create_inventory_item(gAgent.getID(), | ||
879 | gAgent.getSessionID(), | ||
880 | LLUUID::null, | ||
881 | LLTransactionID::tnull, | ||
882 | name, | ||
883 | "WindLight settings (Kitty Viewer compatible)", | ||
884 | LLAssetType::AT_NOTECARD, | ||
885 | LLInventoryType::IT_NOTECARD, | ||
886 | NOT_WEARABLE, | ||
887 | PERM_ITEM_UNRESTRICTED, | ||
888 | cb); | ||
889 | |||
890 | } | 892 | } |
891 | } | 893 | } |
892 | 894 | ||
893 | void KVFloaterWindLightNotecardCreatedCallback::fire(const LLUUID& inv_item) | ||
894 | { | ||
895 | LLWLParamManager * param_mgr = LLWLParamManager::instance(); | ||
896 | param_mgr->setParamSet(param_mgr->mCurParams.mName, param_mgr->mCurParams); | ||
897 | param_mgr->mParamList[param_mgr->mCurParams.mName].mInventoryID = inv_item; | ||
898 | param_mgr->mCurParams.mInventoryID = inv_item; | ||
899 | LL_INFOS("WindLight") << "Created inventory item " << inv_item << LL_ENDL; | ||
900 | param_mgr->savePresetToNotecard(param_mgr->mCurParams.mName); | ||
901 | } | ||
902 | |||
903 | bool LLFloaterWindLight::saveNotecardCallback(const LLSD& notification, const LLSD& response) | 895 | bool LLFloaterWindLight::saveNotecardCallback(const LLSD& notification, const LLSD& response) |
904 | { | 896 | { |
905 | S32 option = LLNotification::getSelectedOption(notification, response); | 897 | S32 option = LLNotification::getSelectedOption(notification, response); |