diff options
Diffstat (limited to 'linden/indra/newview/primbackup.h')
-rw-r--r-- | linden/indra/newview/primbackup.h | 223 |
1 files changed, 119 insertions, 104 deletions
diff --git a/linden/indra/newview/primbackup.h b/linden/indra/newview/primbackup.h index cbd757a..97dd489 100644 --- a/linden/indra/newview/primbackup.h +++ b/linden/indra/newview/primbackup.h | |||
@@ -1,134 +1,149 @@ | |||
1 | 1 | ||
2 | #include "llviewerinventory.h" | 2 | #include "llviewerinventory.h" |
3 | 3 | ||
4 | #define LL_GRID_PERMISSIONS 1 | 4 | enum export_states { |
5 | 5 | EXPORT_INIT, | |
6 | enum export_states {EXPORT_INIT,EXPORT_STRUCTURE,EXPORT_TEXTURES,EXPORT_LLSD,EXPORT_DONE}; | 6 | EXPORT_STRUCTURE, |
7 | 7 | EXPORT_TEXTURES, | |
8 | class primbackup : public LLFloater | 8 | EXPORT_LLSD, |
9 | EXPORT_DONE, | ||
10 | EXPORT_FAILED | ||
11 | }; | ||
9 | 12 | ||
13 | class PrimBackup : public LLFloater | ||
10 | { | 14 | { |
11 | public: | 15 | public: |
12 | //Export state machine | 16 | virtual ~PrimBackup(); |
13 | enum export_states export_state; | 17 | |
14 | 18 | // Floater stuff | |
15 | //Export idle callback | 19 | virtual void show(bool exporting); |
16 | static void exportworker(void *userdata); | ||
17 | |||
18 | //Static accessor | ||
19 | static primbackup* getInstance(); | ||
20 | |||
21 | static bool check_perms( LLSelectNode* node ); | ||
22 | |||
23 | virtual ~primbackup(); | ||
24 | |||
25 | //Floater stuff | ||
26 | virtual void show(); | ||
27 | virtual void draw(); | 20 | virtual void draw(); |
28 | virtual void onClose( bool app_quitting ); | 21 | virtual void onClose(bool app_quitting); |
29 | 22 | ||
30 | //Import entry point | 23 | // Static accessor |
31 | void import_object(bool upload=FALSE); | 24 | static PrimBackup* getInstance(); |
32 | |||
33 | //Export entry point | ||
34 | void pre_export_object(); | ||
35 | 25 | ||
36 | //Update map from texture worker | 26 | // Export idle callback |
37 | void update_map(LLUUID uploaded_asset); | 27 | static void exportWorker(void *userdata); |
38 | 28 | ||
39 | //Move to next texture upload | 29 | // Import entry point |
40 | void upload_next_asset(); | 30 | void importObject(bool upload=FALSE); |
41 | 31 | ||
42 | // is ready for next texture? | 32 | // Export entry point |
43 | bool m_nexttextureready; | 33 | void exportObject(); |
44 | 34 | ||
45 | //Folder public geter | 35 | // Update map from texture worker |
46 | std::string getfolder() {return folder;}; | 36 | void updateMap(LLUUID uploaded_asset); |
47 | 37 | ||
48 | //Prim updated callback | 38 | // Move to next texture upload |
49 | void prim_update(LLViewerObject* object); | 39 | void uploadNextAsset(); |
50 | 40 | ||
51 | //New prim call back | 41 | // Folder public geter |
52 | bool newprim(LLViewerObject * pobject); | 42 | std::string getfolder() { return mFolder; }; |
53 | 43 | ||
54 | private: | 44 | // Prim updated callback |
45 | void primUpdate(LLViewerObject* object); | ||
55 | 46 | ||
56 | //Static singleton stuff | 47 | // New prim call back |
57 | primbackup(); | 48 | bool newPrim(LLViewerObject* pobject); |
58 | static primbackup* sInstance; | ||
59 | 49 | ||
60 | // are we active flag | 50 | static const U32 TEXTURE_OK = 0x00; |
61 | bool running; | 51 | static const U32 TEXTURE_BAD_PERM = 0x01; |
52 | static const U32 TEXTURE_MISSING = 0x02; | ||
53 | static const U32 TEXTURE_BAD_ENCODING = 0x04; | ||
54 | static const U32 TEXTURE_IS_NULL = 0x08; | ||
55 | static const U32 TEXTURE_SAVED_FAILED = 0x10; | ||
62 | 56 | ||
63 | //file and folder name control | 57 | // Is ready for next texture? |
64 | std::string file_name; | 58 | bool mNextTextureReady; |
65 | std::string folder; | ||
66 | 59 | ||
67 | // True if we need to rebase the assets | 60 | // Export state machine |
68 | bool m_retexture; | 61 | enum export_states mExportState; |
69 | 62 | ||
70 | //Counts of import and export objects and textures and prims | 63 | // Export result flags for textures. |
71 | int m_objects,m_curobject; | 64 | U32 mNonExportedTextures; |
72 | int m_prims,m_curprim; | ||
73 | int m_textures,m_curtexture; | ||
74 | 65 | ||
75 | // No prims rezed | 66 | static bool validatePerms(const LLPermissions* item_permissions); |
76 | int rezcount; | 67 | |
68 | private: | ||
69 | // Static singleton stuff | ||
70 | PrimBackup(); | ||
71 | static PrimBackup* sInstance; | ||
77 | 72 | ||
78 | // Update the floater with status numbers | 73 | // Update the floater with status numbers |
79 | void updateimportnumbers(); | 74 | void updateImportNumbers(); |
80 | void updateexportnumbers(); | 75 | void updateExportNumbers(); |
76 | |||
77 | // Permissions stuff. | ||
78 | LLUUID validateTextureID(LLUUID asset_id); | ||
79 | |||
80 | // Convert a selection list of objects to LLSD | ||
81 | LLSD primsToLLSD(LLViewerObject::child_list_t child_list, bool is_attachment); | ||
81 | 82 | ||
82 | //Convert a selection list of objects to LLSD | ||
83 | LLSD prims_to_llsd(LLViewerObject::child_list_t child_list); | ||
84 | |||
85 | // Start the import process | 83 | // Start the import process |
86 | void import_object1a(); | 84 | void importFirstObject(); |
87 | 85 | ||
88 | //Export the next texture in list | 86 | // Move to the next import group |
89 | void export_next_texture(); | 87 | void importNextObject(); |
90 | 88 | ||
91 | //apply LLSD to object | 89 | // Export the next texture in list |
92 | void xmltoprim(LLSD prim_llsd,LLViewerObject * pobject); | 90 | void exportNextTexture(); |
93 | |||
94 | 91 | ||
95 | //rez a prim at a given position (note not agent offset X/Y screen for raycast) | 92 | // Apply LLSD to object |
96 | void rez_agent_offset(LLVector3 offset); | 93 | void xmlToPrim(LLSD prim_llsd, LLViewerObject* pobject); |
97 | |||
98 | //Move to the next import group | ||
99 | void import_next_object(); | ||
100 | |||
101 | //Get an offset from the agent based on rotation and current pos | ||
102 | LLVector3 offset_agent(LLVector3 offset); | ||
103 | 94 | ||
104 | // Rebase map | 95 | // Rez a prim at a given position (note not agent offset X/Y screen for raycast) |
105 | std::map<LLUUID,LLUUID> assetmap; | 96 | void rezAgentOffset(LLVector3 offset); |
106 | |||
107 | //Export texture list | ||
108 | std::list<LLUUID> textures; | ||
109 | |||
110 | //Import object tracking | ||
111 | std::vector<LLViewerObject *> toselect; | ||
112 | std::vector<LLViewerObject *>::iterator process_iter; | ||
113 | |||
114 | //Working LLSD holders | ||
115 | LLUUID current_asset; | ||
116 | LLSD llsd; | ||
117 | LLSD this_group; | ||
118 | LLUUID expecting_update; | ||
119 | |||
120 | //working llsd itterators for objects and linksets | ||
121 | LLSD::map_const_iterator prim_import_iter; | ||
122 | LLSD::array_const_iterator group_prim_import_iter; | ||
123 | |||
124 | // Root pos and central root pos for link set | ||
125 | LLVector3 root_pos; | ||
126 | LLVector3 root_root_pos; | ||
127 | LLVector3 group_offset; | ||
128 | |||
129 | //Agent inital pos and rot when starting import | ||
130 | LLQuaternion root_rot; | ||
131 | LLQuaternion agent_rot; | ||
132 | 97 | ||
133 | }; | 98 | // Get an offset from the agent based on rotation and current pos |
99 | LLVector3 offsetAgent(LLVector3 offset); | ||
100 | |||
101 | // Are we active flag | ||
102 | bool mRunning; | ||
103 | |||
104 | // File and folder name control | ||
105 | std::string mFileName; | ||
106 | std::string mFolder; | ||
107 | |||
108 | // True if we need to rebase the assets | ||
109 | bool mRetexture; | ||
134 | 110 | ||
111 | // Counts of import and export objects and prims | ||
112 | U32 mObjects; | ||
113 | U32 mCurObject; | ||
114 | U32 mPrims; | ||
115 | U32 mCurPrim; | ||
116 | |||
117 | // No prims rezed | ||
118 | U32 mRezCount; | ||
119 | |||
120 | // Rebase map | ||
121 | std::map<LLUUID,LLUUID> mAssetMap; | ||
122 | |||
123 | // Export texture list | ||
124 | std::list<LLUUID> mTexturesList; | ||
125 | |||
126 | // Import object tracking | ||
127 | std::vector<LLViewerObject*> mToSelect; | ||
128 | std::vector<LLViewerObject*>::iterator mProcessIter; | ||
129 | |||
130 | // Working LLSD holders | ||
131 | LLUUID mCurrentAsset; | ||
132 | LLSD mLLSD; | ||
133 | LLSD mThisGroup; | ||
134 | LLUUID mExpectingUpdate; | ||
135 | |||
136 | // Working llsd itterators for objects and linksets | ||
137 | LLSD::map_const_iterator mPrimImportIter; | ||
138 | LLSD::array_const_iterator mGroupPrimImportIter; | ||
139 | |||
140 | // Root pos and rotation and central root pos for link set | ||
141 | LLVector3 mRootPos; | ||
142 | LLQuaternion mRootRot; | ||
143 | LLVector3 mRootRootPos; | ||
144 | LLVector3 mGroupOffset; | ||
145 | |||
146 | // Agent inital pos and rot when starting import | ||
147 | LLVector3 mAgentPos; | ||
148 | LLQuaternion mAgentRot; | ||
149 | }; | ||