diff options
author | Dave Hiller <daveh@lindenlab.com> | 2008-07-31 12:15:15 +0000 |
---|---|---|
committer | Dave Hiller <daveh@lindenlab.com> | 2008-07-31 12:15:15 +0000 |
commit | 9a7d68cfce5f71cf9d89536431d72941dc369749 (patch) | |
tree | f7e0ce093abef0fcc7737cac63bc2a8dbf11b729 /indra/newview | |
parent | f0f2a416911ba8de9ac1e08cd90720c0d789bb2e (diff) |
svn merge -r93014:93396 svn+ssh://svn.lindenlab.com/svn/linden/branches/mono-r93014-qar633 dataserver-is-deprecated
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/English.lproj/InfoPlist.strings | 5 | ||||
-rw-r--r-- | indra/newview/Info-SecondLife.plist | 2 | ||||
-rw-r--r-- | indra/newview/llassetuploadqueue.cpp | 194 | ||||
-rw-r--r-- | indra/newview/llassetuploadqueue.h | 74 | ||||
-rw-r--r-- | indra/newview/llassetuploadresponders.cpp | 94 | ||||
-rw-r--r-- | indra/newview/llassetuploadresponders.h | 23 | ||||
-rw-r--r-- | indra/newview/llcompilequeue.cpp | 229 | ||||
-rw-r--r-- | indra/newview/llcompilequeue.h | 38 | ||||
-rw-r--r-- | indra/newview/llfloatertopobjects.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llpreviewscript.cpp | 115 | ||||
-rw-r--r-- | indra/newview/llpreviewscript.h | 17 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 33 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llviewerobject.h | 3 | ||||
-rw-r--r-- | indra/newview/llviewerstats.h | 2 | ||||
-rw-r--r-- | indra/newview/res/viewerRes.rc | 8 |
19 files changed, 695 insertions, 188 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e65721e124..0fea3076c3 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -66,6 +66,7 @@ set(viewer_SOURCE_FILES llanimstatelabels.cpp llappviewer.cpp llassetuploadresponders.cpp + llassetuploadqueue.cpp llaudiosourcevo.cpp llbbox.cpp llbox.cpp @@ -454,6 +455,7 @@ set(viewer_HEADER_FILES llappearance.h llappviewer.h llassetuploadresponders.h + llassetuploadqueue.h llaudiosourcevo.h llbbox.h llbox.h diff --git a/indra/newview/English.lproj/InfoPlist.strings b/indra/newview/English.lproj/InfoPlist.strings index 7272173fed..881483e892 100644 --- a/indra/newview/English.lproj/InfoPlist.strings +++ b/indra/newview/English.lproj/InfoPlist.strings @@ -1,5 +1,6 @@ /* Localized versions of Info.plist keys */ CFBundleName = "Second Life"; -CFBundleShortVersionString = "Second Life version 1.20.6.86975"; -CFBundleGetInfoString = "Second Life version 1.20.6.86975, Copyright 2004-2008 Linden Research, Inc."; +CFBundleShortVersionString = "Second Life version 1.20.9.87416"; +CFBundleGetInfoString = "Second Life version 1.20.9.87416, Copyright 2004-2008 Linden Research, Inc."; + diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist index fa50503545..b889d45b9e 100644 --- a/indra/newview/Info-SecondLife.plist +++ b/indra/newview/Info-SecondLife.plist @@ -32,7 +32,7 @@ </dict> </array> <key>CFBundleVersion</key> - <string>1.20.6.86975</string> + <string>1.20.9.87416</string> <key>CSResourcesFileMapped</key> <true/> </dict> diff --git a/indra/newview/llassetuploadqueue.cpp b/indra/newview/llassetuploadqueue.cpp new file mode 100644 index 0000000000..c52c189d56 --- /dev/null +++ b/indra/newview/llassetuploadqueue.cpp @@ -0,0 +1,194 @@ +/** + * @file llassetupload.cpp + * @brief Serializes asset upload request + * Copyright (c) 2007, Linden Research, Inc. + * + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llassetuploadqueue.h" +#include "llviewerregion.h" +#include "llviewerobjectlist.h" + +#include "llassetuploadresponders.h" +#include "llsd.h" +#include <iostream> + +class LLAssetUploadChainResponder : public LLUpdateTaskInventoryResponder +{ +public: + + LLAssetUploadChainResponder(const LLSD& post_data, + const std::string& file_name, + const LLUUID& queue_id, + U8* data, + U32 data_size, + std::string script_name, + LLAssetUploadQueueSupplier *supplier) : + LLUpdateTaskInventoryResponder(post_data, file_name, queue_id, LLAssetType::AT_LSL_TEXT), + mSupplier(supplier), + mData(data), + mDataSize(data_size), + mScriptName(script_name) + { + } + + virtual ~LLAssetUploadChainResponder() + { + if(mSupplier) + { + LLAssetUploadQueue *queue = mSupplier->get(); + if (queue) + { + // Give ownership of supplier back to queue. + queue->mSupplier = mSupplier; + mSupplier = NULL; + } + } + delete mSupplier; + delete mData; + } + + virtual void error(U32 statusNum, const std::string& reason) + { + llwarns << "Error: " << reason << llendl; + LLUpdateTaskInventoryResponder::error(statusNum, reason); + LLAssetUploadQueue *queue = mSupplier->get(); + if (queue) + { + queue->request(&mSupplier); + } + } + + virtual void result(const LLSD& content) + { + LLUpdateTaskInventoryResponder::result(content); + LLAssetUploadQueue *queue = mSupplier->get(); + if (queue) + { + // Responder is reused across 2 phase upload, + // so only start next upload after 2nd phase complete. + std::string state = content["state"]; + if(state == "complete") + { + queue->request(&mSupplier); + } + } + } + + virtual void uploadUpload(const LLSD& content) + { + std::string uploader = content["uploader"]; + + mSupplier->log(std::string("Compiling " + mScriptName).c_str()); + llinfos << "Compiling " << llendl; + + // postRaw takes ownership of mData and will delete it. + LLHTTPClient::postRaw(uploader, mData, mDataSize, this); + mData = NULL; + mDataSize = 0; + } + + virtual void uploadComplete(const LLSD& content) + { + // Bytecode save completed + if (content["compiled"]) + { + mSupplier->log("Compilation succeeded"); + llinfos << "Compiled!" << llendl; + } + else + { + LLSD compile_errors = content["errors"]; + for(LLSD::array_const_iterator line = compile_errors.beginArray(); + line < compile_errors.endArray(); line++) + { + mSupplier->log(line->asString()); + llinfos << content["errors"] << llendl; + } + } + LLUpdateTaskInventoryResponder::uploadComplete(content); + } + + LLAssetUploadQueueSupplier *mSupplier; + U8* mData; + U32 mDataSize; + std::string mScriptName; +}; + + +LLAssetUploadQueue::LLAssetUploadQueue(LLAssetUploadQueueSupplier *supplier) : + mSupplier(supplier) +{ +} + +//virtual +LLAssetUploadQueue::~LLAssetUploadQueue() +{ + delete mSupplier; +} + +// Takes ownership of supplier. +void LLAssetUploadQueue::request(LLAssetUploadQueueSupplier** supplier) +{ + if (mQueue.empty()) + return; + + UploadData data = mQueue.front(); + mQueue.pop_front(); + + LLSD body; + body["task_id"] = data.mTaskId; + body["item_id"] = data.mItemId; + body["is_script_running"] = data.mIsRunning; + body["target"] = data.mIsTargetMono? "mono" : "lsl2"; + + std::string url = ""; + LLViewerObject* object = gObjectList.findObject(data.mTaskId); + if (object) + { + url = object->getRegion()->getCapability("UpdateScriptTaskInventory"); + LLHTTPClient::post(url, body, + new LLAssetUploadChainResponder( + body, data.mFilename, data.mQueueId, + data.mData, data.mDataSize, data.mScriptName, *supplier)); + } + + *supplier = NULL; +} + +void LLAssetUploadQueue::queue(const std::string& filename, + const LLUUID& task_id, + const LLUUID& item_id, + BOOL is_running, + BOOL is_target_mono, + const LLUUID& queue_id, + U8* script_data, + U32 data_size, + std::string script_name) +{ + UploadData data; + data.mTaskId = task_id; + data.mItemId = item_id; + data.mIsRunning = is_running; + data.mIsTargetMono = is_target_mono; + data.mQueueId = queue_id; + data.mFilename = filename; + data.mData = script_data; + data.mDataSize = data_size; + data.mScriptName = script_name; + + mQueue.push_back(data); + + if(mSupplier) + { + request(&mSupplier); + } +} + +LLAssetUploadQueueSupplier::~LLAssetUploadQueueSupplier() +{ +} diff --git a/indra/newview/llassetuploadqueue.h b/indra/newview/llassetuploadqueue.h new file mode 100644 index 0000000000..6e4caa1b0f --- /dev/null +++ b/indra/newview/llassetuploadqueue.h @@ -0,0 +1,74 @@ +/** + * @file llassetuploadqueue.h + * @brief Serializes asset upload request + * Copyright (c) 2007, Linden Research, Inc. + * + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * $/LicenseInfo$ + */ + +#ifndef LL_LLASSETUPLOADQUEUE_H +#define LL_LLASSETUPLOADQUEUE_H + +#include "lluuid.h" + +#include <string> +#include <deque> + +class LLAssetUploadQueueSupplier; + +class LLAssetUploadQueue +{ +public: + + // Takes ownership of supplier. + LLAssetUploadQueue(LLAssetUploadQueueSupplier* supplier); + virtual ~LLAssetUploadQueue(); + + void queue(const std::string& filename, + const LLUUID& task_id, + const LLUUID& item_id, + BOOL is_running, + BOOL is_target_mono, + const LLUUID& queue_id, + U8* data, + U32 data_size, + std::string script_name); + + bool isEmpty() const {return mQueue.empty();} + +private: + + friend class LLAssetUploadChainResponder; + + struct UploadData + { + std::string mFilename; + LLUUID mTaskId; + LLUUID mItemId; + BOOL mIsRunning; + BOOL mIsTargetMono; + LLUUID mQueueId; + U8* mData; + U32 mDataSize; + std::string mScriptName; + }; + + // Ownership of mSupplier passed to currently waiting responder + // and returned to queue when no requests in progress. + LLAssetUploadQueueSupplier* mSupplier; + std::deque<UploadData> mQueue; + + // Passes on ownership of mSupplier if request is made. + void request(LLAssetUploadQueueSupplier** supplier); +}; + +class LLAssetUploadQueueSupplier +{ +public: + virtual ~LLAssetUploadQueueSupplier(); + virtual LLAssetUploadQueue* get() const = 0; + virtual void log(std::string message) const = 0; +}; + +#endif // LL_LLASSETUPLOADQUEUE_H diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 3d91384f48..962066471f 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -34,6 +34,7 @@ #include "llassetuploadresponders.h" #include "llagent.h" +#include "llcompilequeue.h" #include "llfloaterbuycurrency.h" #include "lleconomy.h" #include "llfilepicker.h" @@ -73,11 +74,12 @@ LLAssetUploadResponder::LLAssetUploadResponder(const LLSD &post_data, } LLAssetUploadResponder::LLAssetUploadResponder(const LLSD &post_data, - const std::string& file_name) + const std::string& file_name, + LLAssetType::EType asset_type) : LLHTTPClient::Responder(), mPostData(post_data), - mAssetType(LLAssetType::AT_NONE), - mFileName(file_name) + mFileName(file_name), + mAssetType(asset_type) { } @@ -182,8 +184,8 @@ LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data { } -LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name) -: LLAssetUploadResponder(post_data, file_name) +LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name, LLAssetType::EType asset_type) +: LLAssetUploadResponder(post_data, file_name, asset_type) { } @@ -301,8 +303,9 @@ LLUpdateAgentInventoryResponder::LLUpdateAgentInventoryResponder(const LLSD& pos } LLUpdateAgentInventoryResponder::LLUpdateAgentInventoryResponder(const LLSD& post_data, - const std::string& file_name) -: LLAssetUploadResponder(post_data, file_name) + const std::string& file_name, + LLAssetType::EType asset_type) +: LLAssetUploadResponder(post_data, file_name, asset_type) { } @@ -410,8 +413,17 @@ LLUpdateTaskInventoryResponder::LLUpdateTaskInventoryResponder(const LLSD& post_ } LLUpdateTaskInventoryResponder::LLUpdateTaskInventoryResponder(const LLSD& post_data, - const std::string& file_name) -: LLAssetUploadResponder(post_data, file_name) + const std::string& file_name, + LLAssetType::EType asset_type) +: LLAssetUploadResponder(post_data, file_name, asset_type) +{ +} + +LLUpdateTaskInventoryResponder::LLUpdateTaskInventoryResponder(const LLSD& post_data, + const std::string& file_name, + const LLUUID& queue_id, + LLAssetType::EType asset_type) +: LLAssetUploadResponder(post_data, file_name, asset_type), mQueueId(queue_id) { } @@ -422,35 +434,16 @@ void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content) LLUUID item_id = mPostData["item_id"]; LLUUID task_id = mPostData["task_id"]; - LLViewerObject* object = gObjectList.findObject(task_id); - if (!object) - { - llwarns << "LLUpdateTaskInventoryResponder::uploadComplete task " << task_id - << " no longer exist." << llendl; - return; - } - LLViewerInventoryItem* item = (LLViewerInventoryItem*)object->getInventoryObject(item_id); - if (!item) - { - llwarns << "LLUpdateTaskInventoryResponder::uploadComplete item " - << item_id << " is no longer in task " << task_id - << "'s inventory." << llendl; - return; - } - LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); - // Update Viewer inventory - object->updateViewerInventoryAsset(new_item, content["new_asset"]); dialog_refresh_all(); - LLInventoryType::EType inventory_type = new_item->getInventoryType(); - switch(inventory_type) + switch(mAssetType) { - case LLInventoryType::IT_NOTECARD: + case LLAssetType::AT_NOTECARD: { // Update the UI with the new asset. LLPreviewNotecard* nc; - nc = (LLPreviewNotecard*)LLPreview::find(new_item->getUUID()); + nc = (LLPreviewNotecard*)LLPreview::find(item_id); if(nc) { // *HACK: we have to delete the asset in the VFS so @@ -470,28 +463,39 @@ void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content) } } break; - case LLInventoryType::IT_LSL: + case LLAssetType::AT_LSL_TEXT: { - LLLiveLSLEditor* preview = LLLiveLSLEditor::find(item_id, task_id); - if (preview) + if(mQueueId.notNull()) { - // Bytecode save completed - if (content["compiled"]) + LLFloaterCompileQueue* queue = + (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId); + if(NULL != queue) { - preview->callbackLSLCompileSucceeded( - task_id, - item_id, - mPostData["is_script_running"]); + queue->removeItemByItemID(item_id); } - else + } + else + { + LLLiveLSLEditor* preview = LLLiveLSLEditor::find(item_id, task_id); + if (preview) { - preview->callbackLSLCompileFailed(content["errors"]); + // Bytecode save completed + if (content["compiled"]) + { + preview->callbackLSLCompileSucceeded( + task_id, + item_id, + mPostData["is_script_running"]); + } + else + { + preview->callbackLSLCompileFailed(content["errors"]); + } } } } break; - case LLInventoryType::IT_WEARABLE: - default: - break; + default: + break; } } diff --git a/indra/newview/llassetuploadresponders.h b/indra/newview/llassetuploadresponders.h index 25f3f4c3b1..dc4f6e7bf0 100644 --- a/indra/newview/llassetuploadresponders.h +++ b/indra/newview/llassetuploadresponders.h @@ -42,7 +42,9 @@ public: LLAssetUploadResponder(const LLSD& post_data, const LLUUID& vfile_id, LLAssetType::EType asset_type); - LLAssetUploadResponder(const LLSD& post_data, const std::string& file_name); + LLAssetUploadResponder(const LLSD& post_data, + const std::string& file_name, + LLAssetType::EType asset_type); ~LLAssetUploadResponder(); virtual void error(U32 statusNum, const std::string& reason); virtual void result(const LLSD& content); @@ -52,8 +54,8 @@ public: protected: LLSD mPostData; - LLUUID mVFileID; LLAssetType::EType mAssetType; + LLUUID mVFileID; std::string mFileName; }; @@ -63,7 +65,8 @@ public: LLNewAgentInventoryResponder(const LLSD& post_data, const LLUUID& vfile_id, LLAssetType::EType asset_type); - LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name); + LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name, + LLAssetType::EType asset_type); virtual void uploadComplete(const LLSD& content); }; @@ -74,7 +77,8 @@ public: const LLUUID& vfile_id, LLAssetType::EType asset_type); LLUpdateAgentInventoryResponder(const LLSD& post_data, - const std::string& file_name); + const std::string& file_name, + LLAssetType::EType asset_type); virtual void uploadComplete(const LLSD& content); }; @@ -85,8 +89,17 @@ public: const LLUUID& vfile_id, LLAssetType::EType asset_type); LLUpdateTaskInventoryResponder(const LLSD& post_data, - const std::string& file_name); + const std::string& file_name, + LLAssetType::EType asset_type); + LLUpdateTaskInventoryResponder(const LLSD& post_data, + const std::string& file_name, + const LLUUID& queue_id, + LLAssetType::EType asset_type); + virtual void uploadComplete(const LLSD& content); + +private: + LLUUID mQueueId; }; #endif // LL_LLASSETUPLOADRESPONDER_H diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 3ab340f66a..30d5dc206f 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -42,6 +42,8 @@ #include "llcompilequeue.h" #include "llagent.h" +#include "llassetuploadqueue.h" +#include "llassetuploadresponders.h" #include "llchat.h" #include "llviewerwindow.h" #include "llviewerobject.h" @@ -72,20 +74,15 @@ const std::string RUN_START_STRING("set running"); const std::string NOT_RUN_QUEUE_TITLE("Set Not Running Progress"); const std::string NOT_RUN_START_STRING("set not running"); -struct LLCompileQueueData -{ - LLUUID mQueueID; - LLUUID mOldAssetID; - LLCompileQueueData(const LLUUID& q_id, const LLUUID& old_asset_id) : - mQueueID(q_id), mOldAssetID(old_asset_id) {} -}; - struct LLScriptQueueData { LLUUID mQueueID; std::string mScriptName; - LLScriptQueueData(const LLUUID& q_id, const std::string& name) : - mQueueID(q_id), mScriptName(name) {} + LLUUID mTaskId; + LLUUID mItemId; + LLScriptQueueData(const LLUUID& q_id, const std::string& name, const LLUUID& task_id, const LLUUID& item_id) : + mQueueID(q_id), mScriptName(name), mTaskId(task_id), mItemId(item_id) {} + }; ///---------------------------------------------------------------------------- @@ -105,7 +102,8 @@ LLFloaterScriptQueue::LLFloaterScriptQueue(const std::string& name, RESIZE_YES, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, DRAG_ON_TOP, MINIMIZE_YES, CLOSE_YES) { - + mID.generate(); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_queue.xml"); childSetAction("close",onCloseBtn,this); @@ -113,11 +111,8 @@ LLFloaterScriptQueue::LLFloaterScriptQueue(const std::string& name, setTitle(title); - if (!getHost()) - { - LLRect curRect = getRect(); - translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); - } + LLRect curRect = getRect(); + translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); mStartString = start_string; mDone = FALSE; @@ -279,14 +274,57 @@ BOOL LLFloaterScriptQueue::popNext() ///---------------------------------------------------------------------------- // static -LLFloaterCompileQueue* LLFloaterCompileQueue::create() +LLFloaterCompileQueue* LLFloaterCompileQueue::create(BOOL mono) { S32 left, top; gFloaterView->getNewFloaterPosition(&left, &top); LLRect rect = gSavedSettings.getRect("CompileOutputRect"); rect.translate(left - rect.mLeft, top - rect.mTop); LLFloaterCompileQueue* new_queue = new LLFloaterCompileQueue("queue", rect); - new_queue->open(); /*Flawfinder: ignore*/ + + class LLCompileFloaterUploadQueueSupplier : public LLAssetUploadQueueSupplier + { + public: + + LLCompileFloaterUploadQueueSupplier(const LLUUID& queue_id) : + mQueueId(queue_id) + { + } + + virtual LLAssetUploadQueue* get() const + { + LLFloaterCompileQueue* queue = + (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId); + + if(NULL == queue) + { + return NULL; + } + + return queue->mUploadQueue; + } + + virtual void log(std::string message) const + { + LLFloaterCompileQueue* queue = + (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId); + + if(NULL == queue) + { + return; + } + + LLScrollListCtrl* list = queue->getChild<LLScrollListCtrl>("queue output"); + list->addCommentText(message.c_str()); + } + + private: + LLUUID mQueueId; + }; + + new_queue->mUploadQueue = new LLAssetUploadQueue(new LLCompileFloaterUploadQueueSupplier(new_queue->getID())); + new_queue->mMono = mono; + new_queue->open(); return new_queue; } @@ -304,7 +342,7 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. - typedef std::map<LLUUID, LLPointer<LLInventoryItem> > uuid_item_map; + typedef std::multimap<LLUUID, LLPointer<LLInventoryItem> > uuid_item_map; uuid_item_map asset_item_map; InventoryObjectList::const_iterator it = inv->begin(); @@ -315,17 +353,12 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); // Check permissions before allowing the user to retrieve data. - if (item->getPermissions().allowModifyBy(gAgent.getID()) && - item->getPermissions().allowCopyBy(gAgent.getID()) ) + if (item->getPermissions().allowModifyBy(gAgent.getID(), gAgent.getGroupID()) && + item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID()) ) { LLPointer<LLViewerInventoryItem> script = new LLViewerInventoryItem(item); mCurrentScripts.put(script); - - if (!asset_item_map.count(item->getAssetUUID())) - { - // No entry, put in an entry for this supposedly permissive script - asset_item_map[item->getAssetUUID()] = item; - } + asset_item_map.insert(std::make_pair(item->getAssetUUID(), item)); } } } @@ -342,7 +375,10 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, for(iter = asset_item_map.begin(); iter != asset_item_map.end(); iter++) { LLInventoryItem *itemp = iter->second; - LLScriptQueueData* datap = new LLScriptQueueData(getID(), itemp->getName()); + LLScriptQueueData* datap = new LLScriptQueueData(getID(), + itemp->getName(), + viewer_object->getID(), + itemp->getUUID()); //llinfos << "ITEM NAME 2: " << names.get(i) << llendl; gAssetStorage->getInvItemAsset(viewer_object->getRegion()->getHost(), @@ -359,7 +395,6 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, } } - // This is the callback for when each script arrives // static void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, @@ -382,31 +417,58 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, std::string uuid_str; asset_id.toString(uuid_str); filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str) + llformat(".%s",LLAssetType::lookup(type)); - - LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ - if (fp) + + const bool is_running = true; + LLViewerObject* object = gObjectList.findObject(data->mTaskId); + if (object) { - const S32 buf_size = 65536; - U8 copy_buf[buf_size]; - while (file.read(copy_buf, buf_size)) /*Flawfinder: ignore*/ + std::string url = object->getRegion()->getCapability("UpdateScriptTaskInventory"); + if(!url.empty()) + { + // Read script source in to buffer. + U32 script_size = file.getSize(); + U8* script_data = new U8[script_size]; + file.read(script_data, script_size); + + queue->mUploadQueue->queue(filename, data->mTaskId, + data->mItemId, is_running, queue->mMono, queue->getID(), + script_data, script_size, data->mScriptName); + } + else { - if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1) + // It's now in the file, now compile it. + buffer = std::string("Downloaded, now compiling: ") + data->mScriptName; // *TODO: Translate + + // Write script to local file for compilation. + LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ + if (fp) { - // return a bad file error if we can't write the whole thing - status = LL_ERR_CANNOT_OPEN_FILE; + const S32 buf_size = 65536; + U8 copy_buf[buf_size]; + + while (file.read(copy_buf, buf_size)) /*Flawfinder: ignore*/ + { + if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1) + { + // return a bad file error if we can't write the whole thing + status = LL_ERR_CANNOT_OPEN_FILE; + } + } + + fclose(fp); + } + else + { + llerrs << "Unable to find object to compile" << llendl; } - } - fclose(fp); + // TODO: babbage: No compile if no cap. + queue->compile(filename, data->mItemId); + + // Delete it after we're done compiling? + LLFile::remove(filename); + } } - - // *TODO: translate - // It's now in the file, now compile it. - buffer = std::string("Downloaded, now compiling: ") + data->mScriptName; // *TODO: Translate - queue->compile(filename, asset_id); - - // Delete it after we're done compiling? - LLFile::remove(filename); } else { @@ -430,9 +492,9 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, } llwarns << "Problem downloading script asset." << llendl; - if(queue) queue->removeItemByAssetID(asset_id); + if(queue) queue->removeItemByItemID(data->mItemId); } - if(queue) + if(queue && (buffer.size() > 0)) { LLScrollListCtrl* list = queue->getChild<LLScrollListCtrl>("queue output"); list->addCommentText(buffer); @@ -462,9 +524,8 @@ void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void* (LLFloaterScriptQueue::findInstance(data->mQueueID)); if(queue && (0 == status) && data) { - queue->updateAssetID(data->mOldAssetID, asset_id); - queue->saveItemByAssetID(asset_id); - queue->removeItemByAssetID(asset_id); + queue->saveItemByItemID(data->mItemId); + queue->removeItemByItemID(data->mItemId); } else { @@ -479,7 +540,7 @@ void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void* // compile the file given and save it out. void LLFloaterCompileQueue::compile(const std::string& filename, - const LLUUID& asset_id) + const LLUUID& item_id) { LLUUID new_asset_id; LLTransactionID tid; @@ -496,29 +557,34 @@ void LLFloaterCompileQueue::compile(const std::string& filename, gAssetStorage->storeAssetData(filename, tid, LLAssetType::AT_LSL_TEXT, &onSaveTextComplete, NULL, FALSE); - if(!lscript_compile(filename.c_str(), dst_filename.c_str(), err_filename.c_str(), gAgent.isGodlike())) + + const BOOL compile_to_mono = FALSE; + if(!lscript_compile(filename.c_str(), dst_filename.c_str(), + err_filename.c_str(), compile_to_mono, + uuid_string.c_str(), gAgent.isGodlike())) { llwarns << "compile failed" << llendl; - removeItemByAssetID(asset_id); + removeItemByItemID(item_id); } else { llinfos << "compile successful." << llendl; - // Save the bytecode - LLCompileQueueData* data = new LLCompileQueueData(mID, asset_id); - gAssetStorage->storeAssetData(dst_filename, tid, - LLAssetType::AT_LSL_BYTECODE, - &onSaveBytecodeComplete, - (void*)data, FALSE); + + // Save LSL bytecode + LLCompileQueueData* data = new LLCompileQueueData(mID, item_id); + gAssetStorage->storeAssetData(dst_filename, new_asset_id, + LLAssetType::AT_LSL_BYTECODE, + &LLFloaterCompileQueue::onSaveBytecodeComplete, + (void*)data, FALSE); } } -void LLFloaterCompileQueue::removeItemByAssetID(const LLUUID& asset_id) +void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id) { llinfos << "LLFloaterCompileQueue::removeItemByAssetID()" << llendl; for(S32 i = 0; i < mCurrentScripts.count(); ) { - if(asset_id == mCurrentScripts.get(i)->getAssetUUID()) + if(asset_id == mCurrentScripts.get(i)->getUUID()) { mCurrentScripts.remove(i); } @@ -533,7 +599,21 @@ void LLFloaterCompileQueue::removeItemByAssetID(const LLUUID& asset_id) } } -void LLFloaterCompileQueue::saveItemByAssetID(const LLUUID& asset_id) +const LLInventoryItem* LLFloaterCompileQueue::findItemByItemID(const LLUUID& asset_id) const +{ + LLInventoryItem* result = NULL; + S32 count = mCurrentScripts.count(); + for(S32 i = 0; i < count; ++i) + { + if(asset_id == mCurrentScripts.get(i)->getUUID()) + { + result = mCurrentScripts.get(i); + } + } + return result; +} + +void LLFloaterCompileQueue::saveItemByItemID(const LLUUID& asset_id) { llinfos << "LLFloaterCompileQueue::saveItemByAssetID()" << llendl; LLViewerObject* viewer_object = gObjectList.findObject(mCurrentObjectID); @@ -542,7 +622,7 @@ void LLFloaterCompileQueue::saveItemByAssetID(const LLUUID& asset_id) S32 count = mCurrentScripts.count(); for(S32 i = 0; i < count; ++i) { - if(asset_id == mCurrentScripts.get(i)->getAssetUUID()) + if(asset_id == mCurrentScripts.get(i)->getUUID()) { // *FIX: this auto-resets active to TRUE. That might // be a bad idea. @@ -556,20 +636,6 @@ void LLFloaterCompileQueue::saveItemByAssetID(const LLUUID& asset_id) } } -// find old_asst_id, and set the asset id to new_asset_id -void LLFloaterCompileQueue::updateAssetID(const LLUUID& old_asset_id, - const LLUUID& new_asset_id) -{ - S32 count = mCurrentScripts.count(); - for(S32 i = 0; i < count; ++i) - { - if(old_asset_id == mCurrentScripts.get(i)->getAssetUUID()) - { - mCurrentScripts.get(i)->setAssetUUID(new_asset_id); - } - } -} - ///---------------------------------------------------------------------------- /// Class LLFloaterResetQueue ///---------------------------------------------------------------------------- @@ -582,7 +648,8 @@ LLFloaterResetQueue* LLFloaterResetQueue::create() LLRect rect = gSavedSettings.getRect("CompileOutputRect"); rect.translate(left - rect.mLeft, top - rect.mTop); LLFloaterResetQueue* new_queue = new LLFloaterResetQueue("queue", rect); - new_queue->open(); /*Flawfinder: ignore*/ + gFloaterView->addChild(new_queue); + new_queue->open(); return new_queue; } diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h index be7bbd5ceb..68e9a27266 100644 --- a/indra/newview/llcompilequeue.h +++ b/indra/newview/llcompilequeue.h @@ -64,6 +64,9 @@ public: // start() returns TRUE if the queue has started, otherwise FALSE. BOOL start(); + // find an instance by ID. Return NULL if it does not exist. + static LLFloaterScriptQueue* findInstance(const LLUUID& id); + protected: LLFloaterScriptQueue(const std::string& name, const LLRect& rect, const std::string& title, const std::string& start_string); @@ -92,9 +95,6 @@ protected: // Get this instances ID. const LLUUID& getID() const { return mID; } - - // find an instance by ID. Return NULL if it does not exist. - static LLFloaterScriptQueue* findInstance(const LLUUID& id); protected: // UI @@ -118,12 +118,29 @@ protected: // This script queue will recompile each script. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +struct LLCompileQueueData +{ + LLUUID mQueueID; + LLUUID mItemId; + LLCompileQueueData(const LLUUID& q_id, const LLUUID& item_id) : + mQueueID(q_id), mItemId(item_id) {} +}; + +class LLAssetUploadQueue; + class LLFloaterCompileQueue : public LLFloaterScriptQueue { public: // Use this method to create a compile queue. Once created, it // will be responsible for it's own destruction. - static LLFloaterCompileQueue* create(); + static LLFloaterCompileQueue* create(BOOL mono); + + static void onSaveBytecodeComplete(const LLUUID& asset_id, + void* user_data, + S32 status); + + // remove any object in mScriptScripts with the matching uuid. + void removeItemByItemID(const LLUUID& item_id); protected: LLFloaterCompileQueue(const std::string& name, const LLRect& rect); @@ -139,6 +156,7 @@ protected: void* user_data, S32 status, LLExtStat ext_status); static void onSaveTextComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status); + static void onSaveBytecodeComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status); @@ -149,14 +167,18 @@ protected: // remove any object in mScriptScripts with the matching uuid. void removeItemByAssetID(const LLUUID& asset_id); - // save the items indicatd by the asset id. - void saveItemByAssetID(const LLUUID& asset_id); + // save the items indicated by the item id. + void saveItemByItemID(const LLUUID& item_id); - // find old_asst_id, and set the asset id to new_asset_id - void updateAssetID(const LLUUID& old_asset_id, const LLUUID& new_asset_id); + // find InventoryItem given item id. + const LLInventoryItem* findItemByItemID(const LLUUID& item_id) const; protected: LLViewerInventoryItem::item_array_t mCurrentScripts; + +private: + BOOL mMono; // Compile to mono. + LLAssetUploadQueue* mUploadQueue; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index 3c1b89d04b..2d0723f1eb 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -170,6 +170,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) F32 score; std::string name_buf; std::string owner_buf; + F32 mono_score; msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block); msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block); @@ -192,6 +193,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) element["columns"][0]["column"] = "score"; element["columns"][0]["value"] = llformat("%0.3f", score); element["columns"][0]["font"] = "SANSSERIF"; + element["columns"][1]["column"] = "name"; element["columns"][1]["value"] = name_buf; element["columns"][1]["font"] = "SANSSERIF"; @@ -205,6 +207,14 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) element["columns"][3]["value"] = formatted_time((time_t)time_stamp); element["columns"][3]["font"] = "SANSSERIF"; + if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS) + { + msg->getF32Fast(_PREHASH_ReportData, "MonoScore", mono_score, block); + element["columns"][4]["column"] = "Mono Time"; + element["columns"][4]["value"] = llformat("%0.3f", mono_score); + element["columns"][4]["font"] = "SANSSERIF"; + } + list->addElement(element); mObjectListData.append(element); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 75e8f52cfc..71733e5cd7 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -139,6 +139,12 @@ const S32 TEXT_EDIT_COLUMN_HEIGHT = 16; const S32 MAX_HISTORY_COUNT = 10; const F32 LIVE_HELP_REFRESH_TIME = 1.f; +static bool have_script_upload_cap(LLUUID& object_id) +{ + LLViewerObject* object = gObjectList.findObject(object_id); + return object && (! object->getRegion()->getCapability("UpdateScriptTaskInventory").empty()); +} + /// --------------------------------------------------------------------------- /// LLFloaterScriptSearch /// --------------------------------------------------------------------------- @@ -173,7 +179,7 @@ private: LLFloaterScriptSearch* LLFloaterScriptSearch::sInstance = NULL; LLFloaterScriptSearch::LLFloaterScriptSearch(std::string title, LLRect rect, LLScriptEdCore* editor_core) - : LLFloater(std::string("script search"),rect,title), mEditorCore(editor_core) + : LLFloater("script search",rect,title), mEditorCore(editor_core) { LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_search.xml"); @@ -306,14 +312,15 @@ LLScriptEdCore::LLScriptEdCore( mUserdata( userdata ), mForceClose( FALSE ), mLastHelpToken(NULL), - mLiveHelpHistorySize(0) + mLiveHelpHistorySize(0), + mEnableSave(FALSE) { setFollowsAll(); setBorderVisible(FALSE); LLUICtrlFactory::getInstance()->buildPanel(this, "floater_script_ed_panel.xml"); - + mErrorList = getChild<LLScrollListCtrl>("lsl errors"); mFunctions = getChild<LLComboBox>( "Insert..."); @@ -439,13 +446,13 @@ BOOL LLScriptEdCore::hasChanged(void* userdata) LLScriptEdCore* self = (LLScriptEdCore*)userdata; if (!self || !self->mEditor) return FALSE; - return !self->mEditor->isPristine(); + return !self->mEditor->isPristine() || self->mEnableSave; } void LLScriptEdCore::draw() { - BOOL script_changed = !mEditor->isPristine(); - childSetEnabled("Save_btn", script_changed); + BOOL script_changed = hasChanged(this); + childSetEnabled("Save_btn", script_changed); if( mEditor->hasFocus() ) { @@ -594,7 +601,7 @@ void LLScriptEdCore::addHelpItemToHistory(const std::string& help_string) BOOL LLScriptEdCore::canClose() { - if(mForceClose || mEditor->isPristine()) + if(mForceClose || !hasChanged(this)) { return TRUE; } @@ -1133,7 +1140,9 @@ void LLPreviewLSL::callbackLSLCompileFailed(const LLSD& compile_errors) line++) { LLSD row; - row["columns"][0]["value"] = line->asString(); + std::string error_message = line->asString(); + LLStringUtil::stripNonprintable(error_message); + row["columns"][0]["value"] = error_message; row["columns"][0]["font"] = "OCRA"; mScriptEd->mErrorList->addElement(row); } @@ -1247,7 +1256,7 @@ void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save) void LLPreviewLSL::saveIfNeeded() { // llinfos << "LLPreviewLSL::saveIfNeeded()" << llendl; - if(mScriptEd->mEditor->isPristine()) + if(!LLScriptEdCore::hasChanged(mScriptEd)) { return; } @@ -1305,7 +1314,8 @@ void LLPreviewLSL::uploadAssetViaCaps(const std::string& url, llinfos << "Update Agent Inventory via capability" << llendl; LLSD body; body["item_id"] = item_id; - LLHTTPClient::post(url, body, new LLUpdateAgentInventoryResponder(body, filename)); + body["target"] = "lsl2"; + LLHTTPClient::post(url, body, new LLUpdateAgentInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT)); } void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, @@ -1326,9 +1336,12 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, std::string dst_filename = llformat("%s.lso", filepath.c_str()); std::string err_filename = llformat("%s.out", filepath.c_str()); + const BOOL compile_to_mono = FALSE; if(!lscript_compile(filename.c_str(), dst_filename.c_str(), err_filename.c_str(), + compile_to_mono, + asset_id.asString().c_str(), gAgent.isGodlike())) { llinfos << "Compile failed!" << llendl; @@ -1601,7 +1614,8 @@ LLLiveLSLEditor::LLLiveLSLEditor(const std::string& name, mAskedForRunningInfo(FALSE), mHaveRunningInfo(FALSE), mCloseAfterSave(FALSE), - mPendingUploads(0) + mPendingUploads(0), + mIsModifiable(FALSE) { @@ -1615,13 +1629,14 @@ LLLiveLSLEditor::LLLiveLSLEditor(const std::string& name, LLLiveLSLEditor::sInstances.addData(mItemID ^ mObjectID, this); - - LLCallbackMap::map_t factory_map; factory_map["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this); LLUICtrlFactory::getInstance()->buildFloater(this,"floater_live_lsleditor.xml", &factory_map); - + + mMonoCheckbox = getChild<LLCheckBoxCtrl>("mono"); + childSetCommitCallback("mono", &LLLiveLSLEditor::onMonoCheckboxClicked, this); + childSetEnabled("mono", FALSE); childSetCommitCallback("running", LLLiveLSLEditor::onRunningCheckboxClicked, this); childSetEnabled("running", FALSE); @@ -1633,7 +1648,6 @@ LLLiveLSLEditor::LLLiveLSLEditor(const std::string& name, mScriptEd->mEditor->makePristine(); loadAsset(is_new); mScriptEd->mEditor->setFocus(TRUE); - if (!getHost()) { @@ -1677,7 +1691,9 @@ void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors) line++) { LLSD row; - row["columns"][0]["value"] = line->asString(); + std::string error_message = line->asString(); + LLStringUtil::stripNonprintable(error_message); + row["columns"][0]["value"] = error_message; row["columns"][0]["font"] = "OCRA"; mScriptEd->mErrorList->addElement(row); } @@ -1712,6 +1728,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) mScriptEd->mEditor->setText(getString("not_allowed")); mScriptEd->mEditor->makePristine(); mScriptEd->mEditor->setEnabled(FALSE); + mScriptEd->enableSave(FALSE); mAssetStatus = PREVIEW_ASSET_LOADED; } else if(item && mItem.notNull()) @@ -1745,12 +1762,14 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) mAssetStatus = PREVIEW_ASSET_LOADED; } - if(item - && !gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), - GP_OBJECT_MANIPULATE)) + mIsModifiable = item && gAgent.allowOperation(PERM_MODIFY, + item->getPermissions(), + GP_OBJECT_MANIPULATE); + if(!mIsModifiable) { mScriptEd->mEditor->setEnabled(FALSE); } + // This is commented out, because we don't completely // handle script exports yet. /* @@ -1784,8 +1803,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new) else { mScriptEd->mEditor->setText(std::string(HELLO_LSL)); - //mScriptEd->mEditor->setText(LLStringUtil::null); - //mScriptEd->mEditor->makePristine(); + mScriptEd->enableSave(FALSE); LLPermissions perm; perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, gAgent.getGroupID()); perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER); @@ -1955,22 +1973,43 @@ void LLLiveLSLEditor::draw() { LLViewerObject* object = gObjectList.findObject(mObjectID); LLCheckBoxCtrl* runningCheckbox = getChild<LLCheckBoxCtrl>( "running"); - if(object && mAskedForRunningInfo && mHaveRunningInfo) + if(object && mAskedForRunningInfo && mHaveRunningInfo) { if(object->permAnyOwner()) { runningCheckbox->setLabel(getString("script_running")); runningCheckbox->setEnabled(TRUE); + + if(object->permAnyOwner()) + { + runningCheckbox->setLabel(getString("script_running")); + runningCheckbox->setEnabled(TRUE); + } + else + { + runningCheckbox->setLabel(getString("public_objects_can_not_run")); + runningCheckbox->setEnabled(FALSE); + // *FIX: Set it to false so that the ui is correct for + // a box that is released to public. It could be + // incorrect after a release/claim cycle, but will be + // correct after clicking on it. + runningCheckbox->set(FALSE); + mMonoCheckbox->set(FALSE); + } } else { runningCheckbox->setLabel(getString("public_objects_can_not_run")); runningCheckbox->setEnabled(FALSE); + // *FIX: Set it to false so that the ui is correct for // a box that is released to public. It could be // incorrect after a release/claim cycle, but will be // correct after clicking on it. runningCheckbox->set(FALSE); + mMonoCheckbox->setEnabled(FALSE); + // object may have fallen out of range. + mHaveRunningInfo = FALSE; } } else if(!object) @@ -2044,7 +2083,7 @@ void LLLiveLSLEditor::saveIfNeeded() } // Don't need to save if we're pristine - if(mScriptEd->mEditor->isPristine()) + if(!LLScriptEdCore::hasChanged(mScriptEd)) { return; } @@ -2052,6 +2091,7 @@ void LLLiveLSLEditor::saveIfNeeded() mPendingUploads = 0; // save the script + mScriptEd->enableSave(FALSE); mScriptEd->mEditor->makePristine(); mScriptEd->mErrorList->deleteAllItems(); @@ -2091,7 +2131,7 @@ void LLLiveLSLEditor::saveIfNeeded() fp = NULL; // save it out to asset server - std::string url = gAgent.getRegion()->getCapability("UpdateScriptTaskInventory"); + std::string url = object->getRegion()->getCapability("UpdateScriptTaskInventory"); getWindow()->incBusyCount(); mPendingUploads++; BOOL is_running = getChild<LLCheckBoxCtrl>( "running")->get(); @@ -2117,8 +2157,9 @@ void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url, body["task_id"] = task_id; body["item_id"] = item_id; body["is_script_running"] = is_running; + body["target"] = monoChecked() ? "mono" : "lsl2"; LLHTTPClient::post(url, body, - new LLUpdateTaskInventoryResponder(body, filename)); + new LLUpdateTaskInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT)); } void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, @@ -2141,9 +2182,12 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, std::string err_filename = llformat("%s.out", filepath.c_str()); LLFILE *fp; + const BOOL compile_to_mono = FALSE; if(!lscript_compile(filename.c_str(), dst_filename.c_str(), err_filename.c_str(), + compile_to_mono, + asset_id.asString().c_str(), gAgent.isGodlike())) { // load the error file into the error scrolllist @@ -2384,6 +2428,11 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) msg->getBOOLFast(_PREHASH_Script, _PREHASH_Running, running); LLCheckBoxCtrl* runningCheckbox = instance->getChild<LLCheckBoxCtrl>("running"); runningCheckbox->set(running); + BOOL mono; + msg->getBOOLFast(_PREHASH_Script, "Mono", mono); + LLCheckBoxCtrl* monoCheckbox = instance->getChild<LLCheckBoxCtrl>("mono"); + monoCheckbox->setEnabled(instance->getIsModifiable() && have_script_upload_cap(object_id)); + monoCheckbox->set(mono); } } @@ -2398,3 +2447,19 @@ void LLLiveLSLEditor::reshape(S32 width, S32 height, BOOL called_from_parent) gSavedSettings.setRect("PreviewScriptRect", getRect()); } } + +void LLLiveLSLEditor::onMonoCheckboxClicked(LLUICtrl*, void* userdata) +{ + LLLiveLSLEditor* self = static_cast<LLLiveLSLEditor*>(userdata); + self->mMonoCheckbox->setEnabled(have_script_upload_cap(self->mObjectID)); + self->mScriptEd->enableSave(self->getIsModifiable()); +} + +BOOL LLLiveLSLEditor::monoChecked() const +{ + if(NULL != mMonoCheckbox) + { + return mMonoCheckbox->getValue()? TRUE : FALSE; + } + return FALSE; +} diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index aec4bb2ab7..ca1c527cb2 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -118,13 +118,14 @@ public: void selectFirstError(); virtual BOOL handleKeyHere(KEY key, MASK mask); + + void enableSave(BOOL b) {mEnableSave = b;} protected: void deleteBridges(); void setHelpPage(const std::string& help_string); void updateDynamicHelp(BOOL immediate = FALSE); void addHelpItemToHistory(const std::string& help_string); - static void onErrorList(LLUICtrl*, void* user_data); virtual const char *getTitleName() const { return "Script"; } @@ -147,6 +148,7 @@ private: LLKeywordToken* mLastHelpToken; LLFrameTimer mLiveHelpTimer; S32 mLiveHelpHistorySize; + BOOL mEnableSave; }; @@ -184,8 +186,9 @@ protected: void* user_data, S32 status, LLExtStat ext_status); static void onSaveComplete(const LLUUID& uuid, void* user_data, S32 status, LLExtStat ext_status); static void onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status); +public: static LLPreviewLSL* getInstance(const LLUUID& uuid); - +protected: static void* createScriptEdPanel(void* userdata); @@ -195,6 +198,7 @@ protected: LLScriptEdCore* mScriptEd; // Can safely close only after both text and bytecode are uploaded S32 mPendingUploads; + }; @@ -277,6 +281,15 @@ protected: S32 mPendingUploads; static LLMap<LLUUID, LLLiveLSLEditor*> sInstances; + BOOL getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert + +private: + + static void onMonoCheckboxClicked(LLUICtrl*, void* userdata); + BOOL monoChecked() const; + + LLCheckBoxCtrl* mMonoCheckbox; + BOOL mIsModifiable; }; #endif // LL_LLPREVIEWSCRIPT_H diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index e37de3b2de..d24c738f2c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -3381,13 +3381,13 @@ void init_stat_view() stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; - stat_barp = sim_statviewp->addStat("Script Perf", &(LLViewerStats::getInstance()->mSimLSLIPS)); - stat_barp->setUnitLabel(" ips"); + stat_barp = sim_statviewp->addStat("Script Events", &(LLViewerStats::getInstance()->mSimScriptEPS)); + stat_barp->setUnitLabel(" eps"); stat_barp->mPrecision = 0; stat_barp->mMinBar = 0.f; - stat_barp->mMaxBar = 100000.f; - stat_barp->mTickSpacing = 25000.f; - stat_barp->mLabelSpacing = 50000.f; + stat_barp->mMaxBar = 20000.f; + stat_barp->mTickSpacing = 2500.f; + stat_barp->mLabelSpacing = 5000.f; stat_barp->mPerSec = FALSE; stat_barp->mDisplayBar = FALSE; stat_barp->mDisplayMean = FALSE; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index a095c9e159..771a71c5c5 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6160,9 +6160,13 @@ class LLToolsSelectedScriptAction : public view_listener_t { std::string action = userdata.asString(); LLFloaterScriptQueue* queue = NULL; - if (action == "compile") + if (action == "compile mono") { - queue = LLFloaterCompileQueue::create(); + queue = LLFloaterCompileQueue::create(TRUE); + } + if (action == "compile lsl") + { + queue = LLFloaterCompileQueue::create(FALSE); } else if (action == "reset") { @@ -6405,16 +6409,36 @@ BOOL enable_more_than_one_selected(void* ) return (LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1); } +static bool is_editable_selected() +{ + return (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL); +} + class LLEditableSelected : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { - bool new_value = (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); + gMenuHolder->findControl(userdata["control"].asString())->setValue(is_editable_selected()); return true; } }; +class LLEditableSelectedMono : public view_listener_t +{ + bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) + { + LLViewerRegion* region = gAgent.getRegion(); + if(region && gMenuHolder && gMenuHolder->findControl(userdata["control"].asString())) + { + bool have_cap = (! region->getCapability("UpdateScriptTaskInventory").empty()); + bool selected = is_editable_selected() && have_cap; + gMenuHolder->findControl(userdata["control"].asString())->setValue(selected); + return true; + } + return false; + } +}; + class LLToolsEnableTakeCopy : public view_listener_t { bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) @@ -7842,4 +7866,5 @@ void initialize_menus() addMenu(new LLSomethingSelected(), "SomethingSelected"); addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD"); addMenu(new LLEditableSelected(), "EditableSelected"); + addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a082d6f1b5..d440491661 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3464,8 +3464,8 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) case LL_SIM_STAT_NUMSCRIPTSACTIVE: LLViewerStats::getInstance()->mSimActiveScripts.addValue(stat_value); break; - case LL_SIM_STAT_LSLIPS: - LLViewerStats::getInstance()->mSimLSLIPS.addValue(stat_value); + case LL_SIM_STAT_SCRIPT_EPS: + LLViewerStats::getInstance()->mSimScriptEPS.addValue(stat_value); break; case LL_SIM_STAT_INPPS: LLViewerStats::getInstance()->mSimInPPS.addValue(stat_value); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 1aa7d2c3ff..8745a73e79 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2145,7 +2145,7 @@ void LLViewerObject::deleteInventoryItem(const LLUUID& item_id) } void LLViewerObject::doUpdateInventory( - LLViewerInventoryItem* item, + LLPointer<LLViewerInventoryItem>& item, U8 key, bool is_new) { @@ -2217,7 +2217,8 @@ void LLViewerObject::doUpdateInventory( --mInventorySerialNum; } } - LLViewerInventoryItem* new_item = new LLViewerInventoryItem(item); + LLViewerInventoryItem* oldItem = item; + LLViewerInventoryItem* new_item = new LLViewerInventoryItem(oldItem); new_item->setPermissions(perm); mInventory->push_front(new_item); doInventoryCallback(); @@ -2608,6 +2609,21 @@ void LLViewerObject::updateInventory( doUpdateInventory(task_item, key, is_new); } +void LLViewerObject::updateInventoryLocal(LLInventoryItem* item, U8 key) +{ + LLPointer<LLViewerInventoryItem> task_item = + new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(), + item->getAssetUUID(), item->getType(), + item->getInventoryType(), + item->getName(), item->getDescription(), + item->getSaleInfo(), item->getFlags(), + item->getCreationDate()); + + // do the internal logic + const bool is_new = false; + doUpdateInventory(task_item, key, is_new); +} + LLInventoryObject* LLViewerObject::getInventoryObject(const LLUUID& item_id) { LLInventoryObject* rv = NULL; diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index a143589ee9..1fd4a29238 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -384,6 +384,7 @@ public: // manager, so do no call updateInventory() from the selection // manager until we have better iterators. void updateInventory(LLViewerInventoryItem* item, U8 key, bool is_new); + void updateInventoryLocal(LLInventoryItem* item, U8 key); // Update without messaging. LLInventoryObject* getInventoryObject(const LLUUID& item_id); void getInventoryContents(InventoryObjectList& objects); LLInventoryObject* getInventoryRoot(); @@ -540,7 +541,7 @@ protected: // do the update/caching logic. called by saveScript and // updateInventory. - void doUpdateInventory(LLViewerInventoryItem* item, U8 key, bool is_new); + void doUpdateInventory(LLPointer<LLViewerInventoryItem>& item, U8 key, bool is_new); static LLViewerObject *createObject(const LLUUID &id, LLPCode pcode, LLViewerRegion *regionp); diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index ccd3110758..446f8f026a 100644 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -63,7 +63,7 @@ public: LLStat mSimFPS; LLStat mSimPhysicsFPS; LLStat mSimAgentUPS; - LLStat mSimLSLIPS; + LLStat mSimScriptEPS; LLStat mSimFrameMsec; LLStat mSimNetMsec; diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index 20a572c8e0..a39bb9faf6 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -231,8 +231,8 @@ TOOLMEDIAOPEN CURSOR "toolmediaopen.cur" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,19,1,83014 - PRODUCTVERSION 1,19,1,83014 + FILEVERSION 1,20,9,87416 + PRODUCTVERSION 1,20,9,87416 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -249,12 +249,12 @@ BEGIN BEGIN VALUE "CompanyName", "Linden Lab" VALUE "FileDescription", "Second Life" - VALUE "FileVersion", "1.19.1.83014" + VALUE "FileVersion", "1.20.9.87416" VALUE "InternalName", "Second Life" VALUE "LegalCopyright", "Copyright © 2001-2008, Linden Research, Inc." VALUE "OriginalFilename", "SecondLife.exe" VALUE "ProductName", "Second Life" - VALUE "ProductVersion", "1.19.1.83014" + VALUE "ProductVersion", "1.20.9.87416" END END BLOCK "VarFileInfo" |