Bridge directory protected, "wire ring" cut.

meow-7.2.2
Tozh 2011-06-25 15:26:24 -04:00
parent 5bf6b89715
commit 8a8ee31942
7 changed files with 151 additions and 29 deletions

View File

@ -309,6 +309,15 @@
<integer>0</integer>
</array>
</map>
<key>ProtectBridgeFolder</key>
<map>
<key>Comment</key>
<string>Keep the Bridge folder in Inventory safe from manual changes.</string>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>PhoenixKeywordOn</key>
<map>

View File

@ -27,6 +27,7 @@
#include "llviewerprecompiledheaders.h"
#include "fslslbridge.h"
#include "fslslbridgerequest.h"
#include "imageids.h"
#include "llxmlnode.h"
#include "llbufferstream.h"
#include "llsdserialize.h"
@ -48,6 +49,7 @@
#include "llassetuploadresponders.h"
#include "llnearbychatbar.h"
#include "llnotificationmanager.h"
#include "llviewerobject.h"
#include <boost/regex.hpp>
@ -57,6 +59,7 @@
#define LIB_ROCK_NAME "Rock - medium, round"
//#define ROOT_FIRESTORM_FOLDER "#Firestorm" //moved to llinventoryfunctions to synch with the AO object
#define FS_BRIDGE_FOLDER "#LSL Bridge"
#define FS_BRIDGE_NAME "#Firestorm LSL Bridge v"
#define FS_BRIDGE_MAJOR_VERSION 1
#define FS_BRIDGE_MINOR_VERSION 7
@ -97,6 +100,7 @@ FSLSLBridge :: FSLSLBridge():
mBridgeCreating(false),
mpBridge(NULL)
{
llinfos << "Initializing fsbridge class" << llendl;
std::stringstream sstr;
sstr << FS_BRIDGE_NAME;
@ -162,6 +166,12 @@ void FSLSLBridge :: recreateBridge()
if (!gSavedSettings.getBOOL("UseLSLBridge"))
return;
if (mBridgeCreating)
{
reportToNearbyChat("Bridge creation in process, can't start another. Please wait a few minutes.");
return;
}
LLUUID catID = findFSCategory();
LLViewerInventoryItem* fsBridge = findInvObject(mCurrentFullName, catID, LLAssetType::AT_OBJECT);
@ -255,13 +265,24 @@ void FSLSLBridge :: processAttach(LLViewerObject *object, const LLViewerJointAtt
{
llinfos << "enter process attach, checking the rock" << llendl;
if ((mpBridge == NULL) || (!gAgentAvatarp->isSelf()) || (attachment->getName() != "Bridge"))
if ((!gAgentAvatarp->isSelf()) || (attachment->getName() != "Bridge"))
return;
llinfos << "rock is attached, mpBridge not NULL, avatar is self, point is bridge" << llendl;
LLViewerInventoryItem *fsObject = gInventory.getItem(object->getAttachmentItemID());
if (fsObject == NULL) //just in case
return;
if (mpBridge == NULL) //user is attaching an existing bridge?
{
//is it in the right place?
LLUUID catID = findFSCategory();
if (catID != fsObject->getParentUUID())
{
//the object is not where we think it is. what to do?
}
mpBridge = fsObject;
}
llinfos << "rock is attached, mpBridge not NULL, avatar is self, point is bridge" << llendl;
if (fsObject->getUUID() != mpBridge->getUUID())
{
@ -340,18 +361,24 @@ void FSLSLBridge :: setupBridgePrim(LLViewerObject *object)
{
llinfos << "enter rock change" << llendl;
object->setScale(LLVector3(0.01f, 0.01f, 0.01f));
LLProfileParams profParams(LL_PCODE_PROFILE_CIRCLE, F32(0.230), F32(0.250), F32(0.95));
LLPathParams pathParams(LL_PCODE_PATH_CIRCLE, F32(0), F32(0.2), F32(0.01), F32(0.01), F32(0.00), F32(0.0),
F32(0), F32(0), F32(0), F32(0), F32(0), F32(0.01), 0);
LLPathParams pathParams(LL_PCODE_PATH_CIRCLE, F32(0.2), F32(0.22),
F32(0.0), F32(350.0), //scale
F32(0.0), F32(0.0), //shear
F32(0), F32(0), //twist
F32(0), //offset
F32(0), F32(0.0), //taper
F32(0.05), F32(0.05)); //revolutions, skew
pathParams.setRevolutions(F32(1.0));
object->setVolume(LLVolumeParams(profParams, pathParams), 0);
object->setScale(LLVector3(10.0f, 10.0f, 10.0f), TRUE);
for (int i = 0; i < object->getNumTEs(); i++)
{
object->setTETexture(i, LLUUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")); //transparent texture
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( IMG_INVISIBLE );
object->setTEImage(i, image); //transparent texture
}
object->setChanged(LLXform::MOVED | LLXform::SILHOUETTE | LLXform::TEXTURE);
//object->setTETexture(0, LLUUID("29de489d-0491-fb00-7dab-f9e686d31e83")); //another test texture
object->sendShapeUpdate();
@ -550,13 +577,43 @@ bool FSLSLBridge :: isItemAttached(LLUUID iID)
LLUUID FSLSLBridge :: findFSCategory()
{
LLUUID catID;
catID = gInventory.findCategoryByName(ROOT_FIRESTORM_FOLDER);
if(catID.isNull())
if (!mBridgeFolderID.isNull())
return mBridgeFolderID;
LLUUID fsCatID;
LLUUID bridgeCatID;
fsCatID = gInventory.findCategoryByName(ROOT_FIRESTORM_FOLDER);
if(!fsCatID.isNull())
{
catID = gInventory.createNewCategory(gInventory.getRootFolderID(), LLFolderType::FT_NONE, ROOT_FIRESTORM_FOLDER);
LLInventoryModel::item_array_t* items;
LLInventoryModel::cat_array_t* cats;
gInventory.getDirectDescendentsOf(fsCatID, cats, items);
if(cats)
{
S32 count = cats->count();
for(S32 i = 0; i < count; ++i)
{
if(cats->get(i)->getName() == FS_BRIDGE_FOLDER)
{
bridgeCatID = cats->get(i)->getUUID();
}
}
}
}
return catID;
else
{
fsCatID = gInventory.createNewCategory(gInventory.getRootFolderID(), LLFolderType::FT_NONE, ROOT_FIRESTORM_FOLDER);
}
if (bridgeCatID.isNull())
{
bridgeCatID = gInventory.createNewCategory(fsCatID, LLFolderType::FT_NONE, FS_BRIDGE_FOLDER);
}
mBridgeFolderID = bridgeCatID;
return mBridgeFolderID;
}
LLViewerInventoryItem* FSLSLBridge :: findInvObject(std::string obj_name, LLUUID catID, LLAssetType::EType type)
{

View File

@ -58,7 +58,6 @@ public:
void initBridge();
void recreateBridge();
void processAttach(LLViewerObject *object, const LLViewerJointAttachment *attachment);
void startCreation();
bool getBridgeCreating() {return mBridgeCreating; };
void setBridgeCreating(bool status) { mBridgeCreating = status; };
@ -68,26 +67,22 @@ public:
void checkBridgeScriptName(std::string fileName);
std::string currentFullName() { return mCurrentFullName; }
void finishBridge();
protected:
/*virtual*/ void inventoryChanged(LLViewerObject* obj,
LLInventoryObject::object_list_t* inv,
S32 serial_num,
void* queue);
LLUUID mScriptItemID; //internal script ID
LLUUID getBridgeFolder() { return mBridgeFolderID; }
private:
std::string mCurrentURL;
int mCurrentChannel;
bool mBridgeCreating;
LLViewerInventoryItem* mpBridge;
std::string mCurrentFullName;
LLUUID mScriptItemID; //internal script ID
LLUUID mBridgeFolderID;
protected:
LLViewerInventoryItem* findInvObject(std::string obj_name, LLUUID catID, LLAssetType::EType type);
LLUUID findFSCategory();
bool isItemAttached(LLUUID iID);
void createNewBridge();
void create_script_inner(LLViewerObject* object);
@ -97,6 +92,13 @@ protected:
void setupBridgePrim(LLViewerObject *object);
void initCreationStep();
void cleanUpBridge();
void startCreation();
void finishBridge();
/*virtual*/ void inventoryChanged(LLViewerObject* obj,
LLInventoryObject::object_list_t* inv,
S32 serial_num,
void* queue);
};

View File

@ -29,6 +29,7 @@
// viewer includes
#include "aoengine.h" // ## Zi: Animation Overrider
#include "fslslbridge.h" //-TT Client LSL Bridge
#include "llfolderview.h" // Items depend extensively on LLFolderViews
#include "llfoldervieweventlistener.h"
#include "llinventorybridge.h" // for LLItemBridge in LLInventorySort::operator()
@ -1069,7 +1070,11 @@ void LLFolderViewItem::draw()
//--------------------------------------------------------------------------------//
// Draw "protected" indicator
//
if(mListener->getUUID()==AOEngine::instance().getAOFolder() && gSavedPerAccountSettings.getBOOL("ProtectAOFolders"))
if((mListener->getUUID()==AOEngine::instance().getAOFolder() && gSavedPerAccountSettings.getBOOL("ProtectAOFolders"))
//-TT Client LSL Bridge
||(mListener->getUUID()==FSLSLBridge::instance().getBridgeFolder() && gSavedPerAccountSettings.getBOOL("ProtectBridgeFolder"))
//-TT
)
{
std::string locked_string = " (" + LLTrans::getString("ProtectedFolder") + ") ";
font->renderUTF8(locked_string, 0, right_x, y, sProtectedColor,

View File

@ -72,6 +72,9 @@
#include "rlvhandler.h"
#include "rlvlocks.h"
// [/RLVa:KB]
//-TT Client LSL Bridge
#include "fslslbridge.h"
//-TT
typedef std::pair<LLUUID, LLUUID> two_uuids_t;
typedef std::list<two_uuids_t> two_uuids_list_t;
@ -612,7 +615,10 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
// Don't allow items to be pasted directly into the COF.
if (!isCOFFolder())
//if (!isCOFFolder())
//-TT Client LSL Bridge
if (!isCOFFolder() && !isProtectedFolder())
//-TT
{
items.push_back(std::string("Paste"));
}
@ -835,6 +841,18 @@ BOOL LLInvFVBridge::isCOFFolder() const
return LLAppearanceMgr::instance().getIsInCOF(mUUID);
}
//-TT Client LSL Bridge
BOOL LLInvFVBridge::isProtectedFolder() const
{
const LLInventoryModel* model = getInventoryModel();
if(!model) return FALSE;
return ((mUUID == FSLSLBridge::instance().getBridgeFolder())
|| (model->isObjectDescendentOf(mUUID, FSLSLBridge::instance().getBridgeFolder()))
&& gSavedPerAccountSettings.getBOOL("ProtectBridgeFolder"));
}
//-TT
BOOL LLInvFVBridge::isItemPermissive() const
{
return FALSE;

View File

@ -138,6 +138,9 @@ protected:
BOOL isAgentInventory() const; // false if lost or in the inventory library
BOOL isCOFFolder() const; // true if COF or descendent of
//-TT Client LSL Bridge
BOOL isProtectedFolder() const;
//-TT
virtual BOOL isItemPermissive() const;
static void changeItemParent(LLInventoryModel* model,
LLViewerInventoryItem* item,

View File

@ -44,6 +44,9 @@
// newview includes
#include "aoengine.h" // ## Zi: Animation Overrider
//-TT Client LSL Bridge
#include "fslslbridge.h"
//-TT
#include "llappearancemgr.h"
#include "llappviewer.h"
//#include "llfirstuse.h"
@ -122,6 +125,11 @@ void change_item_parent(LLInventoryModel* model,
&& gSavedPerAccountSettings.getBOOL("ProtectAOFolders"))
return;
// ## Zi: Animation Overrider
//-TT Client LSL Bridge
if(model->isObjectDescendentOf(item->getUUID(),FSLSLBridge::instance().getBridgeFolder())
&& gSavedPerAccountSettings.getBOOL("ProtectBridgeFolder"))
return;
//-TT
LLInventoryModel::update_list_t update;
LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
@ -155,8 +163,13 @@ void change_category_parent(LLInventoryModel* model,
}
// ## Zi: Animation Overrider
if(model->isObjectDescendentOf(cat->getUUID(),AOEngine::instance().getAOFolder())
if((model->isObjectDescendentOf(cat->getUUID(),AOEngine::instance().getAOFolder())
&& gSavedPerAccountSettings.getBOOL("ProtectAOFolders"))
//-TT Client LSL Bridge
|| (model->isObjectDescendentOf(cat->getUUID(),FSLSLBridge::instance().getBridgeFolder())
&& gSavedPerAccountSettings.getBOOL("ProtectBridgeFolder"))
//-TT
)
return;
// ## Zi: Animation Overrider
@ -340,8 +353,13 @@ BOOL get_is_item_removable(const LLInventoryModel* model, const LLUUID& id)
}
// ## Zi: Animation Overrider
if(model->isObjectDescendentOf(id,AOEngine::instance().getAOFolder())
if((model->isObjectDescendentOf(id,AOEngine::instance().getAOFolder())
&& gSavedPerAccountSettings.getBOOL("ProtectAOFolders"))
//-TT Client LSL Bridge
|| (model->isObjectDescendentOf(id,FSLSLBridge::instance().getBridgeFolder())
&& gSavedPerAccountSettings.getBOOL("ProtectBridgeFolder"))
)
//-TT
return FALSE;
// ## Zi: Animation Overrider
@ -400,8 +418,13 @@ BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id)
// [/RLVa:KB]
// ## Zi: Animation Overrider
if((id==AOEngine::instance().getAOFolder() || model->isObjectDescendentOf(id,AOEngine::instance().getAOFolder()))
if(((id==AOEngine::instance().getAOFolder() || model->isObjectDescendentOf(id,AOEngine::instance().getAOFolder()))
&& gSavedPerAccountSettings.getBOOL("ProtectAOFolders"))
//-TT Client LSL Bridge
|| (id==FSLSLBridge::instance().getBridgeFolder() || model->isObjectDescendentOf(id,FSLSLBridge::instance().getBridgeFolder())
&& gSavedPerAccountSettings.getBOOL("ProtectBridgeFolder"))
)
//-TT
return FALSE;
// ## Zi: Animation Overrider
@ -448,8 +471,13 @@ BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id)
// [/RLVa:KB]
// ## Zi: Animation Overrider
if((id==AOEngine::instance().getAOFolder() || model->isObjectDescendentOf(id,AOEngine::instance().getAOFolder()))
if(((id==AOEngine::instance().getAOFolder() || model->isObjectDescendentOf(id,AOEngine::instance().getAOFolder()))
&& gSavedPerAccountSettings.getBOOL("ProtectAOFolders"))
//-TT Client LSL Bridge
|| (id==FSLSLBridge::instance().getBridgeFolder() || model->isObjectDescendentOf(id,FSLSLBridge::instance().getBridgeFolder())
&& gSavedPerAccountSettings.getBOOL("ProtectBridgeFolder"))
)
//-TT
return FALSE;
// ## Zi: Animation Overrider