diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llselectmgr.h | 390 |
1 files changed, 254 insertions, 136 deletions
diff --git a/linden/indra/newview/llselectmgr.h b/linden/indra/newview/llselectmgr.h index fec3a0a..26b919b 100644 --- a/linden/indra/newview/llselectmgr.h +++ b/linden/indra/newview/llselectmgr.h | |||
@@ -2,6 +2,8 @@ | |||
2 | * @file llselectmgr.h | 2 | * @file llselectmgr.h |
3 | * @brief A manager for selected objects and TEs. | 3 | * @brief A manager for selected objects and TEs. |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
6 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | 7 | * Copyright (c) 2001-2007, Linden Research, Inc. |
6 | * | 8 | * |
7 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
@@ -24,13 +26,13 @@ | |||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
26 | * COMPLETENESS OR PERFORMANCE. | 28 | * COMPLETENESS OR PERFORMANCE. |
29 | * $/LicenseInfo$ | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #ifndef LL_LLSELECTMGR_H | 32 | #ifndef LL_LLSELECTMGR_H |
30 | #define LL_LLSELECTMGR_H | 33 | #define LL_LLSELECTMGR_H |
31 | 34 | ||
32 | #include "llcharacter.h" | 35 | #include "llcharacter.h" |
33 | #include "lldarray.h" | ||
34 | #include "lleditmenuhandler.h" | 36 | #include "lleditmenuhandler.h" |
35 | #include "llstring.h" | 37 | #include "llstring.h" |
36 | #include "llundo.h" | 38 | #include "llundo.h" |
@@ -44,8 +46,10 @@ | |||
44 | #include "llframetimer.h" | 46 | #include "llframetimer.h" |
45 | #include "llbbox.h" | 47 | #include "llbbox.h" |
46 | #include "llpermissions.h" | 48 | #include "llpermissions.h" |
49 | #include "llviewerobject.h" | ||
47 | 50 | ||
48 | #include <deque> | 51 | #include <deque> |
52 | #include "boost/iterator/filter_iterator.hpp" | ||
49 | 53 | ||
50 | class LLMessageSystem; | 54 | class LLMessageSystem; |
51 | class LLViewerImage; | 55 | class LLViewerImage; |
@@ -58,27 +62,37 @@ const S32 SELECT_ALL_TES = -1; | |||
58 | const S32 SELECT_MAX_TES = 32; | 62 | const S32 SELECT_MAX_TES = 32; |
59 | 63 | ||
60 | // Do something to all objects in the selection manager. | 64 | // Do something to all objects in the selection manager. |
61 | // The bool return value can be used to indicate if all | 65 | // The BOOL return value can be used to indicate if all |
62 | // objects are identical (gathering information) or if | 66 | // objects are identical (gathering information) or if |
63 | // the operation was successful. | 67 | // the operation was successful. |
64 | class LLSelectedObjectFunctor | 68 | struct LLSelectedObjectFunctor |
65 | { | 69 | { |
66 | public: | ||
67 | virtual ~LLSelectedObjectFunctor() {}; | 70 | virtual ~LLSelectedObjectFunctor() {}; |
68 | virtual bool apply(LLViewerObject* object) = 0; | 71 | virtual bool apply(LLViewerObject* object) = 0; |
69 | }; | 72 | }; |
70 | 73 | ||
71 | // Do something to all select nodes in the selection manager. | 74 | // Do something to all select nodes in the selection manager. |
72 | // The bool return value can be used to indicate if all | 75 | // The BOOL return value can be used to indicate if all |
73 | // objects are identical (gathering information) or if | 76 | // objects are identical (gathering information) or if |
74 | // the operation was successful. | 77 | // the operation was successful. |
75 | class LLSelectedNodeFunctor | 78 | struct LLSelectedNodeFunctor |
76 | { | 79 | { |
77 | public: | ||
78 | virtual ~LLSelectedNodeFunctor() {}; | 80 | virtual ~LLSelectedNodeFunctor() {}; |
79 | virtual bool apply(LLSelectNode* node) = 0; | 81 | virtual bool apply(LLSelectNode* node) = 0; |
80 | }; | 82 | }; |
81 | 83 | ||
84 | struct LLSelectedTEFunctor | ||
85 | { | ||
86 | virtual ~LLSelectedTEFunctor() {}; | ||
87 | virtual bool apply(LLViewerObject* object, S32 face) = 0; | ||
88 | }; | ||
89 | |||
90 | template <typename T> struct LLSelectedTEGetFunctor | ||
91 | { | ||
92 | virtual ~LLSelectedTEGetFunctor() {}; | ||
93 | virtual T get(LLViewerObject* object, S32 te) = 0; | ||
94 | }; | ||
95 | |||
82 | typedef enum e_send_type | 96 | typedef enum e_send_type |
83 | { | 97 | { |
84 | SEND_ONLY_ROOTS, | 98 | SEND_ONLY_ROOTS, |
@@ -111,53 +125,165 @@ typedef enum e_selection_type | |||
111 | SELECT_TYPE_HUD | 125 | SELECT_TYPE_HUD |
112 | }ESelectType; | 126 | }ESelectType; |
113 | 127 | ||
114 | class LLObjectSelection : public std::list<LLSelectNode*>, public LLRefCount | 128 | // Contains information about a selected object, particularly which TEs are selected. |
129 | class LLSelectNode | ||
130 | { | ||
131 | public: | ||
132 | LLSelectNode(LLViewerObject* object, BOOL do_glow); | ||
133 | LLSelectNode(const LLSelectNode& nodep); | ||
134 | ~LLSelectNode(); | ||
135 | |||
136 | void selectAllTEs(BOOL b); | ||
137 | void selectTE(S32 te_index, BOOL selected); | ||
138 | BOOL isTESelected(S32 te_index); | ||
139 | S32 getLastSelectedTE(); | ||
140 | void renderOneSilhouette(const LLColor4 &color); | ||
141 | void setTransient(BOOL transient) { mTransient = transient; } | ||
142 | BOOL isTransient() { return mTransient; } | ||
143 | LLViewerObject* getObject(); | ||
144 | void setObject(LLViewerObject* object); | ||
145 | // *NOTE: invalidate stored textures and colors when # faces change | ||
146 | void saveColors(); | ||
147 | void saveTextures(const std::vector<LLUUID>& textures); | ||
148 | void saveTextureScaleRatios(); | ||
149 | |||
150 | BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const; | ||
151 | |||
152 | public: | ||
153 | BOOL mIndividualSelection; // For root objects and objects individually selected | ||
154 | |||
155 | BOOL mTransient; | ||
156 | BOOL mValid; // is extra information valid? | ||
157 | LLPermissions* mPermissions; | ||
158 | LLSaleInfo mSaleInfo; | ||
159 | LLAggregatePermissions mAggregatePerm; | ||
160 | LLAggregatePermissions mAggregateTexturePerm; | ||
161 | LLAggregatePermissions mAggregateTexturePermOwner; | ||
162 | LLString mName; | ||
163 | LLString mDescription; | ||
164 | LLCategory mCategory; | ||
165 | S16 mInventorySerial; | ||
166 | LLVector3 mSavedPositionLocal; // for interactively modifying object position | ||
167 | LLVector3 mLastPositionLocal; | ||
168 | LLVector3d mSavedPositionGlobal; // for interactively modifying object position | ||
169 | LLVector3 mSavedScale; // for interactively modifying object scale | ||
170 | LLVector3 mLastScale; | ||
171 | LLQuaternion mSavedRotation; // for interactively modifying object rotation | ||
172 | LLQuaternion mLastRotation; | ||
173 | BOOL mDuplicated; | ||
174 | LLVector3d mDuplicatePos; | ||
175 | LLQuaternion mDuplicateRot; | ||
176 | LLUUID mItemID; | ||
177 | LLUUID mFolderID; | ||
178 | LLUUID mFromTaskID; | ||
179 | LLString mTouchName; | ||
180 | LLString mSitName; | ||
181 | U64 mCreationDate; | ||
182 | std::vector<LLColor4> mSavedColors; | ||
183 | std::vector<LLUUID> mSavedTextures; | ||
184 | std::vector<LLVector3> mTextureScaleRatios; | ||
185 | std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object | ||
186 | std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object | ||
187 | std::vector<S32> mSilhouetteSegments; // array of normals to render silhouette of object | ||
188 | BOOL mSilhouetteExists; // need to generate silhouette? | ||
189 | |||
190 | protected: | ||
191 | LLPointer<LLViewerObject> mObject; | ||
192 | BOOL mTESelected[SELECT_MAX_TES]; | ||
193 | S32 mLastTESelected; | ||
194 | }; | ||
195 | |||
196 | class LLObjectSelection : public LLRefCount | ||
115 | { | 197 | { |
116 | friend class LLSelectMgr; | 198 | friend class LLSelectMgr; |
117 | 199 | ||
118 | protected: | 200 | protected: |
119 | ~LLObjectSelection(); | 201 | ~LLObjectSelection(); |
120 | 202 | ||
203 | // List | ||
204 | public: | ||
205 | typedef std::list<LLSelectNode*> list_t; | ||
206 | private: | ||
207 | list_t mList; | ||
208 | |||
209 | public: | ||
210 | // Iterators | ||
211 | struct is_non_null | ||
212 | { | ||
213 | bool operator()(LLSelectNode* node) | ||
214 | { | ||
215 | return (node->getObject() != NULL); | ||
216 | } | ||
217 | }; | ||
218 | typedef boost::filter_iterator<is_non_null, list_t::iterator > iterator; | ||
219 | iterator begin() { return iterator(mList.begin(), mList.end()); } | ||
220 | iterator end() { return iterator(mList.end(), mList.end()); } | ||
221 | |||
222 | struct is_valid | ||
223 | { | ||
224 | bool operator()(LLSelectNode* node) | ||
225 | { | ||
226 | return (node->getObject() != NULL) && node->mValid; | ||
227 | } | ||
228 | }; | ||
229 | typedef boost::filter_iterator<is_valid, list_t::iterator > valid_iterator; | ||
230 | valid_iterator valid_begin() { return valid_iterator(mList.begin(), mList.end()); } | ||
231 | valid_iterator valid_end() { return valid_iterator(mList.end(), mList.end()); } | ||
232 | |||
233 | struct is_root | ||
234 | { | ||
235 | bool operator()(LLSelectNode* node) | ||
236 | { | ||
237 | LLViewerObject* object = node->getObject(); | ||
238 | return (object != NULL) && !node->mIndividualSelection && (object->isRootEdit() || object->isJointChild()); | ||
239 | } | ||
240 | }; | ||
241 | typedef boost::filter_iterator<is_root, list_t::iterator > root_iterator; | ||
242 | root_iterator root_begin() { return root_iterator(mList.begin(), mList.end()); } | ||
243 | root_iterator root_end() { return root_iterator(mList.end(), mList.end()); } | ||
244 | |||
245 | struct is_valid_root | ||
246 | { | ||
247 | bool operator()(LLSelectNode* node) | ||
248 | { | ||
249 | LLViewerObject* object = node->getObject(); | ||
250 | return (object != NULL) && node->mValid && !node->mIndividualSelection && (object->isRootEdit() || object->isJointChild()); | ||
251 | } | ||
252 | }; | ||
253 | typedef boost::filter_iterator<is_root, list_t::iterator > valid_root_iterator; | ||
254 | valid_root_iterator valid_root_begin() { return valid_root_iterator(mList.begin(), mList.end()); } | ||
255 | valid_root_iterator valid_root_end() { return valid_root_iterator(mList.end(), mList.end()); } | ||
256 | |||
121 | public: | 257 | public: |
122 | LLObjectSelection(); | 258 | LLObjectSelection(); |
123 | 259 | ||
124 | void updateEffects(); | 260 | void updateEffects(); |
261 | void cleanupNodes(); | ||
125 | 262 | ||
126 | BOOL isEmpty(); | 263 | BOOL isEmpty(); |
127 | 264 | ||
128 | S32 getOwnershipCost(S32 &cost); | 265 | S32 getOwnershipCost(S32 &cost); |
129 | 266 | ||
130 | LLSelectNode* getFirstNode(); | 267 | LLSelectNode* getFirstNode(LLSelectedNodeFunctor* func = NULL); |
131 | LLSelectNode* getCurrentNode(); // Warning! This is NOT the same as the linked_list getCurrentNode | 268 | LLSelectNode* getFirstRootNode(LLSelectedNodeFunctor* func = NULL, BOOL non_root_ok = FALSE); |
132 | LLSelectNode* getNextNode(); | 269 | LLViewerObject* getFirstSelectedObject(LLSelectedNodeFunctor* func, BOOL get_parent = FALSE); |
133 | 270 | LLViewerObject* getFirstObject(); | |
134 | LLSelectNode *getFirstRootNode(); | 271 | LLViewerObject* getFirstRootObject(BOOL non_root_ok = FALSE); |
135 | LLSelectNode *getNextRootNode(); | 272 | |
136 | 273 | LLSelectNode* getFirstMoveableNode(BOOL get_root_first = FALSE); | |
137 | LLSelectNode* getFirstMoveableNode(BOOL get_root = FALSE); | ||
138 | |||
139 | // iterate through objects | ||
140 | LLViewerObject* getFirstObject(); | ||
141 | LLViewerObject* getNextObject(); | ||
142 | |||
143 | // iterate through root objects | ||
144 | LLViewerObject *getFirstRootObject(); | ||
145 | LLViewerObject *getNextRootObject(); | ||
146 | 274 | ||
147 | LLViewerObject* getFirstEditableObject(BOOL get_root = FALSE); | 275 | LLViewerObject* getFirstEditableObject(BOOL get_parent = FALSE); |
148 | LLViewerObject* getFirstCopyableObject(BOOL get_root = FALSE); | 276 | LLViewerObject* getFirstCopyableObject(BOOL get_parent = FALSE); |
149 | LLViewerObject* getFirstDeleteableObject(BOOL get_root = FALSE); | 277 | LLViewerObject* getFirstDeleteableObject(); |
150 | LLViewerObject* getFirstMoveableObject(BOOL get_root = FALSE); | 278 | LLViewerObject* getFirstMoveableObject(BOOL get_parent = FALSE); |
151 | LLViewerObject* getPrimaryObject() { return mPrimaryObject; } | 279 | LLViewerObject* getPrimaryObject() { return mPrimaryObject; } |
152 | 280 | ||
153 | // iterate through texture entries | 281 | // iterate through texture entries |
154 | void getPrimaryTE(LLViewerObject* *object, S32 *te); | 282 | template <typename T> bool getSelectedTEValue(LLSelectedTEGetFunctor<T>* func, T& res); |
155 | void getFirstTE(LLViewerObject* *object, S32 *te); | 283 | |
156 | void getNextTE(LLViewerObject* *object, S32 *te); | ||
157 | void getCurrentTE(LLViewerObject* *object, S32 *te); | ||
158 | |||
159 | void addNode(LLSelectNode *nodep); | 284 | void addNode(LLSelectNode *nodep); |
160 | void addNodeAtEnd(LLSelectNode *nodep); | 285 | void addNodeAtEnd(LLSelectNode *nodep); |
286 | void moveNodeToFront(LLSelectNode *nodep); | ||
161 | void removeNode(LLSelectNode *nodep); | 287 | void removeNode(LLSelectNode *nodep); |
162 | void deleteAllNodes(); // Delete all nodes | 288 | void deleteAllNodes(); // Delete all nodes |
163 | S32 getNumNodes(); | 289 | S32 getNumNodes(); |
@@ -175,21 +301,22 @@ public: | |||
175 | BOOL isAttachment(); | 301 | BOOL isAttachment(); |
176 | 302 | ||
177 | // Apply functors to various subsets of the selected objects | 303 | // Apply functors to various subsets of the selected objects |
178 | // Returns the AND of all apply() calls. | 304 | // If firstonly is FALSE, returns the AND of all apply() calls. |
179 | bool applyToRootObjects(LLSelectedObjectFunctor* func); | 305 | // Else returns TRUE immediately if any apply() call succeeds (i.e. OR with early exit) |
180 | bool applyToObjects(LLSelectedObjectFunctor* func); | 306 | bool applyToRootObjects(LLSelectedObjectFunctor* func, bool firstonly = false); |
181 | bool applyToNodes(LLSelectedNodeFunctor* func); | 307 | bool applyToObjects(LLSelectedObjectFunctor* func, bool firstonly = false); |
308 | bool applyToTEs(LLSelectedTEFunctor* func, bool firstonly = false); | ||
309 | bool applyToRootNodes(LLSelectedNodeFunctor* func, bool firstonly = false); | ||
310 | bool applyToNodes(LLSelectedNodeFunctor* func, bool firstonly = false); | ||
182 | 311 | ||
183 | ESelectType getSelectType() { return mSelectType; } | 312 | ESelectType getSelectType() { return mSelectType; } |
184 | 313 | ||
185 | private: | 314 | private: |
186 | const LLObjectSelection &operator=(const LLObjectSelection &); | 315 | const LLObjectSelection &operator=(const LLObjectSelection &); |
187 | 316 | ||
188 | LLPointer<LLViewerObject> mPrimaryObject; | 317 | LLPointer<LLViewerObject> mPrimaryObject; |
189 | std::list<LLSelectNode*>::iterator mCurrentNode; | 318 | std::map<LLPointer<LLViewerObject>, LLSelectNode*> mSelectNodeMap; |
190 | S32 mCurrentTE; | 319 | ESelectType mSelectType; |
191 | std::map<LLPointer<LLViewerObject>, LLSelectNode*> mSelectNodeMap; | ||
192 | ESelectType mSelectType; | ||
193 | }; | 320 | }; |
194 | 321 | ||
195 | typedef LLHandle<LLObjectSelection> LLObjectSelectionHandle; | 322 | typedef LLHandle<LLObjectSelection> LLObjectSelectionHandle; |
@@ -236,6 +363,8 @@ public: | |||
236 | virtual void duplicate(); | 363 | virtual void duplicate(); |
237 | virtual BOOL canDuplicate(); | 364 | virtual BOOL canDuplicate(); |
238 | 365 | ||
366 | void clearSelections(); | ||
367 | void update(); | ||
239 | void updateEffects(); // Update HUD effects | 368 | void updateEffects(); // Update HUD effects |
240 | void overrideObjectUpdates(); | 369 | void overrideObjectUpdates(); |
241 | 370 | ||
@@ -258,7 +387,7 @@ public: | |||
258 | LLObjectSelectionHandle selectObjectAndFamily(LLViewerObject* object, BOOL add_to_end = FALSE); | 387 | LLObjectSelectionHandle selectObjectAndFamily(LLViewerObject* object, BOOL add_to_end = FALSE); |
259 | 388 | ||
260 | // Same as above, but takes a list of objects. Used by rectangle select. | 389 | // Same as above, but takes a list of objects. Used by rectangle select. |
261 | LLObjectSelectionHandle selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& object_list, BOOL send_to_sim = TRUE); | 390 | LLObjectSelectionHandle selectObjectAndFamily(const std::vector<LLViewerObject*>& object_list, BOOL send_to_sim = TRUE); |
262 | 391 | ||
263 | // converts all objects currently highlighted to a selection, and returns it | 392 | // converts all objects currently highlighted to a selection, and returns it |
264 | LLObjectSelectionHandle selectHighlightedObjects(); | 393 | LLObjectSelectionHandle selectHighlightedObjects(); |
@@ -267,7 +396,7 @@ public: | |||
267 | 396 | ||
268 | void highlightObjectOnly(LLViewerObject *objectp); | 397 | void highlightObjectOnly(LLViewerObject *objectp); |
269 | void highlightObjectAndFamily(LLViewerObject *objectp); | 398 | void highlightObjectAndFamily(LLViewerObject *objectp); |
270 | void highlightObjectAndFamily(const LLDynamicArray<LLViewerObject*>& list); | 399 | void highlightObjectAndFamily(const std::vector<LLViewerObject*>& list); |
271 | 400 | ||
272 | //////////////////////////////////////////////////////////////// | 401 | //////////////////////////////////////////////////////////////// |
273 | // Remove | 402 | // Remove |
@@ -314,7 +443,7 @@ public: | |||
314 | EGridMode getGridMode() { return mGridMode; } | 443 | EGridMode getGridMode() { return mGridMode; } |
315 | void getGrid(LLVector3& origin, LLQuaternion& rotation, LLVector3 &scale); | 444 | void getGrid(LLVector3& origin, LLQuaternion& rotation, LLVector3 &scale); |
316 | 445 | ||
317 | BOOL getTEMode() { return mTEMode; } | 446 | BOOL getTEMode() { return mTEMode; } |
318 | void setTEMode(BOOL b) { mTEMode = b; } | 447 | void setTEMode(BOOL b) { mTEMode = b; } |
319 | 448 | ||
320 | BOOL shouldShowSelection() { return mShowSelection; } | 449 | BOOL shouldShowSelection() { return mShowSelection; } |
@@ -343,17 +472,8 @@ public: | |||
343 | void selectionDump(); | 472 | void selectionDump(); |
344 | 473 | ||
345 | BOOL selectionAllPCode(LLPCode code); // all objects have this PCode | 474 | BOOL selectionAllPCode(LLPCode code); // all objects have this PCode |
346 | BOOL selectionGetMaterial(U8 *material); // all objects have same material | 475 | BOOL selectionGetClickAction(U8 *out_action); |
347 | BOOL selectionGetTexUUID(LLUUID& id); // true if all selected tes have same texture | 476 | bool selectionGetIncludeInSearch(bool* include_in_search_out); // true if all selected objects have same |
348 | BOOL selectionGetColor(LLColor4 &color); // all tes have same color | ||
349 | BOOL selectionGetTexScale(F32 *u, F32 *v); // true if all selected tes have same scale | ||
350 | BOOL selectionGetTexOffset(F32 *u, F32 *v); // true if all selected tes have same offset | ||
351 | BOOL selectionGetTexRotation(F32 *rad); // true if all selected tes have same rotation | ||
352 | BOOL selectionGetBumpmap(U8 *bumpmap); // true if all selected tes have same | ||
353 | BOOL selectionGetShiny(U8 *shiny); // true if all selected tes have same | ||
354 | BOOL selectionGetFullbright(U8 *fullbright);// true if all selected tes have same | ||
355 | bool selectionGetMediaType(U8 *media_type); // true if all selected tes have same | ||
356 | BOOL selectionGetClickAction(U8* action); | ||
357 | 477 | ||
358 | void selectionSetMaterial(U8 material); | 478 | void selectionSetMaterial(U8 material); |
359 | void selectionSetImage(const LLUUID& imageid); // could be item or asset id | 479 | void selectionSetImage(const LLUUID& imageid); // could be item or asset id |
@@ -368,6 +488,7 @@ public: | |||
368 | void selectionSetFullbright( U8 fullbright ); | 488 | void selectionSetFullbright( U8 fullbright ); |
369 | void selectionSetMediaTypeAndURL( U8 media_type, const std::string& media_url ); | 489 | void selectionSetMediaTypeAndURL( U8 media_type, const std::string& media_url ); |
370 | void selectionSetClickAction(U8 action); | 490 | void selectionSetClickAction(U8 action); |
491 | void selectionSetIncludeInSearch(bool include_in_search); | ||
371 | 492 | ||
372 | void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE); | 493 | void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE); |
373 | void selectionSetObjectName(const LLString& name); | 494 | void selectionSetObjectName(const LLString& name); |
@@ -376,9 +497,7 @@ public: | |||
376 | void selectionSetObjectSaleInfo(const LLSaleInfo& sale_info); | 497 | void selectionSetObjectSaleInfo(const LLSaleInfo& sale_info); |
377 | 498 | ||
378 | void selectionTexScaleAutofit(F32 repeats_per_meter); | 499 | void selectionTexScaleAutofit(F32 repeats_per_meter); |
379 | void selectionResetTexInfo(S32 te); // sets S,T to 1 | ||
380 | void adjustTexturesByScale(BOOL send_to_sim, BOOL stretch); | 500 | void adjustTexturesByScale(BOOL send_to_sim, BOOL stretch); |
381 | BOOL getTESTAxes(const LLViewerObject* object, const U8 te, U32* s_axis, U32* t_axis); // Only for flex boxes | ||
382 | 501 | ||
383 | void selectionResetRotation(); // sets rotation quat to identity | 502 | void selectionResetRotation(); // sets rotation quat to identity |
384 | void selectionRotateAroundZ(F32 degrees); | 503 | void selectionRotateAroundZ(F32 degrees); |
@@ -391,7 +510,7 @@ public: | |||
391 | // returns TRUE if it is possible to select this object | 510 | // returns TRUE if it is possible to select this object |
392 | BOOL canSelectObject(LLViewerObject* object); | 511 | BOOL canSelectObject(LLViewerObject* object); |
393 | 512 | ||
394 | // Returns true if the viewer has information on all selected objects | 513 | // Returns TRUE if the viewer has information on all selected objects |
395 | BOOL selectGetAllRootsValid(); | 514 | BOOL selectGetAllRootsValid(); |
396 | BOOL selectGetAllValid(); | 515 | BOOL selectGetAllValid(); |
397 | 516 | ||
@@ -405,17 +524,17 @@ public: | |||
405 | // returns TRUE if selected objects can be copied. | 524 | // returns TRUE if selected objects can be copied. |
406 | BOOL selectGetRootsCopy(); | 525 | BOOL selectGetRootsCopy(); |
407 | 526 | ||
408 | BOOL selectGetCreator(LLUUID& id, LLString& name); // true if all have same creator, returns id | 527 | BOOL selectGetCreator(LLUUID& id, LLString& name); // TRUE if all have same creator, returns id |
409 | BOOL selectGetOwner(LLUUID& id, LLString& name); // true if all objects have same owner, returns id | 528 | BOOL selectGetOwner(LLUUID& id, LLString& name); // TRUE if all objects have same owner, returns id |
410 | BOOL selectGetLastOwner(LLUUID& id, LLString& name); // true if all objects have same owner, returns id | 529 | BOOL selectGetLastOwner(LLUUID& id, LLString& name); // TRUE if all objects have same owner, returns id |
411 | 530 | ||
412 | // returns TRUE if all are the same. id is stuffed with | 531 | // returns TRUE if all are the same. id is stuffed with |
413 | // the value found if available. | 532 | // the value found if available. |
414 | BOOL selectGetGroup(LLUUID& id); | 533 | BOOL selectGetGroup(LLUUID& id); |
415 | 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 | 534 | 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 |
416 | BOOL selectGetOwnershipCost(S32* cost); // sum of all ownership costs | 535 | BOOL selectGetOwnershipCost(S32* cost); // sum of all ownership costs |
417 | 536 | ||
418 | BOOL selectIsGroupOwned(); // true if all root objects have valid data and are group owned. | 537 | BOOL selectIsGroupOwned(); // TRUE if all root objects have valid data and are group owned. |
419 | 538 | ||
420 | // returns TRUE if all the nodes are valid. Accumulates | 539 | // returns TRUE if all the nodes are valid. Accumulates |
421 | // permissions in the parameter. | 540 | // permissions in the parameter. |
@@ -483,10 +602,15 @@ public: | |||
483 | 602 | ||
484 | LLVector3d getSelectionCenterGlobal() const { return mSelectionCenterGlobal; } | 603 | LLVector3d getSelectionCenterGlobal() const { return mSelectionCenterGlobal; } |
485 | void updateSelectionCenter(); | 604 | void updateSelectionCenter(); |
486 | void updatePointAt(); | 605 | |
606 | void resetAgentHUDZoom(); | ||
607 | void setAgentHUDZoom(F32 target_zoom, F32 current_zoom); | ||
608 | void getAgentHUDZoom(F32 &target_zoom, F32 ¤t_zoom) const; | ||
609 | |||
610 | void updatePointAt(); | ||
487 | 611 | ||
488 | // Internal list maintenance functions. TODO: Make these private! | 612 | // Internal list maintenance functions. TODO: Make these private! |
489 | void remove(LLDynamicArray<LLViewerObject*>& objects); | 613 | void remove(std::vector<LLViewerObject*>& objects); |
490 | void remove(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE); | 614 | void remove(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE); |
491 | void removeAll(); | 615 | void removeAll(); |
492 | void addAsIndividual(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE); | 616 | void addAsIndividual(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE); |
@@ -496,7 +620,7 @@ public: | |||
496 | private: | 620 | private: |
497 | void convertTransient(); // converts temporarily selected objects to full-fledged selections | 621 | void convertTransient(); // converts temporarily selected objects to full-fledged selections |
498 | ESelectType getSelectTypeForObject(LLViewerObject* object); | 622 | ESelectType getSelectTypeForObject(LLViewerObject* object); |
499 | void addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add_to_end = FALSE); | 623 | void addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to_end = FALSE); |
500 | void generateSilhouette(LLSelectNode *nodep, const LLVector3& view_point); | 624 | void generateSilhouette(LLSelectNode *nodep, const LLVector3& view_point); |
501 | // Send one message to each region containing an object on selection list. | 625 | // Send one message to each region containing an object on selection list. |
502 | void sendListToRegions( const LLString& message_name, | 626 | void sendListToRegions( const LLString& message_name, |
@@ -518,6 +642,7 @@ private: | |||
518 | static void packObjectIDAndRotation( LLSelectNode* node, void *); | 642 | static void packObjectIDAndRotation( LLSelectNode* node, void *); |
519 | static void packObjectLocalID(LLSelectNode* node, void *); | 643 | static void packObjectLocalID(LLSelectNode* node, void *); |
520 | static void packObjectClickAction(LLSelectNode* node, void* data); | 644 | static void packObjectClickAction(LLSelectNode* node, void* data); |
645 | static void packObjectIncludeInSearch(LLSelectNode* node, void* data); | ||
521 | static void packObjectName(LLSelectNode* node, void* user_data); | 646 | static void packObjectName(LLSelectNode* node, void* user_data); |
522 | static void packObjectDescription(LLSelectNode* node, void* user_data); | 647 | static void packObjectDescription(LLSelectNode* node, void* user_data); |
523 | static void packObjectCategory(LLSelectNode* node, void* user_data); | 648 | static void packObjectCategory(LLSelectNode* node, void* user_data); |
@@ -568,78 +693,71 @@ private: | |||
568 | LLAnimPauseRequest mPauseRequest; | 693 | LLAnimPauseRequest mPauseRequest; |
569 | }; | 694 | }; |
570 | 695 | ||
571 | |||
572 | // Contains information about a selected object, particularly which | ||
573 | // tes are selected. | ||
574 | class LLSelectNode | ||
575 | { | ||
576 | public: | ||
577 | LLSelectNode(LLViewerObject* object, BOOL do_glow); | ||
578 | LLSelectNode(const LLSelectNode& nodep); | ||
579 | ~LLSelectNode(); | ||
580 | |||
581 | void selectAllTEs(BOOL b); | ||
582 | void selectTE(S32 te_index, BOOL selected); | ||
583 | BOOL isTESelected(S32 te_index); | ||
584 | S32 getLastSelectedTE(); | ||
585 | void renderOneSilhouette(const LLColor4 &color); | ||
586 | void setTransient(BOOL transient) { mTransient = transient; } | ||
587 | BOOL isTransient() { return mTransient; } | ||
588 | LLViewerObject *getObject(); | ||
589 | // *NOTE: invalidate stored textures and colors when # faces change | ||
590 | void saveColors(); | ||
591 | void saveTextures(const std::vector<LLUUID>& textures); | ||
592 | void saveTextureScaleRatios(); | ||
593 | |||
594 | BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const; | ||
595 | |||
596 | public: | ||
597 | BOOL mIndividualSelection; // For root objects and objects individually selected | ||
598 | |||
599 | BOOL mTransient; | ||
600 | BOOL mValid; // is extra information valid? | ||
601 | LLPermissions* mPermissions; | ||
602 | LLSaleInfo mSaleInfo; | ||
603 | LLAggregatePermissions mAggregatePerm; | ||
604 | LLAggregatePermissions mAggregateTexturePerm; | ||
605 | LLAggregatePermissions mAggregateTexturePermOwner; | ||
606 | LLString mName; | ||
607 | LLString mDescription; | ||
608 | LLCategory mCategory; | ||
609 | S16 mInventorySerial; | ||
610 | LLVector3 mSavedPositionLocal; // for interactively modifying object position | ||
611 | LLVector3 mLastPositionLocal; | ||
612 | LLVector3d mSavedPositionGlobal; // for interactively modifying object position | ||
613 | LLVector3 mSavedScale; // for interactively modifying object scale | ||
614 | LLVector3 mLastScale; | ||
615 | LLQuaternion mSavedRotation; // for interactively modifying object rotation | ||
616 | LLQuaternion mLastRotation; | ||
617 | BOOL mDuplicated; | ||
618 | LLVector3d mDuplicatePos; | ||
619 | LLQuaternion mDuplicateRot; | ||
620 | LLUUID mItemID; | ||
621 | LLUUID mFolderID; | ||
622 | LLUUID mFromTaskID; | ||
623 | LLString mTouchName; | ||
624 | LLString mSitName; | ||
625 | U64 mCreationDate; | ||
626 | std::vector<LLColor4> mSavedColors; | ||
627 | std::vector<LLUUID> mSavedTextures; | ||
628 | std::vector<LLVector3> mTextureScaleRatios; | ||
629 | std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object | ||
630 | std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object | ||
631 | std::vector<S32> mSilhouetteSegments; // array of normals to render silhouette of object | ||
632 | BOOL mSilhouetteExists; // need to generate silhouette? | ||
633 | |||
634 | protected: | ||
635 | LLPointer<LLViewerObject> mObject; | ||
636 | BOOL mTESelected[SELECT_MAX_TES]; | ||
637 | S32 mLastTESelected; | ||
638 | }; | ||
639 | |||
640 | extern LLSelectMgr* gSelectMgr; | 696 | extern LLSelectMgr* gSelectMgr; |
641 | 697 | ||
642 | // Utilities | 698 | // Utilities |
643 | void dialog_refresh_all(); // Update subscribers to the selection list | 699 | void dialog_refresh_all(); // Update subscribers to the selection list |
644 | 700 | ||
701 | // Templates | ||
702 | //----------------------------------------------------------------------------- | ||
703 | // getSelectedTEValue | ||
704 | //----------------------------------------------------------------------------- | ||
705 | template <typename T> bool LLObjectSelection::getSelectedTEValue(LLSelectedTEGetFunctor<T>* func, T& res) | ||
706 | { | ||
707 | bool have_first = false; | ||
708 | bool have_selected = false; | ||
709 | T selected_value = T(); | ||
710 | |||
711 | // Now iterate through all TEs to test for sameness | ||
712 | bool identical = TRUE; | ||
713 | for (iterator iter = begin(); iter != end(); iter++) | ||
714 | { | ||
715 | LLSelectNode* node = *iter; | ||
716 | LLViewerObject* object = node->getObject(); | ||
717 | S32 selected_te = -1; | ||
718 | if (object == getPrimaryObject()) | ||
719 | { | ||
720 | selected_te = node->getLastSelectedTE(); | ||
721 | } | ||
722 | for (S32 te = 0; te < object->getNumTEs(); ++te) | ||
723 | { | ||
724 | if (!node->isTESelected(te)) | ||
725 | { | ||
726 | continue; | ||
727 | } | ||
728 | T value = func->get(object, te); | ||
729 | if (!have_first) | ||
730 | { | ||
731 | have_first = true; | ||
732 | if (!have_selected) | ||
733 | { | ||
734 | selected_value = value; | ||
735 | } | ||
736 | } | ||
737 | else | ||
738 | { | ||
739 | if ( value != selected_value ) | ||
740 | { | ||
741 | identical = false; | ||
742 | } | ||
743 | if (te == selected_te) | ||
744 | { | ||
745 | selected_value = value; | ||
746 | have_selected = true; | ||
747 | } | ||
748 | } | ||
749 | } | ||
750 | if (!identical && have_selected) | ||
751 | { | ||
752 | break; | ||
753 | } | ||
754 | } | ||
755 | if (have_first || have_selected) | ||
756 | { | ||
757 | res = selected_value; | ||
758 | } | ||
759 | return identical; | ||
760 | } | ||
761 | |||
762 | |||
645 | #endif | 763 | #endif |