aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llselectmgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llselectmgr.h')
-rw-r--r--linden/indra/newview/llselectmgr.h261
1 files changed, 126 insertions, 135 deletions
diff --git a/linden/indra/newview/llselectmgr.h b/linden/indra/newview/llselectmgr.h
index fe54360..4b9a550 100644
--- a/linden/indra/newview/llselectmgr.h
+++ b/linden/indra/newview/llselectmgr.h
@@ -110,11 +110,12 @@ typedef enum e_selection_type
110 SELECT_TYPE_HUD 110 SELECT_TYPE_HUD
111}ESelectType; 111}ESelectType;
112 112
113class LLSelectNodeList : public std::list<LLSelectNode*> 113class LLObjectSelection : public std::list<LLSelectNode*>, public LLRefCount
114{ 114{
115 friend class LLSelectMgr;
115public: 116public:
116 LLSelectNodeList(); 117 LLObjectSelection();
117 virtual ~LLSelectNodeList(); 118 virtual ~LLObjectSelection();
118 119
119 void updateEffects(); 120 void updateEffects();
120 121
@@ -129,6 +130,8 @@ public:
129 LLSelectNode *getFirstRootNode(); 130 LLSelectNode *getFirstRootNode();
130 LLSelectNode *getNextRootNode(); 131 LLSelectNode *getNextRootNode();
131 132
133 LLSelectNode* getFirstMoveableNode(BOOL get_root = FALSE);
134
132 // iterate through objects 135 // iterate through objects
133 LLViewerObject* getFirstObject(); 136 LLViewerObject* getFirstObject();
134 LLViewerObject* getNextObject(); 137 LLViewerObject* getNextObject();
@@ -137,6 +140,12 @@ public:
137 LLViewerObject *getFirstRootObject(); 140 LLViewerObject *getFirstRootObject();
138 LLViewerObject *getNextRootObject(); 141 LLViewerObject *getNextRootObject();
139 142
143 LLViewerObject* getFirstEditableObject(BOOL get_root = FALSE);
144 LLViewerObject* getFirstCopyableObject(BOOL get_root = FALSE);
145 LLViewerObject* getFirstDeleteableObject(BOOL get_root = FALSE);
146 LLViewerObject* getFirstMoveableObject(BOOL get_root = FALSE);
147 LLViewerObject* getPrimaryObject() { return mPrimaryObject; }
148
140 // iterate through texture entries 149 // iterate through texture entries
141 void getPrimaryTE(LLViewerObject* *object, S32 *te); 150 void getPrimaryTE(LLViewerObject* *object, S32 *te);
142 void getFirstTE(LLViewerObject* *object, S32 *te); 151 void getFirstTE(LLViewerObject* *object, S32 *te);
@@ -149,24 +158,37 @@ public:
149 void deleteAllNodes(); // Delete all nodes 158 void deleteAllNodes(); // Delete all nodes
150 S32 getNumNodes(); 159 S32 getNumNodes();
151 LLSelectNode* findNode(LLViewerObject* objectp); 160 LLSelectNode* findNode(LLViewerObject* objectp);
161
162 // count members
163 S32 getObjectCount();
164 S32 getTECount();
165 S32 getRootObjectCount();
166
167 BOOL contains(LLViewerObject* object);
168 BOOL contains(LLViewerObject* object, S32 te);
169
170 // returns TRUE is any node is currenly worn as an attachment
171 BOOL isAttachment();
172
173 // Apply functors to various subsets of the selected objects
174 // Returns the AND of all apply() calls.
175 bool applyToRootObjects(LLSelectedObjectFunctor* func);
176 bool applyToObjects(LLSelectedObjectFunctor* func);
177 bool applyToNodes(LLSelectedNodeFunctor* func);
178
179 ESelectType getSelectType() { return mSelectType; }
180
152private: 181private:
153 const LLSelectNodeList &operator=(const LLSelectNodeList &); 182 const LLObjectSelection &operator=(const LLObjectSelection &);
154 183
155 std::list<LLSelectNode*>::iterator mCurrentNode; 184 LLPointer<LLViewerObject> mPrimaryObject;
156 S32 mCurrentTE; 185 std::list<LLSelectNode*>::iterator mCurrentNode;
157 std::map<LLViewerObject*, LLSelectNode*> mSelectNodeMap; 186 S32 mCurrentTE;
187 std::map<LLViewerObject*, LLSelectNode*> mSelectNodeMap;
188 ESelectType mSelectType;
158}; 189};
159 190
160struct LLSelectAction 191typedef LLHandle<LLObjectSelection> LLObjectSelectionHandle;
161{
162public:
163 EActionType mActionType;
164 LLVector3 mPosition;
165 LLVector3 mScale;
166 LLQuaternion mRotation;
167 LLUUID mObjectID;
168 BOOL mIndividualSelection;
169};
170 192
171class LLSelectMgr : public LLEditMenuHandler 193class LLSelectMgr : public LLEditMenuHandler
172{ 194{
@@ -187,6 +209,7 @@ public:
187 static LLColor4 sHighlightChildColor; 209 static LLColor4 sHighlightChildColor;
188 static LLColor4 sHighlightInspectColor; 210 static LLColor4 sHighlightInspectColor;
189 static LLColor4 sContextSilhouetteColor; 211 static LLColor4 sContextSilhouetteColor;
212
190public: 213public:
191 LLSelectMgr(); 214 LLSelectMgr();
192 ~LLSelectMgr(); 215 ~LLSelectMgr();
@@ -207,115 +230,91 @@ public:
207 virtual void duplicate(); 230 virtual void duplicate();
208 virtual BOOL canDuplicate(); 231 virtual BOOL canDuplicate();
209 232
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 233 void updateEffects(); // Update HUD effects
234 void overrideObjectUpdates();
217 235
218 void setForceSelection(BOOL force) { mForceSelection = force; } 236 void setForceSelection(BOOL force) { mForceSelection = force; }
219 237
238 ////////////////////////////////////////////////////////////////
239 // Selection methods
240 ////////////////////////////////////////////////////////////////
241
242 ////////////////////////////////////////////////////////////////
243 // Add
244 ////////////////////////////////////////////////////////////////
245
220 // For when you want just a child object. 246 // For when you want just a child object.
221 void selectObjectOnly(LLViewerObject* object, S32 face = SELECT_ALL_TES); 247 LLObjectSelectionHandle selectObjectOnly(LLViewerObject* object, S32 face = SELECT_ALL_TES);
222 248
223 // This method is meant to select an object, and then select all 249 // This method is meant to select an object, and then select all
224 // of the ancestors and descendents. This should be the normal behavior. 250 // of the ancestors and descendents. This should be the normal behavior.
225 void selectObjectAndFamily(LLViewerObject* object, BOOL add_to_end = FALSE); 251 LLObjectSelectionHandle selectObjectAndFamily(LLViewerObject* object, BOOL add_to_end = FALSE);
226 252
227 // Same as above, but takes a list of objects. Used by rectangle select. 253 // 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); 254 LLObjectSelectionHandle selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& object_list, BOOL send_to_sim = TRUE);
229 255
230 void deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim = TRUE); 256 // converts all objects currently highlighted to a selection, and returns it
257 LLObjectSelectionHandle selectHighlightedObjects();
231 258
232 void deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_sim = TRUE); 259 LLObjectSelectionHandle setHoverObject(LLViewerObject *objectp);
233 260
234 void deselectTransient(); // deselect "temporarily" selected objects (via pie menu) 261 void highlightObjectOnly(LLViewerObject *objectp);
235 void convertTransient(); // converts temporarily selected objects to full-fledged selections 262 void highlightObjectAndFamily(LLViewerObject *objectp);
263 void highlightObjectAndFamily(const LLDynamicArray<LLViewerObject*>& list);
264
265 ////////////////////////////////////////////////////////////////
266 // Remove
267 ////////////////////////////////////////////////////////////////
268
269 void deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim = TRUE);
270 void deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_sim = TRUE);
236 271
237 // Send deselect messages to simulator, then clear the list 272 // Send deselect messages to simulator, then clear the list
238 void deselectAll(); 273 void deselectAll();
239 274
275 // deselect only if nothing else currently referencing the selection
276 void deselectUnused();
277
240 // Deselect if the selection center is too far away from the agent. 278 // Deselect if the selection center is too far away from the agent.
241 void deselectAllIfTooFar(); 279 void deselectAllIfTooFar();
242 280
243 BOOL selectionRemoveObject(const LLUUID &id); 281 // Removes all highlighted objects from current selection
244 282 void deselectHighlightedObjects();
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 283
286 void highlightObjectOnly(LLViewerObject *objectp);
287 void highlightObjectAndFamily(LLViewerObject *objectp);
288 void highlightObjectAndFamily(const LLDynamicArray<LLViewerObject*>& list);
289 void unhighlightObjectOnly(LLViewerObject *objectp); 284 void unhighlightObjectOnly(LLViewerObject *objectp);
290 void unhighlightObjectAndFamily(LLViewerObject *objectp); 285 void unhighlightObjectAndFamily(LLViewerObject *objectp);
291 void unhighlightAll(); 286 void unhighlightAll();
292 void selectHighlightedObjects();
293 void deselectHighlightedObjects();
294 287
295 LLSelectNode *findSelectNode(LLViewerObject *objectp); 288 BOOL removeObjectFromSelections(const LLUUID &id);
296 LLSelectNode *getFirstRootNode() { return mSelectedObjects.getFirstRootNode(); } 289
297 LLSelectNode *getNextRootNode() { return mSelectedObjects.getNextRootNode(); } 290 ////////////////////////////////////////////////////////////////
298 LLSelectNode* getFirstNode() { return mSelectedObjects.getFirstNode(); } 291 // Selection accessors
299 LLSelectNode* getNextNode() { return mSelectedObjects.getNextNode(); } 292 ////////////////////////////////////////////////////////////////
293 LLObjectSelectionHandle getHoverObjects() { return mHoverObjects; }
294 LLObjectSelectionHandle getSelection() { return mSelectedObjects; }
295 // right now this just renders the selection with root/child colors instead of a single color
296 LLObjectSelectionHandle getEditSelection() { convertTransient(); return mSelectedObjects; }
297 LLObjectSelectionHandle getHighlightedObjects() { return mHighlightedObjects; }
300 298
301 LLSelectNode *getHoverNode(); 299 LLSelectNode *getHoverNode();
302 300
301 ////////////////////////////////////////////////////////////////
302 // Grid manipulation
303 ////////////////////////////////////////////////////////////////
304 void addGridObject(LLViewerObject* objectp);
305 void clearGridObjects();
306 void setGridMode(EGridMode mode);
307 EGridMode getGridMode() { return mGridMode; }
308 void getGrid(LLVector3& origin, LLQuaternion& rotation, LLVector3 &scale);
309
303 BOOL getTEMode() { return mTEMode; } 310 BOOL getTEMode() { return mTEMode; }
304 void setTEMode(BOOL b) { mTEMode = b; } 311 void setTEMode(BOOL b) { mTEMode = b; }
305 312
306 LLViewerObject* getFirstCopyableObject(BOOL get_root = FALSE); 313 BOOL shouldShowSelection() { return mShowSelection; }
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
314 LLBBox getBBoxOfSelection() const; 315 LLBBox getBBoxOfSelection() const;
315 LLBBox getSavedBBoxOfSelection() const { return mSavedSelectionBBox; } 316 LLBBox getSavedBBoxOfSelection() const { return mSavedSelectionBBox; }
316 317
317 BOOL areMultpleEditableObjectsSelected();
318
319 void dump(); 318 void dump();
320 void cleanup(); 319 void cleanup();
321 320
@@ -323,17 +322,18 @@ public:
323 void renderSilhouettes(BOOL for_hud); 322 void renderSilhouettes(BOOL for_hud);
324 void enableSilhouette(BOOL enable) { mRenderSilhouettes = enable; } 323 void enableSilhouette(BOOL enable) { mRenderSilhouettes = enable; }
325 324
326 // Utility functions to operate on the list 325 ////////////////////////////////////////////////////////////////
327 326 // Utility functions that operate on the current selection
328 void saveSelectedObjectTransform(EActionType action_type); 327 ////////////////////////////////////////////////////////////////
329 void saveSelectedObjectColors(); 328 void saveSelectedObjectTransform(EActionType action_type);
330 void saveSelectedObjectTextures(); 329 void saveSelectedObjectColors();
331 330 void saveSelectedObjectTextures();
332 void selectionUpdatePhysics(BOOL use_physics); 331
333 void selectionUpdateTemporary(BOOL is_temporary); 332 void selectionUpdatePhysics(BOOL use_physics);
334 void selectionUpdatePhantom(BOOL is_ghost); 333 void selectionUpdateTemporary(BOOL is_temporary);
335 void selectionUpdateCastShadows(BOOL cast_shadows); 334 void selectionUpdatePhantom(BOOL is_ghost);
336 void selectionDump(); 335 void selectionUpdateCastShadows(BOOL cast_shadows);
336 void selectionDump();
337 337
338 BOOL selectionAllPCode(LLPCode code); // all objects have this PCode 338 BOOL selectionAllPCode(LLPCode code); // all objects have this PCode
339 BOOL selectionGetMaterial(U8 *material); // all objects have same material 339 BOOL selectionGetMaterial(U8 *material); // all objects have same material
@@ -362,11 +362,11 @@ public:
362 void selectionSetMediaTypeAndURL( U8 media_type, const std::string& media_url ); 362 void selectionSetMediaTypeAndURL( U8 media_type, const std::string& media_url );
363 void selectionSetClickAction(U8 action); 363 void selectionSetClickAction(U8 action);
364 364
365 void setObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE); 365 void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE);
366 void setObjectName(const LLString& name); 366 void selectionSetObjectName(const LLString& name);
367 void setObjectDescription(const LLString& desc); 367 void selectionSetObjectDescription(const LLString& desc);
368 void setObjectCategory(const LLCategory& category); 368 void selectionSetObjectCategory(const LLCategory& category);
369 void setObjectSaleInfo(const LLSaleInfo& sale_info); 369 void selectionSetObjectSaleInfo(const LLSaleInfo& sale_info);
370 370
371 void selectionTexScaleAutofit(F32 repeats_per_meter); 371 void selectionTexScaleAutofit(F32 repeats_per_meter);
372 void selectionResetTexInfo(S32 te); // sets S,T to 1 372 void selectionResetTexInfo(S32 te); // sets S,T to 1
@@ -433,23 +433,20 @@ public:
433 // with the aggregate permissions for texture inventory items of the selection. 433 // with the aggregate permissions for texture inventory items of the selection.
434 BOOL selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm); 434 BOOL selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm);
435 435
436 // returns TRUE is any node is currenly worn as an attachment
437 BOOL selectionIsAttachment();
438
439 LLPermissions* findObjectPermissions(const LLViewerObject* object); 436 LLPermissions* findObjectPermissions(const LLViewerObject* object);
440 437
441 void selectDelete(); // Delete on simulator 438 void selectDelete(); // Delete on simulator
442 void selectForceDelete(); // just delete, no into trash 439 void selectForceDelete(); // just delete, no into trash
443 void selectDuplicate(const LLVector3& offset, BOOL select_copy); // Duplicate on simulator 440 void selectDuplicate(const LLVector3& offset, BOOL select_copy); // Duplicate on simulator
444 void repeatDuplicate(); 441 void repeatDuplicate();
445 void selectDuplicateOnRay(const LLVector3 &ray_start_region, 442 void selectDuplicateOnRay(const LLVector3 &ray_start_region,
446 const LLVector3 &ray_end_region, 443 const LLVector3 &ray_end_region,
447 BOOL bypass_raycast, 444 BOOL bypass_raycast,
448 BOOL ray_end_is_intersection, 445 BOOL ray_end_is_intersection,
449 const LLUUID &ray_target_id, 446 const LLUUID &ray_target_id,
450 BOOL copy_centers, 447 BOOL copy_centers,
451 BOOL copy_rotates, 448 BOOL copy_rotates,
452 BOOL select_copy); 449 BOOL select_copy);
453 450
454 void sendMultipleUpdate(U32 type); // Position, rotation, scale all in one 451 void sendMultipleUpdate(U32 type); // Position, rotation, scale all in one
455 void sendOwner(const LLUUID& owner_id, const LLUUID& group_id, BOOL override = FALSE); 452 void sendOwner(const LLUUID& owner_id, const LLUUID& group_id, BOOL override = FALSE);
@@ -490,7 +487,7 @@ public:
490 void demoteSelectionToIndividuals(); 487 void demoteSelectionToIndividuals();
491 488
492private: 489private:
493 490 void convertTransient(); // converts temporarily selected objects to full-fledged selections
494 ESelectType getSelectTypeForObject(LLViewerObject* object); 491 ESelectType getSelectTypeForObject(LLViewerObject* object);
495 void addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add_to_end = FALSE); 492 void addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add_to_end = FALSE);
496 void generateSilhouette(LLSelectNode *nodep, const LLVector3& view_point); 493 void generateSilhouette(LLSelectNode *nodep, const LLVector3& view_point);
@@ -501,7 +498,6 @@ private:
501 void (*pack_body)(LLSelectNode* node, void *user_data), 498 void (*pack_body)(LLSelectNode* node, void *user_data),
502 void *user_data, 499 void *user_data,
503 ESendType send_type); 500 ESendType send_type);
504 U32 undoRedo(std::deque<LLSelectAction*> &queue_src, std::deque<LLSelectAction*> &queue_dst, const LLUUID &object_id);
505 501
506 static void packAgentID( void *); 502 static void packAgentID( void *);
507 static void packAgentAndSessionID(void* user_data); 503 static void packAgentAndSessionID(void* user_data);
@@ -536,22 +532,19 @@ private:
536 static void confirmDelete(S32 option, void* data); 532 static void confirmDelete(S32 option, void* data);
537 533
538private: 534private:
539 LLPointer<LLViewerImage> mSilhouetteImagep; 535 LLPointer<LLViewerImage> mSilhouetteImagep;
540 536 LLObjectSelectionHandle mSelectedObjects;
541 LLSelectNodeList mSelectedObjects; 537 LLObjectSelectionHandle mHoverObjects;
542 538 LLObjectSelectionHandle mHighlightedObjects;
543 LLSelectNodeList mHoverObjects;
544
545 std::set<LLPointer<LLViewerObject> > mRectSelectedObjects; 539 std::set<LLPointer<LLViewerObject> > mRectSelectedObjects;
546 540
547 LLSelectNodeList mGridObjects; 541 LLObjectSelection mGridObjects;
548 LLQuaternion mGridRotation; 542 LLQuaternion mGridRotation;
549 LLVector3 mGridOrigin; 543 LLVector3 mGridOrigin;
550 LLVector3 mGridScale; 544 LLVector3 mGridScale;
551 EGridMode mGridMode; 545 EGridMode mGridMode;
552 BOOL mGridValid; 546 BOOL mGridValid;
553 547
554 LLSelectNodeList mHighlightedObjects;
555 548
556 BOOL mTEMode; // render te 549 BOOL mTEMode; // render te
557 LLVector3d mSelectionCenterGlobal; 550 LLVector3d mSelectionCenterGlobal;
@@ -563,15 +556,10 @@ private:
563 BOOL mRenderSilhouettes; // do we render the silhouette 556 BOOL mRenderSilhouettes; // do we render the silhouette
564 LLBBox mSavedSelectionBBox; 557 LLBBox mSavedSelectionBBox;
565 558
566 ESelectType mSelectType;
567
568 LLFrameTimer mEffectsTimer; 559 LLFrameTimer mEffectsTimer;
569 BOOL mForceSelection; 560 BOOL mForceSelection;
570 561
571 std::deque<LLSelectAction*> mUndoQueue; 562 LLAnimPauseRequest mPauseRequest;
572 std::deque<LLSelectAction*> mRedoQueue;
573
574 LLAnimPauseRequest mPauseRequest;
575}; 563};
576 564
577 565
@@ -614,9 +602,12 @@ public:
614 LLCategory mCategory; 602 LLCategory mCategory;
615 S16 mInventorySerial; 603 S16 mInventorySerial;
616 LLVector3 mSavedPositionLocal; // for interactively modifying object position 604 LLVector3 mSavedPositionLocal; // for interactively modifying object position
605 LLVector3 mLastPositionLocal;
617 LLVector3d mSavedPositionGlobal; // for interactively modifying object position 606 LLVector3d mSavedPositionGlobal; // for interactively modifying object position
618 LLVector3 mSavedScale; // for interactively modifying object scale 607 LLVector3 mSavedScale; // for interactively modifying object scale
608 LLVector3 mLastScale;
619 LLQuaternion mSavedRotation; // for interactively modifying object rotation 609 LLQuaternion mSavedRotation; // for interactively modifying object rotation
610 LLQuaternion mLastRotation;
620 BOOL mDuplicated; 611 BOOL mDuplicated;
621 LLVector3d mDuplicatePos; 612 LLVector3d mDuplicatePos;
622 LLQuaternion mDuplicateRot; 613 LLQuaternion mDuplicateRot;