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

@@ -64,6 +64,7 @@ include_directories(
)
set(viewer_SOURCE_FILES
llviewerobjectbackup.cpp
slfloatermediafilter.cpp
floaterlocalassetbrowse.cpp
aoremotectrl.cpp
@@ -533,6 +534,7 @@ set(viewer_HEADER_FILES
CMakeLists.txt
ViewerInstall.cmake
llviewerobjectbackup.h
slfloatermediafilter.h
floaterlocalassetbrowse.h
aoremotectrl.h

View File

@@ -9,6 +9,22 @@
<string>settings_rlv.xml</string>
</array>
<key>FloaterObjectBackuptRect</key>
<map>
<key>Comment</key>
<string>Rectangle for the object backup floater</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Rect</string>
<key>Value</key>
<array>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
</array>
</map>
<key>MediaEnableFilter</key>
<map>

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");

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,176 @@
/**
* @file llviewerobjectbackup.h
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "llviewerinventory.h"
enum export_states {
EXPORT_INIT,
EXPORT_STRUCTURE,
EXPORT_TEXTURES,
EXPORT_LLSD,
EXPORT_DONE,
EXPORT_FAILED
};
class LLObjectBackup : public LLFloater
{
public:
virtual ~LLObjectBackup();
// Floater stuff
virtual void show(bool exporting);
virtual void draw();
virtual void onClose(bool app_quitting);
// Static accessor
static LLObjectBackup* getInstance();
// Export idle callback
static void exportWorker(void *userdata);
// Import entry point
void importObject(bool upload=FALSE);
// Export entry point
void exportObject();
// Update map from texture worker
void updateMap(LLUUID uploaded_asset);
// Move to next texture upload
void uploadNextAsset();
// Folder public geter
std::string getfolder() { return mFolder; };
// Prim updated callback
void primUpdate(LLViewerObject* object);
// New prim call back
bool newPrim(LLViewerObject* pobject);
static const U32 TEXTURE_OK = 0x00;
static const U32 TEXTURE_BAD_PERM = 0x01;
static const U32 TEXTURE_MISSING = 0x02;
static const U32 TEXTURE_BAD_ENCODING = 0x04;
static const U32 TEXTURE_IS_NULL = 0x08;
static const U32 TEXTURE_SAVED_FAILED = 0x10;
// Is ready for next texture?
bool mNextTextureReady;
// Export state machine
enum export_states mExportState;
// Export result flags for textures.
U32 mNonExportedTextures;
private:
// Static singleton stuff
LLObjectBackup();
static LLObjectBackup* sInstance;
// Update the floater with status numbers
void updateImportNumbers();
void updateExportNumbers();
// Permissions stuff.
bool validatePerms(const LLPermissions* item_permissions);
LLUUID validateTextureID(LLUUID asset_id);
// Convert a selection list of objects to LLSD
LLSD primsToLLSD(LLViewerObject::child_list_t child_list);
// Start the import process
void importFirstObject();
// Move to the next import group
void importNextObject();
// Export the next texture in list
void exportNextTexture();
// Apply LLSD to object
void xmlToPrim(LLSD prim_llsd, LLViewerObject* pobject);
// Rez a prim at a given position (note not agent offset X/Y screen for raycast)
void rezAgentOffset(LLVector3 offset);
// Get an offset from the agent based on rotation and current pos
LLVector3 offsetAgent(LLVector3 offset);
// Are we active flag
bool mRunning;
// File and folder name control
std::string mFileName;
std::string mFolder;
// True if we need to rebase the assets
bool mRetexture;
// Counts of import and export objects and prims
U32 mObjects;
U32 mCurObject;
U32 mPrims;
U32 mCurPrim;
// No prims rezed
U32 mRezCount;
// Rebase map
std::map<LLUUID,LLUUID> mAssetMap;
// Export texture list
std::list<LLUUID> mTexturesList;
// Import object tracking
std::vector<LLViewerObject*> mToSelect;
std::vector<LLViewerObject*>::iterator mProcessIter;
// Working LLSD holders
LLUUID mCurrentAsset;
LLSD mLLSD;
LLSD mThisGroup;
LLUUID mExpectingUpdate;
// Working llsd itterators for objects and linksets
LLSD::map_const_iterator mPrimImportIter;
LLSD::array_const_iterator mGroupPrimImportIter;
// Root pos and rotation and central root pos for link set
LLVector3 mRootPos;
LLQuaternion mRootRot;
LLVector3 mRootRootPos;
LLVector3 mGroupOffset;
// Agent inital pos and rot when starting import
LLVector3 mAgentPos;
LLQuaternion mAgentRot;
};

View File

@@ -75,6 +75,8 @@
#include "llappviewer.h"
#include "llviewerobjectbackup.h"
extern F32 gMinObjectDistance;
extern BOOL gAnimateTextures;
@@ -247,6 +249,11 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp,
{
gPipeline.addObject(objectp);
}
else
{
LLObjectBackup::getInstance()->primUpdate(objectp);
}
// Also sets the approx. pixel area
objectp->setPixelAreaAndAngle(gAgent);
@@ -272,6 +279,8 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp,
objectp->mCreateSelected = false;
gViewerWindow->getWindow()->decBusyCount();
gViewerWindow->getWindow()->setCursor( UI_CURSOR_ARROW );
LLObjectBackup::getInstance()->newPrim(objectp);
}
}

View File

@@ -69,6 +69,10 @@
<on_click function="Tools.SelectedScriptAction" userdata="reset" />
<on_enable function="EditableSelected" />
</menu_item_call>
<menu_item_call enabled="false" hidden="false" label="Export" mouse_opaque="true" name="Export">
<on_click function="Object.Export" />
<on_enable function="Object.EnableExport" />
</menu_item_call>
</pie_menu>
<menu_item_call enabled="false" label="Mute" mouse_opaque="true" name="Object Mute">
<on_click function="Object.Mute" />
@@ -81,6 +85,11 @@
<menu_item_call enabled="true" label="Derender" mouse_opaque="true" name="Derender">
<on_click function="Object.DERENDER" />
</menu_item_call>
<menu_item_call enabled="false" label="Report..." mouse_opaque="true"
name="Report Abuse...">
<on_click function="Object.ReportAbuse" />
<on_enable function="Object.EnableReportAbuse" />
</menu_item_call>
</pie_menu>
<menu_item_call enabled="false" label="Buy..." mouse_opaque="true" name="Buy...">
<on_click function="Object.Buy" />

View File

@@ -24,11 +24,11 @@
mouse_opaque="true" enabled="true" >
<on_click function="File.UploadBulk" userdata="" />
</menu_item_call>
<menu_item_call enabled="false" hidden="false" label="Import" mouse_opaque="true" name="Import">
<menu_item_call enabled="false" hidden="false" label="Import XML" mouse_opaque="true" name="Import">
<on_click function="Object.Import" />
<on_enable function="Object.EnableImport" />
</menu_item_call>
<menu_item_call enabled="false" hidden="false" label="Upload Textures + Import" mouse_opaque="true" name="Import">
<menu_item_call enabled="false" hidden="false" label="Import with Textures" mouse_opaque="true" name="Import">
<on_click function="Object.ImportUpload" />
<on_enable function="Object.EnableImport" />
</menu_item_call>

View File

@@ -5236,6 +5236,27 @@ Cannot retrieve grid info from server.
Builds with extended hollow or extended hole size do not render properly on other viewers. Please keep this option checked, if you want your builds looking properly in other viewers.
</notification>
<notification
icon="alertmodal.tga"
name="ExportFailed"
type="alertmodal">
Bad permissions for the exported object. Export aborted.
</notification>
<notification
icon="alertmodal.tga"
name="ExportPartial"
type="alertmodal">
Object exported. Some textures could not be saved due to: [REASON]
</notification>
<notification
icon="notifytip.tga"
name="ExportSuccessful"
type="notifytip">
Export successful.
</notification>
<notification
icon="notifytip.tga"
name="SystemMessageTip"