OpenSim compatible prim backup

This commit is contained in:
Siana Gearz
2011-04-19 01:33:09 +02:00
parent 25b4452a12
commit 955ca21298
9 changed files with 1523 additions and 30 deletions

View File

@@ -250,6 +250,7 @@
#include "llavatarnamecache.h"
#include "floaterao.h"
#include "slfloatermediafilter.h"
#include "llviewerobjectbackup.h"
#include "hippogridmanager.h"
@@ -575,14 +576,6 @@ void handle_grab_texture(void*);
BOOL enable_grab_texture(void*);
void handle_dump_region_object_cache(void*);
BOOL menu_ui_enabled(void *user_data);
BOOL menu_check_control( void* user_data);
void menu_toggle_variable( void* user_data );
@@ -2803,6 +2796,90 @@ class LLGoToObject : public view_listener_t
}
};
//---------------------------------------------------------------------------
// Object backup
//---------------------------------------------------------------------------
class LLObjectEnableExport : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
bool new_value = (object != NULL);
if (new_value)
{
struct ff : public LLSelectedNodeFunctor
{
ff(const LLSD& data) : LLSelectedNodeFunctor(), userdata(data)
{
}
const LLSD& userdata;
virtual bool apply(LLSelectNode* node)
{
// Note: the actual permission checking algorithm depends on the grid TOS and must be
// performed for each prim and texture. This is done later in llviewerobjectbackup.cpp.
// This means that even if the item is enabled in the menu, the export may fail should
// the permissions not be met for each exported asset. The permissions check below
// therefore only corresponds to the minimal permissions requirement common to all grids.
LLPermissions *item_permissions = node->mPermissions;
return (gAgent.getID() == item_permissions->getOwner() &&
(gAgent.getID() == item_permissions->getCreator() ||
(item_permissions->getMaskOwner() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED));
}
};
ff * the_ff = new ff(userdata);
new_value = LLSelectMgr::getInstance()->getSelection()->applyToNodes(the_ff, false);
}
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
return true;
}
};
class LLObjectExport : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
if (!object) return true;
LLVOAvatar* avatar = find_avatar_from_object(object);
if (!avatar)
{
LLObjectBackup::getInstance()->exportObject();
}
return true;
}
};
class LLObjectEnableImport : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
gMenuHolder->findControl(userdata["control"].asString())->setValue(TRUE);
return true;
}
};
class LLObjectImport : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLObjectBackup::getInstance()->importObject(FALSE);
return true;
}
};
class LLObjectImportUpload : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLObjectBackup::getInstance()->importObject(TRUE);
return true;
}
};
//---------------------------------------------------------------------------
// Parcel freeze, eject, etc.
//---------------------------------------------------------------------------
@@ -10254,22 +10331,6 @@ void initialize_menus()
addMenu(new LLViewCheckRenderType(), "View.CheckRenderType");
addMenu(new LLViewCheckHUDAttachments(), "View.CheckHUDAttachments");
// World menu
addMenu(new LLWorldChat(), "World.Chat");
addMenu(new LLWorldAlwaysRun(), "World.AlwaysRun");
@@ -10383,7 +10444,6 @@ void initialize_menus()
addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
addMenu(new LLObjectReportAbuse(), "Object.ReportAbuse");
// <edit>
//addMenu(new LLObjectImport(), "Object.Import");
addMenu(new LLObjectMeasure(), "Object.Measure");
addMenu(new LLObjectData(), "Object.Data");
addMenu(new LLScriptCount(), "Object.ScriptCount");
@@ -10398,6 +10458,10 @@ void initialize_menus()
addMenu(new LLObjectInspect(), "Object.Inspect");
// <dogmode> Visual mute, originally by Phox.
addMenu(new LLObjectDerender(), "Object.DERENDER");
addMenu(new LLObjectExport(), "Object.Export");
addMenu(new LLObjectImport(), "Object.Import");
addMenu(new LLObjectImportUpload(), "Object.ImportUpload");
addMenu(new LLObjectEnableOpen(), "Object.EnableOpen");
addMenu(new LLObjectEnableTouch(), "Object.EnableTouch");
@@ -10406,11 +10470,10 @@ void initialize_menus()
addMenu(new LLObjectEnableWear(), "Object.EnableWear");
addMenu(new LLObjectEnableReturn(), "Object.EnableReturn");
addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse");
// <edit>
//addMenu(new LLObjectEnableImport(), "Object.EnableImport");
// </edit>
addMenu(new LLObjectEnableMute(), "Object.EnableMute");
addMenu(new LLObjectEnableBuy(), "Object.EnableBuy");
addMenu(new LLObjectEnableExport(), "Object.EnableExport");
addMenu(new LLObjectEnableImport(), "Object.EnableImport");
/*addMenu(new LLObjectVisibleTouch(), "Object.VisibleTouch");
addMenu(new LLObjectVisibleCustomTouch(), "Object.VisibleCustomTouch");