diff options
-rwxr-xr-x | indra/newview/llassetuploadqueue.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/llassetuploadqueue.h | 4 | ||||
-rwxr-xr-x | indra/newview/llcompilequeue.cpp | 152 | ||||
-rwxr-xr-x | indra/newview/llcompilequeue.h | 12 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/strings.xml | 3 |
5 files changed, 145 insertions, 31 deletions
diff --git a/indra/newview/llassetuploadqueue.cpp b/indra/newview/llassetuploadqueue.cpp index 2b428aec4b..1b72a077fb 100755 --- a/indra/newview/llassetuploadqueue.cpp +++ b/indra/newview/llassetuploadqueue.cpp @@ -165,6 +165,7 @@ void LLAssetUploadQueue::request(LLAssetUploadQueueSupplier** supplier) body["item_id"] = data.mItemId; body["is_script_running"] = data.mIsRunning; body["target"] = data.mIsTargetMono? "mono" : "lsl2"; + body["experience"] = data.mExperienceId; std::string url = ""; LLViewerObject* object = gObjectList.findObject(data.mTaskId); @@ -188,7 +189,8 @@ void LLAssetUploadQueue::queue(const std::string& filename, const LLUUID& queue_id, U8* script_data, U32 data_size, - std::string script_name) + std::string script_name, + const LLUUID& experience_id) { UploadData data; data.mTaskId = task_id; @@ -200,6 +202,7 @@ void LLAssetUploadQueue::queue(const std::string& filename, data.mData = script_data; data.mDataSize = data_size; data.mScriptName = script_name; + data.mExperienceId = experience_id; mQueue.push_back(data); diff --git a/indra/newview/llassetuploadqueue.h b/indra/newview/llassetuploadqueue.h index 434f3e5c03..2ceee8f700 100755 --- a/indra/newview/llassetuploadqueue.h +++ b/indra/newview/llassetuploadqueue.h @@ -50,7 +50,8 @@ public: const LLUUID& queue_id, U8* data, U32 data_size, - std::string script_name); + std::string script_name, + const LLUUID& experience_id); bool isEmpty() const {return mQueue.empty();} @@ -69,6 +70,7 @@ private: U8* mData; U32 mDataSize; std::string mScriptName; + LLUUID mExperienceId; }; // Ownership of mSupplier passed to currently waiting responder diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index b0916d769a..9e554ba0eb 100755 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -59,6 +59,8 @@ #include "lltrans.h" #include "llselectmgr.h" +#include "llexperienceassociationresponder.h" +#include "llexperiencecache.h" // *TODO: This should be separated into the script queue, and the floater views of that queue. // There should only be one floater class that can view any queue type @@ -70,11 +72,13 @@ struct LLScriptQueueData { LLUUID mQueueID; - std::string mScriptName; 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) {} + LLPointer<LLInventoryItem> mItem; + LLHost mHost; + LLUUID mExperienceId; + std::string mExperiencename; + LLScriptQueueData(const LLUUID& q_id, const LLUUID& task_id, LLInventoryItem* item) : + mQueueID(q_id), mTaskId(task_id), mItem(new LLInventoryItem(item)) {} }; @@ -88,6 +92,7 @@ LLFloaterScriptQueue::LLFloaterScriptQueue(const LLSD& key) : mDone(false), mMono(false) { + } // Destroys the object @@ -167,7 +172,7 @@ BOOL LLFloaterScriptQueue::start() getChild<LLScrollListCtrl>("queue output")->addSimpleElement(buffer, ADD_BOTTOM); - return nextObject(); + return startQueue(); } BOOL LLFloaterScriptQueue::isDone() const @@ -232,6 +237,40 @@ BOOL LLFloaterScriptQueue::popNext() return rv; } +BOOL LLFloaterScriptQueue::startQueue() +{ + return nextObject(); +} + +class CompileQueueExperienceResponder : public LLHTTPClient::Responder +{ +public: + CompileQueueExperienceResponder(const LLUUID& parent):mParent(parent) + { + } + + LLUUID mParent; + + virtual void result(const LLSD& content) + { + sendResult(content); + } + virtual void error(U32 status, const std::string& reason) + { + sendResult(LLSD()); + } + void sendResult(const LLSD& content) + { + LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance<LLFloaterCompileQueue>("compile_queue", mParent); + if(!queue) + return; + + queue->experienceIdsReceived(content["experience_ids"]); + } +}; + + + ///---------------------------------------------------------------------------- /// Class LLFloaterCompileQueue @@ -284,6 +323,21 @@ LLFloaterCompileQueue::~LLFloaterCompileQueue() { } +void LLFloaterCompileQueue::experienceIdsReceived( const LLSD& content ) +{ + for(LLSD::array_const_iterator it = content.beginArray(); it != content.endArray(); ++it) + { + mExperienceIds.insert(it->asUUID()); + } + nextObject(); +} + +BOOL LLFloaterCompileQueue::hasExperience( const LLUUID& id ) const +{ + return mExperienceIds.find(id) != mExperienceIds.end(); +} + + void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, LLInventoryObject::object_list_t* inv) { @@ -324,25 +378,52 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, { LLInventoryItem *itemp = iter->second; LLScriptQueueData* datap = new LLScriptQueueData(getKey().asUUID(), - itemp->getName(), - viewer_object->getID(), - itemp->getUUID()); - - //LL_INFOS() << "ITEM NAME 2: " << names.get(i) << LL_ENDL; - gAssetStorage->getInvItemAsset(viewer_object->getRegion()->getHost(), - gAgent.getID(), - gAgent.getSessionID(), - itemp->getPermissions().getOwner(), - viewer_object->getID(), - itemp->getUUID(), - itemp->getAssetUUID(), - itemp->getType(), - LLFloaterCompileQueue::scriptArrived, - (void*)datap); + viewer_object->getID(), itemp); + + ExperienceAssociationResponder::fetchAssociatedExperience(itemp->getParentUUID(), itemp->getUUID(), + boost::bind(LLFloaterCompileQueue::requestAsset, datap, _1)); + } + } +} + + +void LLFloaterCompileQueue::requestAsset( LLScriptQueueData* datap, const LLSD& experience ) +{ + LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance<LLFloaterCompileQueue>("compile_queue", datap->mQueueID); + if(!queue) + { + delete datap; + return; + } + if(experience.has(LLExperienceCache::EXPERIENCE_ID)) + { + datap->mExperienceId=experience[LLExperienceCache::EXPERIENCE_ID].asUUID(); + if(!queue->hasExperience(datap->mExperienceId)) + { + std::string buffer = LLTrans::getString("CompileNoExperiencePerm", LLSD::emptyMap() + .with("SCRIPT", datap->mItem->getName()) + .with("EXPERIENCE", experience[LLExperienceCache::NAME].asString())); + + queue->getChild<LLScrollListCtrl>("queue output")->addSimpleElement(buffer, ADD_BOTTOM); + queue->removeItemByItemID(datap->mItem->getUUID()); + delete datap; + return; } } + //LL_INFOS() << "ITEM NAME 2: " << names.get(i) << LL_ENDL; + gAssetStorage->getInvItemAsset(datap->mHost, + gAgent.getID(), + gAgent.getSessionID(), + datap->mItem->getPermissions().getOwner(), + datap->mTaskId, + datap->mItem->getUUID(), + datap->mItem->getAssetUUID(), + datap->mItem->getType(), + LLFloaterCompileQueue::scriptArrived, + (void*)datap); } + // This is the callback for when each script arrives // static void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, @@ -382,12 +463,12 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, file.read(script_data, script_size); queue->mUploadQueue->queue(filename, data->mTaskId, - data->mItemId, is_running, queue->mMono, queue->getKey().asUUID(), - script_data, script_size, data->mScriptName); + data->mItem->getUUID(), is_running, queue->mMono, queue->getKey().asUUID(), + script_data, script_size, data->mItem->getName(), data->mExperienceId); } else { - buffer = LLTrans::getString("CompileQueueServiceUnavailable") + (": ") + data->mScriptName; + buffer = LLTrans::getString("CompileQueueServiceUnavailable") + (": ") + data->mItem->getName(); } } } @@ -399,7 +480,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, args["MESSAGE"] = LLTrans::getString("CompileQueueScriptNotFound"); LLNotificationsUtil::add("SystemMessage", args); - buffer = LLTrans::getString("CompileQueueProblemDownloading") + (": ") + data->mScriptName; + buffer = LLTrans::getString("CompileQueueProblemDownloading") + (": ") + data->mItem->getName(); } else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status) { @@ -407,15 +488,15 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, args["MESSAGE"] = LLTrans::getString("CompileQueueInsufficientPermDownload"); LLNotificationsUtil::add("SystemMessage", args); - buffer = LLTrans::getString("CompileQueueInsufficientPermFor") + (": ") + data->mScriptName; + buffer = LLTrans::getString("CompileQueueInsufficientPermFor") + (": ") + data->mItem->getName(); } else { - buffer = LLTrans::getString("CompileQueueUnknownFailure") + (" ") + data->mScriptName; + buffer = LLTrans::getString("CompileQueueUnknownFailure") + (" ") + data->mItem->getName(); } LL_WARNS() << "Problem downloading script asset." << LL_ENDL; - if(queue) queue->removeItemByItemID(data->mItemId); + if(queue) queue->removeItemByItemID(data->mItem->getUUID()); } if(queue && (buffer.size() > 0)) { @@ -564,6 +645,23 @@ void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id) } } +BOOL LLFloaterCompileQueue::startQueue() +{ + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + std::string lookup_url=region->getCapability("GetCreatorExperiences"); + if(!lookup_url.empty()) + { + LLHTTPClient::get(lookup_url, new CompileQueueExperienceResponder(getKey().asUUID())); + return TRUE; + } + } + return nextObject(); +} + + + void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv) { diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h index 28f4625de8..54842bb302 100755 --- a/indra/newview/llcompilequeue.h +++ b/indra/newview/llcompilequeue.h @@ -81,13 +81,15 @@ protected: // returns true if this is done BOOL isDone() const; + virtual BOOL startQueue(); + // go to the next object. If no objects left, it falls out // silently and waits to be killed by the deleteIfDone() callback. BOOL nextObject(); BOOL popNext(); void setStartString(const std::string& s) { mStartString = s; } - + protected: // UI LLScrollListCtrl* mMessages; @@ -131,6 +133,9 @@ public: LLAssetUploadQueue* getUploadQueue() { return mUploadQueue; } + void experienceIdsReceived( const LLSD& content ); + BOOL hasExperience(const LLUUID& id)const; + protected: LLFloaterCompileQueue(const LLSD& key); virtual ~LLFloaterCompileQueue(); @@ -139,16 +144,21 @@ protected: virtual void handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv); + static void requestAsset(struct LLScriptQueueData* datap, const LLSD& experience); + + // This is the callback for when each script arrives static void scriptArrived(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); + virtual BOOL startQueue(); protected: LLViewerInventoryItem::item_array_t mCurrentScripts; private: LLAssetUploadQueue* mUploadQueue; + uuid_list_t mExperienceIds; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index a45aaa2e99..ef6877b5fa 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2464,7 +2464,8 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. <string name="CompileQueueProblemDownloading">Problem downloading</string> <string name="CompileQueueInsufficientPermDownload">Insufficient permissions to download a script.</string> <string name="CompileQueueInsufficientPermFor">Insufficient permissions for</string> - <string name="CompileQueueUnknownFailure">Unknown failure to download</string> + <string name="CompileQueueUnknownFailure">Unknown failure to download</string> + <string name="CompileNoExperiencePerm">Skipping script [SCRIPT] with Experience [EXPERIENCE].</string> <string name="CompileQueueTitle">Recompilation Progress</string> <string name="CompileQueueStart">recompile</string> <string name="ResetQueueTitle">Reset Progress</string> |