summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2015-07-17 14:32:14 -0700
committerRider Linden <rider@lindenlab.com>2015-07-17 14:32:14 -0700
commitd22812a8c8cf96992bcf8d159be76a7bd962de63 (patch)
tree87bdad8ede96dccd9ac5680c96bba774c27bced1 /indra/newview
parent9b64867d8bc2fa93d0bdb67fa529690348b67611 (diff)
LSL Compile and upload from task object. Fix auto open when finished on all uploads...
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llassetuploadqueue.cpp1
-rwxr-xr-xindra/newview/llpreviewgesture.cpp4
-rwxr-xr-xindra/newview/llpreviewgesture.h1
-rwxr-xr-xindra/newview/llpreviewnotecard.cpp6
-rwxr-xr-xindra/newview/llpreviewnotecard.h2
-rwxr-xr-xindra/newview/llpreviewscript.cpp203
-rwxr-xr-xindra/newview/llpreviewscript.h16
-rw-r--r--indra/newview/llviewerassetupload.cpp53
-rw-r--r--indra/newview/llviewerassetupload.h20
9 files changed, 150 insertions, 156 deletions
diff --git a/indra/newview/llassetuploadqueue.cpp b/indra/newview/llassetuploadqueue.cpp
index 359ee1e221..9e52807d02 100755
--- a/indra/newview/llassetuploadqueue.cpp
+++ b/indra/newview/llassetuploadqueue.cpp
@@ -142,7 +142,6 @@ public:
std::string mScriptName;
};
-
LLAssetUploadQueue::LLAssetUploadQueue(LLAssetUploadQueueSupplier *supplier) :
mSupplier(supplier)
{
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index c1d1b9b03c..2604eb1840 100755
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -1016,7 +1016,7 @@ struct LLSaveInfo
};
-void finishInventoryUpload(LLUUID itemId, LLUUID newAssetId)
+void LLPreviewGesture::finishInventoryUpload(LLUUID itemId, LLUUID newAssetId)
{
// If this gesture is active, then we need to update the in-memory
// active map with the new pointer.
@@ -1108,7 +1108,7 @@ void LLPreviewGesture::saveIfNeeded()
item->setComplete(true);
uploadInfo = LLResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mItemUUID, LLAssetType::AT_GESTURE, buffer,
- boost::bind(&finishInventoryUpload, _1, _2)));
+ boost::bind(&LLPreviewGesture::finishInventoryUpload, _1, _2)));
url = agent_url;
}
else if (!mObjectUUID.isNull() && !task_url.empty())
diff --git a/indra/newview/llpreviewgesture.h b/indra/newview/llpreviewgesture.h
index 7ce5706a0d..3ba4f56295 100755
--- a/indra/newview/llpreviewgesture.h
+++ b/indra/newview/llpreviewgesture.h
@@ -132,6 +132,7 @@ protected:
static void onDonePreview(LLMultiGesture* gesture, void* data);
+ static void finishInventoryUpload(LLUUID itemId, LLUUID newAssetId);
private:
// LLPreview contains mDescEditor
LLLineEditor* mTriggerEditor;
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index be44fbd300..9273e06d65 100755
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -405,7 +405,7 @@ struct LLSaveNotecardInfo
}
};
-void finishInventoryUpload(LLUUID itemId, LLUUID newAssetId, LLUUID newItemId)
+void LLPreviewNotecard::finishInventoryUpload(LLUUID itemId, LLUUID newAssetId, LLUUID newItemId)
{
// Update the UI with the new asset.
LLPreviewNotecard* nc = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", LLSD(itemId));
@@ -475,13 +475,13 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem)
if (mObjectUUID.isNull() && !agent_url.empty())
{
uploadInfo = LLResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mItemUUID, LLAssetType::AT_NOTECARD, buffer,
- boost::bind(&finishInventoryUpload, _1, _2, _3)));
+ boost::bind(&LLPreviewNotecard::finishInventoryUpload, _1, _2, _3)));
url = agent_url;
}
else if (!mObjectUUID.isNull() && !task_url.empty())
{
uploadInfo = LLResourceUploadInfo::ptr_t(new LLBufferedAssetUploadInfo(mObjectUUID, mItemUUID, LLAssetType::AT_NOTECARD, buffer,
- boost::bind(&finishInventoryUpload, _1, _3, LLUUID::null)));
+ boost::bind(&LLPreviewNotecard::finishInventoryUpload, _1, _3, LLUUID::null)));
url = task_url;
}
diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h
index 1cf08dedd6..ba571995f6 100755
--- a/indra/newview/llpreviewnotecard.h
+++ b/indra/newview/llpreviewnotecard.h
@@ -95,6 +95,8 @@ protected:
bool handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
bool handleConfirmDeleteDialog(const LLSD& notification, const LLSD& response);
+ static void finishInventoryUpload(LLUUID itemId, LLUUID newAssetId, LLUUID newItemId);
+
protected:
LLViewerTextEditor* mEditor;
LLButton* mSaveBtn;
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index fc565ffa20..2f09214dd6 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -1642,7 +1642,8 @@ void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save)
self->saveIfNeeded();
}
-void finishedLSLUpload(LLUUID itemId, LLSD response)
+/*static*/
+void LLPreviewLSL::finishedLSLUpload(LLUUID itemId, LLSD response)
{
// Find our window and close it if requested.
LLPreviewLSL* preview = LLFloaterReg::findTypedInstance<LLPreviewLSL>("preview_script", LLSD(itemId));
@@ -1674,7 +1675,6 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/)
mScriptEd->mErrorList->deleteAllItems();
mScriptEd->mEditor->makePristine();
-#if 1
if (sync)
{
mScriptEd->sync();
@@ -1690,12 +1690,11 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/)
if (!url.empty())
{
std::string buffer(mScriptEd->mEditor->getText());
- LLBufferedAssetUploadInfo::invnUploadFinish_f proc = boost::bind(&finishedLSLUpload, _1, _4);
+ LLBufferedAssetUploadInfo::invnUploadFinish_f proc = boost::bind(&LLPreviewLSL::finishedLSLUpload, _1, _4);
LLResourceUploadInfo::ptr_t uploadInfo(new LLScriptAssetUpload(mItemUUID, buffer, proc));
LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo);
-
}
else if (gAssetStorage)
{
@@ -1711,56 +1710,7 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/)
uploadAssetLegacy(filename, mItemUUID, tid);
}
}
-
-
-#else
- // LL_INFOS() << "LLPreviewLSL::saveIfNeeded()" << LL_ENDL;
-
- // save off asset into file
- LLTransactionID tid;
- tid.generate();
- LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
- std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id.asString());
- std::string filename = filepath + ".lsl";
-
- mScriptEd->writeToFile(filename);
-
- if (sync)
- {
- mScriptEd->sync();
- }
-
- const LLInventoryItem *inv_item = getItem();
- // save it out to asset server
- std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
- if(inv_item)
- {
- getWindow()->incBusyCount();
- mPendingUploads++;
- if (!url.empty())
- {
- uploadAssetViaCaps(url, filename, mItemUUID);
- }
- else if (gAssetStorage)
- {
- uploadAssetLegacy(filename, mItemUUID, tid);
- }
- }
-#endif
-}
-
-#if 0
-void LLPreviewLSL::uploadAssetViaCaps(const std::string& url,
- const std::string& filename,
- const LLUUID& item_id)
-{
- LL_INFOS() << "Update Agent Inventory via capability" << LL_ENDL;
- LLSD body;
- body["item_id"] = item_id;
- body["target"] = "lsl2";
- LLHTTPClient::post(url, body, new LLUpdateAgentInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT));
}
-#endif
void LLPreviewLSL::uploadAssetLegacy(const std::string& filename,
const LLUUID& item_id,
@@ -2384,6 +2334,33 @@ LLLiveLSLSaveData::LLLiveLSLSaveData(const LLUUID& id,
mItem = new LLViewerInventoryItem(item);
}
+
+/*static*/
+void LLLiveLSLEditor::finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, bool isRunning)
+{
+ LLSD floater_key;
+ floater_key["taskid"] = taskId;
+ floater_key["itemid"] = itemId;
+
+ LLLiveLSLEditor* preview = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key);
+ if (preview)
+ {
+ preview->mItem->setAssetUUID(newAssetId);
+
+ // Bytecode save completed
+ if (response["compiled"])
+ {
+ preview->callbackLSLCompileSucceeded(taskId, itemId, isRunning);
+ }
+ else
+ {
+ preview->callbackLSLCompileFailed(response["errors"]);
+ }
+ }
+
+}
+
+
// virtual
void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/)
{
@@ -2394,7 +2371,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/)
return;
}
- if(mItem.isNull() || !mItem->isFinished())
+ if (mItem.isNull() || !mItem->isFinished())
{
// $NOTE: While the error message may not be exactly correct,
// it's pretty close.
@@ -2402,78 +2379,68 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/)
return;
}
- // get the latest info about it. We used to be losing the script
- // name on save, because the viewer object version of the item,
- // and the editor version would get out of synch. Here's a good
- // place to synch them back up.
- LLInventoryItem* inv_item = dynamic_cast<LLInventoryItem*>(object->getInventoryObject(mItemUUID));
- if(inv_item)
- {
- mItem->copyItem(inv_item);
- }
+ // get the latest info about it. We used to be losing the script
+ // name on save, because the viewer object version of the item,
+ // and the editor version would get out of synch. Here's a good
+ // place to synch them back up.
+ LLInventoryItem* inv_item = dynamic_cast<LLInventoryItem*>(object->getInventoryObject(mItemUUID));
+ if (inv_item)
+ {
+ mItem->copyItem(inv_item);
+ }
- // Don't need to save if we're pristine
- if(!mScriptEd->hasChanged())
- {
- return;
- }
+ // Don't need to save if we're pristine
+ if(!mScriptEd->hasChanged())
+ {
+ return;
+ }
- mPendingUploads = 0;
+ mPendingUploads = 0;
- // save the script
- mScriptEd->enableSave(FALSE);
- mScriptEd->mEditor->makePristine();
- mScriptEd->mErrorList->deleteAllItems();
+ // save the script
+ mScriptEd->enableSave(FALSE);
+ mScriptEd->mEditor->makePristine();
+ mScriptEd->mErrorList->deleteAllItems();
+ mScriptEd->mEditor->makePristine();
- // set up the save on the local machine.
- mScriptEd->mEditor->makePristine();
- LLTransactionID tid;
- tid.generate();
- LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
- std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id.asString());
- std::string filename = llformat("%s.lsl", filepath.c_str());
+ if (sync)
+ {
+ mScriptEd->sync();
+ }
+ bool isRunning = getChild<LLCheckBoxCtrl>("running")->get();
+ getWindow()->incBusyCount();
+ mPendingUploads++;
- mItem->setAssetUUID(asset_id);
- mItem->setTransactionID(tid);
+ std::string url = object->getRegion()->getCapability("UpdateScriptTask");
- mScriptEd->writeToFile(filename);
+ if (!url.empty())
+ {
+ std::string buffer(mScriptEd->mEditor->getText());
+ LLBufferedAssetUploadInfo::taskUploadFinish_f proc = boost::bind(&LLLiveLSLEditor::finishLSLUpload, _1, _2, _3, _4, isRunning);
- if (sync)
- {
- mScriptEd->sync();
- }
-
- // save it out to asset server
- std::string url = object->getRegion()->getCapability("UpdateScriptTask");
- getWindow()->incBusyCount();
- mPendingUploads++;
- BOOL is_running = getChild<LLCheckBoxCtrl>( "running")->get();
- if (!url.empty())
- {
- uploadAssetViaCaps(url, filename, mObjectUUID, mItemUUID, is_running, mScriptEd->getAssociatedExperience());
- }
- else if (gAssetStorage)
- {
- uploadAssetLegacy(filename, object, tid, is_running);
- }
-}
+ LLResourceUploadInfo::ptr_t uploadInfo(new LLScriptAssetUpload(mObjectUUID, mItemUUID,
+ monoChecked() ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2,
+ isRunning, mScriptEd->getAssociatedExperience(), buffer, proc));
+
+ LLViewerAssetUpload::EnqueueInventoryUpload(url, uploadInfo);
+ }
+ else if (gAssetStorage)
+ {
+ // set up the save on the local machine.
+ LLTransactionID tid;
+ tid.generate();
+ LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
+ std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, asset_id.asString());
+ std::string filename = llformat("%s.lsl", filepath.c_str());
+
+ mItem->setAssetUUID(asset_id);
+ mItem->setTransactionID(tid);
+
+ mScriptEd->writeToFile(filename);
+
+ uploadAssetLegacy(filename, object, tid, isRunning);
+ }
-void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url,
- const std::string& filename,
- const LLUUID& task_id,
- const LLUUID& item_id,
- BOOL is_running,
- const LLUUID& experience_public_id )
-{
- LL_INFOS() << "Update Task Inventory via capability " << url << LL_ENDL;
- LLSD body;
- body["task_id"] = task_id;
- body["item_id"] = item_id;
- body["is_script_running"] = is_running;
- body["target"] = monoChecked() ? "mono" : "lsl2";
- body["experience"] = experience_public_id;
- LLHTTPClient::post(url, body,
- new LLUpdateTaskInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT));
}
void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename,
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index 954d040bda..55ac64677a 100755
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -203,11 +203,7 @@ protected:
virtual void loadAsset();
/*virtual*/ void saveIfNeeded(bool sync = true);
-#if 0
- void uploadAssetViaCaps(const std::string& url,
- const std::string& filename,
- const LLUUID& item_id);
-#endif // 0
+
void uploadAssetLegacy(const std::string& filename,
const LLUUID& item_id,
const LLTransactionID& tid);
@@ -225,7 +221,7 @@ protected:
protected:
static void* createScriptEdPanel(void* userdata);
-
+ static void finishedLSLUpload(LLUUID itemId, LLSD response);
protected:
// Can safely close only after both text and bytecode are uploaded
@@ -272,12 +268,6 @@ private:
virtual void loadAsset();
void loadAsset(BOOL is_new);
/*virtual*/ void saveIfNeeded(bool sync = true);
- void uploadAssetViaCaps(const std::string& url,
- const std::string& filename,
- const LLUUID& task_id,
- const LLUUID& item_id,
- BOOL is_running,
- const LLUUID& experience_public_id);
void uploadAssetLegacy(const std::string& filename,
LLViewerObject* object,
const LLTransactionID& tid,
@@ -305,6 +295,8 @@ private:
static void onMonoCheckboxClicked(LLUICtrl*, void* userdata);
+ static void finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, bool isRunning);
+
private:
bool mIsNew;
//LLUUID mTransmitID;
diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp
index 426e89b9d5..b29a9a6114 100644
--- a/indra/newview/llviewerassetupload.cpp
+++ b/indra/newview/llviewerassetupload.cpp
@@ -559,10 +559,14 @@ LLScriptAssetUpload::LLScriptAssetUpload(LLUUID itemId, std::string buffer, invn
{
}
-// LLScriptAssetUpload::LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish):
-// LLBufferedAssetUploadInfo()
-// {
-// }
+LLScriptAssetUpload::LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, TargetType_t targetType,
+ bool isRunning, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish):
+ LLBufferedAssetUploadInfo(taskId, itemId, LLAssetType::AT_LSL_TEXT, buffer, finish),
+ mExerienceId(exerienceId),
+ mTargetType(targetType),
+ mIsRunning(isRunning)
+{
+}
LLSD LLScriptAssetUpload::generatePostBody()
{
@@ -573,6 +577,14 @@ LLSD LLScriptAssetUpload::generatePostBody()
body["item_id"] = getItemId();
body["target"] = "lsl2";
}
+ else
+ {
+ body["task_id"] = getTaskId();
+ body["item_id"] = getItemId();
+ body["is_script_running"] = getIsRunning();
+ body["target"] = (getTargetType() == MONO) ? "mono" : "lsl2";
+ body["experience"] = getExerienceId();
+ }
return body;
}
@@ -670,25 +682,28 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti
LLUUID serverInventoryItem = uploadInfo->finishUpload(result);
- if (serverInventoryItem.notNull())
+ if (uploadInfo->showInventoryPanel())
{
- success = true;
-
- // Show the preview panel for textures and sounds to let
- // user know that the image (or snapshot) arrived intact.
- LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel();
- if (panel)
+ if (serverInventoryItem.notNull())
{
- LLFocusableElement* focus = gFocusMgr.getKeyboardFocus();
- panel->setSelection(serverInventoryItem, TAKE_FOCUS_NO);
+ success = true;
- // restore keyboard focus
- gFocusMgr.setKeyboardFocus(focus);
+ // Show the preview panel for textures and sounds to let
+ // user know that the image (or snapshot) arrived intact.
+ LLInventoryPanel* panel = LLInventoryPanel::getActiveInventoryPanel();
+ if (panel)
+ {
+ LLFocusableElement* focus = gFocusMgr.getKeyboardFocus();
+ panel->setSelection(serverInventoryItem, TAKE_FOCUS_NO);
+
+ // restore keyboard focus
+ gFocusMgr.setKeyboardFocus(focus);
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL;
}
- }
- else
- {
- LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL;
}
// remove the "Uploading..." message
diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h
index fa8247cb64..e7145068c5 100644
--- a/indra/newview/llviewerassetupload.h
+++ b/indra/newview/llviewerassetupload.h
@@ -77,6 +77,7 @@ public:
S32 getExpectedUploadCost() const { return mExpectedUploadCost; };
virtual bool showUploadDialog() const { return true; }
+ virtual bool showInventoryPanel() const { return true; }
virtual std::string getDisplayName() const;
@@ -169,6 +170,7 @@ public:
const std::string & getContents() const { return mContents; }
virtual bool showUploadDialog() const { return false; }
+ virtual bool showInventoryPanel() const { return false; }
protected:
@@ -186,11 +188,27 @@ private:
class LLScriptAssetUpload : public LLBufferedAssetUploadInfo
{
public:
+ enum TargetType_t
+ {
+ LSL2,
+ MONO
+ };
+
LLScriptAssetUpload(LLUUID itemId, std::string buffer, invnUploadFinish_f finish);
- LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish);
+ LLScriptAssetUpload(LLUUID taskId, LLUUID itemId, TargetType_t targetType,
+ bool isRunning, LLUUID exerienceId, std::string buffer, taskUploadFinish_f finish);
virtual LLSD generatePostBody();
+ LLUUID getExerienceId() const { return mExerienceId; }
+ TargetType_t getTargetType() const { return mTargetType; }
+ bool getIsRunning() const { return mIsRunning; }
+
+private:
+ LLUUID mExerienceId;
+ TargetType_t mTargetType;
+ bool mIsRunning;
+
};
//=========================================================================