added start of local inventory and object import, broken atm
This commit is contained in:
@@ -233,6 +233,7 @@ set(viewer_SOURCE_FILES
|
||||
llhudtext.cpp
|
||||
llhudview.cpp
|
||||
llimpanel.cpp
|
||||
llimportobject.cpp
|
||||
llimview.cpp
|
||||
llinventoryactions.cpp
|
||||
llinventorybridge.cpp
|
||||
@@ -658,6 +659,7 @@ set(viewer_HEADER_FILES
|
||||
llhudtext.h
|
||||
llhudview.h
|
||||
llimpanel.h
|
||||
llimportobject.h
|
||||
llimview.h
|
||||
llinventorybridge.h
|
||||
llinventoryclipboard.h
|
||||
|
||||
220
indra/newview/llcheats.cpp
Normal file
220
indra/newview/llcheats.cpp
Normal file
@@ -0,0 +1,220 @@
|
||||
// <edit>
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llcheats.h"
|
||||
#include "llchat.h"
|
||||
#include "llfloaterchat.h"
|
||||
#include "llagent.h"
|
||||
#include "llinventorymodel.h"
|
||||
#include "llmochascript.h"
|
||||
|
||||
std::map<std::string, LLCheatCode> LLCheats::cheatCodes;
|
||||
KEY LLCheats::lastKeys[CHEAT_CODE_SIZE] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
// static
|
||||
void LLCheats::init()
|
||||
{
|
||||
KEY AcquireAssetID[CHEAT_CODE_SIZE] = {132, 132, 133, 133, 130, 131, 130, 131, 66, 65, 129, 0, 0, 0, 0, 0};
|
||||
createCode("AcquireAssetID", AcquireAssetID);
|
||||
KEY EverythingIsOk[CHEAT_CODE_SIZE] = {66, 65, 66, 65, 132, 133, 66, 65, 130, 131, 66, 65, 129, 0, 0, 0};
|
||||
createCode("EverythingIsOk", EverythingIsOk);
|
||||
KEY MochaScript[CHEAT_CODE_SIZE] = {'M', 'O', 'C', 'H', 'A', 'S', 'C', 'R', 'I', 'P', 'T', 0, 0, 0, 0, 0};
|
||||
createCode("MochaScript", MochaScript);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLCheats::createCode(std::string name, KEY keys[CHEAT_CODE_SIZE])
|
||||
{
|
||||
LLCheatCode code;
|
||||
code.entered = false;
|
||||
// find last non-zero key
|
||||
int s = CHEAT_CODE_SIZE - 1;
|
||||
while(!keys[s] && s)
|
||||
--s;
|
||||
// add keys in reverse order
|
||||
int i = 0;
|
||||
for( ; s >= 0; s--)
|
||||
{
|
||||
code.keySequence[i] = keys[s];
|
||||
++i;
|
||||
}
|
||||
// zero the rest
|
||||
for( ; i < CHEAT_CODE_SIZE; i++)
|
||||
code.keySequence[i] = 0;
|
||||
// register
|
||||
cheatCodes[name] = code;
|
||||
}
|
||||
|
||||
// static
|
||||
bool LLCheats::checkForCode(LLCheatCode code)
|
||||
{
|
||||
for(int i = 0; i < CHEAT_CODE_SIZE; i++)
|
||||
{
|
||||
if(!code.keySequence[i]) return true;
|
||||
if(code.keySequence[i] != lastKeys[i]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
void LLCheats::pressKey(KEY key)
|
||||
{
|
||||
//llwarns << "Pressed " << llformat("%d", key) << llendl;
|
||||
|
||||
for(int i = (CHEAT_CODE_SIZE - 1); i > 0; i--)
|
||||
lastKeys[i] = lastKeys[i - 1];
|
||||
lastKeys[0] = key;
|
||||
|
||||
std::map<std::string, LLCheatCode>::iterator iter = cheatCodes.begin();
|
||||
std::map<std::string, LLCheatCode>::iterator end = cheatCodes.end();
|
||||
for( ; iter != end; ++iter)
|
||||
{
|
||||
if(!(*iter).second.entered)
|
||||
{
|
||||
(*iter).second.entered = checkForCode((*iter).second);
|
||||
if((*iter).second.entered)
|
||||
{
|
||||
onCheatEnabled((*iter).first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLCheats::onCheatEnabled(std::string code_name)
|
||||
{
|
||||
LLFloaterChat::addChat(LLChat(code_name + " code entered"));
|
||||
if(code_name == "MochaScript")
|
||||
{
|
||||
LLFloaterMochaScript::show();
|
||||
cheatCodes[code_name].entered = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool LLAssetIDAcquirer::mBusy = false;
|
||||
std::vector<LLUUID> LLAssetIDAcquirer::mQueue;
|
||||
LLUUID LLAssetIDAcquirer::mItemID;
|
||||
LLUUID LLAssetIDAcquirer::mUnderwear;
|
||||
|
||||
// static
|
||||
void LLAssetIDAcquirer::acquire(std::set<LLUUID> item_list)
|
||||
{
|
||||
if(!LLCheats::cheatCodes["AcquireAssetID"].entered) return;
|
||||
|
||||
// add to queue
|
||||
std::set<LLUUID>::iterator iter = item_list.begin();
|
||||
std::set<LLUUID>::iterator end = item_list.end();
|
||||
for( ; iter != end; ++iter)
|
||||
mQueue.push_back(*iter);
|
||||
|
||||
work();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLAssetIDAcquirer::work()
|
||||
{
|
||||
if(mQueue.size())
|
||||
{
|
||||
if(mBusy)
|
||||
{
|
||||
// waiting
|
||||
}
|
||||
else
|
||||
{
|
||||
mBusy = true;
|
||||
mItemID = *(mQueue.begin());
|
||||
mUnderwear = gAgent.getWearableItem(WT_UNDERPANTS);
|
||||
|
||||
gMessageSystem->newMessageFast(_PREHASH_AgentIsNowWearing);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
for(int i=0; i < WT_COUNT; ++i)
|
||||
{
|
||||
gMessageSystem->nextBlockFast(_PREHASH_WearableData);
|
||||
gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(i));
|
||||
if(i != WT_UNDERPANTS)
|
||||
gMessageSystem->addUUIDFast(_PREHASH_ItemID, gAgent.getWearableItem((EWearableType)i));
|
||||
else
|
||||
gMessageSystem->addUUIDFast(_PREHASH_ItemID, mItemID);
|
||||
}
|
||||
gAgent.sendReliableMessage();
|
||||
new LLAssetIDRequester();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mBusy = false;
|
||||
|
||||
// finished, so set back to normal
|
||||
gMessageSystem->newMessageFast(_PREHASH_AgentIsNowWearing);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
for(int i = 0; i < WT_COUNT; ++i)
|
||||
{
|
||||
gMessageSystem->nextBlockFast(_PREHASH_WearableData);
|
||||
gMessageSystem->addU8Fast(_PREHASH_WearableType, U8(i));
|
||||
if(i != WT_UNDERPANTS)
|
||||
gMessageSystem->addUUIDFast(_PREHASH_ItemID, gAgent.getWearableItem((EWearableType)i));
|
||||
else
|
||||
gMessageSystem->addUUIDFast(_PREHASH_ItemID, mUnderwear);
|
||||
}
|
||||
gAgent.sendReliableMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLAssetIDAcquirer::handle(LLMessageSystem* mesgsys)
|
||||
{
|
||||
if(!mBusy) return;
|
||||
LLUUID agent_id;
|
||||
gMessageSystem->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
|
||||
if(agent_id != gAgent.getID()) return;
|
||||
S32 num_wearables = gMessageSystem->getNumberOfBlocksFast(_PREHASH_WearableData);
|
||||
for(int i = 0; i < num_wearables; i++)
|
||||
{
|
||||
U8 type_u8 = 0;
|
||||
gMessageSystem->getU8Fast(_PREHASH_WearableData, _PREHASH_WearableType, type_u8, i );
|
||||
if(type_u8 == WT_UNDERPANTS)
|
||||
{
|
||||
LLUUID item_id;
|
||||
gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_ItemID, item_id, i );
|
||||
LLUUID asset_id;
|
||||
gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_AssetID, asset_id, i );
|
||||
if(item_id == mItemID)
|
||||
{
|
||||
LLViewerInventoryItem* item = gInventory.getItem(item_id);
|
||||
if(item)
|
||||
{
|
||||
item->setAssetUUID(asset_id);
|
||||
}
|
||||
}
|
||||
// anyway
|
||||
// remove from queue
|
||||
std::vector<LLUUID>::iterator iter = std::find(mQueue.begin(), mQueue.end(), item_id);
|
||||
if(iter != mQueue.end())
|
||||
mQueue.erase(iter);
|
||||
|
||||
// continue
|
||||
mBusy = false;
|
||||
work();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLAssetIDRequester::LLAssetIDRequester() : LLEventTimer(0.25f)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLAssetIDRequester::tick()
|
||||
{
|
||||
gMessageSystem->newMessageFast(_PREHASH_AgentWearablesRequest);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
|
||||
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
|
||||
gAgent.sendReliableMessage();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// </edit>
|
||||
50
indra/newview/llcheats.h
Normal file
50
indra/newview/llcheats.h
Normal file
@@ -0,0 +1,50 @@
|
||||
// <edit>
|
||||
#ifndef LL_LLCHEATS_H
|
||||
#define LL_LLCHEATS_H
|
||||
|
||||
const int CHEAT_CODE_SIZE = 16;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
KEY keySequence[CHEAT_CODE_SIZE];
|
||||
bool entered;
|
||||
} LLCheatCode;
|
||||
|
||||
class LLCheats
|
||||
{
|
||||
public:
|
||||
static std::map<std::string, LLCheatCode> cheatCodes;
|
||||
|
||||
static void init();
|
||||
static void pressKey(KEY key);
|
||||
static void onCheatEnabled(std::string code_name);
|
||||
|
||||
private:
|
||||
static KEY lastKeys[CHEAT_CODE_SIZE];
|
||||
|
||||
static void createCode(std::string name, KEY keys[CHEAT_CODE_SIZE]);
|
||||
static bool checkForCode(LLCheatCode code);
|
||||
};
|
||||
|
||||
class LLAssetIDAcquirer
|
||||
{
|
||||
public:
|
||||
static void acquire(std::set<LLUUID> item_list);
|
||||
static void handle(LLMessageSystem* mesgsys);
|
||||
private:
|
||||
static void work();
|
||||
static bool mBusy;
|
||||
static LLUUID mItemID;
|
||||
static LLUUID mUnderwear;
|
||||
static std::vector<LLUUID> mQueue;
|
||||
};
|
||||
|
||||
class LLAssetIDRequester : public LLEventTimer
|
||||
{
|
||||
public:
|
||||
LLAssetIDRequester();
|
||||
BOOL tick();
|
||||
};
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
1133
indra/newview/llimportobject.cpp
Normal file
1133
indra/newview/llimportobject.cpp
Normal file
File diff suppressed because it is too large
Load Diff
127
indra/newview/llimportobject.h
Normal file
127
indra/newview/llimportobject.h
Normal file
@@ -0,0 +1,127 @@
|
||||
// <edit>
|
||||
/**
|
||||
* @file llimportobject.h
|
||||
*/
|
||||
|
||||
#ifndef LL_LLIMPORTOBJECT_H
|
||||
#define LL_LLIMPORTOBJECT_H
|
||||
|
||||
#include "llviewerobject.h"
|
||||
#include "llfloater.h"
|
||||
|
||||
|
||||
class BuildingSupply : public LLEventTimer
|
||||
{
|
||||
public:
|
||||
BuildingSupply();
|
||||
BOOL tick();
|
||||
};
|
||||
|
||||
class LLImportWearable
|
||||
{
|
||||
public:
|
||||
std::string mName;
|
||||
int mType;
|
||||
std::string mData;
|
||||
|
||||
LLImportWearable(LLSD sd);
|
||||
};
|
||||
|
||||
class LLImportObject : public LLViewerObject
|
||||
{
|
||||
public:
|
||||
//LLImportObject(std::string id, std::string parentId);
|
||||
LLImportObject(std::string id, LLSD prim);
|
||||
|
||||
std::string mId;
|
||||
std::string mParentId;
|
||||
std::string mPrimName;
|
||||
bool importIsAttachment;
|
||||
U32 importAttachPoint;
|
||||
LLVector3 importAttachPos;
|
||||
LLQuaternion importAttachRot;
|
||||
};
|
||||
|
||||
|
||||
class LLXmlImportOptions
|
||||
{
|
||||
public:
|
||||
LLXmlImportOptions(LLXmlImportOptions* options);
|
||||
LLXmlImportOptions(std::string filename);
|
||||
LLXmlImportOptions(LLSD llsd);
|
||||
void init(LLSD llsd);
|
||||
std::string mName;
|
||||
//LLSD mLLSD;
|
||||
std::vector<LLImportObject*> mRootObjects;
|
||||
std::vector<LLImportObject*> mChildObjects;
|
||||
std::vector<LLImportWearable*> mWearables;
|
||||
BOOL mKeepPosition;
|
||||
LLViewerObject* mSupplier;
|
||||
};
|
||||
|
||||
|
||||
class LLXmlImport
|
||||
{
|
||||
public:
|
||||
static void import(LLXmlImportOptions* import_options);
|
||||
static void onNewPrim(LLViewerObject* object);
|
||||
static void onNewItem(LLViewerInventoryItem* item);
|
||||
static void onNewAttachment(LLViewerObject* object);
|
||||
static void Cancel(void* user_data);
|
||||
|
||||
static bool sImportInProgress;
|
||||
static bool sImportHasAttachments;
|
||||
static LLUUID sFolderID;
|
||||
static LLViewerObject* sSupplyParams;
|
||||
static int sPrimsNeeded;
|
||||
static std::vector<LLImportObject*> sPrims; // all prims being imported
|
||||
static std::map<U8, bool> sPt2watch; // attach points that need watching
|
||||
static std::map<std::string, U8> sId2attachpt; // attach points of all attachables
|
||||
static std::map<U8, LLVector3> sPt2attachpos; // positions of all attachables
|
||||
static std::map<U8, LLQuaternion> sPt2attachrot; // rotations of all attachables
|
||||
static int sPrimIndex;
|
||||
static int sAttachmentsDone;
|
||||
static std::map<std::string, U32> sId2localid;
|
||||
static std::map<U32, LLVector3> sRootpositions;
|
||||
static LLXmlImportOptions* sXmlImportOptions;
|
||||
};
|
||||
|
||||
|
||||
class LLFloaterImportProgress
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
void close(bool app_quitting);
|
||||
static LLFloaterImportProgress* sInstance;
|
||||
static void show();
|
||||
static void update();
|
||||
private:
|
||||
LLFloaterImportProgress();
|
||||
virtual ~LLFloaterImportProgress();
|
||||
};
|
||||
|
||||
|
||||
class LLFloaterXmlImportOptions : public LLFloater
|
||||
{
|
||||
public:
|
||||
LLFloaterXmlImportOptions(LLXmlImportOptions* default_options);
|
||||
BOOL postBuild();
|
||||
LLXmlImportOptions* mDefaultOptions;
|
||||
std::map<LLUUID, LLImportWearable*> mImportWearableMap;
|
||||
std::map<LLUUID, LLImportObject*> mImportObjectMap;
|
||||
private:
|
||||
enum LIST_COLUMN_ORDER
|
||||
{
|
||||
LIST_CHECKED,
|
||||
LIST_TYPE,
|
||||
LIST_NAME,
|
||||
};
|
||||
static void onClickSelectAll(void* user_data);
|
||||
static void onClickSelectObjects(void* user_data);
|
||||
static void onClickSelectWearables(void* user_data);
|
||||
static void onClickOK(void* user_data);
|
||||
static void onClickCancel(void* user_data);
|
||||
};
|
||||
|
||||
#endif
|
||||
// </edit>
|
||||
@@ -86,8 +86,15 @@
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llselectmgr.h"
|
||||
#include "llfloateropenobject.h"
|
||||
#include "dofloaterhex.h"
|
||||
#include "hgfloatertexteditor.h"
|
||||
// <edit>
|
||||
#include "llappviewer.h" // gLocalInventoryRoot
|
||||
#include "llfloateranimpreview.h" // for reuploads
|
||||
#include "llfloaterimagepreview.h" // for reuploads
|
||||
#include "llimportobject.h" // for disabling options during import
|
||||
//#include "llcheats.h"
|
||||
#include "dofloaterhex.h"
|
||||
#include "hgfloatertexteditor.h"
|
||||
// </edit>
|
||||
|
||||
// Helpers
|
||||
// bug in busy count inc/dec right now, logic is complex... do we really need it?
|
||||
@@ -112,8 +119,21 @@ void wear_inventory_category_on_avatar_loop(LLWearable* wearable, void*);
|
||||
void wear_inventory_category_on_avatar_step3(LLWearableHoldingPattern* holder, BOOL append);
|
||||
void remove_inventory_category_from_avatar(LLInventoryCategory* category);
|
||||
void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata);
|
||||
bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv*);
|
||||
bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response);
|
||||
bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv*);
|
||||
void confirm_replace_attachment_rez(S32 option, void* user_data);
|
||||
// <edit>
|
||||
void gotImageForSaveItemAs(BOOL success,
|
||||
LLViewerImage *src_vi,
|
||||
LLImageRaw* src,
|
||||
LLImageRaw* aux_src,
|
||||
S32 discard_level,
|
||||
BOOL final,
|
||||
void* userdata);
|
||||
void gotAssetForSaveItemAs(LLVFS *vfs,
|
||||
const LLUUID& asset_uuid,
|
||||
LLAssetType::EType type,
|
||||
void* user_data, S32 status, LLExtStat ext_status);
|
||||
// </edit>
|
||||
|
||||
std::string ICON_NAME[ICON_NAME_COUNT] =
|
||||
{
|
||||
@@ -192,13 +212,24 @@ time_t LLInvFVBridge::getCreationDate() const
|
||||
// Can be destoryed (or moved to trash)
|
||||
BOOL LLInvFVBridge::isItemRemovable()
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
if(model->isObjectDescendentOf(mUUID, gAgent.getInventoryRootID()))
|
||||
{
|
||||
// <edit>
|
||||
//if(model->isObjectDescendentOf(mUUID, gAgent.getInventoryRootID()))
|
||||
//{
|
||||
// return TRUE;
|
||||
//}
|
||||
//
|
||||
//return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
// </edit>
|
||||
}
|
||||
|
||||
// Can be moved to another folder
|
||||
@@ -215,6 +246,13 @@ void LLInvFVBridge::showProperties()
|
||||
|
||||
void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch)
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return;
|
||||
}
|
||||
// </edit>
|
||||
// Deactivate gestures when moving them into Trash
|
||||
LLInvFVBridge* bridge;
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
@@ -259,6 +297,13 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc
|
||||
|
||||
void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch)
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return;
|
||||
}
|
||||
// </edit>
|
||||
// this method moves a bunch of items and folders to the trash. As
|
||||
// per design guidelines for the inventory model, the message is
|
||||
// built and the accounting is performed first. After all of that,
|
||||
@@ -276,6 +321,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
|
||||
bool start_new_message = true;
|
||||
S32 count = batch.count();
|
||||
S32 i;
|
||||
// <edit> close floaters first
|
||||
for(i = 0; i < count; ++i)
|
||||
{
|
||||
bridge = (LLInvFVBridge*)(batch.get(i));
|
||||
@@ -283,31 +329,51 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
|
||||
item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
|
||||
if(item)
|
||||
{
|
||||
LLPreview::hide(item->getUUID());
|
||||
}
|
||||
}
|
||||
// </edit>
|
||||
for(i = 0; i < count; ++i)
|
||||
{
|
||||
bridge = (LLInvFVBridge*)(batch.get(i));
|
||||
if(!bridge || !bridge->isItemRemovable()) continue;
|
||||
item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
|
||||
if(item)
|
||||
{
|
||||
if(item->getParentUUID() == trash_id) continue;
|
||||
move_ids.push_back(item->getUUID());
|
||||
LLPreview::hide(item->getUUID());
|
||||
// <edit> don't do stuff that messes with gMessageSystem
|
||||
//LLPreview::hide(item->getUUID());
|
||||
// </edit>
|
||||
--update[item->getParentUUID()];
|
||||
++update[trash_id];
|
||||
if(start_new_message)
|
||||
{
|
||||
start_new_message = false;
|
||||
msg->newMessageFast(_PREHASH_MoveInventoryItem);
|
||||
msg->nextBlockFast(_PREHASH_AgentData);
|
||||
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
msg->addBOOLFast(_PREHASH_Stamp, TRUE);
|
||||
}
|
||||
msg->nextBlockFast(_PREHASH_InventoryData);
|
||||
msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
|
||||
msg->addUUIDFast(_PREHASH_FolderID, trash_id);
|
||||
msg->addString("NewName", NULL);
|
||||
if(msg->isSendFullFast(_PREHASH_InventoryData))
|
||||
{
|
||||
start_new_message = true;
|
||||
gAgent.sendReliableMessage();
|
||||
gInventory.accountForUpdate(update);
|
||||
update.clear();
|
||||
}
|
||||
// <edit>
|
||||
if(!gInventory.isObjectDescendentOf(item->getUUID(), gLocalInventoryRoot))
|
||||
{
|
||||
// </edit>
|
||||
if(start_new_message)
|
||||
{
|
||||
start_new_message = false;
|
||||
msg->newMessageFast(_PREHASH_MoveInventoryItem);
|
||||
msg->nextBlockFast(_PREHASH_AgentData);
|
||||
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
msg->addBOOLFast(_PREHASH_Stamp, TRUE);
|
||||
}
|
||||
msg->nextBlockFast(_PREHASH_InventoryData);
|
||||
msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
|
||||
msg->addUUIDFast(_PREHASH_FolderID, trash_id);
|
||||
msg->addString("NewName", NULL);
|
||||
if(msg->isSendFullFast(_PREHASH_InventoryData))
|
||||
{
|
||||
start_new_message = true;
|
||||
gAgent.sendReliableMessage();
|
||||
gInventory.accountForUpdate(update);
|
||||
update.clear();
|
||||
}
|
||||
// <edit>
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
}
|
||||
if(!start_new_message)
|
||||
@@ -328,25 +394,32 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
|
||||
move_ids.push_back(cat->getUUID());
|
||||
--update[cat->getParentUUID()];
|
||||
++update[trash_id];
|
||||
if(start_new_message)
|
||||
{
|
||||
start_new_message = false;
|
||||
msg->newMessageFast(_PREHASH_MoveInventoryFolder);
|
||||
msg->nextBlockFast(_PREHASH_AgentData);
|
||||
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
msg->addBOOL("Stamp", TRUE);
|
||||
}
|
||||
msg->nextBlockFast(_PREHASH_InventoryData);
|
||||
msg->addUUIDFast(_PREHASH_FolderID, cat->getUUID());
|
||||
msg->addUUIDFast(_PREHASH_ParentID, trash_id);
|
||||
if(msg->isSendFullFast(_PREHASH_InventoryData))
|
||||
{
|
||||
start_new_message = true;
|
||||
gAgent.sendReliableMessage();
|
||||
gInventory.accountForUpdate(update);
|
||||
update.clear();
|
||||
}
|
||||
// <edit>
|
||||
if(!gInventory.isObjectDescendentOf(cat->getUUID(), gLocalInventoryRoot))
|
||||
{
|
||||
// </edit>
|
||||
if(start_new_message)
|
||||
{
|
||||
start_new_message = false;
|
||||
msg->newMessageFast(_PREHASH_MoveInventoryFolder);
|
||||
msg->nextBlockFast(_PREHASH_AgentData);
|
||||
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
msg->addBOOL("Stamp", TRUE);
|
||||
}
|
||||
msg->nextBlockFast(_PREHASH_InventoryData);
|
||||
msg->addUUIDFast(_PREHASH_FolderID, cat->getUUID());
|
||||
msg->addUUIDFast(_PREHASH_ParentID, trash_id);
|
||||
if(msg->isSendFullFast(_PREHASH_InventoryData))
|
||||
{
|
||||
start_new_message = true;
|
||||
gAgent.sendReliableMessage();
|
||||
gInventory.accountForUpdate(update);
|
||||
update.clear();
|
||||
}
|
||||
// <edit>
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
}
|
||||
if(!start_new_message)
|
||||
@@ -360,6 +433,37 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
|
||||
std::vector<LLUUID>::iterator end = move_ids.end();
|
||||
for(; it != end; ++it)
|
||||
{
|
||||
// <edit> trash problem
|
||||
if(gInventory.isObjectDescendentOf(*it, gLocalInventoryRoot))
|
||||
{
|
||||
// if it's a category, delete descendents
|
||||
if(gInventory.getCategory(*it))
|
||||
{
|
||||
LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
|
||||
cat->setDescendentCount(0);
|
||||
LLInventoryModel::cat_array_t categories;
|
||||
LLInventoryModel::item_array_t items;
|
||||
gInventory.collectDescendents(cat->getUUID(),
|
||||
categories,
|
||||
items,
|
||||
false); // include trash?
|
||||
S32 count = items.count();
|
||||
S32 i;
|
||||
for(i = 0; i < count; ++i)
|
||||
{
|
||||
gInventory.deleteObject(items.get(i)->getUUID());
|
||||
}
|
||||
count = categories.count();
|
||||
for(i = 0; i < count; ++i)
|
||||
{
|
||||
gInventory.deleteObject(categories.get(i)->getUUID());
|
||||
}
|
||||
}
|
||||
// delete it
|
||||
gInventory.deleteObject(*it);
|
||||
}
|
||||
else
|
||||
// </edit>
|
||||
gInventory.moveObject((*it), trash_id);
|
||||
}
|
||||
|
||||
@@ -369,6 +473,13 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
|
||||
|
||||
BOOL LLInvFVBridge::isClipboardPasteable() const
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
BOOL is_agent_inventory = model->isObjectDescendentOf(mUUID, gAgent.getInventoryRootID());
|
||||
@@ -439,13 +550,22 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, std::vector<std::str
|
||||
if (show_asset_id)
|
||||
{
|
||||
items.push_back(std::string("Copy Asset UUID"));
|
||||
// <edit>
|
||||
/*
|
||||
// </edit>
|
||||
if ( (! ( isItemPermissive() || gAgent.isGodlike() ) )
|
||||
|| (flags & FIRST_SELECTED_ITEM) == 0)
|
||||
{
|
||||
disabled_items.push_back(std::string("Copy Asset UUID"));
|
||||
}
|
||||
// <edit>
|
||||
*/
|
||||
// </edit>
|
||||
}
|
||||
|
||||
// <edit>
|
||||
//items.push_back(std::string("Magic Get"));
|
||||
//items.push_back(std::string("Rez"));
|
||||
items.push_back(std::string("Open With..."));
|
||||
|
||||
items.push_back(std::string("Copy Separator"));
|
||||
@@ -527,6 +647,13 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
|
||||
|
||||
LLInventoryObject* LLInvFVBridge::getInventoryObject() const
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return NULL;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryObject* obj = NULL;
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(model)
|
||||
@@ -538,6 +665,13 @@ LLInventoryObject* LLInvFVBridge::getInventoryObject() const
|
||||
|
||||
BOOL LLInvFVBridge::isInTrash() const
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH);
|
||||
@@ -546,6 +680,13 @@ BOOL LLInvFVBridge::isInTrash() const
|
||||
|
||||
BOOL LLInvFVBridge::isAgentInventory() const
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
if(gAgent.getInventoryRootID() == mUUID) return TRUE;
|
||||
@@ -563,6 +704,9 @@ void LLInvFVBridge::changeItemParent(LLInventoryModel* model,
|
||||
const LLUUID& new_parent,
|
||||
BOOL restamp)
|
||||
{
|
||||
// <edit>
|
||||
bool send_parent_update = gInventory.isObjectDescendentOf(item->getUUID(), gAgent.getInventoryRootID());
|
||||
// </edit>
|
||||
if(item->getParentUUID() != new_parent)
|
||||
{
|
||||
LLInventoryModel::update_list_t update;
|
||||
@@ -574,6 +718,9 @@ void LLInvFVBridge::changeItemParent(LLInventoryModel* model,
|
||||
|
||||
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
|
||||
new_item->setParent(new_parent);
|
||||
// <edit>
|
||||
if(send_parent_update)
|
||||
// </edit>
|
||||
new_item->updateParentOnServer(restamp);
|
||||
model->updateItem(new_item);
|
||||
model->notifyObservers();
|
||||
@@ -822,12 +969,22 @@ void LLItemBridge::selectItem()
|
||||
LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem();
|
||||
if(item && !item->isComplete())
|
||||
{
|
||||
// <edit>
|
||||
if(!(gInventory.isObjectDescendentOf(mUUID, gLocalInventoryRoot)))
|
||||
// </edit>
|
||||
item->fetchFromServer();
|
||||
}
|
||||
}
|
||||
|
||||
void LLItemBridge::restoreItem()
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return;
|
||||
}
|
||||
// </edit>
|
||||
LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem();
|
||||
if(item)
|
||||
{
|
||||
@@ -931,8 +1088,11 @@ std::string LLItemBridge::getLabelSuffix() const
|
||||
if(item)
|
||||
{
|
||||
// it's a bit confusing to put nocopy/nomod/etc on calling cards.
|
||||
if(LLAssetType::AT_CALLINGCARD != item->getType()
|
||||
&& item->getPermissions().getOwner() == gAgent.getID())
|
||||
// <edit> Not really sheesh
|
||||
//if(LLAssetType::AT_CALLINGCARD != item->getType()
|
||||
// && item->getPermissions().getOwner() == gAgent.getID())
|
||||
if(item->getPermissions().getOwner() == gAgent.getID())
|
||||
// </edit>
|
||||
{
|
||||
BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
|
||||
BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
|
||||
@@ -983,6 +1143,13 @@ BOOL LLItemBridge::renameItem(const std::string& new_name)
|
||||
{
|
||||
if(!isItemRenameable()) return FALSE;
|
||||
LLPreview::rename(mUUID, getPrefix() + new_name);
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
LLViewerInventoryItem* item = getItem();
|
||||
@@ -1009,6 +1176,13 @@ BOOL LLItemBridge::removeItem()
|
||||
}
|
||||
// move it to the trash
|
||||
LLPreview::hide(mUUID, TRUE);
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH);
|
||||
@@ -1017,6 +1191,16 @@ BOOL LLItemBridge::removeItem()
|
||||
// if item is not already in trash
|
||||
if(item && !model->isObjectDescendentOf(mUUID, trash_id))
|
||||
{
|
||||
// <edit> trash problem
|
||||
if(gInventory.isObjectDescendentOf(mUUID, gLocalInventoryRoot))
|
||||
{
|
||||
LLInventoryModel::LLCategoryUpdate up(item->getParentUUID(), -1);
|
||||
gInventory.deleteObject(mUUID);
|
||||
gInventory.accountForUpdate(up);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
else
|
||||
// </edit>
|
||||
// move to trash, and restamp
|
||||
LLInvFVBridge::changeItemParent(model, item, trash_id, TRUE);
|
||||
// delete was successful
|
||||
@@ -1050,6 +1234,13 @@ BOOL LLItemBridge::copyToClipboard() const
|
||||
|
||||
LLViewerInventoryItem* LLItemBridge::getItem() const
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return NULL;
|
||||
}
|
||||
// </edit>
|
||||
LLViewerInventoryItem* item = NULL;
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(model)
|
||||
@@ -1098,12 +1289,27 @@ void LLFolderBridge::selectItem()
|
||||
// Can be destroyed (or moved to trash)
|
||||
BOOL LLFolderBridge::isItemRemovable()
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// <edit>
|
||||
// People delete their inventory easily...
|
||||
if(mUUID == gAgent.getInventoryRootID())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
/*
|
||||
// </edit>
|
||||
if(!model->isObjectDescendentOf(mUUID, gAgent.getInventoryRootID()))
|
||||
{
|
||||
return FALSE;
|
||||
@@ -1160,12 +1366,22 @@ BOOL LLFolderBridge::isItemRemovable()
|
||||
}
|
||||
}
|
||||
}
|
||||
// <edit>
|
||||
*/
|
||||
// </edit>
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLFolderBridge::isUpToDate() const
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
|
||||
@@ -1174,7 +1390,10 @@ BOOL LLFolderBridge::isUpToDate() const
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return category->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN;
|
||||
// <edit> trying to make it stop trying to fetch Local Inventory
|
||||
//return category->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN;
|
||||
return (category->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) || (mUUID == gLocalInventoryRoot) || (gInventory.isObjectDescendentOf(mUUID, gLocalInventoryRoot));
|
||||
// </edit>
|
||||
}
|
||||
|
||||
BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
|
||||
@@ -1184,6 +1403,13 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
|
||||
// the UI will get confused and pass in a NULL.
|
||||
if(!inv_cat) return FALSE;
|
||||
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
|
||||
@@ -1633,6 +1859,13 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model
|
||||
}
|
||||
else if ("removefromoutfit" == action)
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return;
|
||||
LLViewerInventoryCategory* cat = getCategory();
|
||||
@@ -1664,6 +1897,13 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model
|
||||
void LLFolderBridge::openItem()
|
||||
{
|
||||
lldebugs << "LLFolderBridge::openItem()" << llendl;
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return;
|
||||
model->fetchDescendentsOf(mUUID);
|
||||
@@ -1760,6 +2000,13 @@ LLUIImagePtr LLFolderBridge::getIcon() const
|
||||
|
||||
BOOL LLFolderBridge::renameItem(const std::string& new_name)
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
if(!isItemRenameable()) return FALSE;
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
@@ -1779,12 +2026,21 @@ BOOL LLFolderBridge::renameItem(const std::string& new_name)
|
||||
|
||||
BOOL LLFolderBridge::removeItem()
|
||||
{
|
||||
if(!isItemRemovable())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
// <edit>
|
||||
//if(!isItemRemovable())
|
||||
//{
|
||||
// return FALSE;
|
||||
//}
|
||||
// </edit>
|
||||
// move it to the trash
|
||||
LLPreview::hide(mUUID);
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
|
||||
@@ -1812,6 +2068,41 @@ BOOL LLFolderBridge::removeItem()
|
||||
LLViewerInventoryCategory* cat = getCategory();
|
||||
if(cat)
|
||||
{
|
||||
// <edit> trash problem
|
||||
if(gInventory.isObjectDescendentOf(cat->getUUID(), gLocalInventoryRoot))
|
||||
{
|
||||
S32 descendents = cat->getDescendentCount();
|
||||
if(descendents > 0)
|
||||
{
|
||||
LLInventoryModel::LLCategoryUpdate up(cat->getUUID(), -descendents);
|
||||
gInventory.accountForUpdate(up);
|
||||
}
|
||||
cat->setDescendentCount(0);
|
||||
LLInventoryModel::cat_array_t categories;
|
||||
LLInventoryModel::item_array_t items;
|
||||
gInventory.collectDescendents(cat->getUUID(),
|
||||
categories,
|
||||
items,
|
||||
false); // include trash?
|
||||
S32 count = items.count();
|
||||
S32 i;
|
||||
for(i = 0; i < count; ++i)
|
||||
{
|
||||
gInventory.deleteObject(items.get(i)->getUUID());
|
||||
}
|
||||
count = categories.count();
|
||||
for(i = 0; i < count; ++i)
|
||||
{
|
||||
gInventory.deleteObject(categories.get(i)->getUUID());
|
||||
}
|
||||
|
||||
LLInventoryModel::LLCategoryUpdate up(cat->getParentUUID(), -descendents);
|
||||
gInventory.deleteObject(cat->getUUID());
|
||||
gInventory.accountForUpdate(up);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
else
|
||||
// </edit>
|
||||
LLInvFVBridge::changeCategoryParent(model, cat, trash_id, TRUE);
|
||||
}
|
||||
|
||||
@@ -1829,6 +2120,13 @@ BOOL LLFolderBridge::isClipboardPasteable() const
|
||||
|
||||
void LLFolderBridge::pasteFromClipboard()
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(model && isClipboardPasteable())
|
||||
{
|
||||
@@ -1866,6 +2164,13 @@ void LLFolderBridge::folderOptionsMenu()
|
||||
|
||||
// *TODO: Translate
|
||||
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return;
|
||||
|
||||
@@ -1929,6 +2234,14 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
|
||||
// *TODO: Translate
|
||||
lldebugs << "LLFolderBridge::buildContextMenu()" << llendl;
|
||||
// std::vector<std::string> disabled_items;
|
||||
// std::vector<std::string> disabled_items;
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return;
|
||||
LLUUID trash_id = model->findCategoryUUIDForType(LLAssetType::AT_TRASH);
|
||||
@@ -2036,8 +2349,12 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
|
||||
}
|
||||
else
|
||||
{
|
||||
mItems.push_back(std::string("--no options--"));
|
||||
mDisabledItems.push_back(std::string("--no options--"));
|
||||
// <edit>
|
||||
//mItems.push_back(std::string("--no options--"));
|
||||
//mDisabledItems.push_back(std::string("--no options--"));
|
||||
mItems.push_back(std::string("Save As..."));
|
||||
mItems.push_back(std::string("Save InvCache..."));
|
||||
// </edit>
|
||||
}
|
||||
hideContextEntries(menu, mItems, mDisabledItems);
|
||||
}
|
||||
@@ -2084,7 +2401,14 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,
|
||||
}
|
||||
|
||||
LLViewerInventoryCategory* LLFolderBridge::getCategory() const
|
||||
{
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return NULL;
|
||||
}
|
||||
// </edit>
|
||||
LLViewerInventoryCategory* cat = NULL;
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(model)
|
||||
@@ -2209,7 +2533,14 @@ void LLFolderBridge::createWearable(LLUUID parent_id, EWearableType type)
|
||||
}
|
||||
|
||||
void LLFolderBridge::modifyOutfit(BOOL append)
|
||||
{
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return;
|
||||
LLViewerInventoryCategory* cat = getCategory();
|
||||
@@ -2260,7 +2591,14 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
|
||||
|
||||
BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
|
||||
BOOL drop)
|
||||
{
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
|
||||
@@ -2749,7 +3087,14 @@ LLCallingCardBridge::~LLCallingCardBridge()
|
||||
}
|
||||
|
||||
void LLCallingCardBridge::refreshFolderViewItem()
|
||||
{
|
||||
{
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return;
|
||||
}
|
||||
// </edit>
|
||||
LLFolderViewItem* itemp = mInventoryPanel->getRootFolder()->getItemByID(mUUID);
|
||||
if (itemp)
|
||||
{
|
||||
@@ -3256,10 +3601,12 @@ std::string LLObjectBridge::sPrefix("Object: ");
|
||||
LLUUID LLObjectBridge::sContextMenuItemID;
|
||||
|
||||
BOOL LLObjectBridge::isItemRemovable()
|
||||
{
|
||||
LLVOAvatar* avatar = gAgent.getAvatarObject();
|
||||
if(!avatar) return FALSE;
|
||||
if(avatar->isWearingAttachment(mUUID)) return FALSE;
|
||||
{
|
||||
// <edit>
|
||||
//LLVOAvatar* avatar = gAgent.getAvatarObject();
|
||||
//if(!avatar) return FALSE;
|
||||
//if(avatar->isWearingAttachment(mUUID)) return FALSE;
|
||||
// </edit>
|
||||
return LLInvFVBridge::isItemRemovable();
|
||||
}
|
||||
|
||||
@@ -3370,6 +3717,18 @@ std::string LLObjectBridge::getLabelSuffix() const
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
// <edit> testzone attachpt
|
||||
if(avatar)
|
||||
{
|
||||
std::map<S32, LLUUID>::iterator iter = avatar->mUnsupportedAttachmentPoints.begin();
|
||||
std::map<S32, LLUUID>::iterator end = avatar->mUnsupportedAttachmentPoints.end();
|
||||
for( ; iter != end; ++iter)
|
||||
if((*iter).second == mUUID)
|
||||
return LLItemBridge::getLabelSuffix() + llformat(" (worn on unsupported point %d)", (*iter).first);
|
||||
}
|
||||
// </edit>
|
||||
return LLItemBridge::getLabelSuffix();
|
||||
}
|
||||
}
|
||||
@@ -3468,9 +3827,19 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
|
||||
if( avatarp->isWearingAttachment( mUUID ) )
|
||||
{
|
||||
items.push_back(std::string("Detach From Yourself"));
|
||||
}
|
||||
else
|
||||
if( !isInTrash() )
|
||||
}
|
||||
else
|
||||
// <edit> testzone attachpt
|
||||
if( avatarp->isWearingUnsupportedAttachment( mUUID ) )
|
||||
{
|
||||
items.push_back(std::string("Detach From Yourself"));
|
||||
}
|
||||
else
|
||||
// </edit>
|
||||
// <edit> don't allow attaching objects while importing attachments
|
||||
//if( !isInTrash() )
|
||||
if( !isInTrash() && !(LLXmlImport::sImportInProgress && LLXmlImport::sImportHasAttachments))
|
||||
// </edit>
|
||||
{
|
||||
items.push_back(std::string("Attach Separator"));
|
||||
items.push_back(std::string("Object Wear"));
|
||||
@@ -3505,14 +3874,40 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
|
||||
NULL, &attach_label, (void*)attachment));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// </edit>
|
||||
LLSimpleListener* callback = mInventoryPanel->getListenerByName("Inventory.AttachObject");
|
||||
|
||||
if (callback)
|
||||
{
|
||||
new_item->addListener(callback, "on_click", LLSD(attachment->getName()));
|
||||
}
|
||||
// <edit> derf
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
// <edit>
|
||||
LLMenuItemCallGL *new_item = new LLMenuItemCallGL("Custom...", NULL, NULL);
|
||||
attach_menu->append(new_item);
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSimpleListener* callback = mInventoryPanel->getListenerByName("Inventory.AttachCustom");
|
||||
new_item->addListener(callback, "on_click", NULL);
|
||||
}
|
||||
// </edit>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3523,6 +3918,13 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
|
||||
{
|
||||
if(!isItemRenameable()) return FALSE;
|
||||
LLPreview::rename(mUUID, getPrefix() + new_name);
|
||||
// <edit> derf
|
||||
if(std::find(LLInventoryPanel::sInstances.begin(), LLInventoryPanel::sInstances.end(), mInventoryPanel) == LLInventoryPanel::sInstances.end())
|
||||
{
|
||||
llwarns << "scheduled for delayed delete" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
// </edit>
|
||||
LLInventoryModel* model = mInventoryPanel->getModel();
|
||||
if(!model) return FALSE;
|
||||
LLViewerInventoryItem* item = getItem();
|
||||
@@ -4323,7 +4725,9 @@ BOOL LLWearableBridge::renameItem(const std::string& new_name)
|
||||
|
||||
BOOL LLWearableBridge::isItemRemovable()
|
||||
{
|
||||
if(gAgent.isWearingItem(mUUID)) return FALSE;
|
||||
// <edit>
|
||||
//if(gAgent.isWearingItem(mUUID)) return FALSE;
|
||||
// </edit>
|
||||
return LLInvFVBridge::isItemRemovable();
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,9 @@ public:
|
||||
BOOL allow_multi_select,
|
||||
LLView *parent_view = NULL);
|
||||
~LLInventoryPanel();
|
||||
// <edit>
|
||||
static std::list<LLInventoryPanel*> sInstances;
|
||||
// </edit>
|
||||
|
||||
LLInventoryModel* getModel() { return mInventory; }
|
||||
|
||||
@@ -138,6 +141,9 @@ protected:
|
||||
// Given the id and the parent, build all of the folder views.
|
||||
void rebuildViewsFor(const LLUUID& id, U32 mask);
|
||||
void buildNewViews(const LLUUID& id);
|
||||
// <edit>
|
||||
void buildNewViews(const LLInventoryObject* objectp);
|
||||
// </edit>
|
||||
|
||||
public:
|
||||
// TomY TODO: Move this elsewhere?
|
||||
|
||||
Reference in New Issue
Block a user