DEV-34488 Can not save script to a prim. Underlying issue was LLPreview holding two member variables mObjectUUID and mObjectID. mObjectID was null for scripts. It appears to be used only for notecards (?), so I converted it to mNotecardObjectID and switched references to point to mObjectUUID. Renamed one other variable to mSaveObjectID for clarity. Removed unnecessary include files and de-inlined a couple functions because I was there. Reviewed with Steve.
parent
a00af78b95
commit
572ee5c9db
|
|
@ -57,6 +57,7 @@
|
|||
#include "llslurl.h"
|
||||
#include "lltextbox.h"
|
||||
#include "lltracker.h"
|
||||
#include "llviewerinventory.h" // LLViewerInventoryItem
|
||||
#include "llviewermenu.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llviewerstats.h"
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@
|
|||
LLPreview::LLPreview(const LLSD& key)
|
||||
: LLFloater(key),
|
||||
mItemUUID(key.asUUID()),
|
||||
mObjectUUID(), // set later by setObjectID()
|
||||
mCopyToInvBtn( NULL ),
|
||||
mForceClose(FALSE),
|
||||
mUserResized(FALSE),
|
||||
|
|
@ -194,6 +195,13 @@ void LLPreview::changed(U32 mask)
|
|||
mDirty = TRUE;
|
||||
}
|
||||
|
||||
void LLPreview::setNotecardInfo(const LLUUID& notecard_inv_id,
|
||||
const LLUUID& object_id)
|
||||
{
|
||||
mNotecardInventoryID = notecard_inv_id;
|
||||
mNotecardObjectID = object_id;
|
||||
}
|
||||
|
||||
void LLPreview::draw()
|
||||
{
|
||||
LLFloater::draw();
|
||||
|
|
@ -338,6 +346,12 @@ void LLPreview::onOpen(const LLSD& key)
|
|||
}
|
||||
}
|
||||
|
||||
void LLPreview::setAuxItem( const LLInventoryItem* item )
|
||||
{
|
||||
if ( mAuxItem )
|
||||
mAuxItem->copyItem(item);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLPreview::onBtnCopyToInv(void* userdata)
|
||||
{
|
||||
|
|
@ -349,7 +363,7 @@ void LLPreview::onBtnCopyToInv(void* userdata)
|
|||
// Copy to inventory
|
||||
if (self->mNotecardInventoryID.notNull())
|
||||
{
|
||||
copy_inventory_from_notecard(self->mObjectID,
|
||||
copy_inventory_from_notecard(self->mNotecardObjectID,
|
||||
self->mNotecardInventoryID, item);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -35,13 +35,12 @@
|
|||
|
||||
#include "llmultifloater.h"
|
||||
#include "llresizehandle.h"
|
||||
#include "llmap.h"
|
||||
#include "llpointer.h"
|
||||
#include "lluuid.h"
|
||||
#include "llviewerinventory.h"
|
||||
#include "lltabcontainer.h"
|
||||
#include "llinventorymodel.h"
|
||||
#include "llinventorymodel.h" // LLInventoryObserver
|
||||
#include <map>
|
||||
|
||||
class LLInventoryItem;
|
||||
class LLLineEditor;
|
||||
class LLRadioGroup;
|
||||
class LLPreview;
|
||||
|
|
@ -88,11 +87,7 @@ public:
|
|||
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
|
||||
virtual void onOpen(const LLSD& key);
|
||||
|
||||
void setAuxItem( const LLInventoryItem* item )
|
||||
{
|
||||
if ( mAuxItem )
|
||||
mAuxItem->copyItem(item);
|
||||
}
|
||||
void setAuxItem( const LLInventoryItem* item );
|
||||
|
||||
static void onBtnCopyToInv(void* userdata);
|
||||
|
||||
|
|
@ -107,11 +102,12 @@ public:
|
|||
virtual EAssetStatus getAssetStatus() { return mAssetStatus;}
|
||||
|
||||
static LLPreview* getFirstPreviewForSource(const LLUUID& source_id);
|
||||
void setNotecardInfo(const LLUUID& notecard_inv_id, const LLUUID& object_id)
|
||||
{ mNotecardInventoryID = notecard_inv_id; mObjectID = object_id; }
|
||||
|
||||
// Why is this at the LLPreview level? JC
|
||||
void setNotecardInfo(const LLUUID& notecard_inv_id, const LLUUID& object_id);
|
||||
|
||||
// llview
|
||||
virtual void draw();
|
||||
/*virtual*/ void draw();
|
||||
void refreshFromItem();
|
||||
|
||||
protected:
|
||||
|
|
@ -129,7 +125,7 @@ protected:
|
|||
protected:
|
||||
LLUUID mItemUUID;
|
||||
|
||||
// mObjectID will have a value if it is associated with a task in
|
||||
// mObjectUUID will have a value if it is associated with a task in
|
||||
// the world, and will be == LLUUID::null if it's in the agent
|
||||
// inventory.
|
||||
LLUUID mObjectUUID;
|
||||
|
|
@ -152,7 +148,9 @@ protected:
|
|||
EAssetStatus mAssetStatus;
|
||||
|
||||
LLUUID mNotecardInventoryID;
|
||||
LLUUID mObjectID;
|
||||
// I am unsure if this is always the same as mObjectUUID, or why it exists
|
||||
// at the LLPreview level. JC 2009-06-24
|
||||
LLUUID mNotecardObjectID;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1424,7 +1424,7 @@ void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id,
|
|||
bool is_script_running)
|
||||
{
|
||||
lldebugs << "LSL Bytecode saved" << llendl;
|
||||
mScriptEd->mErrorList->setCommentText(LLTrans::getString("Compilesuccessful"));
|
||||
mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful"));
|
||||
mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete"));
|
||||
closeIfNeeded();
|
||||
}
|
||||
|
|
@ -1441,6 +1441,7 @@ void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors)
|
|||
std::string error_message = line->asString();
|
||||
LLStringUtil::stripNonprintable(error_message);
|
||||
row["columns"][0]["value"] = error_message;
|
||||
// *TODO: change to "MONOSPACE" and change llfontgl.cpp?
|
||||
row["columns"][0]["font"] = "OCRA";
|
||||
mScriptEd->mErrorList->addElement(row);
|
||||
}
|
||||
|
|
@ -1767,7 +1768,7 @@ void LLLiveLSLEditor::onSearchReplace(void* userdata)
|
|||
struct LLLiveLSLSaveData
|
||||
{
|
||||
LLLiveLSLSaveData(const LLUUID& id, const LLViewerInventoryItem* item, BOOL active);
|
||||
LLUUID mObjectID;
|
||||
LLUUID mSaveObjectID;
|
||||
LLPointer<LLViewerInventoryItem> mItem;
|
||||
BOOL mActive;
|
||||
};
|
||||
|
|
@ -1775,7 +1776,7 @@ struct LLLiveLSLSaveData
|
|||
LLLiveLSLSaveData::LLLiveLSLSaveData(const LLUUID& id,
|
||||
const LLViewerInventoryItem* item,
|
||||
BOOL active) :
|
||||
mObjectID(id),
|
||||
mSaveObjectID(id),
|
||||
mActive(active)
|
||||
{
|
||||
llassert(item);
|
||||
|
|
@ -1785,7 +1786,7 @@ LLLiveLSLSaveData::LLLiveLSLSaveData(const LLUUID& id,
|
|||
void LLLiveLSLEditor::saveIfNeeded()
|
||||
{
|
||||
llinfos << "LLLiveLSLEditor::saveIfNeeded()" << llendl;
|
||||
LLViewerObject* object = gObjectList.findObject(mObjectID);
|
||||
LLViewerObject* object = gObjectList.findObject(mObjectUUID);
|
||||
if(!object)
|
||||
{
|
||||
LLNotifications::instance().add("SaveScriptFailObjectNotFound");
|
||||
|
|
@ -1865,7 +1866,7 @@ void LLLiveLSLEditor::saveIfNeeded()
|
|||
BOOL is_running = getChild<LLCheckBoxCtrl>( "running")->get();
|
||||
if (!url.empty())
|
||||
{
|
||||
uploadAssetViaCaps(url, filename, mObjectID, mItemUUID, is_running);
|
||||
uploadAssetViaCaps(url, filename, mObjectUUID, mItemUUID, is_running);
|
||||
}
|
||||
else if (gAssetStorage)
|
||||
{
|
||||
|
|
@ -1894,7 +1895,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename,
|
|||
const LLTransactionID& tid,
|
||||
BOOL is_running)
|
||||
{
|
||||
LLLiveLSLSaveData* data = new LLLiveLSLSaveData(mObjectID,
|
||||
LLLiveLSLSaveData* data = new LLLiveLSLSaveData(mObjectUUID,
|
||||
mItem,
|
||||
is_running);
|
||||
gAssetStorage->storeAssetData(filename, tid,
|
||||
|
|
@ -1965,7 +1966,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename,
|
|||
getWindow()->incBusyCount();
|
||||
mPendingUploads++;
|
||||
LLLiveLSLSaveData* data = NULL;
|
||||
data = new LLLiveLSLSaveData(mObjectID,
|
||||
data = new LLLiveLSLSaveData(mObjectUUID,
|
||||
mItem,
|
||||
is_running);
|
||||
gAssetStorage->storeAssetData(dst_filename,
|
||||
|
|
@ -2001,7 +2002,7 @@ void LLLiveLSLEditor::onSaveTextComplete(const LLUUID& asset_uuid, void* user_da
|
|||
}
|
||||
else
|
||||
{
|
||||
LLLiveLSLEditor* self = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", data->mItem->getUUID()); // ^ data->mObjectID
|
||||
LLLiveLSLEditor* self = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", data->mItem->getUUID()); // ^ data->mSaveObjectID
|
||||
if (self)
|
||||
{
|
||||
self->getWindow()->decBusyCount();
|
||||
|
|
@ -2026,7 +2027,7 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use
|
|||
if(0 ==status)
|
||||
{
|
||||
llinfos << "LSL Bytecode saved" << llendl;
|
||||
LLLiveLSLEditor* self = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", data->mItem->getUUID()); // ^ data->mObjectID
|
||||
LLLiveLSLEditor* self = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", data->mItem->getUUID()); // ^ data->mSaveObjectID
|
||||
if (self)
|
||||
{
|
||||
// Tell the user that the compile worked.
|
||||
|
|
@ -2040,7 +2041,7 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use
|
|||
self->closeFloater();
|
||||
}
|
||||
}
|
||||
LLViewerObject* object = gObjectList.findObject(data->mObjectID);
|
||||
LLViewerObject* object = gObjectList.findObject(data->mSaveObjectID);
|
||||
if(object)
|
||||
{
|
||||
object->saveScript(data->mItem, data->mActive, false);
|
||||
|
|
@ -2122,7 +2123,7 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**)
|
|||
void LLLiveLSLEditor::onMonoCheckboxClicked(LLUICtrl*, void* userdata)
|
||||
{
|
||||
LLLiveLSLEditor* self = static_cast<LLLiveLSLEditor*>(userdata);
|
||||
self->mMonoCheckbox->setEnabled(have_script_upload_cap(self->mObjectID));
|
||||
self->mMonoCheckbox->setEnabled(have_script_upload_cap(self->mObjectUUID));
|
||||
self->mScriptEd->enableSave(self->getIsModifiable());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue