Sync llviewerobjectbackup with Cool VL Viewer

Note to Translators:
-Adds translation work to floater_object_backup.xml
-Adds ImportFailed, ExportAborted, and ConfirmAbortBackup to notifications.xml

Turns LLViewerObjectBackup into an LLFloaterSingleton.. but eventually, this should probably be an instance tracker on the uuid of the object to export or something instead.
This commit is contained in:
Inusaito Sayori
2014-09-11 19:45:15 -04:00
parent e5e665b9ee
commit 86ff77665c
5 changed files with 591 additions and 365 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -30,10 +30,22 @@
#ifndef LL_LLVIEWEROBJECTBACKUP_H
#define LL_LLVIEWEROBJECTBACKUP_H
#include <deque>
#include <string>
#include <vector>
#include "boost/unordered_map.hpp"
#include "boost/unordered_set.hpp"
#include "llfloater.h"
#include "statemachine/aifilepicker.h"
#include "lluuid.h"
#include "llviewerinventory.h"
#include "llviewerobject.h"
class LLSelectNode;
class LLViewerObject;
enum export_states {
EXPORT_INIT,
@@ -43,24 +55,27 @@ enum export_states {
EXPORT_TEXTURES,
EXPORT_LLSD,
EXPORT_DONE,
EXPORT_FAILED
EXPORT_FAILED,
EXPORT_ABORTED
};
class LLObjectBackup : public LLFloater
class LLObjectBackup : public LLFloater,
public LLFloaterSingleton<LLObjectBackup>
{
friend class LLUISingleton<LLObjectBackup, VisibilityPolicy<LLFloater> >;
protected:
LOG_CLASS(LLObjectBackup);
public:
virtual ~LLObjectBackup();
///////////////////////////////////////////////////////////////////////////
// LLFloater interface
// Floater stuff
virtual void show(bool exporting);
virtual void onClose(bool app_quitting);
/*virtual*/ ~LLObjectBackup();
/*virtual*/ void onClose(bool app_quitting);
// Static accessor
static LLObjectBackup* getInstance();
static bool instanceExists() { return sInstance != NULL; }
// Export idle callback
static void exportWorker(void *userdata);
///////////////////////////////////////////////////////////////////////////
// Public interface for invoking the object backup feature
// Import entry point
void importObject(bool upload = false);
@@ -70,47 +85,44 @@ public:
void exportObject();
void exportObject_continued(AIFilePicker* filepicker);
///////////////////////////////////////////////////////////////////////////
// Public methods used in callbacks, workers and responders
// Update map from texture worker
void updateMap(LLUUID uploaded_asset);
// Move to next texture upload
// Move to next texture upload, called by the agent inventory responder
void uploadNextAsset();
// Folder public geter
std::string getfolder() { return mFolder; }
// Export idle callback
static void exportWorker(void *userdata);
// Prim updated callback
void primUpdate(LLViewerObject* object);
// Prim updated callback, called in llviewerobjectlist.cpp
static void primUpdate(LLViewerObject* object);
// New prim call back
bool newPrim(LLViewerObject* pobject);
// New prim call back, called in llviewerobjectlist.cpp
static void newPrim(LLViewerObject* object);
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;
// Folder public getter, used by the texture cache responder
std::string getFolder() { return mFolder; }
// Set when the region supports the extra physics flags
bool mGotExtraPhysics;
// Are we ready to check for next texture?
bool mCheckNextTexture;
// Export state machine
enum export_states mExportState;
// Export result flags for textures.
U32 mNonExportedTextures;
static void setDefaultTextures();
// Is exporting these objects allowed
bool validatePerms(const LLPermissions* item_permissions);
// Permissions checking
static bool validatePerms(const LLPermissions* item_permissions);
static bool validateTexturePerms(const LLUUID& asset_id);
static bool validateNode(LLSelectNode* node);
private:
LLObjectBackup();
// Open only via the importObject() and exportObject() methods defined
// above.
LLObjectBackup(const LLSD&);
void showFloater(bool exporting);
static bool confirmCloseCallback(const LLSD& notification,
const LLSD& response);
// Update the floater with status numbers
void updateImportNumbers();
@@ -133,7 +145,7 @@ private:
void exportNextTexture();
// Apply LLSD to object
void xmlToPrim(LLSD prim_llsd, LLViewerObject* pobject);
void xmlToPrim(LLSD prim_llsd, LLViewerObject* object);
// Rez a prim at a given position
void rezAgentOffset(LLVector3 offset);
@@ -141,9 +153,28 @@ private:
// Get an offset from the agent based on rotation and current pos
LLVector3 offsetAgent(LLVector3 offset);
private:
static LLObjectBackup* sInstance;
public:
// Public static constants, used in callbacks, workers and responders
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;
// Export state machine
enum export_states mExportState;
// Export result flags for textures.
U32 mNonExportedTextures;
// Set when the region supports the extra physics flags
bool mGotExtraPhysics;
// Are we ready to check for next texture?
bool mCheckNextTexture;
private:
// Are we active flag
bool mRunning;
@@ -156,7 +187,7 @@ private:
U32 mPrims;
U32 mCurPrim;
// No prims rezed
// Number of rezzed prims
U32 mRezCount;
// Root pos and rotation and central root pos for link set
@@ -168,31 +199,39 @@ private:
// Agent inital pos and rot when starting import
LLVector3 mAgentPos;
LLQuaternion mAgentRot;
// Rebase map
boost::unordered_map<LLUUID, LLUUID> mAssetMap;
LLUUID mCurrentAsset;
LLUUID mExpectingUpdate;
// Working llsd iterators for objects and linksets
LLSD::map_const_iterator mPrimImportIter;
LLSD::array_const_iterator mGroupPrimImportIter;
// File and folder name control
std::string mFileName;
std::string mFolder;
// Export texture list
typedef boost::unordered_set<LLUUID> textures_set_t;
textures_set_t mTexturesList;
textures_set_t mBadPermsTexturesList;
// Rebase map
boost::unordered_map<LLUUID, LLUUID> mAssetMap;
// Import object tracking
std::vector<LLViewerObject*> mToSelect;
std::vector<LLViewerObject*>::iterator mProcessIter;
// File and folder name control
std::string mFileName;
std::string mFolder;
// Working LLSD holders
LLUUID mCurrentAsset;
LLUUID mExpectingUpdate;
LLSD mLLSD;
LLSD mThisGroup;
// Working llsd itterators for objects and linksets
LLSD::map_const_iterator mPrimImportIter;
LLSD::array_const_iterator mGroupPrimImportIter;
};
#endif
extern LLUUID LL_TEXTURE_PLYWOOD;
extern LLUUID LL_TEXTURE_BLANK;
extern LLUUID LL_TEXTURE_INVISIBLE;
extern LLUUID LL_TEXTURE_TRANSPARENT;
extern LLUUID LL_TEXTURE_MEDIA;
#endif // LL_LLVIEWEROBJECTBACKUP_H

View File

@@ -272,7 +272,7 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp,
}
else
{
LLObjectBackup::getInstance()->primUpdate(objectp);
LLObjectBackup::primUpdate(objectp);
}
@@ -310,7 +310,7 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp,
gViewerWindow->getWindow()->decBusyCount();
gViewerWindow->getWindow()->setCursor( UI_CURSOR_ARROW );
LLObjectBackup::getInstance()->newPrim(objectp);
LLObjectBackup::newPrim(objectp);
}
}

View File

@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="false"
rect_control="FloaterObjectBackuptRect"
height="80" width="200" name="Import" title="Import progress" mouse_opaque="true">
<text height="30" left="10" name="name_label" top="-20"> Progress </text>
<floater name="Object Backup" title="Progress" rect_control="FloaterObjectBackuptRect"
can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="false"
height="80" width="200" mouse_opaque="true">
<text height="30" left="10" name="name_label" top="-20">
Progress
</text>
<string name="export">
Object export
</string>
<string name="import">
Object import
</string>
</floater>

View File

@@ -5938,11 +5938,25 @@ A login URI is required to retrieve the grid info.
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="ImportFailed"
type="alertmodal">
Bad XML file. Import aborted.
</notification>
<notification
icon="notifytip.tga"
name="ExportAborted"
type="notifytip">
The Object was deselected before the export could occur. Export aborted.
</notification>
<notification
icon="alertmodal.tga"
name="ExportFailed"
type="alertmodal">
None of the selected objects are exportable. Export aborted.
Bad permissions for the exported object. Export aborted.
</notification>
<notification
@@ -5959,6 +5973,23 @@ Object exported. Some textures could not be saved due to: [REASON]
Export successful.
</notification>
<notification
icon="alertmodal.tga"
name="ConfirmAbortBackup"
type="alertmodal">
Are you sure you want to abort the current object backup operation?
<form name="form">
<button
index="0"
name="Yes"
text="Yes"/>
<button
index="1"
name="No"
text="No"/>
</form>
</notification>
<notification
icon="notifytip.tga"
name="SystemMessageTip"