From ca08bd5aba5e69fce3b0f5b4f861ffec9fe4d2e5 Mon Sep 17 00:00:00 2001 From: Cinder Date: Sun, 8 Feb 2015 12:53:39 -0700 Subject: OPEN-292 - Remove lscript from project, Remove legacy udp script upload methods, Refactor script runtime perms from three arrays to one struct array so we don't have to juggle array order anymore. --- indra/newview/llpreviewscript.cpp | 193 -------------------------------------- 1 file changed, 193 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 5415c273e2..9184159321 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -53,7 +53,6 @@ #include "llscrolllistcell.h" #include "llsdserialize.h" #include "llslider.h" -#include "lscript_rt_interface.h" #include "lltooldraganddrop.h" #include "llvfile.h" @@ -1474,10 +1473,6 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) { uploadAssetViaCaps(url, filename, mItemUUID); } - else if (gAssetStorage) - { - uploadAssetLegacy(filename, mItemUUID, tid); - } } } @@ -1492,91 +1487,6 @@ void LLPreviewLSL::uploadAssetViaCaps(const std::string& url, LLHTTPClient::post(url, body, new LLUpdateAgentInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT)); } -void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, - const LLUUID& item_id, - const LLTransactionID& tid) -{ - LLLineEditor* descEditor = getChild("desc"); - LLScriptSaveInfo* info = new LLScriptSaveInfo(item_id, - descEditor->getText(), - tid); - gAssetStorage->storeAssetData(filename, tid, - LLAssetType::AT_LSL_TEXT, - &LLPreviewLSL::onSaveComplete, - info); - - LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id.asString()); - 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())) - { - LL_INFOS() << "Compile failed!" << LL_ENDL; - //char command[256]; - //sprintf(command, "type %s\n", err_filename.c_str()); - //system(command); - - // load the error file into the error scrolllist - LLFILE* fp = LLFile::fopen(err_filename, "r"); - if(fp) - { - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - std::string line; - while(!feof(fp)) - { - if (fgets(buffer, MAX_STRING, fp) == NULL) - { - buffer[0] = '\0'; - } - if(feof(fp)) - { - break; - } - else - { - line.assign(buffer); - LLStringUtil::stripNonprintable(line); - - LLSD row; - row["columns"][0]["value"] = line; - row["columns"][0]["font"] = "OCRA"; - mScriptEd->mErrorList->addElement(row); - } - } - fclose(fp); - mScriptEd->selectFirstError(); - } - } - else - { - LL_INFOS() << "Compile worked!" << LL_ENDL; - if(gAssetStorage) - { - getWindow()->incBusyCount(); - mPendingUploads++; - LLUUID* this_uuid = new LLUUID(mItemUUID); - gAssetStorage->storeAssetData(dst_filename, - tid, - LLAssetType::AT_LSL_BYTECODE, - &LLPreviewLSL::onSaveBytecodeComplete, - (void**)this_uuid); - } - } - - // get rid of any temp files left lying around - LLFile::remove(filename); - LLFile::remove(err_filename); - LLFile::remove(dst_filename); -} - - // static void LLPreviewLSL::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) { @@ -2170,10 +2080,6 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) { uploadAssetViaCaps(url, filename, mObjectUUID, mItemUUID, is_running); } - else if (gAssetStorage) - { - uploadAssetLegacy(filename, object, tid, is_running); - } } void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url, @@ -2192,105 +2098,6 @@ void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url, new LLUpdateTaskInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT)); } -void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, - LLViewerObject* object, - const LLTransactionID& tid, - BOOL is_running) -{ - LLLiveLSLSaveData* data = new LLLiveLSLSaveData(mObjectUUID, - mItem, - is_running); - gAssetStorage->storeAssetData(filename, tid, - LLAssetType::AT_LSL_TEXT, - &onSaveTextComplete, - (void*)data, - FALSE); - - LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id.asString()); - std::string dst_filename = llformat("%s.lso", filepath.c_str()); - 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 - LL_INFOS() << "Compile failed!" << LL_ENDL; - if(NULL != (fp = LLFile::fopen(err_filename, "r"))) - { - char buffer[MAX_STRING]; /*Flawfinder: ignore*/ - std::string line; - while(!feof(fp)) - { - - if (fgets(buffer, MAX_STRING, fp) == NULL) - { - buffer[0] = '\0'; - } - if(feof(fp)) - { - break; - } - else - { - line.assign(buffer); - LLStringUtil::stripNonprintable(line); - - LLSD row; - row["columns"][0]["value"] = line; - row["columns"][0]["font"] = "OCRA"; - mScriptEd->mErrorList->addElement(row); - } - } - fclose(fp); - mScriptEd->selectFirstError(); - // don't set the asset id, because we want to save the - // script, even though the compile failed. - //mItem->setAssetUUID(LLUUID::null); - object->saveScript(mItem, FALSE, false); - dialog_refresh_all(); - } - } - else - { - LL_INFOS() << "Compile worked!" << LL_ENDL; - mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessfulSaving")); - if(gAssetStorage) - { - LL_INFOS() << "LLLiveLSLEditor::saveAsset " - << mItem->getAssetUUID() << LL_ENDL; - getWindow()->incBusyCount(); - mPendingUploads++; - LLLiveLSLSaveData* data = NULL; - data = new LLLiveLSLSaveData(mObjectUUID, - mItem, - is_running); - gAssetStorage->storeAssetData(dst_filename, - tid, - LLAssetType::AT_LSL_BYTECODE, - &LLLiveLSLEditor::onSaveBytecodeComplete, - (void*)data); - dialog_refresh_all(); - } - } - - // get rid of any temp files left lying around - LLFile::remove(filename); - LLFile::remove(err_filename); - LLFile::remove(dst_filename); - - // If we successfully saved it, then we should be able to check/uncheck the running box! - LLCheckBoxCtrl* runningCheckbox = getChild( "running"); - runningCheckbox->setLabel(getString("script_running")); - runningCheckbox->setEnabled(TRUE); -} - void LLLiveLSLEditor::onSaveTextComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) { LLLiveLSLSaveData* data = (LLLiveLSLSaveData*)user_data; -- cgit v1.2.3 From c8726aba303bcf1207b730a344536e25491420bc Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 10 Nov 2015 09:48:56 -0500 Subject: remove execute permission from many files that should not have it --- indra/newview/llpreviewscript.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 indra/newview/llpreviewscript.cpp (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp old mode 100755 new mode 100644 -- cgit v1.2.3 From e25e95b10e3f8c4c965fb7ded6d3205f8e4b2247 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 5 Apr 2016 11:28:43 +0200 Subject: Fix old merge issue in LLLiveLSLEditor::draw() --- indra/newview/llpreviewscript.cpp | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 89f01c58c6..26b5a743d0 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -2160,23 +2160,6 @@ void LLLiveLSLEditor::draw() { runningCheckbox->setLabel(getString("script_running")); runningCheckbox->setEnabled(!mIsSaving); - - if(object->permAnyOwner()) - { - runningCheckbox->setLabel(getString("script_running")); - runningCheckbox->setEnabled(!mIsSaving); - } - 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 { -- cgit v1.2.3 From 77ef10e0493a192a1e7f1cb988bac757bd199f69 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 7 Apr 2016 10:04:05 +0200 Subject: OPEN-292: More removal of orphaned legacy script upload methods --- indra/newview/llpreviewscript.cpp | 172 -------------------------------------- 1 file changed, 172 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 26b5a743d0..fc185667d7 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -1690,94 +1690,6 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) } } - -// static -void LLPreviewLSL::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - LLScriptSaveInfo* info = reinterpret_cast(user_data); - if(0 == status) - { - if (info) - { - const LLViewerInventoryItem* item; - item = (const LLViewerInventoryItem*)gInventory.getItem(info->mItemUUID); - if(item) - { - LLPointer new_item = new LLViewerInventoryItem(item); - new_item->setAssetUUID(asset_uuid); - new_item->setTransactionID(info->mTransactionID); - new_item->updateServer(FALSE); - gInventory.updateItem(new_item); - gInventory.notifyObservers(); - } - else - { - LL_WARNS() << "Inventory item for script " << info->mItemUUID - << " is no longer in agent inventory." << LL_ENDL; - } - - // Find our window and close it if requested. - LLPreviewLSL* self = LLFloaterReg::findTypedInstance("preview_script", info->mItemUUID); - if (self) - { - getWindow()->decBusyCount(); - self->mPendingUploads--; - if (self->mPendingUploads <= 0 - && self->mCloseAfterSave) - { - self->closeFloater(); - } - } - } - } - else - { - LL_WARNS() << "Problem saving script: " << status << LL_ENDL; - LLSD args; - args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); - LLNotificationsUtil::add("SaveScriptFailReason", args); - } - delete info; -} - -// static -void LLPreviewLSL::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - LLUUID* instance_uuid = (LLUUID*)user_data; - LLPreviewLSL* self = NULL; - if(instance_uuid) - { - self = LLFloaterReg::findTypedInstance("preview_script", *instance_uuid); - } - if (0 == status) - { - if (self) - { - LLSD row; - row["columns"][0]["value"] = "Compile successful!"; - row["columns"][0]["font"] = "SANSSERIF_SMALL"; - self->mScriptEd->mErrorList->addElement(row); - - // Find our window and close it if requested. - self->getWindow()->decBusyCount(); - self->mPendingUploads--; - if (self->mPendingUploads <= 0 - && self->mCloseAfterSave) - { - self->closeFloater(); - } - } - } - else - { - LL_WARNS() << "Problem saving LSL Bytecode (Preview)" << LL_ENDL; - LLSD args; - args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); - LLNotificationsUtil::add("SaveBytecodeFailReason", args); - } - delete instance_uuid; -} - // static void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) @@ -2308,90 +2220,6 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) } } - -void LLLiveLSLEditor::onSaveTextComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - LLLiveLSLSaveData* data = (LLLiveLSLSaveData*)user_data; - - if (status) - { - LL_WARNS() << "Unable to save text for a script." << LL_ENDL; - LLSD args; - args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); - LLNotificationsUtil::add("CompileQueueSaveText", args); - } - else - { - LLSD floater_key; - floater_key["taskid"] = data->mSaveObjectID; - floater_key["itemid"] = data->mItem->getUUID(); - LLLiveLSLEditor* self = LLFloaterReg::findTypedInstance("preview_scriptedit", floater_key); - if (self) - { - self->getWindow()->decBusyCount(); - self->mPendingUploads--; - if (self->mPendingUploads <= 0 - && self->mCloseAfterSave) - { - self->closeFloater(); - } - } - } - delete data; - data = NULL; -} - - -void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - LLLiveLSLSaveData* data = (LLLiveLSLSaveData*)user_data; - if(!data) - return; - if(0 ==status) - { - LL_INFOS() << "LSL Bytecode saved" << LL_ENDL; - LLSD floater_key; - floater_key["taskid"] = data->mSaveObjectID; - floater_key["itemid"] = data->mItem->getUUID(); - LLLiveLSLEditor* self = LLFloaterReg::findTypedInstance("preview_scriptedit", floater_key); - if (self) - { - // Tell the user that the compile worked. - self->mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete")); - // close the window if this completes both uploads - self->getWindow()->decBusyCount(); - self->mPendingUploads--; - if (self->mPendingUploads <= 0 - && self->mCloseAfterSave) - { - self->closeFloater(); - } - } - LLViewerObject* object = gObjectList.findObject(data->mSaveObjectID); - if(object) - { - object->saveScript(data->mItem, data->mActive, false); - dialog_refresh_all(); - //LLToolDragAndDrop::dropScript(object, ids->first, - // LLAssetType::AT_LSL_TEXT, FALSE); - } - } - else - { - LL_INFOS() << "Problem saving LSL Bytecode (Live Editor)" << LL_ENDL; - LL_WARNS() << "Unable to save a compiled script." << LL_ENDL; - - LLSD args; - args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); - LLNotificationsUtil::add("CompileQueueSaveBytecode", args); - } - - std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_uuid.asString()); - std::string dst_filename = llformat("%s.lso", filepath.c_str()); - LLFile::remove(dst_filename); - delete data; -} - BOOL LLLiveLSLEditor::canClose() { return (mScriptEd->canClose()); -- cgit v1.2.3 From adf4b727c26f5906d78ac2a3fa6b88436baddcc0 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 14 Apr 2016 14:03:43 +0200 Subject: Fix further merge error in LLLiveLSLEditor::draw() --- indra/newview/llpreviewscript.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpreviewscript.cpp') diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index fc185667d7..5b1b356597 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -2083,9 +2083,7 @@ void LLLiveLSLEditor::draw() // 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; + mMonoCheckbox->set(FALSE); } } else if(!object) @@ -2094,6 +2092,7 @@ void LLLiveLSLEditor::draw() // Really ought to put in main window. setTitle(LLTrans::getString("ObjectOutOfRange")); runningCheckbox->setEnabled(FALSE); + mMonoCheckbox->setEnabled(FALSE); // object may have fallen out of range. mHaveRunningInfo = FALSE; } -- cgit v1.2.3