diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 4193a4edca..1641ec6b89 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -1141,6 +1141,30 @@ Value + FSBuildPrefs_UseCustomScript + + Comment + Use custom script template when clicking New Script button + Persist + 1 + Type + Boolean + Value + 0 + + FSBuildPrefs_CustomScriptItem + + HideFromEditor + 1 + Comment + Script UUID to use as template for New Script button + Persist + 1 + Type + String + Value + + FSllOwnerSayToScriptDebugWindow Comment diff --git a/indra/newview/fspanelprefs.cpp b/indra/newview/fspanelprefs.cpp index 8ddf3fe0e6..a27984ad5f 100644 --- a/indra/newview/fspanelprefs.cpp +++ b/indra/newview/fspanelprefs.cpp @@ -49,6 +49,7 @@ FSPanelPrefs::FSPanelPrefs() : LLPanelPreference() mCommitCallbackRegistrar.add("Perms.Trans", boost::bind(&FSPanelPrefs::onCommitTrans, this)); mEmbeddedItem = gSavedPerAccountSettings.getString("FSBuildPrefs_Item"); + mCustomScriptItem = gSavedPerAccountSettings.getString("FSBuildPrefs_CustomScriptItem"); } bool FSPanelPrefs::postBuild() @@ -75,6 +76,9 @@ bool FSPanelPrefs::postBuild() mInvDropTarget = getChild("embed_item"); mInvDropTarget->setDADCallback(boost::bind(&FSPanelPrefs::onDADEmbeddedItem, this, _1)); + mCustomScriptDropTarget = getChild("custom_script"); + mCustomScriptDropTarget->setDADCallback(boost::bind(&FSPanelPrefs::onDADCustomScript, this, _1)); + return LLPanelPreference::postBuild(); } @@ -101,12 +105,35 @@ void FSPanelPrefs::onOpen(const LLSD& key) getChild("build_item_add_disp_rect_txt")->setTextArg("[ITEM]", getString("EmbeddedItemNotAvailable")); } } + + getChild("FSBuildPrefs_UseCustomScript")->setEnabled(true); + mCustomScriptItem = gSavedPerAccountSettings.getString("FSBuildPrefs_CustomScriptItem"); + LLUUID script_id(mCustomScriptItem); + if (script_id.isNull()) + { + getChild("custom_script_disp_rect_txt")->setTextArg("[SCRIPT]", getString("EmbeddedItemNotSet")); + } + else + { + LLInventoryObject* script = gInventory.getObject(script_id); + if (script) + { + getChild("custom_script_disp_rect_txt")->setTextArg("[SCRIPT]", script->getName()); + } + else + { + getChild("custom_script_disp_rect_txt")->setTextArg("[SCRIPT]", getString("EmbeddedItemNotAvailable")); + } + } + getChild("reset_default_folders")->setEnabled(true); } else { getChild("FSBuildPrefs_EmbedItem")->setEnabled(false); getChild("build_item_add_disp_rect_txt")->setTextArg("[ITEM]", getString("EmbeddedItemNotLoggedIn")); + getChild("FSBuildPrefs_UseCustomScript")->setEnabled(false); + getChild("custom_script_disp_rect_txt")->setTextArg("[SCRIPT]", getString("EmbeddedItemNotLoggedIn")); getChild("reset_default_folders")->setEnabled(false); } } @@ -118,6 +145,7 @@ void FSPanelPrefs::apply() if (LLStartUp::getStartupState() == STATE_STARTED) { gSavedPerAccountSettings.setString("FSBuildPrefs_Item", mEmbeddedItem); + gSavedPerAccountSettings.setString("FSBuildPrefs_CustomScriptItem", mCustomScriptItem); } } @@ -277,6 +305,16 @@ void FSPanelPrefs::onDADEmbeddedItem(const LLUUID& item_id) } } +void FSPanelPrefs::onDADCustomScript(const LLUUID& item_id) +{ + LLInventoryObject* item = gInventory.getObject(item_id); + if (item && item->getType() == LLAssetType::AT_LSL_TEXT) + { + getChild("custom_script_disp_rect_txt")->setTextArg("[SCRIPT]", item->getName()); + mCustomScriptItem = item_id.asString(); + } +} + void FSPanelPrefs::onResetDefaultFolders() { gSavedPerAccountSettings.getControl("ModelUploadFolder")->resetToDefault(true); diff --git a/indra/newview/fspanelprefs.h b/indra/newview/fspanelprefs.h index e0f37d880a..a349314101 100644 --- a/indra/newview/fspanelprefs.h +++ b/indra/newview/fspanelprefs.h @@ -55,11 +55,14 @@ private: void onCommitTrans(); void onDADEmbeddedItem(const LLUUID& item_id); + void onDADCustomScript(const LLUUID& item_id); void onResetDefaultFolders(); FSEmbeddedItemDropTarget* mInvDropTarget; + FSEmbeddedItemDropTarget* mCustomScriptDropTarget; std::string mEmbeddedItem; + std::string mCustomScriptItem; }; #endif // FS_PANELPREFS_H diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index 82ccca2600..a593e7b375 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -52,8 +52,10 @@ #include "lltool.h" #include "lltoolcomp.h" #include "lltoolmgr.h" +#include "lltooldraganddrop.h" // For custom script template #include "lltrans.h" #include "llviewerassettype.h" +#include "llviewercontrol.h" // For custom script template #include "llviewerinventory.h" #include "llviewermenu.h" // Script reset in edit floater #include "llviewerobject.h" @@ -280,6 +282,22 @@ void LLPanelContents::onClickNewScript(void *userdata) } // [/RLVa:KB] + // FIRE-36059 Optional custom script template for New Script button + if (gSavedPerAccountSettings.getBOOL("FSBuildPrefs_UseCustomScript")) + { + LLUUID custom_script_id(gSavedPerAccountSettings.getString("FSBuildPrefs_CustomScriptItem")); + if (custom_script_id.notNull()) + { + LLInventoryItem* custom_script = dynamic_cast(gInventory.getObject(custom_script_id)); + if (custom_script && custom_script->getType() == LLAssetType::AT_LSL_TEXT) + { + LLToolDragAndDrop::dropScript(object, custom_script, true, LLToolDragAndDrop::SOURCE_AGENT, gAgentID); + return; + } + } + } + // + LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, LLUUID::null); diff --git a/indra/newview/skins/default/xui/az/panel_preferences_firestorm.xml b/indra/newview/skins/default/xui/az/panel_preferences_firestorm.xml index 7dc384fefa..1d6de6043c 100644 --- a/indra/newview/skins/default/xui/az/panel_preferences_firestorm.xml +++ b/indra/newview/skins/default/xui/az/panel_preferences_firestorm.xml @@ -165,33 +165,6 @@ + + - - - - Script Editor Font: - - - - - - - - - - - - - - - - - - - - - - Preprocessor include path: - - - - - External Editor: - - - @@ -1608,14 +1516,6 @@ tool_tip="When checked, object for sale info is saved on change instead of requiring a confirm." name="FSCommitForSaleOnChange_toggle" control_name="FSCommitForSaleOnChange"/> - + + + + Script Editor Font: + + + + + + + + + + + + + + + + + + + + + + + + + Preprocessor include path: + + + + + External Editor: + + + + + - - - - - - - Ruta include del preprocesador: - -