diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c9e9c85907..40f91a5d81 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14196,6 +14196,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 + UseLSLFlightAssist + + Comment + Use the client LSL bridge for flight boost + Persist + 1 + Type + Boolean + Value + 0 + VFSOldSize Comment diff --git a/indra/newview/fs_resources/EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt b/indra/newview/fs_resources/EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt index 2b02e1b95a..84df68be8f 100644 --- a/indra/newview/fs_resources/EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt +++ b/indra/newview/fs_resources/EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt @@ -1,4 +1,4 @@ -//http bridge script 3.0.1.22450 +//http bridge script v.1.9 //Firestorm //Tozh Taurog, Arrehn Oberlander @@ -154,12 +154,17 @@ useFlightAssist = llList2Integer(commandList,1); if (useFlightAssist) { - flight_init(); + debugOutput("Flight assist true, going to flight_init"); + flight_init(); } else { + debugOutput("Flight assist false, removing flag"); if (timerMask & TIMER_FLIGHT) + { + debugOutput("timerMask & TIMER_FLIGHT"); timerMask = timerMask ^ TIMER_FLIGHT; // remove flight from event counter + } } } @@ -474,7 +479,7 @@ default controls = 0; if(level & CONTROL_UP) controls++; if(level & CONTROL_DOWN) controls--; - if (controls > 0) + if ((controls > 0) && useFlightAssist) flight_check_boost(); } } diff --git a/indra/newview/fslslbridge.cpp b/indra/newview/fslslbridge.cpp index d9be0dae64..34d4b2f984 100644 --- a/indra/newview/fslslbridge.cpp +++ b/indra/newview/fslslbridge.cpp @@ -53,19 +53,20 @@ #include -#define phoenix_bridge_name "#LSL<->Client Bridge v0.12" +//#define phoenix_bridge_name "#LSL<->Client Bridge v0.12" #define phoenix_folder_name "#Phoenix" #define LIB_ROCK_NAME "Rock - medium, round" //#define ROOT_FIRESTORM_FOLDER "#Firestorm" //moved to llinventoryfunctions to synch with the AO object #define FS_BRIDGE_FOLDER "#LSL Bridge" -// If you change this, change it in llappearancemgr.cpp too. -- TS #define FS_BRIDGE_NAME "#Firestorm LSL Bridge v" #define FS_BRIDGE_MAJOR_VERSION 1 -#define FS_BRIDGE_MINOR_VERSION 7 +#define FS_BRIDGE_MINOR_VERSION 9 + +//current script version is 1.9 +const std::string UPLOAD_SCRIPT_CURRENT = "EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt"; -const std::string UPLOAD_SCRIPT_1_7 = "EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt"; const boost::regex FSBridgePattern("^#Firestorm LSL Bridge v*.*"); @@ -99,7 +100,8 @@ private: // FSLSLBridge :: FSLSLBridge(): mBridgeCreating(false), - mpBridge(NULL) + mpBridge(NULL), + mIsFirstCallDone(false) { llinfos << "Initializing fsbridge class" << llendl; std::stringstream sstr; @@ -127,6 +129,7 @@ bool FSLSLBridge :: lslToViewer(std::string message, LLUUID fromID, LLUUID owner llinfos << message << llendl; std::string tag = message.substr(0,11); + bool status = false; if (tag == "") { @@ -142,9 +145,18 @@ bool FSLSLBridge :: lslToViewer(std::string message, LLUUID fromID, LLUUID owner if (fsBridge != NULL) mpBridge = fsBridge; } - return viewerToLSL("URL Confirmed", new FSLSLBridgeRequestResponder()); + status = true; + if (!mIsFirstCallDone) + { + //on first call from bridge, confirm that we are here + //then check options use + viewerToLSL("URL Confirmed", new FSLSLBridgeRequestResponder()); + updateBoolSettingValue("UseLSLFlightAssist"); + + mIsFirstCallDone = true; + } } - return false; + return status; } bool FSLSLBridge :: viewerToLSL(std::string message, FSLSLBridgeRequestResponder *responder) @@ -159,6 +171,26 @@ bool FSLSLBridge :: viewerToLSL(std::string message, FSLSLBridgeRequestResponder return true; } +bool FSLSLBridge :: updateBoolSettingValue(std::string msgVal) +{ + std::string boolVal = "0"; + + if (gSavedSettings.getBOOL(msgVal)) + boolVal = "1"; + + return viewerToLSL( msgVal+"|"+boolVal, new FSLSLBridgeRequestResponder()); +} + +bool FSLSLBridge :: updateBoolSettingValue(std::string msgVal, bool contentVal) +{ + std::string boolVal = "0"; + + if (contentVal) + boolVal = "1"; + + return viewerToLSL( msgVal+"|"+boolVal, new FSLSLBridgeRequestResponder()); +} + // //Bridge initialization // @@ -530,8 +562,8 @@ void FSLSLBridgeScriptCallback::fire(const LLUUID& inv_item) std::string FSLSLBridgeScriptCallback::prepUploadFile() { - std::string fName = gDirUtilp->getExpandedFilename(LL_PATH_FS_RESOURCES, UPLOAD_SCRIPT_1_7); - std::string fNew = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,UPLOAD_SCRIPT_1_7); + std::string fName = gDirUtilp->getExpandedFilename(LL_PATH_FS_RESOURCES, UPLOAD_SCRIPT_CURRENT); + std::string fNew = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,UPLOAD_SCRIPT_CURRENT); //open script text file typedef std::istream_iterator istream_iterator; @@ -551,9 +583,9 @@ void FSLSLBridge :: checkBridgeScriptName(std::string fileName) if ((fileName.length() == 0) || !mBridgeCreating) return; //need to parse out the last length of a GUID and compare to saved possible names. - std::string fileOnly = fileName.substr(fileName.length()-UPLOAD_SCRIPT_1_7.length(), UPLOAD_SCRIPT_1_7.length()); + std::string fileOnly = fileName.substr(fileName.length()-UPLOAD_SCRIPT_CURRENT.length(), UPLOAD_SCRIPT_CURRENT.length()); - if (fileOnly == UPLOAD_SCRIPT_1_7) + if (fileOnly == UPLOAD_SCRIPT_CURRENT) { //this is our script upload LLViewerObject* obj = gAgentAvatarp->getWornAttachment(mpBridge->getUUID()); @@ -596,6 +628,7 @@ void FSLSLBridge :: finishBridge() mBridgeCreating = false; //removeVOInventoryListener(); + cleanUpOldVersions(); cleanUpBridgeFolder(); } // @@ -686,21 +719,27 @@ void FSLSLBridge :: reportToNearbyChat(std::string message) LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); } -void FSLSLBridge :: cleanUpBridgeFolder() +void FSLSLBridge :: cleanUpBridgeFolder(std::string nameToCleanUp) { - llinfos << "Cleaning leftover scripts and bridges..." << llendl; + llinfos << "Cleaning leftover scripts and bridges... for " << nameToCleanUp << llendl; LLUUID catID = findFSCategory(); LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; //find all bridge and script duplicates and delete them - NameCollectFunctor namefunctor(mCurrentFullName); + //NameCollectFunctor namefunctor(mCurrentFullName); + NameCollectFunctor namefunctor(nameToCleanUp); gInventory.collectDescendentsIf(catID,cats,items,FALSE,namefunctor); for (S32 iIndex = 0; iIndex < items.count(); iIndex++) { const LLViewerInventoryItem* itemp = items.get(iIndex); + if (get_is_item_worn(itemp->getUUID())) + { + LLVOAvatarSelf::detachAttachmentIntoInventory(itemp->getUUID()); + } + if (!itemp->getIsLinkType() && (itemp->getUUID() != mpBridge->getUUID())) { gInventory.purgeObject(itemp->getUUID()); @@ -709,6 +748,33 @@ void FSLSLBridge :: cleanUpBridgeFolder() gInventory.notifyObservers(); } +void FSLSLBridge :: cleanUpBridgeFolder() +{ + cleanUpBridgeFolder(mCurrentFullName); + +} + +void FSLSLBridge :: cleanUpOldVersions() +{ + std::string mProcessingName; + + for(int i = 1; i <= FS_BRIDGE_MAJOR_VERSION; i++) + { + for (int j = 1; j < FS_BRIDGE_MINOR_VERSION; j++) + { + std::stringstream sstr; + + sstr << FS_BRIDGE_NAME; + sstr << i; + sstr << "."; + sstr << j; + + mProcessingName = sstr.str(); + cleanUpBridgeFolder(mProcessingName); + } + } +} + bool FSLSLBridge :: isOldBridgeVersion(LLInventoryItem *item) { //if (!item) diff --git a/indra/newview/fslslbridge.h b/indra/newview/fslslbridge.h index a7215bdec4..4fcfda1b50 100644 --- a/indra/newview/fslslbridge.h +++ b/indra/newview/fslslbridge.h @@ -55,6 +55,9 @@ public: bool lslToViewer(std::string message, LLUUID fromID, LLUUID ownerID); bool viewerToLSL(std::string message, FSLSLBridgeRequestResponder *responder = NULL); + bool updateBoolSettingValue(std::string msgVal); + bool updateBoolSettingValue(std::string msgVal, bool contentVal); + void initBridge(); void recreateBridge(); void processAttach(LLViewerObject *object, const LLViewerJointAttachment *attachment); @@ -80,6 +83,8 @@ private: LLUUID mScriptItemID; //internal script ID LLUUID mBridgeFolderID; + bool mIsFirstCallDone; //initialization conversation + protected: LLViewerInventoryItem* findInvObject(std::string obj_name, LLUUID catID, LLAssetType::EType type); LLUUID findFSCategory(); @@ -90,11 +95,13 @@ protected: bool isOldBridgeVersion(LLInventoryItem *item); void reportToNearbyChat(std::string message); void cleanUpBridgeFolder(); + void cleanUpBridgeFolder(std::string nameToCleanUp); void setupBridgePrim(LLViewerObject *object); void initCreationStep(); void cleanUpBridge(); void startCreation(); void finishBridge(); + void cleanUpOldVersions(); /*virtual*/ void inventoryChanged(LLViewerObject* obj, LLInventoryObject::object_list_t* inv, diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index adb874edb8..5f87c96c5a 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3502,7 +3502,7 @@ bool LLAgent::teleportBridgeGlobal(const LLVector3d& pos_global) return teleportBridgeLocal(pos_local); } -//-TT Client LSL Bridge +//-TT Client LSL Bridge // teleportCore() - stuff to do on any teleport // protected diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 940047c80a..5b62ac30b3 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -58,10 +58,6 @@ #include "fslslbridge.h" //-TT -// Firestorm bridge name prefix. MUST correspond to the same variable in -// fslslbridge.cpp. -- TS -#define FS_BRIDGE_NAME "#Firestorm LSL Bridge v" - // RAII thingy to guarantee that a variable gets reset when the Setter // goes out of scope. More general utility would be handy - TODO: // check boost. @@ -1265,12 +1261,11 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL { const LLViewerInventoryItem* item = (*iter); std::string item_name = item->getName(); - size_t bridge_name_len = sizeof(FS_BRIDGE_NAME) - 1; switch (item->getActualType()) { case LLAssetType::AT_LINK: { - if (item_name.substr(0,bridge_name_len) != FS_BRIDGE_NAME) + if (item_name != FSLSLBridge::instance().currentFullName()) { llinfos << "copying inventory link " << item_name << llendl; //LLInventoryItem::getDescription() is used for a new description @@ -1304,7 +1299,7 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL case LLAssetType::AT_BODYPART: case LLAssetType::AT_GESTURE: { - if (item_name.substr(0,bridge_name_len) != FS_BRIDGE_NAME) + if (item_name != FSLSLBridge::instance().currentFullName()) { llinfos << "copying inventory item " << item_name << llendl; copy_inventory_item(gAgent.getID(), diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index ad082062cb..7c35081eff 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -114,6 +114,9 @@ #include "lllogininstance.h" // to check if logged in yet #include "llsdserialize.h" +//-TT Client LSL Bridge +#include "fslslbridge.h" +//-TT const F32 MAX_USER_FAR_CLIP = 512.f; const F32 MIN_USER_FAR_CLIP = 64.f; @@ -192,6 +195,7 @@ void LLVoiceSetKeyDialog::onCancel(void* user_data) void handleNameTagOptionChanged(const LLSD& newvalue); void handleDisplayNamesOptionChanged(const LLSD& newvalue); +void handleFlightAssistOptionChanged(const LLSD& newvalue); bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response); bool callback_clear_cache(const LLSD& notification, const LLSD& response); bool callback_clear_settings(const LLSD& notification, const LLSD& response); @@ -253,6 +257,13 @@ void handleDisplayNamesOptionChanged(const LLSD& newvalue) LLVOAvatar::invalidateNameTags(); } +//-TT Client LSL Bridge +void handleFlightAssistOptionChanged(const LLSD& newvalue) +{ + FSLSLBridge::instance().updateBoolSettingValue("UseLSLFlightAssist", newvalue.asBoolean()); +} +//-TT + /*bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater) { @@ -372,6 +383,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); + gSavedSettings.getControl("UseLSLFlightAssist")->getCommitSignal()->connect(boost::bind(&handleFlightAssistOptionChanged, _2)); //[FIX FIRE-1927 - enable DoubleClickTeleport shortcut : SJ] gSavedSettings.getControl("DoubleClickTeleport")->getCommitSignal()->connect(boost::bind(&LLFloaterPreference::onChangeDoubleClickSettings, this)); diff --git a/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml b/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml index 98f37b2120..34edb7f794 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_firestorm.xml @@ -324,6 +324,16 @@ left="15" width="270" tool_tip="Allows the Viewer to use a scripted attachment (Bridge) to extend its features"/> +