diff options
Diffstat (limited to 'linden/indra/newview/llselectmgr.h')
-rw-r--r-- | linden/indra/newview/llselectmgr.h | 648 |
1 files changed, 648 insertions, 0 deletions
diff --git a/linden/indra/newview/llselectmgr.h b/linden/indra/newview/llselectmgr.h new file mode 100644 index 0000000..fe54360 --- /dev/null +++ b/linden/indra/newview/llselectmgr.h | |||
@@ -0,0 +1,648 @@ | |||
1 | /** | ||
2 | * @file llselectmgr.h | ||
3 | * @brief A manager for selected objects and TEs. | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_LLSELECTMGR_H | ||
29 | #define LL_LLSELECTMGR_H | ||
30 | |||
31 | #include "llcharacter.h" | ||
32 | #include "lldarray.h" | ||
33 | #include "lleditmenuhandler.h" | ||
34 | #include "llstring.h" | ||
35 | #include "llundo.h" | ||
36 | #include "lluuid.h" | ||
37 | #include "llmemory.h" | ||
38 | #include "llsaleinfo.h" | ||
39 | #include "llcategory.h" | ||
40 | #include "v3dmath.h" | ||
41 | #include "llquaternion.h" | ||
42 | #include "llcoord.h" | ||
43 | #include "llframetimer.h" | ||
44 | #include "llbbox.h" | ||
45 | #include "llpermissions.h" | ||
46 | |||
47 | #include <deque> | ||
48 | |||
49 | class LLMessageSystem; | ||
50 | class LLViewerImage; | ||
51 | class LLViewerObject; | ||
52 | class LLColor4; | ||
53 | class LLVector3; | ||
54 | class LLSelectNode; | ||
55 | |||
56 | const S32 SELECT_ALL_TES = -1; | ||
57 | const S32 SELECT_MAX_TES = 32; | ||
58 | |||
59 | // Do something to all objects in the selection manager. | ||
60 | // The bool return value can be used to indicate if all | ||
61 | // objects are identical (gathering information) or if | ||
62 | // the operation was successful. | ||
63 | class LLSelectedObjectFunctor | ||
64 | { | ||
65 | public: | ||
66 | virtual ~LLSelectedObjectFunctor() {}; | ||
67 | virtual bool apply(LLViewerObject* object) = 0; | ||
68 | }; | ||
69 | |||
70 | // Do something to all select nodes in the selection manager. | ||
71 | // The bool return value can be used to indicate if all | ||
72 | // objects are identical (gathering information) or if | ||
73 | // the operation was successful. | ||
74 | class LLSelectedNodeFunctor | ||
75 | { | ||
76 | public: | ||
77 | virtual ~LLSelectedNodeFunctor() {}; | ||
78 | virtual bool apply(LLSelectNode* node) = 0; | ||
79 | }; | ||
80 | |||
81 | typedef enum e_send_type | ||
82 | { | ||
83 | SEND_ONLY_ROOTS, | ||
84 | SEND_INDIVIDUALS, | ||
85 | SEND_ROOTS_FIRST, // useful for serial undos on linked sets | ||
86 | SEND_CHILDREN_FIRST // useful for serial transforms of linked sets | ||
87 | } ESendType; | ||
88 | |||
89 | typedef enum e_grid_mode | ||
90 | { | ||
91 | GRID_MODE_WORLD, | ||
92 | GRID_MODE_LOCAL, | ||
93 | GRID_MODE_REF_OBJECT | ||
94 | } EGridMode; | ||
95 | |||
96 | typedef enum e_action_type | ||
97 | { | ||
98 | SELECT_ACTION_TYPE_BEGIN, | ||
99 | SELECT_ACTION_TYPE_PICK, | ||
100 | SELECT_ACTION_TYPE_MOVE, | ||
101 | SELECT_ACTION_TYPE_ROTATE, | ||
102 | SELECT_ACTION_TYPE_SCALE, | ||
103 | NUM_ACTION_TYPES | ||
104 | }EActionType; | ||
105 | |||
106 | typedef enum e_selection_type | ||
107 | { | ||
108 | SELECT_TYPE_WORLD, | ||
109 | SELECT_TYPE_ATTACHMENT, | ||
110 | SELECT_TYPE_HUD | ||
111 | }ESelectType; | ||
112 | |||
113 | class LLSelectNodeList : public std::list<LLSelectNode*> | ||
114 | { | ||
115 | public: | ||
116 | LLSelectNodeList(); | ||
117 | virtual ~LLSelectNodeList(); | ||
118 | |||
119 | void updateEffects(); | ||
120 | |||
121 | BOOL isEmpty(); | ||
122 | |||
123 | S32 getOwnershipCost(S32 &cost); | ||
124 | |||
125 | LLSelectNode* getFirstNode(); | ||
126 | LLSelectNode* getCurrentNode(); // Warning! This is NOT the same as the linked_list getCurrentNode | ||
127 | LLSelectNode* getNextNode(); | ||
128 | |||
129 | LLSelectNode *getFirstRootNode(); | ||
130 | LLSelectNode *getNextRootNode(); | ||
131 | |||
132 | // iterate through objects | ||
133 | LLViewerObject* getFirstObject(); | ||
134 | LLViewerObject* getNextObject(); | ||
135 | |||
136 | // iterate through root objects | ||
137 | LLViewerObject *getFirstRootObject(); | ||
138 | LLViewerObject *getNextRootObject(); | ||
139 | |||
140 | // iterate through texture entries | ||
141 | void getPrimaryTE(LLViewerObject* *object, S32 *te); | ||
142 | void getFirstTE(LLViewerObject* *object, S32 *te); | ||
143 | void getNextTE(LLViewerObject* *object, S32 *te); | ||
144 | void getCurrentTE(LLViewerObject* *object, S32 *te); | ||
145 | |||
146 | void addNode(LLSelectNode *nodep); | ||
147 | void addNodeAtEnd(LLSelectNode *nodep); | ||
148 | void removeNode(LLSelectNode *nodep); | ||
149 | void deleteAllNodes(); // Delete all nodes | ||
150 | S32 getNumNodes(); | ||
151 | LLSelectNode* findNode(LLViewerObject* objectp); | ||
152 | private: | ||
153 | const LLSelectNodeList &operator=(const LLSelectNodeList &); | ||
154 | |||
155 | std::list<LLSelectNode*>::iterator mCurrentNode; | ||
156 | S32 mCurrentTE; | ||
157 | std::map<LLViewerObject*, LLSelectNode*> mSelectNodeMap; | ||
158 | }; | ||
159 | |||
160 | struct LLSelectAction | ||
161 | { | ||
162 | public: | ||
163 | EActionType mActionType; | ||
164 | LLVector3 mPosition; | ||
165 | LLVector3 mScale; | ||
166 | LLQuaternion mRotation; | ||
167 | LLUUID mObjectID; | ||
168 | BOOL mIndividualSelection; | ||
169 | }; | ||
170 | |||
171 | class LLSelectMgr : public LLEditMenuHandler | ||
172 | { | ||
173 | public: | ||
174 | static BOOL sRectSelectInclusive; // do we need to surround an object to pick it? | ||
175 | static BOOL sRenderHiddenSelections; // do we show selection silhouettes that are occluded? | ||
176 | static BOOL sRenderLightRadius; // do we show the radius of selected lights? | ||
177 | static F32 sHighlightThickness; | ||
178 | static F32 sHighlightUScale; | ||
179 | static F32 sHighlightVScale; | ||
180 | static F32 sHighlightAlpha; | ||
181 | static F32 sHighlightAlphaTest; | ||
182 | static F32 sHighlightUAnim; | ||
183 | static F32 sHighlightVAnim; | ||
184 | static LLColor4 sSilhouetteParentColor; | ||
185 | static LLColor4 sSilhouetteChildColor; | ||
186 | static LLColor4 sHighlightParentColor; | ||
187 | static LLColor4 sHighlightChildColor; | ||
188 | static LLColor4 sHighlightInspectColor; | ||
189 | static LLColor4 sContextSilhouetteColor; | ||
190 | public: | ||
191 | LLSelectMgr(); | ||
192 | ~LLSelectMgr(); | ||
193 | |||
194 | // LLEditMenuHandler interface | ||
195 | virtual BOOL canUndo(); | ||
196 | virtual void undo(); | ||
197 | |||
198 | virtual BOOL canRedo(); | ||
199 | virtual void redo(); | ||
200 | |||
201 | virtual BOOL canDoDelete(); | ||
202 | virtual void doDelete(); | ||
203 | |||
204 | virtual void deselect(); | ||
205 | virtual BOOL canDeselect(); | ||
206 | |||
207 | virtual void duplicate(); | ||
208 | virtual BOOL canDuplicate(); | ||
209 | |||
210 | // Apply functors to various subsets of the selected objects | ||
211 | // Returns the AND of all apply() calls. | ||
212 | bool applyToRootObjects(LLSelectedObjectFunctor* func); | ||
213 | bool applyToObjects(LLSelectedObjectFunctor* func); | ||
214 | bool applyToNodes(LLSelectedNodeFunctor* func); | ||
215 | |||
216 | void updateEffects(); // Update HUD effects | ||
217 | |||
218 | void setForceSelection(BOOL force) { mForceSelection = force; } | ||
219 | |||
220 | // For when you want just a child object. | ||
221 | void selectObjectOnly(LLViewerObject* object, S32 face = SELECT_ALL_TES); | ||
222 | |||
223 | // This method is meant to select an object, and then select all | ||
224 | // of the ancestors and descendents. This should be the normal behavior. | ||
225 | void selectObjectAndFamily(LLViewerObject* object, BOOL add_to_end = FALSE); | ||
226 | |||
227 | // Same as above, but takes a list of objects. Used by rectangle select. | ||
228 | void selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& object_list, BOOL send_to_sim = TRUE); | ||
229 | |||
230 | void deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim = TRUE); | ||
231 | |||
232 | void deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_sim = TRUE); | ||
233 | |||
234 | void deselectTransient(); // deselect "temporarily" selected objects (via pie menu) | ||
235 | void convertTransient(); // converts temporarily selected objects to full-fledged selections | ||
236 | |||
237 | // Send deselect messages to simulator, then clear the list | ||
238 | void deselectAll(); | ||
239 | |||
240 | // Deselect if the selection center is too far away from the agent. | ||
241 | void deselectAllIfTooFar(); | ||
242 | |||
243 | BOOL selectionRemoveObject(const LLUUID &id); | ||
244 | |||
245 | BOOL contains(LLViewerObject* object); | ||
246 | BOOL contains(LLViewerObject* object, S32 te); | ||
247 | |||
248 | ESelectType getSelectType() { return mSelectType; } | ||
249 | |||
250 | // count members | ||
251 | S32 getObjectCount(); | ||
252 | S32 getTECount(); | ||
253 | S32 getRootObjectCount(); | ||
254 | |||
255 | BOOL isEmpty() { return !mSelectedObjects.getNumNodes(); } | ||
256 | |||
257 | BOOL shouldShowSelection() { return mShowSelection; } | ||
258 | |||
259 | LLSelectNodeList &getHoverObjects() { return mHoverObjects; } | ||
260 | LLSelectNodeList &getSelectedObjects() { return mSelectedObjects; } | ||
261 | |||
262 | // iterate through objects | ||
263 | LLViewerObject* getFirstObject() { return mSelectedObjects.getFirstObject(); } | ||
264 | LLViewerObject* getNextObject() { return mSelectedObjects.getNextObject(); } | ||
265 | |||
266 | // iterate through root objects | ||
267 | LLViewerObject *getFirstRootObject() { return mSelectedObjects.getFirstRootObject(); } | ||
268 | LLViewerObject *getNextRootObject() { return mSelectedObjects.getNextRootObject(); } | ||
269 | |||
270 | LLViewerObject* getFirstHighlightedObject() { return mHighlightedObjects.getFirstObject(); } | ||
271 | LLViewerObject* getNextHighlightedObject() { return mHighlightedObjects.getNextObject(); } | ||
272 | |||
273 | // iterate through tes | ||
274 | void getPrimaryTE(LLViewerObject* *object, S32 *te) { mSelectedObjects.getPrimaryTE(object, te); } | ||
275 | void getFirstTE(LLViewerObject* *object, S32 *te) { mSelectedObjects.getFirstTE(object, te); } | ||
276 | void getNextTE(LLViewerObject* *object, S32 *te) { mSelectedObjects.getNextTE(object, te); }; | ||
277 | |||
278 | void setHoverObject(LLViewerObject *objectp); | ||
279 | |||
280 | void addGridObject(LLViewerObject* objectp); | ||
281 | void clearGridObjects(); | ||
282 | void setGridMode(EGridMode mode); | ||
283 | EGridMode getGridMode() { return mGridMode; } | ||
284 | void getGrid(LLVector3& origin, LLQuaternion& rotation, LLVector3 &scale); | ||
285 | |||
286 | void highlightObjectOnly(LLViewerObject *objectp); | ||
287 | void highlightObjectAndFamily(LLViewerObject *objectp); | ||
288 | void highlightObjectAndFamily(const LLDynamicArray<LLViewerObject*>& list); | ||
289 | void unhighlightObjectOnly(LLViewerObject *objectp); | ||
290 | void unhighlightObjectAndFamily(LLViewerObject *objectp); | ||
291 | void unhighlightAll(); | ||
292 | void selectHighlightedObjects(); | ||
293 | void deselectHighlightedObjects(); | ||
294 | |||
295 | LLSelectNode *findSelectNode(LLViewerObject *objectp); | ||
296 | LLSelectNode *getFirstRootNode() { return mSelectedObjects.getFirstRootNode(); } | ||
297 | LLSelectNode *getNextRootNode() { return mSelectedObjects.getNextRootNode(); } | ||
298 | LLSelectNode* getFirstNode() { return mSelectedObjects.getFirstNode(); } | ||
299 | LLSelectNode* getNextNode() { return mSelectedObjects.getNextNode(); } | ||
300 | |||
301 | LLSelectNode *getHoverNode(); | ||
302 | |||
303 | BOOL getTEMode() { return mTEMode; } | ||
304 | void setTEMode(BOOL b) { mTEMode = b; } | ||
305 | |||
306 | LLViewerObject* getFirstCopyableObject(BOOL get_root = FALSE); | ||
307 | LLViewerObject* getFirstEditableObject(BOOL get_root = FALSE); | ||
308 | LLViewerObject* getFirstMoveableObject(BOOL get_root = FALSE); | ||
309 | LLViewerObject* getFirstDeleteableObject(BOOL get_root = FALSE); | ||
310 | |||
311 | LLSelectNode* getFirstEditableNode(BOOL get_root = FALSE); | ||
312 | LLSelectNode* getFirstMoveableNode(BOOL get_root = FALSE); | ||
313 | |||
314 | LLBBox getBBoxOfSelection() const; | ||
315 | LLBBox getSavedBBoxOfSelection() const { return mSavedSelectionBBox; } | ||
316 | |||
317 | BOOL areMultpleEditableObjectsSelected(); | ||
318 | |||
319 | void dump(); | ||
320 | void cleanup(); | ||
321 | |||
322 | void updateSilhouettes(); | ||
323 | void renderSilhouettes(BOOL for_hud); | ||
324 | void enableSilhouette(BOOL enable) { mRenderSilhouettes = enable; } | ||
325 | |||
326 | // Utility functions to operate on the list | ||
327 | |||
328 | void saveSelectedObjectTransform(EActionType action_type); | ||
329 | void saveSelectedObjectColors(); | ||
330 | void saveSelectedObjectTextures(); | ||
331 | |||
332 | void selectionUpdatePhysics(BOOL use_physics); | ||
333 | void selectionUpdateTemporary(BOOL is_temporary); | ||
334 | void selectionUpdatePhantom(BOOL is_ghost); | ||
335 | void selectionUpdateCastShadows(BOOL cast_shadows); | ||
336 | void selectionDump(); | ||
337 | |||
338 | BOOL selectionAllPCode(LLPCode code); // all objects have this PCode | ||
339 | BOOL selectionGetMaterial(U8 *material); // all objects have same material | ||
340 | BOOL selectionGetTexUUID(LLUUID& id); // true if all selected tes have same texture | ||
341 | BOOL selectionGetColor(LLColor4 &color); // all tes have same color | ||
342 | BOOL selectionGetTexScale(F32 *u, F32 *v); // true if all selected tes have same scale | ||
343 | BOOL selectionGetTexOffset(F32 *u, F32 *v); // true if all selected tes have same offset | ||
344 | BOOL selectionGetTexRotation(F32 *rad); // true if all selected tes have same rotation | ||
345 | BOOL selectionGetBumpmap(U8 *bumpmap); // true if all selected tes have same | ||
346 | BOOL selectionGetShiny(U8 *shiny); // true if all selected tes have same | ||
347 | BOOL selectionGetFullbright(U8 *fullbright);// true if all selected tes have same | ||
348 | bool selectionGetMediaType(U8 *media_type); // true if all selected tes have same | ||
349 | BOOL selectionGetClickAction(U8* action); | ||
350 | |||
351 | void selectionSetMaterial(U8 material); | ||
352 | void selectionSetImage(const LLUUID& imageid); // could be item or asset id | ||
353 | void selectionSetColor(const LLColor4 &color); | ||
354 | void selectionSetColorOnly(const LLColor4 &color); // Set only the RGB channels | ||
355 | void selectionSetAlphaOnly(const F32 alpha); // Set only the alpha channel | ||
356 | void selectionRevertColors(); | ||
357 | BOOL selectionRevertTextures(); | ||
358 | void selectionSetBumpmap( U8 bumpmap ); | ||
359 | void selectionSetTexGen( U8 texgen ); | ||
360 | void selectionSetShiny( U8 shiny ); | ||
361 | void selectionSetFullbright( U8 fullbright ); | ||
362 | void selectionSetMediaTypeAndURL( U8 media_type, const std::string& media_url ); | ||
363 | void selectionSetClickAction(U8 action); | ||
364 | |||
365 | void setObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE); | ||
366 | void setObjectName(const LLString& name); | ||
367 | void setObjectDescription(const LLString& desc); | ||
368 | void setObjectCategory(const LLCategory& category); | ||
369 | void setObjectSaleInfo(const LLSaleInfo& sale_info); | ||
370 | |||
371 | void selectionTexScaleAutofit(F32 repeats_per_meter); | ||
372 | void selectionResetTexInfo(S32 te); // sets S,T to 1 | ||
373 | void adjustTexturesByScale(BOOL send_to_sim, BOOL stretch); | ||
374 | BOOL getTESTAxes(const LLViewerObject* object, const U8 te, U32* s_axis, U32* t_axis); // Only for flex boxes | ||
375 | |||
376 | void selectionResetRotation(); // sets rotation quat to identity | ||
377 | void selectionRotateAroundZ(F32 degrees); | ||
378 | void sendGodlikeRequest(const LLString& request, const LLString& parameter); | ||
379 | |||
380 | |||
381 | // will make sure all selected object meet current criteria, or deselect them otherwise | ||
382 | void validateSelection(); | ||
383 | |||
384 | // returns TRUE if it is possible to select this object | ||
385 | BOOL canSelectObject(LLViewerObject* object); | ||
386 | |||
387 | // Returns true if the viewer has information on all selected objects | ||
388 | BOOL selectGetAllRootsValid(); | ||
389 | BOOL selectGetAllValid(); | ||
390 | |||
391 | // returns TRUE if you can modify all selected objects. | ||
392 | BOOL selectGetRootsModify(); | ||
393 | BOOL selectGetModify(); | ||
394 | |||
395 | // returns TRUE if selected objects can be transferred. | ||
396 | BOOL selectGetRootsTransfer(); | ||
397 | |||
398 | // returns TRUE if selected objects can be copied. | ||
399 | BOOL selectGetRootsCopy(); | ||
400 | |||
401 | BOOL selectGetCreator(LLUUID& id, LLString& name); // true if all have same creator, returns id | ||
402 | BOOL selectGetOwner(LLUUID& id, LLString& name); // true if all objects have same owner, returns id | ||
403 | BOOL selectGetLastOwner(LLUUID& id, LLString& name); // true if all objects have same owner, returns id | ||
404 | |||
405 | // returns TRUE if all are the same. id is stuffed with | ||
406 | // the value found if available. | ||
407 | BOOL selectGetGroup(LLUUID& id); | ||
408 | BOOL selectGetPerm( U8 which_perm, U32* mask_on, U32* mask_off); // true if all have data, returns two masks, each indicating which bits are all on and all off | ||
409 | BOOL selectGetOwnershipCost(S32* cost); // sum of all ownership costs | ||
410 | |||
411 | BOOL selectIsGroupOwned(); // true if all root objects have valid data and are group owned. | ||
412 | |||
413 | // returns TRUE if all the nodes are valid. Accumulates | ||
414 | // permissions in the parameter. | ||
415 | BOOL selectGetPermissions(LLPermissions& perm); | ||
416 | |||
417 | // returns TRUE if anything is for sale. calculates the total | ||
418 | // price and stores that value in price. | ||
419 | BOOL selectIsForSale(S32& price); | ||
420 | |||
421 | // returns TRUE if all nodes are valid. | ||
422 | BOOL selectGetCategory(LLCategory& category); | ||
423 | |||
424 | // returns TRUE if all nodes are valid. method also stores an | ||
425 | // accumulated sale info. | ||
426 | BOOL selectGetSaleInfo(LLSaleInfo& sale_info); | ||
427 | |||
428 | // returns TRUE if all nodes are valid. fills passed in object | ||
429 | // with the aggregate permissions of the selection. | ||
430 | BOOL selectGetAggregatePermissions(LLAggregatePermissions& ag_perm); | ||
431 | |||
432 | // returns TRUE if all nodes are valid. fills passed in object | ||
433 | // with the aggregate permissions for texture inventory items of the selection. | ||
434 | BOOL selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm); | ||
435 | |||
436 | // returns TRUE is any node is currenly worn as an attachment | ||
437 | BOOL selectionIsAttachment(); | ||
438 | |||
439 | LLPermissions* findObjectPermissions(const LLViewerObject* object); | ||
440 | |||
441 | void selectDelete(); // Delete on simulator | ||
442 | void selectForceDelete(); // just delete, no into trash | ||
443 | void selectDuplicate(const LLVector3& offset, BOOL select_copy); // Duplicate on simulator | ||
444 | void repeatDuplicate(); | ||
445 | void selectDuplicateOnRay(const LLVector3 &ray_start_region, | ||
446 | const LLVector3 &ray_end_region, | ||
447 | BOOL bypass_raycast, | ||
448 | BOOL ray_end_is_intersection, | ||
449 | const LLUUID &ray_target_id, | ||
450 | BOOL copy_centers, | ||
451 | BOOL copy_rotates, | ||
452 | BOOL select_copy); | ||
453 | |||
454 | void sendMultipleUpdate(U32 type); // Position, rotation, scale all in one | ||
455 | void sendOwner(const LLUUID& owner_id, const LLUUID& group_id, BOOL override = FALSE); | ||
456 | void sendGroup(const LLUUID& group_id); | ||
457 | |||
458 | // Category ID is the UUID of the folder you want to contain the purchase. | ||
459 | // *NOTE: sale_info check doesn't work for multiple object buy, | ||
460 | // which UI does not currently support sale info is used for | ||
461 | // verification only, if it doesn't match region info then sale is | ||
462 | // canceled | ||
463 | void sendBuy(const LLUUID& buyer_id, const LLUUID& category_id, const LLSaleInfo sale_info); | ||
464 | void sendAttach(U8 attachment_point); | ||
465 | void sendDetach(); | ||
466 | void sendDropAttachment(); | ||
467 | void sendLink(); | ||
468 | void sendDelink(); | ||
469 | void sendHinge(U8 type); | ||
470 | void sendDehinge(); | ||
471 | void sendSelect(); | ||
472 | |||
473 | void requestObjectPropertiesFamily(LLViewerObject* object); // asks sim for creator, permissions, resources, etc. | ||
474 | static void processObjectProperties(LLMessageSystem *mesgsys, void **user_data); | ||
475 | static void processObjectPropertiesFamily(LLMessageSystem *mesgsys, void **user_data); | ||
476 | static void processForceObjectSelect(LLMessageSystem* msg, void**); | ||
477 | |||
478 | void requestGodInfo(); | ||
479 | |||
480 | LLVector3d getSelectionCenterGlobal() const { return mSelectionCenterGlobal; } | ||
481 | void updateSelectionCenter(); | ||
482 | void updatePointAt(); | ||
483 | |||
484 | // Internal list maintenance functions. TODO: Make these private! | ||
485 | void remove(LLDynamicArray<LLViewerObject*>& objects); | ||
486 | void remove(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE); | ||
487 | void removeAll(); | ||
488 | void addAsIndividual(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE); | ||
489 | void promoteSelectionToRoot(); | ||
490 | void demoteSelectionToIndividuals(); | ||
491 | |||
492 | private: | ||
493 | |||
494 | ESelectType getSelectTypeForObject(LLViewerObject* object); | ||
495 | void addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add_to_end = FALSE); | ||
496 | void generateSilhouette(LLSelectNode *nodep, const LLVector3& view_point); | ||
497 | void getSilhouetteExtents(LLSelectNode* nodep, const LLQuaternion& orientation, LLVector3& min_extents, LLVector3& max_extents); | ||
498 | // Send one message to each region containing an object on selection list. | ||
499 | void sendListToRegions( const LLString& message_name, | ||
500 | void (*pack_header)(void *user_data), | ||
501 | void (*pack_body)(LLSelectNode* node, void *user_data), | ||
502 | void *user_data, | ||
503 | ESendType send_type); | ||
504 | U32 undoRedo(std::deque<LLSelectAction*> &queue_src, std::deque<LLSelectAction*> &queue_dst, const LLUUID &object_id); | ||
505 | |||
506 | static void packAgentID( void *); | ||
507 | static void packAgentAndSessionID(void* user_data); | ||
508 | static void packAgentAndGroupID(void* user_data); | ||
509 | static void packAgentAndSessionAndGroupID(void* user_data); | ||
510 | static void packAgentIDAndSessionAndAttachment(void*); | ||
511 | static void packAgentGroupAndCatID(void*); | ||
512 | static void packDeleteHeader(void* userdata); | ||
513 | static void packDeRezHeader(void* user_data); | ||
514 | static void packObjectID( LLSelectNode* node, void *); | ||
515 | static void packObjectIDAsParam(LLSelectNode* node, void *); | ||
516 | static void packObjectIDAndRotation( LLSelectNode* node, void *); | ||
517 | static void packObjectLocalID(LLSelectNode* node, void *); | ||
518 | static void packObjectClickAction(LLSelectNode* node, void* data); | ||
519 | static void packObjectName(LLSelectNode* node, void* user_data); | ||
520 | static void packObjectDescription(LLSelectNode* node, void* user_data); | ||
521 | static void packObjectCategory(LLSelectNode* node, void* user_data); | ||
522 | static void packObjectSaleInfo(LLSelectNode* node, void* user_data); | ||
523 | static void packBuyObjectIDs(LLSelectNode* node, void* user_data); | ||
524 | static void packDuplicate( LLSelectNode* node, void *duplicate_data); | ||
525 | static void packDuplicateHeader(void*); | ||
526 | static void packDuplicateOnRayHead(void *user_data); | ||
527 | static void packPermissions(LLSelectNode* node, void *user_data); | ||
528 | static void packDeselect( LLSelectNode* node, void *user_data); | ||
529 | static void packMultipleUpdate(LLSelectNode* node, void *user_data); | ||
530 | static void packPhysics(LLSelectNode* node, void *user_data); | ||
531 | static void packShape(LLSelectNode* node, void *user_data); | ||
532 | static void packOwnerHead(void *user_data); | ||
533 | static void packHingeHead(void *user_data); | ||
534 | static void packPermissionsHead(void* user_data); | ||
535 | static void packGodlikeHead(void* user_data); | ||
536 | static void confirmDelete(S32 option, void* data); | ||
537 | |||
538 | private: | ||
539 | LLPointer<LLViewerImage> mSilhouetteImagep; | ||
540 | |||
541 | LLSelectNodeList mSelectedObjects; | ||
542 | |||
543 | LLSelectNodeList mHoverObjects; | ||
544 | |||
545 | std::set<LLPointer<LLViewerObject> > mRectSelectedObjects; | ||
546 | |||
547 | LLSelectNodeList mGridObjects; | ||
548 | LLQuaternion mGridRotation; | ||
549 | LLVector3 mGridOrigin; | ||
550 | LLVector3 mGridScale; | ||
551 | EGridMode mGridMode; | ||
552 | BOOL mGridValid; | ||
553 | |||
554 | LLSelectNodeList mHighlightedObjects; | ||
555 | |||
556 | BOOL mTEMode; // render te | ||
557 | LLVector3d mSelectionCenterGlobal; | ||
558 | LLBBox mSelectionBBox; | ||
559 | |||
560 | LLVector3d mLastSentSelectionCenterGlobal; | ||
561 | BOOL mShowSelection; // do we send the selection center name value and do we animate this selection? | ||
562 | LLVector3d mLastCameraPos; // camera position from last generation of selection silhouette | ||
563 | BOOL mRenderSilhouettes; // do we render the silhouette | ||
564 | LLBBox mSavedSelectionBBox; | ||
565 | |||
566 | ESelectType mSelectType; | ||
567 | |||
568 | LLFrameTimer mEffectsTimer; | ||
569 | BOOL mForceSelection; | ||
570 | |||
571 | std::deque<LLSelectAction*> mUndoQueue; | ||
572 | std::deque<LLSelectAction*> mRedoQueue; | ||
573 | |||
574 | LLAnimPauseRequest mPauseRequest; | ||
575 | }; | ||
576 | |||
577 | |||
578 | // Contains information about a selected object, particularly which | ||
579 | // tes are selected. | ||
580 | class LLSelectNode | ||
581 | { | ||
582 | public: | ||
583 | LLSelectNode(LLViewerObject* object, BOOL do_glow); | ||
584 | LLSelectNode(const LLSelectNode& nodep); | ||
585 | ~LLSelectNode(); | ||
586 | |||
587 | void selectAllTEs(BOOL b); | ||
588 | void selectTE(S32 te_index, BOOL selected); | ||
589 | BOOL isTESelected(S32 te_index); | ||
590 | S32 getLastSelectedTE(); | ||
591 | void renderOneSilhouette(const LLColor4 &color); | ||
592 | void setTransient(BOOL transient) { mTransient = transient; } | ||
593 | BOOL isTransient() { return mTransient; } | ||
594 | LLViewerObject *getObject(); | ||
595 | // *NOTE: invalidate stored textures and colors when # faces change | ||
596 | void saveColors(); | ||
597 | void saveTextures(const std::vector<LLUUID>& textures); | ||
598 | void saveTextureScaleRatios(); | ||
599 | |||
600 | BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const; | ||
601 | |||
602 | public: | ||
603 | BOOL mIndividualSelection; // For root objects and objects individually selected | ||
604 | |||
605 | BOOL mTransient; | ||
606 | BOOL mValid; // is extra information valid? | ||
607 | LLPermissions* mPermissions; | ||
608 | LLSaleInfo mSaleInfo; | ||
609 | LLAggregatePermissions mAggregatePerm; | ||
610 | LLAggregatePermissions mAggregateTexturePerm; | ||
611 | LLAggregatePermissions mAggregateTexturePermOwner; | ||
612 | LLString mName; | ||
613 | LLString mDescription; | ||
614 | LLCategory mCategory; | ||
615 | S16 mInventorySerial; | ||
616 | LLVector3 mSavedPositionLocal; // for interactively modifying object position | ||
617 | LLVector3d mSavedPositionGlobal; // for interactively modifying object position | ||
618 | LLVector3 mSavedScale; // for interactively modifying object scale | ||
619 | LLQuaternion mSavedRotation; // for interactively modifying object rotation | ||
620 | BOOL mDuplicated; | ||
621 | LLVector3d mDuplicatePos; | ||
622 | LLQuaternion mDuplicateRot; | ||
623 | LLUUID mItemID; | ||
624 | LLUUID mFolderID; | ||
625 | LLUUID mFromTaskID; | ||
626 | LLString mTouchName; | ||
627 | LLString mSitName; | ||
628 | U64 mCreationDate; | ||
629 | std::vector<LLColor4> mSavedColors; | ||
630 | std::vector<LLUUID> mSavedTextures; | ||
631 | std::vector<LLVector3> mTextureScaleRatios; | ||
632 | std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object | ||
633 | std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object | ||
634 | std::vector<S32> mSilhouetteSegments; // array of normals to render silhouette of object | ||
635 | BOOL mSilhouetteExists; // need to generate silhouette? | ||
636 | |||
637 | protected: | ||
638 | LLPointer<LLViewerObject> mObject; | ||
639 | BOOL mTESelected[SELECT_MAX_TES]; | ||
640 | S32 mLastTESelected; | ||
641 | }; | ||
642 | |||
643 | extern LLSelectMgr* gSelectMgr; | ||
644 | |||
645 | // Utilities | ||
646 | void dialog_refresh_all(); // Update subscribers to the selection list | ||
647 | |||
648 | #endif | ||