diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llselectmgr.cpp | 1715 |
1 files changed, 765 insertions, 950 deletions
diff --git a/linden/indra/newview/llselectmgr.cpp b/linden/indra/newview/llselectmgr.cpp index 9b13441..4e0cb17 100644 --- a/linden/indra/newview/llselectmgr.cpp +++ b/linden/indra/newview/llselectmgr.cpp | |||
@@ -122,6 +122,10 @@ LLColor4 LLSelectMgr::sHighlightParentColor; | |||
122 | LLColor4 LLSelectMgr::sHighlightChildColor; | 122 | LLColor4 LLSelectMgr::sHighlightChildColor; |
123 | LLColor4 LLSelectMgr::sContextSilhouetteColor; | 123 | LLColor4 LLSelectMgr::sContextSilhouetteColor; |
124 | 124 | ||
125 | static LLObjectSelection* get_null_object_selection(); | ||
126 | template<> | ||
127 | const LLHandle<LLObjectSelection>::NullFunc | ||
128 | LLHandle<LLObjectSelection>::sNullFunc = get_null_object_selection; | ||
125 | 129 | ||
126 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 130 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
127 | // struct LLDeRezInfo | 131 | // struct LLDeRezInfo |
@@ -146,6 +150,13 @@ struct LLDeRezInfo | |||
146 | // Functions | 150 | // Functions |
147 | // | 151 | // |
148 | 152 | ||
153 | LLObjectSelection* get_null_object_selection() | ||
154 | { | ||
155 | static LLObjectSelectionHandle null_ptr(new LLObjectSelection()); | ||
156 | return (LLObjectSelection*)null_ptr; | ||
157 | } | ||
158 | |||
159 | |||
149 | //----------------------------------------------------------------------------- | 160 | //----------------------------------------------------------------------------- |
150 | // LLSelectMgr() | 161 | // LLSelectMgr() |
151 | //----------------------------------------------------------------------------- | 162 | //----------------------------------------------------------------------------- |
@@ -177,7 +188,9 @@ LLSelectMgr::LLSelectMgr() | |||
177 | gSavedSettings.setS32("GridMode", (S32)GRID_MODE_WORLD); | 188 | gSavedSettings.setS32("GridMode", (S32)GRID_MODE_WORLD); |
178 | mGridValid = FALSE; | 189 | mGridValid = FALSE; |
179 | 190 | ||
180 | mSelectType = SELECT_TYPE_WORLD; | 191 | mSelectedObjects = new LLObjectSelection(); |
192 | mHoverObjects = new LLObjectSelection(); | ||
193 | mHighlightedObjects = new LLObjectSelection(); | ||
181 | } | 194 | } |
182 | 195 | ||
183 | 196 | ||
@@ -186,78 +199,72 @@ LLSelectMgr::LLSelectMgr() | |||
186 | //----------------------------------------------------------------------------- | 199 | //----------------------------------------------------------------------------- |
187 | LLSelectMgr::~LLSelectMgr() | 200 | LLSelectMgr::~LLSelectMgr() |
188 | { | 201 | { |
189 | mHoverObjects.deleteAllNodes(); | 202 | mHoverObjects->deleteAllNodes(); |
190 | mSelectedObjects.deleteAllNodes(); | 203 | mSelectedObjects->deleteAllNodes(); |
191 | mHighlightedObjects.deleteAllNodes(); | 204 | mHighlightedObjects->deleteAllNodes(); |
192 | mRectSelectedObjects.clear(); | 205 | mRectSelectedObjects.clear(); |
193 | mGridObjects.deleteAllNodes(); | 206 | mGridObjects.deleteAllNodes(); |
194 | mUndoQueue.clear(); | ||
195 | mRedoQueue.clear(); | ||
196 | } | ||
197 | |||
198 | bool LLSelectMgr::applyToObjects(LLSelectedObjectFunctor* func) | ||
199 | { | ||
200 | bool result = true; | ||
201 | LLViewerObject* object; | ||
202 | for (object = getFirstObject(); object != NULL; object = getNextObject()) | ||
203 | { | ||
204 | result = result && func->apply(object); | ||
205 | } | ||
206 | return result; | ||
207 | } | ||
208 | |||
209 | bool LLSelectMgr::applyToRootObjects(LLSelectedObjectFunctor* func) | ||
210 | { | ||
211 | bool result = true; | ||
212 | LLViewerObject* object; | ||
213 | for (object = getFirstRootObject(); | ||
214 | object != NULL; | ||
215 | object = getNextRootObject()) | ||
216 | { | ||
217 | result = result && func->apply(object); | ||
218 | } | ||
219 | return result; | ||
220 | } | 207 | } |
221 | 208 | ||
222 | bool LLSelectMgr::applyToNodes(LLSelectedNodeFunctor *func) | 209 | void LLSelectMgr::updateEffects() |
223 | { | 210 | { |
224 | bool result = true; | 211 | if (mEffectsTimer.getElapsedTimeF32() > 1.f) |
225 | LLSelectNode* node; | ||
226 | for (node = getFirstNode(); node != NULL; node = getNextNode()) | ||
227 | { | 212 | { |
228 | result = result && func->apply(node); | 213 | mSelectedObjects->updateEffects(); |
214 | mEffectsTimer.reset(); | ||
229 | } | 215 | } |
230 | return result; | ||
231 | } | 216 | } |
232 | 217 | ||
233 | void LLSelectMgr::updateEffects() | 218 | void LLSelectMgr::overrideObjectUpdates() |
234 | { | 219 | { |
235 | if (mEffectsTimer.getElapsedTimeF32() > 1.f) | 220 | //override any position updates from simulator on objects being edited |
221 | LLSelectNode* selectNode; | ||
222 | for (selectNode = gSelectMgr->getSelection()->getFirstNode(); | ||
223 | selectNode != NULL; | ||
224 | selectNode = gSelectMgr->getSelection()->getNextNode()) | ||
236 | { | 225 | { |
237 | mSelectedObjects.updateEffects(); | 226 | LLViewerObject* object = selectNode->getObject(); |
238 | mEffectsTimer.reset(); | 227 | |
228 | if (object->permMove()) | ||
229 | { | ||
230 | if (!selectNode->mLastPositionLocal.isExactlyZero()) | ||
231 | { | ||
232 | object->setPosition(selectNode->mLastPositionLocal); | ||
233 | } | ||
234 | if (selectNode->mLastRotation != LLQuaternion()) | ||
235 | { | ||
236 | object->setRotation(selectNode->mLastRotation); | ||
237 | } | ||
238 | if (!selectNode->mLastScale.isExactlyZero()) | ||
239 | { | ||
240 | object->setScale(selectNode->mLastScale); | ||
241 | } | ||
242 | } | ||
239 | } | 243 | } |
240 | } | 244 | } |
241 | 245 | ||
242 | //----------------------------------------------------------------------------- | 246 | //----------------------------------------------------------------------------- |
243 | // Select just the object, not any other group members. | 247 | // Select just the object, not any other group members. |
244 | //----------------------------------------------------------------------------- | 248 | //----------------------------------------------------------------------------- |
245 | void LLSelectMgr::selectObjectOnly(LLViewerObject* object, S32 face) | 249 | LLObjectSelectionHandle LLSelectMgr::selectObjectOnly(LLViewerObject* object, S32 face) |
246 | { | 250 | { |
247 | llassert( object ); | 251 | llassert( object ); |
248 | 252 | ||
253 | //remember primary object | ||
254 | mSelectedObjects->mPrimaryObject = object; | ||
255 | |||
249 | // Don't add an object that is already in the list | 256 | // Don't add an object that is already in the list |
250 | if (object->isSelected() ) { | 257 | if (object->isSelected() ) { |
251 | // make sure point at position is updated | 258 | // make sure point at position is updated |
252 | updatePointAt(); | 259 | updatePointAt(); |
253 | gEditMenuHandler = this; | 260 | gEditMenuHandler = this; |
254 | return; | 261 | return NULL; |
255 | } | 262 | } |
256 | 263 | ||
257 | if (!canSelectObject(object)) | 264 | if (!canSelectObject(object)) |
258 | { | 265 | { |
259 | //make_ui_sound("UISndInvalidOp"); | 266 | //make_ui_sound("UISndInvalidOp"); |
260 | return; | 267 | return NULL; |
261 | } | 268 | } |
262 | 269 | ||
263 | // llinfos << "Adding object to selected object list" << llendl; | 270 | // llinfos << "Adding object to selected object list" << llendl; |
@@ -291,19 +298,24 @@ void LLSelectMgr::selectObjectOnly(LLViewerObject* object, S32 face) | |||
291 | 298 | ||
292 | // have selection manager handle edit menu immediately after | 299 | // have selection manager handle edit menu immediately after |
293 | // user selects an object | 300 | // user selects an object |
294 | if (getObjectCount()) | 301 | if (mSelectedObjects->getObjectCount()) |
295 | { | 302 | { |
296 | gEditMenuHandler = this; | 303 | gEditMenuHandler = this; |
297 | } | 304 | } |
305 | |||
306 | return mSelectedObjects; | ||
298 | } | 307 | } |
299 | 308 | ||
300 | //----------------------------------------------------------------------------- | 309 | //----------------------------------------------------------------------------- |
301 | // Select the object, parents and children. | 310 | // Select the object, parents and children. |
302 | //----------------------------------------------------------------------------- | 311 | //----------------------------------------------------------------------------- |
303 | void LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end) | 312 | LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end) |
304 | { | 313 | { |
305 | llassert( obj ); | 314 | llassert( obj ); |
306 | 315 | ||
316 | //remember primary object | ||
317 | mSelectedObjects->mPrimaryObject = obj; | ||
318 | |||
307 | // This may be incorrect if things weren't family selected before... - djs 07/08/02 | 319 | // This may be incorrect if things weren't family selected before... - djs 07/08/02 |
308 | // Don't add an object that is already in the list | 320 | // Don't add an object that is already in the list |
309 | if (obj->isSelected() ) | 321 | if (obj->isSelected() ) |
@@ -311,13 +323,13 @@ void LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end) | |||
311 | // make sure pointat position is updated | 323 | // make sure pointat position is updated |
312 | updatePointAt(); | 324 | updatePointAt(); |
313 | gEditMenuHandler = this; | 325 | gEditMenuHandler = this; |
314 | return; | 326 | return NULL; |
315 | } | 327 | } |
316 | 328 | ||
317 | if (!canSelectObject(obj)) | 329 | if (!canSelectObject(obj)) |
318 | { | 330 | { |
319 | //make_ui_sound("UISndInvalidOp"); | 331 | //make_ui_sound("UISndInvalidOp"); |
320 | return; | 332 | return NULL; |
321 | } | 333 | } |
322 | 334 | ||
323 | // Since we're selecting a family, start at the root, but | 335 | // Since we're selecting a family, start at the root, but |
@@ -366,16 +378,18 @@ void LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, BOOL add_to_end) | |||
366 | 378 | ||
367 | // have selection manager handle edit menu immediately after | 379 | // have selection manager handle edit menu immediately after |
368 | // user selects an object | 380 | // user selects an object |
369 | if (getObjectCount()) | 381 | if (mSelectedObjects->getObjectCount()) |
370 | { | 382 | { |
371 | gEditMenuHandler = this; | 383 | gEditMenuHandler = this; |
372 | } | 384 | } |
385 | |||
386 | return mSelectedObjects; | ||
373 | } | 387 | } |
374 | 388 | ||
375 | //----------------------------------------------------------------------------- | 389 | //----------------------------------------------------------------------------- |
376 | // Select the object, parents and children. | 390 | // Select the object, parents and children. |
377 | //----------------------------------------------------------------------------- | 391 | //----------------------------------------------------------------------------- |
378 | void LLSelectMgr::selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& object_list, | 392 | LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& object_list, |
379 | BOOL send_to_sim) | 393 | BOOL send_to_sim) |
380 | { | 394 | { |
381 | // Collect all of the objects, children included | 395 | // Collect all of the objects, children included |
@@ -383,7 +397,10 @@ void LLSelectMgr::selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& o | |||
383 | LLViewerObject *object; | 397 | LLViewerObject *object; |
384 | S32 i; | 398 | S32 i; |
385 | 399 | ||
386 | if (object_list.count() < 1) return; | 400 | //clear primary object (no primary object) |
401 | mSelectedObjects->mPrimaryObject = NULL; | ||
402 | |||
403 | if (object_list.count() < 1) return NULL; | ||
387 | 404 | ||
388 | // NOTE -- we add the objects in REVERSE ORDER | 405 | // NOTE -- we add the objects in REVERSE ORDER |
389 | // to preserve the order in the mSelectedObjects list | 406 | // to preserve the order in the mSelectedObjects list |
@@ -429,25 +446,25 @@ void LLSelectMgr::selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& o | |||
429 | 446 | ||
430 | // have selection manager handle edit menu immediately after | 447 | // have selection manager handle edit menu immediately after |
431 | // user selects an object | 448 | // user selects an object |
432 | if (getObjectCount()) | 449 | if (mSelectedObjects->getObjectCount()) |
433 | { | 450 | { |
434 | gEditMenuHandler = this; | 451 | gEditMenuHandler = this; |
435 | } | 452 | } |
453 | |||
454 | return mSelectedObjects; | ||
436 | } | 455 | } |
437 | 456 | ||
438 | // Use for when the simulator kills an object. This version also | 457 | // Use for when the simulator kills an object. This version also |
439 | // handles informing the current tool of the object's deletion. | 458 | // handles informing the current tool of the object's deletion. |
440 | // | 459 | // |
441 | // Caller needs to call dialog_refresh_all if necessary. | 460 | // Caller needs to call dialog_refresh_all if necessary. |
442 | BOOL LLSelectMgr::selectionRemoveObject(const LLUUID &id) | 461 | BOOL LLSelectMgr::removeObjectFromSelections(const LLUUID &id) |
443 | { | 462 | { |
444 | |||
445 | |||
446 | BOOL object_found = FALSE; | 463 | BOOL object_found = FALSE; |
447 | LLTool *tool = NULL; | 464 | LLTool *tool = NULL; |
448 | if (!gNoRender) | 465 | if (!gNoRender) |
449 | { | 466 | { |
450 | tool = gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) ); | 467 | tool = gToolMgr->getCurrentTool(); |
451 | 468 | ||
452 | // It's possible that the tool is editing an object that is not selected | 469 | // It's possible that the tool is editing an object that is not selected |
453 | LLViewerObject* tool_editing_object = tool->getEditingObject(); | 470 | LLViewerObject* tool_editing_object = tool->getEditingObject(); |
@@ -462,13 +479,13 @@ BOOL LLSelectMgr::selectionRemoveObject(const LLUUID &id) | |||
462 | if( !object_found ) | 479 | if( !object_found ) |
463 | { | 480 | { |
464 | LLViewerObject* prevobjp = NULL; | 481 | LLViewerObject* prevobjp = NULL; |
465 | for( LLViewerObject* tobjp = getFirstObject(); tobjp != NULL; tobjp = getNextObject() ) | 482 | for( LLViewerObject* tobjp = mSelectedObjects->getFirstObject(); tobjp != NULL; tobjp = mSelectedObjects->getNextObject() ) |
466 | { | 483 | { |
467 | if (tobjp == prevobjp) | 484 | if (tobjp == prevobjp) |
468 | { | 485 | { |
469 | // Somehow we got stuck in an infinite loop... (DaveP) | 486 | // Somehow we got stuck in an infinite loop... (DaveP) |
470 | // this logic is kind of twisted, not sure how this is happening, so... | 487 | // this logic is kind of twisted, not sure how this is happening, so... |
471 | llwarns << "Detected infinite loop #1 in LLSelectMgr::selectionRemoveObject:|" << llendl; | 488 | llwarns << "Detected infinite loop #1 in LLSelectMgr::removeObjectFromSelections:|" << llendl; |
472 | //MikeS. adding warning and comment... | 489 | //MikeS. adding warning and comment... |
473 | //These infinite loops happen because the LLSelectMgr iteration routines are non-reentrant. | 490 | //These infinite loops happen because the LLSelectMgr iteration routines are non-reentrant. |
474 | //deselectObjectAndFamily uses getFirstObject and getNextObject to mess with the array, | 491 | //deselectObjectAndFamily uses getFirstObject and getNextObject to mess with the array, |
@@ -492,7 +509,7 @@ BOOL LLSelectMgr::selectionRemoveObject(const LLUUID &id) | |||
492 | if(object_found == TRUE){ | 509 | if(object_found == TRUE){ |
493 | //MikeS. adding warning... This happens when removing a linked attachment while sitting on an object.. | 510 | //MikeS. adding warning... This happens when removing a linked attachment while sitting on an object.. |
494 | //I think the selection manager needs to be rewritten. BAD. | 511 | //I think the selection manager needs to be rewritten. BAD. |
495 | llwarns << "Detected infinite loop #2 in LLSelectMgr::selectionRemoveObject:|" << llendl; | 512 | llwarns << "Detected infinite loop #2 in LLSelectMgr::removeObjectFromSelections:|" << llendl; |
496 | break; | 513 | break; |
497 | } | 514 | } |
498 | object_found = TRUE; | 515 | object_found = TRUE; |
@@ -613,11 +630,11 @@ void LLSelectMgr::addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add | |||
613 | nodep = new LLSelectNode(objectp, TRUE); | 630 | nodep = new LLSelectNode(objectp, TRUE); |
614 | if (add_to_end) | 631 | if (add_to_end) |
615 | { | 632 | { |
616 | mSelectedObjects.addNodeAtEnd(nodep); | 633 | mSelectedObjects->addNodeAtEnd(nodep); |
617 | } | 634 | } |
618 | else | 635 | else |
619 | { | 636 | { |
620 | mSelectedObjects.addNode(nodep); | 637 | mSelectedObjects->addNode(nodep); |
621 | } | 638 | } |
622 | objectp->setSelected(TRUE); | 639 | objectp->setSelected(TRUE); |
623 | 640 | ||
@@ -634,7 +651,7 @@ void LLSelectMgr::addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add | |||
634 | { | 651 | { |
635 | // we want this object to be selected for real | 652 | // we want this object to be selected for real |
636 | // so clear transient flag | 653 | // so clear transient flag |
637 | LLSelectNode* select_node = findSelectNode(objectp); | 654 | LLSelectNode* select_node = mSelectedObjects->findNode(objectp); |
638 | if (select_node) | 655 | if (select_node) |
639 | { | 656 | { |
640 | select_node->setTransient(FALSE); | 657 | select_node->setTransient(FALSE); |
@@ -650,21 +667,21 @@ void LLSelectMgr::addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add | |||
650 | void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoable) | 667 | void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoable) |
651 | { | 668 | { |
652 | // check to see if object is already in list | 669 | // check to see if object is already in list |
653 | LLSelectNode *nodep = findSelectNode(objectp); | 670 | LLSelectNode *nodep = mSelectedObjects->findNode(objectp); |
654 | 671 | ||
655 | // if not in list, add it | 672 | // if not in list, add it |
656 | if (!nodep) | 673 | if (!nodep) |
657 | { | 674 | { |
658 | nodep = new LLSelectNode(objectp, TRUE); | 675 | nodep = new LLSelectNode(objectp, TRUE); |
659 | mSelectedObjects.addNode(nodep); | 676 | mSelectedObjects->addNode(nodep); |
660 | } | 677 | } |
661 | else | 678 | else |
662 | { | 679 | { |
663 | // make this a full-fledged selection | 680 | // make this a full-fledged selection |
664 | nodep->setTransient(FALSE); | 681 | nodep->setTransient(FALSE); |
665 | // Move it to the front of the list | 682 | // Move it to the front of the list |
666 | mSelectedObjects.removeNode(nodep); | 683 | mSelectedObjects->removeNode(nodep); |
667 | mSelectedObjects.addNode(nodep); | 684 | mSelectedObjects->addNode(nodep); |
668 | } | 685 | } |
669 | 686 | ||
670 | // Make sure the object is tagged as selected | 687 | // Make sure the object is tagged as selected |
@@ -698,26 +715,26 @@ void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoab | |||
698 | } | 715 | } |
699 | 716 | ||
700 | 717 | ||
701 | void LLSelectMgr::setHoverObject(LLViewerObject *objectp) | 718 | LLObjectSelectionHandle LLSelectMgr::setHoverObject(LLViewerObject *objectp) |
702 | { | 719 | { |
703 | // Always blitz hover list when setting | 720 | // Always blitz hover list when setting |
704 | mHoverObjects.deleteAllNodes(); | 721 | mHoverObjects->deleteAllNodes(); |
705 | 722 | ||
706 | if (!objectp) | 723 | if (!objectp) |
707 | { | 724 | { |
708 | return; | 725 | return NULL; |
709 | } | 726 | } |
710 | 727 | ||
711 | // Can't select yourself | 728 | // Can't select yourself |
712 | if (objectp->mID == gAgentID) | 729 | if (objectp->mID == gAgentID) |
713 | { | 730 | { |
714 | return; | 731 | return NULL; |
715 | } | 732 | } |
716 | 733 | ||
717 | // Can't select land | 734 | // Can't select land |
718 | if (objectp->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) | 735 | if (objectp->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) |
719 | { | 736 | { |
720 | return; | 737 | return NULL; |
721 | } | 738 | } |
722 | 739 | ||
723 | // Collect all of the objects | 740 | // Collect all of the objects |
@@ -733,15 +750,16 @@ void LLSelectMgr::setHoverObject(LLViewerObject *objectp) | |||
733 | { | 750 | { |
734 | cur_objectp = objects[i]; | 751 | cur_objectp = objects[i]; |
735 | nodep = new LLSelectNode(cur_objectp, FALSE); | 752 | nodep = new LLSelectNode(cur_objectp, FALSE); |
736 | mHoverObjects.addNodeAtEnd(nodep); | 753 | mHoverObjects->addNodeAtEnd(nodep); |
737 | } | 754 | } |
738 | 755 | ||
739 | requestObjectPropertiesFamily(objectp); | 756 | requestObjectPropertiesFamily(objectp); |
757 | return mHoverObjects; | ||
740 | } | 758 | } |
741 | 759 | ||
742 | LLSelectNode *LLSelectMgr::getHoverNode() | 760 | LLSelectNode *LLSelectMgr::getHoverNode() |
743 | { | 761 | { |
744 | return getHoverObjects().getFirstRootNode(); | 762 | return getHoverObjects()->getFirstRootNode(); |
745 | } | 763 | } |
746 | 764 | ||
747 | void LLSelectMgr::highlightObjectOnly(LLViewerObject* objectp) | 765 | void LLSelectMgr::highlightObjectOnly(LLViewerObject* objectp) |
@@ -842,20 +860,23 @@ void LLSelectMgr::unhighlightObjectAndFamily(LLViewerObject* objectp) | |||
842 | void LLSelectMgr::unhighlightAll() | 860 | void LLSelectMgr::unhighlightAll() |
843 | { | 861 | { |
844 | mRectSelectedObjects.clear(); | 862 | mRectSelectedObjects.clear(); |
845 | mHighlightedObjects.deleteAllNodes(); | 863 | mHighlightedObjects->deleteAllNodes(); |
846 | } | 864 | } |
847 | 865 | ||
848 | void LLSelectMgr::selectHighlightedObjects() | 866 | LLObjectSelectionHandle LLSelectMgr::selectHighlightedObjects() |
849 | { | 867 | { |
850 | if (!mHighlightedObjects.getNumNodes()) | 868 | if (!mHighlightedObjects->getNumNodes()) |
851 | { | 869 | { |
852 | return; | 870 | return NULL; |
853 | } | 871 | } |
854 | 872 | ||
873 | //clear primary object | ||
874 | mSelectedObjects->mPrimaryObject = NULL; | ||
875 | |||
855 | LLSelectNode *nodep; | 876 | LLSelectNode *nodep; |
856 | for (nodep = mHighlightedObjects.getFirstNode(); | 877 | for (nodep = mHighlightedObjects->getFirstNode(); |
857 | nodep; | 878 | nodep; |
858 | nodep = mHighlightedObjects.getNextNode()) | 879 | nodep = mHighlightedObjects->getNextNode()) |
859 | { | 880 | { |
860 | LLViewerObject* objectp = nodep->getObject(); | 881 | LLViewerObject* objectp = nodep->getObject(); |
861 | 882 | ||
@@ -871,12 +892,12 @@ void LLSelectMgr::selectHighlightedObjects() | |||
871 | } | 892 | } |
872 | 893 | ||
873 | LLSelectNode* new_nodep = new LLSelectNode(*nodep); | 894 | LLSelectNode* new_nodep = new LLSelectNode(*nodep); |
874 | mSelectedObjects.addNode(new_nodep); | 895 | mSelectedObjects->addNode(new_nodep); |
875 | 896 | ||
876 | // flag this object as selected | 897 | // flag this object as selected |
877 | objectp->setSelected(TRUE); | 898 | objectp->setSelected(TRUE); |
878 | 899 | ||
879 | mSelectType = getSelectTypeForObject(objectp); | 900 | mSelectedObjects->mSelectType = getSelectTypeForObject(objectp); |
880 | 901 | ||
881 | // request properties on root objects | 902 | // request properties on root objects |
882 | if (objectp->isRootEdit()) | 903 | if (objectp->isRootEdit()) |
@@ -892,10 +913,12 @@ void LLSelectMgr::selectHighlightedObjects() | |||
892 | saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); | 913 | saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK); |
893 | updatePointAt(); | 914 | updatePointAt(); |
894 | 915 | ||
895 | if (getObjectCount()) | 916 | if (mSelectedObjects->getObjectCount()) |
896 | { | 917 | { |
897 | gEditMenuHandler = this; | 918 | gEditMenuHandler = this; |
898 | } | 919 | } |
920 | |||
921 | return mSelectedObjects; | ||
899 | } | 922 | } |
900 | 923 | ||
901 | void LLSelectMgr::deselectHighlightedObjects() | 924 | void LLSelectMgr::deselectHighlightedObjects() |
@@ -957,7 +980,7 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & | |||
957 | grid_object = NULL; | 980 | grid_object = NULL; |
958 | } | 981 | } |
959 | 982 | ||
960 | if (mGridMode == GRID_MODE_LOCAL && gSelectMgr->getObjectCount()) | 983 | if (mGridMode == GRID_MODE_LOCAL && mSelectedObjects->getObjectCount()) |
961 | { | 984 | { |
962 | LLBBox bbox = mSavedSelectionBBox; | 985 | LLBBox bbox = mSavedSelectionBBox; |
963 | mGridOrigin = mSavedSelectionBBox.getCenterAgent(); | 986 | mGridOrigin = mSavedSelectionBBox.getCenterAgent(); |
@@ -1011,18 +1034,18 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & | |||
1011 | } | 1034 | } |
1012 | else // GRID_MODE_WORLD or just plain default | 1035 | else // GRID_MODE_WORLD or just plain default |
1013 | { | 1036 | { |
1014 | LLViewerObject* first_object = gSelectMgr->getFirstRootObject(); | 1037 | LLViewerObject* first_object = mSelectedObjects->getFirstRootObject(); |
1015 | if (!first_object) | 1038 | if (!first_object) |
1016 | { | 1039 | { |
1017 | first_object = gSelectMgr->getFirstObject(); | 1040 | first_object = mSelectedObjects->getFirstObject(); |
1018 | } | 1041 | } |
1019 | 1042 | ||
1020 | mGridOrigin.clearVec(); | 1043 | mGridOrigin.clearVec(); |
1021 | mGridRotation.loadIdentity(); | 1044 | mGridRotation.loadIdentity(); |
1022 | 1045 | ||
1023 | mSelectType = getSelectTypeForObject( first_object ); | 1046 | mSelectedObjects->mSelectType = getSelectTypeForObject( first_object ); |
1024 | 1047 | ||
1025 | switch (mSelectType) | 1048 | switch (mSelectedObjects->mSelectType) |
1026 | { | 1049 | { |
1027 | case SELECT_TYPE_ATTACHMENT: | 1050 | case SELECT_TYPE_ATTACHMENT: |
1028 | if (first_object) | 1051 | if (first_object) |
@@ -1051,59 +1074,6 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & | |||
1051 | mGridValid = TRUE; | 1074 | mGridValid = TRUE; |
1052 | } | 1075 | } |
1053 | 1076 | ||
1054 | |||
1055 | |||
1056 | LLSelectNode* LLSelectMgr::findSelectNode(LLViewerObject *object) | ||
1057 | { | ||
1058 | return mSelectedObjects.findNode(object); | ||
1059 | } | ||
1060 | |||
1061 | //----------------------------------------------------------------------------- | ||
1062 | // contains() | ||
1063 | //----------------------------------------------------------------------------- | ||
1064 | BOOL LLSelectMgr::contains(LLViewerObject* object) | ||
1065 | { | ||
1066 | return mSelectedObjects.findNode(object) != NULL; | ||
1067 | } | ||
1068 | |||
1069 | |||
1070 | //----------------------------------------------------------------------------- | ||
1071 | // contains() | ||
1072 | //----------------------------------------------------------------------------- | ||
1073 | BOOL LLSelectMgr::contains(LLViewerObject* object, S32 te) | ||
1074 | { | ||
1075 | LLSelectNode *nodep; | ||
1076 | if (te == SELECT_ALL_TES) | ||
1077 | { | ||
1078 | // ...all faces | ||
1079 | for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode() ) | ||
1080 | { | ||
1081 | if (nodep->getObject() == object) | ||
1082 | { | ||
1083 | BOOL all_selected = TRUE; | ||
1084 | for (S32 i = 0; i < SELECT_MAX_TES; i++) | ||
1085 | { | ||
1086 | all_selected = all_selected && nodep->isTESelected(i); | ||
1087 | } | ||
1088 | return all_selected; | ||
1089 | } | ||
1090 | } | ||
1091 | return FALSE; | ||
1092 | } | ||
1093 | else | ||
1094 | { | ||
1095 | // ...one face | ||
1096 | for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode() ) | ||
1097 | { | ||
1098 | if (nodep->getObject() == object && nodep->isTESelected(te)) | ||
1099 | { | ||
1100 | return TRUE; | ||
1101 | } | ||
1102 | } | ||
1103 | return FALSE; | ||
1104 | } | ||
1105 | } | ||
1106 | |||
1107 | //----------------------------------------------------------------------------- | 1077 | //----------------------------------------------------------------------------- |
1108 | // remove() - an array of objects | 1078 | // remove() - an array of objects |
1109 | //----------------------------------------------------------------------------- | 1079 | //----------------------------------------------------------------------------- |
@@ -1116,14 +1086,14 @@ void LLSelectMgr::remove(LLDynamicArray<LLViewerObject*>& objects) | |||
1116 | for(S32 i = 0; i < count; i++) | 1086 | for(S32 i = 0; i < count; i++) |
1117 | { | 1087 | { |
1118 | objectp = objects.get(i); | 1088 | objectp = objects.get(i); |
1119 | for(nodep = mSelectedObjects.getFirstNode(); | 1089 | for(nodep = mSelectedObjects->getFirstNode(); |
1120 | nodep != NULL; | 1090 | nodep != NULL; |
1121 | nodep = mSelectedObjects.getNextNode()) | 1091 | nodep = mSelectedObjects->getNextNode()) |
1122 | { | 1092 | { |
1123 | if(nodep->getObject() == objectp) | 1093 | if(nodep->getObject() == objectp) |
1124 | { | 1094 | { |
1125 | objectp->setSelected(FALSE); | 1095 | objectp->setSelected(FALSE); |
1126 | mSelectedObjects.removeNode(nodep); | 1096 | mSelectedObjects->removeNode(nodep); |
1127 | break; | 1097 | break; |
1128 | } | 1098 | } |
1129 | } | 1099 | } |
@@ -1140,7 +1110,7 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) | |||
1140 | { | 1110 | { |
1141 | // check if object already in list | 1111 | // check if object already in list |
1142 | // *FIX: can we just check isSelected()? | 1112 | // *FIX: can we just check isSelected()? |
1143 | LLSelectNode *nodep = findSelectNode(objectp); | 1113 | LLSelectNode *nodep = mSelectedObjects->findNode(objectp); |
1144 | 1114 | ||
1145 | if (!nodep) | 1115 | if (!nodep) |
1146 | { | 1116 | { |
@@ -1152,12 +1122,12 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) | |||
1152 | if (objectp->getNumTEs() <= 0) | 1122 | if (objectp->getNumTEs() <= 0) |
1153 | { | 1123 | { |
1154 | // object doesn't have faces, so blow it away | 1124 | // object doesn't have faces, so blow it away |
1155 | mSelectedObjects.removeNode(nodep); | 1125 | mSelectedObjects->removeNode(nodep); |
1156 | objectp->setSelected( FALSE ); | 1126 | objectp->setSelected( FALSE ); |
1157 | } | 1127 | } |
1158 | else if (te == SELECT_ALL_TES) | 1128 | else if (te == SELECT_ALL_TES) |
1159 | { | 1129 | { |
1160 | mSelectedObjects.removeNode(nodep); | 1130 | mSelectedObjects->removeNode(nodep); |
1161 | objectp->setSelected( FALSE ); | 1131 | objectp->setSelected( FALSE ); |
1162 | } | 1132 | } |
1163 | else if (0 <= te && te < SELECT_MAX_TES) | 1133 | else if (0 <= te && te < SELECT_MAX_TES) |
@@ -1183,7 +1153,7 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) | |||
1183 | // ...all faces now turned off, so remove | 1153 | // ...all faces now turned off, so remove |
1184 | if (!found) | 1154 | if (!found) |
1185 | { | 1155 | { |
1186 | mSelectedObjects.removeNode(nodep); | 1156 | mSelectedObjects->removeNode(nodep); |
1187 | objectp->setSelected( FALSE ); | 1157 | objectp->setSelected( FALSE ); |
1188 | 1158 | ||
1189 | // BUG: Doesn't update simulator that object is gone. | 1159 | // BUG: Doesn't update simulator that object is gone. |
@@ -1206,12 +1176,12 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) | |||
1206 | void LLSelectMgr::removeAll() | 1176 | void LLSelectMgr::removeAll() |
1207 | { | 1177 | { |
1208 | LLViewerObject *objectp; | 1178 | LLViewerObject *objectp; |
1209 | for (objectp = mSelectedObjects.getFirstObject(); objectp; objectp = mSelectedObjects.getNextObject() ) | 1179 | for (objectp = mSelectedObjects->getFirstObject(); objectp; objectp = mSelectedObjects->getNextObject() ) |
1210 | { | 1180 | { |
1211 | objectp->setSelected( FALSE ); | 1181 | objectp->setSelected( FALSE ); |
1212 | } | 1182 | } |
1213 | 1183 | ||
1214 | mSelectedObjects.deleteAllNodes(); | 1184 | mSelectedObjects->deleteAllNodes(); |
1215 | 1185 | ||
1216 | updateSelectionCenter(); | 1186 | updateSelectionCenter(); |
1217 | dialog_refresh_all(); | 1187 | dialog_refresh_all(); |
@@ -1228,9 +1198,9 @@ void LLSelectMgr::promoteSelectionToRoot() | |||
1228 | 1198 | ||
1229 | LLSelectNode* nodep; | 1199 | LLSelectNode* nodep; |
1230 | LLViewerObject *objectp; | 1200 | LLViewerObject *objectp; |
1231 | for (nodep = mSelectedObjects.getFirstNode(); | 1201 | for (nodep = mSelectedObjects->getFirstNode(); |
1232 | nodep; | 1202 | nodep; |
1233 | nodep = mSelectedObjects.getNextNode() ) | 1203 | nodep = mSelectedObjects->getNextNode() ) |
1234 | { | 1204 | { |
1235 | if (nodep->mIndividualSelection) | 1205 | if (nodep->mIndividualSelection) |
1236 | { | 1206 | { |
@@ -1266,9 +1236,9 @@ void LLSelectMgr::demoteSelectionToIndividuals() | |||
1266 | { | 1236 | { |
1267 | LLDynamicArray<LLViewerObject*> objects; | 1237 | LLDynamicArray<LLViewerObject*> objects; |
1268 | 1238 | ||
1269 | for (LLViewerObject* root_objectp = mSelectedObjects.getFirstRootObject(); | 1239 | for (LLViewerObject* root_objectp = mSelectedObjects->getFirstRootObject(); |
1270 | root_objectp; | 1240 | root_objectp; |
1271 | root_objectp = mSelectedObjects.getNextRootObject()) | 1241 | root_objectp = mSelectedObjects->getNextRootObject()) |
1272 | { | 1242 | { |
1273 | root_objectp->addThisAndNonJointChildren(objects); | 1243 | root_objectp->addThisAndNonJointChildren(objects); |
1274 | } | 1244 | } |
@@ -1284,71 +1254,20 @@ void LLSelectMgr::demoteSelectionToIndividuals() | |||
1284 | } | 1254 | } |
1285 | 1255 | ||
1286 | //----------------------------------------------------------------------------- | 1256 | //----------------------------------------------------------------------------- |
1287 | // getObjectCount() | ||
1288 | //----------------------------------------------------------------------------- | ||
1289 | S32 LLSelectMgr::getObjectCount() | ||
1290 | { | ||
1291 | return mSelectedObjects.getNumNodes(); | ||
1292 | } | ||
1293 | |||
1294 | |||
1295 | //----------------------------------------------------------------------------- | ||
1296 | // getTECount() | ||
1297 | //----------------------------------------------------------------------------- | ||
1298 | S32 LLSelectMgr::getTECount() | ||
1299 | { | ||
1300 | S32 count = 0; | ||
1301 | |||
1302 | LLSelectNode* nodep; | ||
1303 | for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode() ) | ||
1304 | { | ||
1305 | if (nodep->getObject()) | ||
1306 | { | ||
1307 | S32 num_tes = nodep->getObject()->getNumTEs(); | ||
1308 | for (S32 te = 0; te < num_tes; te++) | ||
1309 | { | ||
1310 | if (nodep->isTESelected(te)) | ||
1311 | { | ||
1312 | count++; | ||
1313 | } | ||
1314 | } | ||
1315 | } | ||
1316 | } | ||
1317 | |||
1318 | return count; | ||
1319 | } | ||
1320 | |||
1321 | //----------------------------------------------------------------------------- | ||
1322 | // getRootObjectCount() | ||
1323 | //----------------------------------------------------------------------------- | ||
1324 | S32 LLSelectMgr::getRootObjectCount() | ||
1325 | { | ||
1326 | LLSelectNode *nodep; | ||
1327 | |||
1328 | S32 count = 0; | ||
1329 | for(nodep = mSelectedObjects.getFirstRootNode(); nodep; nodep = mSelectedObjects.getNextRootNode()) | ||
1330 | { | ||
1331 | ++count; | ||
1332 | } | ||
1333 | return count; | ||
1334 | } | ||
1335 | |||
1336 | |||
1337 | //----------------------------------------------------------------------------- | ||
1338 | // dump() | 1257 | // dump() |
1339 | //----------------------------------------------------------------------------- | 1258 | //----------------------------------------------------------------------------- |
1340 | void LLSelectMgr::dump() | 1259 | void LLSelectMgr::dump() |
1341 | { | 1260 | { |
1342 | llinfos << "Selection Manager: " << mSelectedObjects.getNumNodes() << " items" << llendl; | 1261 | llinfos << "Selection Manager: " << mSelectedObjects->getNumNodes() << " items" << llendl; |
1343 | 1262 | ||
1344 | llinfos << "TE mode " << mTEMode << llendl; | 1263 | llinfos << "TE mode " << mTEMode << llendl; |
1345 | 1264 | ||
1346 | S32 i = 0; | 1265 | S32 i = 0; |
1347 | 1266 | ||
1348 | LLViewerObject *objectp; | 1267 | LLViewerObject *objectp; |
1349 | for (objectp = mSelectedObjects.getFirstObject(); | 1268 | for (objectp = mSelectedObjects->getFirstObject(); |
1350 | objectp; | 1269 | objectp; |
1351 | objectp = mSelectedObjects.getNextObject()) | 1270 | objectp = mSelectedObjects->getNextObject()) |
1352 | { | 1271 | { |
1353 | llinfos << "Object " << i << " type " << LLPrimitive::pCodeToString(objectp->getPCode()) << llendl; | 1272 | llinfos << "Object " << i << " type " << LLPrimitive::pCodeToString(objectp->getPCode()) << llendl; |
1354 | llinfos << " hasLSL " << objectp->flagScripted() << llendl; | 1273 | llinfos << " hasLSL " << objectp->flagScripted() << llendl; |
@@ -1366,14 +1285,14 @@ void LLSelectMgr::dump() | |||
1366 | 1285 | ||
1367 | // Face iterator | 1286 | // Face iterator |
1368 | S32 te; | 1287 | S32 te; |
1369 | for (mSelectedObjects.getFirstTE(&objectp, &te); | 1288 | for (mSelectedObjects->getFirstTE(&objectp, &te); |
1370 | objectp; | 1289 | objectp; |
1371 | mSelectedObjects.getNextTE(&objectp, &te)) | 1290 | mSelectedObjects->getNextTE(&objectp, &te)) |
1372 | { | 1291 | { |
1373 | llinfos << "Object " << objectp << " te " << te << llendl; | 1292 | llinfos << "Object " << objectp << " te " << te << llendl; |
1374 | } | 1293 | } |
1375 | 1294 | ||
1376 | llinfos << mHighlightedObjects.getNumNodes() << " objects currently highlighted." << llendl; | 1295 | llinfos << mHighlightedObjects->getNumNodes() << " objects currently highlighted." << llendl; |
1377 | 1296 | ||
1378 | llinfos << "Center global " << mSelectionCenterGlobal << llendl; | 1297 | llinfos << "Center global " << mSelectionCenterGlobal << llendl; |
1379 | } | 1298 | } |
@@ -1402,7 +1321,7 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) | |||
1402 | 1321 | ||
1403 | if(item | 1322 | if(item |
1404 | && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()) | 1323 | && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()) |
1405 | && (mSelectedObjects.getNumNodes() > 1) ) | 1324 | && (mSelectedObjects->getNumNodes() > 1) ) |
1406 | { | 1325 | { |
1407 | llwarns << "Attempted to apply no-copy texture to multiple objects" | 1326 | llwarns << "Attempted to apply no-copy texture to multiple objects" |
1408 | << llendl; | 1327 | << llendl; |
@@ -1412,43 +1331,43 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) | |||
1412 | LLViewerObject* objectp; | 1331 | LLViewerObject* objectp; |
1413 | S32 te; | 1332 | S32 te; |
1414 | 1333 | ||
1415 | // Apply the texture to each side | 1334 | for (mSelectedObjects->getFirstTE(&objectp, &te); objectp; mSelectedObjects->getNextTE(&objectp, &te)) |
1416 | for (mSelectedObjects.getFirstTE(&objectp, &te); objectp; mSelectedObjects.getNextTE(&objectp, &te)) | ||
1417 | { | 1335 | { |
1418 | |||
1419 | if (item) | 1336 | if (item) |
1420 | { | 1337 | { |
1421 | LLToolDragAndDrop::dropTextureOneFace(objectp,te,item,LLToolDragAndDrop::SOURCE_AGENT,LLUUID::null); | 1338 | if (te == -1) // all faces |
1422 | |||
1423 | // HACK! HACK! ARG! | ||
1424 | // *TODO: Replace mSelectedObjects with a REAL container class! | ||
1425 | LLViewerObject* tmp_object; | ||
1426 | S32 tmp_te; | ||
1427 | mSelectedObjects.getCurrentTE(&tmp_object,&tmp_te); | ||
1428 | if ((tmp_object != objectp) || (tmp_te != te) ) | ||
1429 | { | 1339 | { |
1430 | //AAARG someone has moved our list around! | 1340 | LLToolDragAndDrop::dropTextureAllFaces(objectp, |
1431 | mSelectedObjects.getFirstTE(&tmp_object, &tmp_te); | 1341 | item, |
1432 | while ((tmp_object != objectp) || (tmp_te != te)) | 1342 | LLToolDragAndDrop::SOURCE_AGENT, |
1433 | { | 1343 | LLUUID::null); |
1434 | mSelectedObjects.getNextTE(&tmp_object, &tmp_te); | 1344 | } |
1435 | } | 1345 | else // one face |
1346 | { | ||
1347 | LLToolDragAndDrop::dropTextureOneFace(objectp, | ||
1348 | te, | ||
1349 | item, | ||
1350 | LLToolDragAndDrop::SOURCE_AGENT, | ||
1351 | LLUUID::null); | ||
1436 | } | 1352 | } |
1437 | } | 1353 | } |
1438 | else | 1354 | |
1355 | else // not an inventory item | ||
1439 | { | 1356 | { |
1440 | // Texture picker defaults aren't inventory items | 1357 | // Texture picker defaults aren't inventory items |
1441 | // * Don't need to worry about permissions for them | 1358 | // * Don't need to worry about permissions for them |
1442 | // * Can just apply the texture and be done with it. | 1359 | // * Can just apply the texture and be done with it. |
1443 | objectp->setTEImage(te, gImageList.getImage(imageid)); | 1360 | objectp->setTEImage(te, gImageList.getImage(imageid)); |
1361 | |||
1444 | objectp->sendTEUpdate(); | 1362 | objectp->sendTEUpdate(); |
1445 | } | 1363 | } |
1446 | } | 1364 | } |
1447 | 1365 | ||
1366 | |||
1448 | // 1 particle effect per object | 1367 | // 1 particle effect per object |
1449 | if (mSelectType != SELECT_TYPE_HUD) | 1368 | if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD) |
1450 | { | 1369 | { |
1451 | for (objectp = mSelectedObjects.getFirstObject(); objectp; objectp = mSelectedObjects.getNextObject()) | 1370 | for (objectp = mSelectedObjects->getFirstObject(); objectp; objectp = mSelectedObjects->getNextObject()) |
1452 | { | 1371 | { |
1453 | LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); | 1372 | LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE); |
1454 | effectp->setSourceObject(gAgent.getAvatarObject()); | 1373 | effectp->setSourceObject(gAgent.getAvatarObject()); |
@@ -1466,7 +1385,7 @@ void LLSelectMgr::selectionSetColor(const LLColor4 &color) | |||
1466 | { | 1385 | { |
1467 | LLViewerObject* object; | 1386 | LLViewerObject* object; |
1468 | S32 te; | 1387 | S32 te; |
1469 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) ) | 1388 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) ) |
1470 | { | 1389 | { |
1471 | if (object->permModify()) | 1390 | if (object->permModify()) |
1472 | { | 1391 | { |
@@ -1475,7 +1394,7 @@ void LLSelectMgr::selectionSetColor(const LLColor4 &color) | |||
1475 | } | 1394 | } |
1476 | } | 1395 | } |
1477 | 1396 | ||
1478 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1397 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
1479 | { | 1398 | { |
1480 | if (object->permModify()) | 1399 | if (object->permModify()) |
1481 | { | 1400 | { |
@@ -1492,7 +1411,7 @@ void LLSelectMgr::selectionSetColorOnly(const LLColor4 &color) | |||
1492 | LLViewerObject* object; | 1411 | LLViewerObject* object; |
1493 | LLColor4 new_color = color; | 1412 | LLColor4 new_color = color; |
1494 | S32 te; | 1413 | S32 te; |
1495 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) ) | 1414 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) ) |
1496 | { | 1415 | { |
1497 | if (object->permModify()) | 1416 | if (object->permModify()) |
1498 | { | 1417 | { |
@@ -1503,7 +1422,7 @@ void LLSelectMgr::selectionSetColorOnly(const LLColor4 &color) | |||
1503 | } | 1422 | } |
1504 | } | 1423 | } |
1505 | 1424 | ||
1506 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1425 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
1507 | { | 1426 | { |
1508 | if (object->permModify()) | 1427 | if (object->permModify()) |
1509 | { | 1428 | { |
@@ -1519,7 +1438,7 @@ void LLSelectMgr::selectionSetAlphaOnly(const F32 alpha) | |||
1519 | { | 1438 | { |
1520 | LLViewerObject* object; | 1439 | LLViewerObject* object; |
1521 | S32 te; | 1440 | S32 te; |
1522 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) ) | 1441 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) ) |
1523 | { | 1442 | { |
1524 | if (object->permModify()) | 1443 | if (object->permModify()) |
1525 | { | 1444 | { |
@@ -1530,7 +1449,7 @@ void LLSelectMgr::selectionSetAlphaOnly(const F32 alpha) | |||
1530 | } | 1449 | } |
1531 | } | 1450 | } |
1532 | 1451 | ||
1533 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1452 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
1534 | { | 1453 | { |
1535 | if (object->permModify()) | 1454 | if (object->permModify()) |
1536 | { | 1455 | { |
@@ -1544,11 +1463,11 @@ void LLSelectMgr::selectionRevertColors() | |||
1544 | LLViewerObject* object; | 1463 | LLViewerObject* object; |
1545 | S32 te; | 1464 | S32 te; |
1546 | 1465 | ||
1547 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) ) | 1466 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) ) |
1548 | { | 1467 | { |
1549 | if (object->permModify()) | 1468 | if (object->permModify()) |
1550 | { | 1469 | { |
1551 | LLSelectNode* nodep = mSelectedObjects.findNode(object); | 1470 | LLSelectNode* nodep = mSelectedObjects->findNode(object); |
1552 | if (nodep && te < (S32)nodep->mSavedColors.size()) | 1471 | if (nodep && te < (S32)nodep->mSavedColors.size()) |
1553 | { | 1472 | { |
1554 | LLColor4 color = nodep->mSavedColors[te]; | 1473 | LLColor4 color = nodep->mSavedColors[te]; |
@@ -1558,7 +1477,7 @@ void LLSelectMgr::selectionRevertColors() | |||
1558 | } | 1477 | } |
1559 | } | 1478 | } |
1560 | 1479 | ||
1561 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1480 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
1562 | { | 1481 | { |
1563 | if (object->permModify()) | 1482 | if (object->permModify()) |
1564 | { | 1483 | { |
@@ -1573,11 +1492,11 @@ BOOL LLSelectMgr::selectionRevertTextures() | |||
1573 | S32 te; | 1492 | S32 te; |
1574 | 1493 | ||
1575 | BOOL revert_successful = TRUE; | 1494 | BOOL revert_successful = TRUE; |
1576 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) ) | 1495 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) ) |
1577 | { | 1496 | { |
1578 | if (object->permModify()) | 1497 | if (object->permModify()) |
1579 | { | 1498 | { |
1580 | LLSelectNode* nodep = mSelectedObjects.findNode(object); | 1499 | LLSelectNode* nodep = mSelectedObjects->findNode(object); |
1581 | if (nodep && te < (S32)nodep->mSavedTextures.size()) | 1500 | if (nodep && te < (S32)nodep->mSavedTextures.size()) |
1582 | { | 1501 | { |
1583 | LLUUID id = nodep->mSavedTextures[te]; | 1502 | LLUUID id = nodep->mSavedTextures[te]; |
@@ -1596,7 +1515,7 @@ BOOL LLSelectMgr::selectionRevertTextures() | |||
1596 | } | 1515 | } |
1597 | 1516 | ||
1598 | // propagate texture changes to server | 1517 | // propagate texture changes to server |
1599 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1518 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
1600 | { | 1519 | { |
1601 | if (object->permModify()) | 1520 | if (object->permModify()) |
1602 | { | 1521 | { |
@@ -1611,7 +1530,7 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap) | |||
1611 | { | 1530 | { |
1612 | LLViewerObject* object; | 1531 | LLViewerObject* object; |
1613 | S32 te; | 1532 | S32 te; |
1614 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) ) | 1533 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) ) |
1615 | { | 1534 | { |
1616 | if (object->permModify()) | 1535 | if (object->permModify()) |
1617 | { | 1536 | { |
@@ -1620,7 +1539,7 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap) | |||
1620 | } | 1539 | } |
1621 | } | 1540 | } |
1622 | 1541 | ||
1623 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1542 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
1624 | { | 1543 | { |
1625 | if (object->permModify()) | 1544 | if (object->permModify()) |
1626 | { | 1545 | { |
@@ -1633,7 +1552,7 @@ void LLSelectMgr::selectionSetTexGen(U8 texgen) | |||
1633 | { | 1552 | { |
1634 | LLViewerObject* object; | 1553 | LLViewerObject* object; |
1635 | S32 te; | 1554 | S32 te; |
1636 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) ) | 1555 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) ) |
1637 | { | 1556 | { |
1638 | if (object->permModify()) | 1557 | if (object->permModify()) |
1639 | { | 1558 | { |
@@ -1642,7 +1561,7 @@ void LLSelectMgr::selectionSetTexGen(U8 texgen) | |||
1642 | } | 1561 | } |
1643 | } | 1562 | } |
1644 | 1563 | ||
1645 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1564 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
1646 | { | 1565 | { |
1647 | if (object->permModify()) | 1566 | if (object->permModify()) |
1648 | { | 1567 | { |
@@ -1656,7 +1575,7 @@ void LLSelectMgr::selectionSetShiny(U8 shiny) | |||
1656 | { | 1575 | { |
1657 | LLViewerObject* object; | 1576 | LLViewerObject* object; |
1658 | S32 te; | 1577 | S32 te; |
1659 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) ) | 1578 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) ) |
1660 | { | 1579 | { |
1661 | if (object->permModify()) | 1580 | if (object->permModify()) |
1662 | { | 1581 | { |
@@ -1665,7 +1584,7 @@ void LLSelectMgr::selectionSetShiny(U8 shiny) | |||
1665 | } | 1584 | } |
1666 | } | 1585 | } |
1667 | 1586 | ||
1668 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1587 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
1669 | { | 1588 | { |
1670 | if (object->permModify()) | 1589 | if (object->permModify()) |
1671 | { | 1590 | { |
@@ -1678,7 +1597,7 @@ void LLSelectMgr::selectionSetFullbright(U8 fullbright) | |||
1678 | { | 1597 | { |
1679 | LLViewerObject* object; | 1598 | LLViewerObject* object; |
1680 | S32 te; | 1599 | S32 te; |
1681 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) ) | 1600 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) ) |
1682 | { | 1601 | { |
1683 | if (object->permModify()) | 1602 | if (object->permModify()) |
1684 | { | 1603 | { |
@@ -1687,7 +1606,7 @@ void LLSelectMgr::selectionSetFullbright(U8 fullbright) | |||
1687 | } | 1606 | } |
1688 | } | 1607 | } |
1689 | 1608 | ||
1690 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1609 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
1691 | { | 1610 | { |
1692 | if (object->permModify()) | 1611 | if (object->permModify()) |
1693 | { | 1612 | { |
@@ -1718,7 +1637,7 @@ void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string& | |||
1718 | media_flags = LLTextureEntry::MF_WEB_PAGE; | 1637 | media_flags = LLTextureEntry::MF_WEB_PAGE; |
1719 | } | 1638 | } |
1720 | 1639 | ||
1721 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te) ) | 1640 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) ) |
1722 | { | 1641 | { |
1723 | if (object->permModify()) | 1642 | if (object->permModify()) |
1724 | { | 1643 | { |
@@ -1727,7 +1646,7 @@ void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string& | |||
1727 | } | 1646 | } |
1728 | } | 1647 | } |
1729 | 1648 | ||
1730 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1649 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
1731 | { | 1650 | { |
1732 | if (object->permModify()) | 1651 | if (object->permModify()) |
1733 | { | 1652 | { |
@@ -1749,7 +1668,7 @@ LLPermissions* LLSelectMgr::findObjectPermissions(const LLViewerObject* object) | |||
1749 | { | 1668 | { |
1750 | LLSelectNode* nodep; | 1669 | LLSelectNode* nodep; |
1751 | 1670 | ||
1752 | for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode() ) | 1671 | for (nodep = mSelectedObjects->getFirstNode(); nodep; nodep = mSelectedObjects->getNextNode() ) |
1753 | { | 1672 | { |
1754 | if((nodep->getObject() == object) && nodep->mValid) | 1673 | if((nodep->getObject() == object) && nodep->mValid) |
1755 | { | 1674 | { |
@@ -1768,7 +1687,7 @@ BOOL LLSelectMgr::selectionGetTexUUID(LLUUID& id) | |||
1768 | { | 1687 | { |
1769 | LLViewerObject* first_objectp; | 1688 | LLViewerObject* first_objectp; |
1770 | S32 first_te; | 1689 | S32 first_te; |
1771 | mSelectedObjects.getPrimaryTE(&first_objectp, &first_te); | 1690 | mSelectedObjects->getPrimaryTE(&first_objectp, &first_te); |
1772 | 1691 | ||
1773 | // nothing selected | 1692 | // nothing selected |
1774 | if (!first_objectp) | 1693 | if (!first_objectp) |
@@ -1786,7 +1705,7 @@ BOOL LLSelectMgr::selectionGetTexUUID(LLUUID& id) | |||
1786 | BOOL identical = TRUE; | 1705 | BOOL identical = TRUE; |
1787 | LLViewerObject *objectp; | 1706 | LLViewerObject *objectp; |
1788 | S32 te; | 1707 | S32 te; |
1789 | for (mSelectedObjects.getFirstTE(&objectp, &te); objectp; mSelectedObjects.getNextTE(&objectp, &te) ) | 1708 | for (mSelectedObjects->getFirstTE(&objectp, &te); objectp; mSelectedObjects->getNextTE(&objectp, &te) ) |
1790 | { | 1709 | { |
1791 | if (objectp->getTEImage(te) != first_imagep) | 1710 | if (objectp->getTEImage(te) != first_imagep) |
1792 | { | 1711 | { |
@@ -1806,7 +1725,7 @@ BOOL LLSelectMgr::selectionGetColor(LLColor4 &color) | |||
1806 | { | 1725 | { |
1807 | LLViewerObject* first_object; | 1726 | LLViewerObject* first_object; |
1808 | S32 first_te; | 1727 | S32 first_te; |
1809 | mSelectedObjects.getPrimaryTE(&first_object, &first_te); | 1728 | mSelectedObjects->getPrimaryTE(&first_object, &first_te); |
1810 | 1729 | ||
1811 | // nothing selected | 1730 | // nothing selected |
1812 | if (!first_object) | 1731 | if (!first_object) |
@@ -1827,7 +1746,7 @@ BOOL LLSelectMgr::selectionGetColor(LLColor4 &color) | |||
1827 | BOOL identical = TRUE; | 1746 | BOOL identical = TRUE; |
1828 | LLViewerObject* object; | 1747 | LLViewerObject* object; |
1829 | S32 te; | 1748 | S32 te; |
1830 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te)) | 1749 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te)) |
1831 | { | 1750 | { |
1832 | if (!object->getTE(te) || (object->getTE(te)->getColor() != first_color)) | 1751 | if (!object->getTE(te) || (object->getTE(te)->getColor() != first_color)) |
1833 | { | 1752 | { |
@@ -1848,7 +1767,7 @@ BOOL LLSelectMgr::selectionGetBumpmap(U8 *bumpmap) | |||
1848 | { | 1767 | { |
1849 | LLViewerObject* first_object; | 1768 | LLViewerObject* first_object; |
1850 | S32 first_te; | 1769 | S32 first_te; |
1851 | mSelectedObjects.getPrimaryTE(&first_object, &first_te); | 1770 | mSelectedObjects->getPrimaryTE(&first_object, &first_te); |
1852 | 1771 | ||
1853 | // nothing selected | 1772 | // nothing selected |
1854 | if (!first_object) | 1773 | if (!first_object) |
@@ -1869,7 +1788,7 @@ BOOL LLSelectMgr::selectionGetBumpmap(U8 *bumpmap) | |||
1869 | BOOL identical = TRUE; | 1788 | BOOL identical = TRUE; |
1870 | LLViewerObject* object; | 1789 | LLViewerObject* object; |
1871 | S32 te; | 1790 | S32 te; |
1872 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te)) | 1791 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te)) |
1873 | { | 1792 | { |
1874 | if (!object->getTE(te) || (object->getTE(te)->getBumpmap() != first_value)) | 1793 | if (!object->getTE(te) || (object->getTE(te)->getBumpmap() != first_value)) |
1875 | { | 1794 | { |
@@ -1889,7 +1808,7 @@ BOOL LLSelectMgr::selectionGetShiny(U8 *shiny) | |||
1889 | { | 1808 | { |
1890 | LLViewerObject* first_object; | 1809 | LLViewerObject* first_object; |
1891 | S32 first_te; | 1810 | S32 first_te; |
1892 | mSelectedObjects.getPrimaryTE(&first_object, &first_te); | 1811 | mSelectedObjects->getPrimaryTE(&first_object, &first_te); |
1893 | 1812 | ||
1894 | // nothing selected | 1813 | // nothing selected |
1895 | if (!first_object) | 1814 | if (!first_object) |
@@ -1910,7 +1829,7 @@ BOOL LLSelectMgr::selectionGetShiny(U8 *shiny) | |||
1910 | BOOL identical = TRUE; | 1829 | BOOL identical = TRUE; |
1911 | LLViewerObject* object; | 1830 | LLViewerObject* object; |
1912 | S32 te; | 1831 | S32 te; |
1913 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te)) | 1832 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te)) |
1914 | { | 1833 | { |
1915 | if (!object->getTE(te) || (object->getTE(te)->getShiny() != first_value)) | 1834 | if (!object->getTE(te) || (object->getTE(te)->getShiny() != first_value)) |
1916 | { | 1835 | { |
@@ -1930,7 +1849,7 @@ BOOL LLSelectMgr::selectionGetFullbright(U8 *fullbright) | |||
1930 | { | 1849 | { |
1931 | LLViewerObject* first_object; | 1850 | LLViewerObject* first_object; |
1932 | S32 first_te; | 1851 | S32 first_te; |
1933 | mSelectedObjects.getPrimaryTE(&first_object, &first_te); | 1852 | mSelectedObjects->getPrimaryTE(&first_object, &first_te); |
1934 | 1853 | ||
1935 | // nothing selected | 1854 | // nothing selected |
1936 | if (!first_object) | 1855 | if (!first_object) |
@@ -1951,7 +1870,7 @@ BOOL LLSelectMgr::selectionGetFullbright(U8 *fullbright) | |||
1951 | BOOL identical = TRUE; | 1870 | BOOL identical = TRUE; |
1952 | LLViewerObject* object; | 1871 | LLViewerObject* object; |
1953 | S32 te; | 1872 | S32 te; |
1954 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te)) | 1873 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te)) |
1955 | { | 1874 | { |
1956 | if (!object->getTE(te) || (object->getTE(te)->getFullbright() != first_value)) | 1875 | if (!object->getTE(te) || (object->getTE(te)->getFullbright() != first_value)) |
1957 | { | 1876 | { |
@@ -1969,7 +1888,7 @@ bool LLSelectMgr::selectionGetMediaType(U8 *media_type) | |||
1969 | { | 1888 | { |
1970 | LLViewerObject* first_object; | 1889 | LLViewerObject* first_object; |
1971 | S32 first_te; | 1890 | S32 first_te; |
1972 | mSelectedObjects.getPrimaryTE(&first_object, &first_te); | 1891 | mSelectedObjects->getPrimaryTE(&first_object, &first_te); |
1973 | 1892 | ||
1974 | // nothing selected | 1893 | // nothing selected |
1975 | if (!first_object) | 1894 | if (!first_object) |
@@ -1990,7 +1909,7 @@ bool LLSelectMgr::selectionGetMediaType(U8 *media_type) | |||
1990 | bool identical = true; | 1909 | bool identical = true; |
1991 | LLViewerObject* object; | 1910 | LLViewerObject* object; |
1992 | S32 te; | 1911 | S32 te; |
1993 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te)) | 1912 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te)) |
1994 | { | 1913 | { |
1995 | if (!object->getTE(te) || (object->getTE(te)->getMediaFlags() != first_value)) | 1914 | if (!object->getTE(te) || (object->getTE(te)->getMediaFlags() != first_value)) |
1996 | { | 1915 | { |
@@ -2011,7 +1930,7 @@ bool LLSelectMgr::selectionGetMediaType(U8 *media_type) | |||
2011 | void LLSelectMgr::selectionSetMaterial(U8 material) | 1930 | void LLSelectMgr::selectionSetMaterial(U8 material) |
2012 | { | 1931 | { |
2013 | LLViewerObject* object; | 1932 | LLViewerObject* object; |
2014 | for (object = mSelectedObjects.getFirstObject(); object != NULL; object = mSelectedObjects.getNextObject() ) | 1933 | for (object = mSelectedObjects->getFirstObject(); object != NULL; object = mSelectedObjects->getNextObject() ) |
2015 | { | 1934 | { |
2016 | if (object->permModify()) | 1935 | if (object->permModify()) |
2017 | { | 1936 | { |
@@ -2027,7 +1946,7 @@ void LLSelectMgr::selectionSetMaterial(U8 material) | |||
2027 | BOOL LLSelectMgr::selectionAllPCode(LLPCode code) | 1946 | BOOL LLSelectMgr::selectionAllPCode(LLPCode code) |
2028 | { | 1947 | { |
2029 | LLViewerObject *object; | 1948 | LLViewerObject *object; |
2030 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1949 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
2031 | { | 1950 | { |
2032 | if (object->getPCode() != code) | 1951 | if (object->getPCode() != code) |
2033 | { | 1952 | { |
@@ -2042,13 +1961,13 @@ BOOL LLSelectMgr::selectionAllPCode(LLPCode code) | |||
2042 | //----------------------------------------------------------------------------- | 1961 | //----------------------------------------------------------------------------- |
2043 | BOOL LLSelectMgr::selectionGetMaterial(U8 *out_material) | 1962 | BOOL LLSelectMgr::selectionGetMaterial(U8 *out_material) |
2044 | { | 1963 | { |
2045 | LLViewerObject *object = mSelectedObjects.getFirstObject(); | 1964 | LLViewerObject *object = mSelectedObjects->getFirstObject(); |
2046 | if (!object) return FALSE; | 1965 | if (!object) return FALSE; |
2047 | 1966 | ||
2048 | U8 material = object->getMaterial(); | 1967 | U8 material = object->getMaterial(); |
2049 | 1968 | ||
2050 | BOOL identical = TRUE; | 1969 | BOOL identical = TRUE; |
2051 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1970 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
2052 | { | 1971 | { |
2053 | if ( material != object->getMaterial()) | 1972 | if ( material != object->getMaterial()) |
2054 | { | 1973 | { |
@@ -2063,13 +1982,13 @@ BOOL LLSelectMgr::selectionGetMaterial(U8 *out_material) | |||
2063 | 1982 | ||
2064 | BOOL LLSelectMgr::selectionGetClickAction(U8 *out_action) | 1983 | BOOL LLSelectMgr::selectionGetClickAction(U8 *out_action) |
2065 | { | 1984 | { |
2066 | LLViewerObject *object = mSelectedObjects.getFirstObject(); | 1985 | LLViewerObject *object = mSelectedObjects->getFirstObject(); |
2067 | if (!object) return FALSE; | 1986 | if (!object) return FALSE; |
2068 | 1987 | ||
2069 | U8 action = object->getClickAction(); | 1988 | U8 action = object->getClickAction(); |
2070 | 1989 | ||
2071 | BOOL identical = TRUE; | 1990 | BOOL identical = TRUE; |
2072 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 1991 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
2073 | { | 1992 | { |
2074 | if ( action != object->getClickAction()) | 1993 | if ( action != object->getClickAction()) |
2075 | { | 1994 | { |
@@ -2085,7 +2004,7 @@ BOOL LLSelectMgr::selectionGetClickAction(U8 *out_action) | |||
2085 | void LLSelectMgr::selectionSetClickAction(U8 action) | 2004 | void LLSelectMgr::selectionSetClickAction(U8 action) |
2086 | { | 2005 | { |
2087 | LLViewerObject* object = NULL; | 2006 | LLViewerObject* object = NULL; |
2088 | for ( object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 2007 | for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
2089 | { | 2008 | { |
2090 | object->setClickAction(action); | 2009 | object->setClickAction(action); |
2091 | } | 2010 | } |
@@ -2118,7 +2037,7 @@ void LLSelectMgr::sendGodlikeRequest(const LLString& request, const LLString& pa | |||
2118 | } | 2037 | } |
2119 | 2038 | ||
2120 | godlike_request_t data(request, param); | 2039 | godlike_request_t data(request, param); |
2121 | if(!getRootObjectCount()) | 2040 | if(!mSelectedObjects->getRootObjectCount()) |
2122 | { | 2041 | { |
2123 | LLMessageSystem* msg = gMessageSystem; | 2042 | LLMessageSystem* msg = gMessageSystem; |
2124 | msg->newMessage(message_type.c_str()); | 2043 | msg->newMessage(message_type.c_str()); |
@@ -2158,8 +2077,8 @@ void LLSelectMgr::packGodlikeHead(void* user_data) | |||
2158 | // static | 2077 | // static |
2159 | void LLSelectMgr::packObjectIDAsParam(LLSelectNode* node, void *) | 2078 | void LLSelectMgr::packObjectIDAsParam(LLSelectNode* node, void *) |
2160 | { | 2079 | { |
2161 | char buf [MAX_STRING]; | 2080 | char buf [MAX_STRING]; /* Flawfinder: ignore */ |
2162 | sprintf(buf, "%u", node->getObject()->getLocalID()); | 2081 | snprintf(buf, MAX_STRING, "%u", node->getObject()->getLocalID()); /* Flawfinder: ignore */ |
2163 | gMessageSystem->nextBlock("ParamList"); | 2082 | gMessageSystem->nextBlock("ParamList"); |
2164 | gMessageSystem->addString("Parameter", buf); | 2083 | gMessageSystem->addString("Parameter", buf); |
2165 | } | 2084 | } |
@@ -2172,7 +2091,7 @@ void LLSelectMgr::selectionResetRotation() | |||
2172 | LLQuaternion identity(0.f, 0.f, 0.f, 1.f); | 2091 | LLQuaternion identity(0.f, 0.f, 0.f, 1.f); |
2173 | 2092 | ||
2174 | LLViewerObject* object; | 2093 | LLViewerObject* object; |
2175 | for (object = mSelectedObjects.getFirstRootObject(); object; object = mSelectedObjects.getNextRootObject() ) | 2094 | for (object = mSelectedObjects->getFirstRootObject(); object; object = mSelectedObjects->getNextRootObject() ) |
2176 | { | 2095 | { |
2177 | object->setRotation(identity); | 2096 | object->setRotation(identity); |
2178 | if (object->mDrawable.notNull()) | 2097 | if (object->mDrawable.notNull()) |
@@ -2188,7 +2107,7 @@ void LLSelectMgr::selectionRotateAroundZ(F32 degrees) | |||
2188 | LLQuaternion rot( degrees * DEG_TO_RAD, LLVector3(0,0,1) ); | 2107 | LLQuaternion rot( degrees * DEG_TO_RAD, LLVector3(0,0,1) ); |
2189 | 2108 | ||
2190 | LLViewerObject* object; | 2109 | LLViewerObject* object; |
2191 | for (object = mSelectedObjects.getFirstRootObject(); object; object = mSelectedObjects.getNextRootObject() ) | 2110 | for (object = mSelectedObjects->getFirstRootObject(); object; object = mSelectedObjects->getNextRootObject() ) |
2192 | { | 2111 | { |
2193 | object->setRotation( object->getRotationEdit() * rot ); | 2112 | object->setRotation( object->getRotationEdit() * rot ); |
2194 | if (object->mDrawable.notNull()) | 2113 | if (object->mDrawable.notNull()) |
@@ -2207,7 +2126,7 @@ void LLSelectMgr::selectionTexScaleAutofit(F32 repeats_per_meter) | |||
2207 | { | 2126 | { |
2208 | LLViewerObject* object; | 2127 | LLViewerObject* object; |
2209 | S32 te; | 2128 | S32 te; |
2210 | for (mSelectedObjects.getFirstTE(&object, &te); object; mSelectedObjects.getNextTE(&object, &te)) | 2129 | for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te)) |
2211 | { | 2130 | { |
2212 | if (!object->permModify()) | 2131 | if (!object->permModify()) |
2213 | { | 2132 | { |
@@ -2232,7 +2151,7 @@ void LLSelectMgr::selectionTexScaleAutofit(F32 repeats_per_meter) | |||
2232 | object->setTEScale(te, new_s, new_t); | 2151 | object->setTEScale(te, new_s, new_t); |
2233 | } | 2152 | } |
2234 | 2153 | ||
2235 | for (object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject()) | 2154 | for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject()) |
2236 | { | 2155 | { |
2237 | if (object->permModify()) | 2156 | if (object->permModify()) |
2238 | { | 2157 | { |
@@ -2299,7 +2218,7 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch) | |||
2299 | 2218 | ||
2300 | BOOL send = FALSE; | 2219 | BOOL send = FALSE; |
2301 | 2220 | ||
2302 | for (selectNode = mSelectedObjects.getFirstNode(); selectNode; selectNode = mSelectedObjects.getNextNode()) | 2221 | for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode()) |
2303 | { | 2222 | { |
2304 | object = selectNode->getObject(); | 2223 | object = selectNode->getObject(); |
2305 | if (!object->permModify()) | 2224 | if (!object->permModify()) |
@@ -2357,7 +2276,7 @@ void LLSelectMgr::selectionResetTexInfo(S32 selected_face) | |||
2357 | S32 start_face, end_face; | 2276 | S32 start_face, end_face; |
2358 | 2277 | ||
2359 | LLViewerObject* object; | 2278 | LLViewerObject* object; |
2360 | for (object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject()) | 2279 | for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject()) |
2361 | { | 2280 | { |
2362 | if (!object->permModify()) | 2281 | if (!object->permModify()) |
2363 | { | 2282 | { |
@@ -2392,259 +2311,12 @@ void LLSelectMgr::selectionResetTexInfo(S32 selected_face) | |||
2392 | } | 2311 | } |
2393 | 2312 | ||
2394 | //----------------------------------------------------------------------------- | 2313 | //----------------------------------------------------------------------------- |
2395 | // getFirstEditableObject() | ||
2396 | //----------------------------------------------------------------------------- | ||
2397 | LLViewerObject* LLSelectMgr::getFirstEditableObject(BOOL get_root) | ||
2398 | { | ||
2399 | LLViewerObject* object = NULL; | ||
2400 | for(LLViewerObject* cur = mSelectedObjects.getFirstObject(); cur; cur = mSelectedObjects.getNextObject()) | ||
2401 | { | ||
2402 | if( cur->permModify() ) | ||
2403 | { | ||
2404 | object = cur; | ||
2405 | break; | ||
2406 | } | ||
2407 | } | ||
2408 | |||
2409 | if (get_root && object) | ||
2410 | { | ||
2411 | LLViewerObject *parent; | ||
2412 | while ((parent = (LLViewerObject*)object->getParent())) | ||
2413 | { | ||
2414 | if (parent->isSelected()) | ||
2415 | { | ||
2416 | object = parent; | ||
2417 | } | ||
2418 | else | ||
2419 | { | ||
2420 | break; | ||
2421 | } | ||
2422 | } | ||
2423 | } | ||
2424 | |||
2425 | return object; | ||
2426 | } | ||
2427 | |||
2428 | //----------------------------------------------------------------------------- | ||
2429 | // getFirstMoveableObject() | ||
2430 | //----------------------------------------------------------------------------- | ||
2431 | LLViewerObject* LLSelectMgr::getFirstMoveableObject(BOOL get_root) | ||
2432 | { | ||
2433 | LLViewerObject* object = NULL; | ||
2434 | for(LLViewerObject* cur = mSelectedObjects.getFirstObject(); cur; cur = mSelectedObjects.getNextObject()) | ||
2435 | { | ||
2436 | if( cur->permMove() ) | ||
2437 | { | ||
2438 | object = cur; | ||
2439 | break; | ||
2440 | } | ||
2441 | } | ||
2442 | |||
2443 | if (get_root && object && !object->isJointChild()) | ||
2444 | { | ||
2445 | LLViewerObject *parent; | ||
2446 | while ((parent = (LLViewerObject*)object->getParent())) | ||
2447 | { | ||
2448 | if (parent->isSelected()) | ||
2449 | { | ||
2450 | object = parent; | ||
2451 | } | ||
2452 | else | ||
2453 | { | ||
2454 | break; | ||
2455 | } | ||
2456 | } | ||
2457 | } | ||
2458 | |||
2459 | return object; | ||
2460 | } | ||
2461 | |||
2462 | //----------------------------------------------------------------------------- | ||
2463 | // getFirstEditableNode() | ||
2464 | //----------------------------------------------------------------------------- | ||
2465 | LLSelectNode* LLSelectMgr::getFirstEditableNode(BOOL get_root) | ||
2466 | { | ||
2467 | LLSelectNode* selectNode = NULL; | ||
2468 | |||
2469 | if (get_root) | ||
2470 | { | ||
2471 | for(selectNode = mSelectedObjects.getFirstRootNode(); selectNode; selectNode = mSelectedObjects.getNextRootNode()) | ||
2472 | { | ||
2473 | if( selectNode->getObject()->permModify() ) | ||
2474 | { | ||
2475 | return selectNode; | ||
2476 | break; | ||
2477 | } | ||
2478 | } | ||
2479 | } | ||
2480 | for(selectNode = mSelectedObjects.getFirstNode(); selectNode; selectNode = mSelectedObjects.getNextNode()) | ||
2481 | { | ||
2482 | if( selectNode->getObject()->permModify() ) | ||
2483 | { | ||
2484 | return selectNode; | ||
2485 | break; | ||
2486 | } | ||
2487 | } | ||
2488 | |||
2489 | return NULL; | ||
2490 | } | ||
2491 | |||
2492 | //----------------------------------------------------------------------------- | ||
2493 | // getFirstMoveableNode() | ||
2494 | //----------------------------------------------------------------------------- | ||
2495 | LLSelectNode* LLSelectMgr::getFirstMoveableNode(BOOL get_root) | ||
2496 | { | ||
2497 | LLSelectNode* selectNode = NULL; | ||
2498 | |||
2499 | if (get_root) | ||
2500 | { | ||
2501 | for(selectNode = mSelectedObjects.getFirstRootNode(); selectNode; selectNode = mSelectedObjects.getNextRootNode()) | ||
2502 | { | ||
2503 | if( selectNode->getObject()->permMove() ) | ||
2504 | { | ||
2505 | return selectNode; | ||
2506 | break; | ||
2507 | } | ||
2508 | } | ||
2509 | } | ||
2510 | for(selectNode = mSelectedObjects.getFirstNode(); selectNode; selectNode = mSelectedObjects.getNextNode()) | ||
2511 | { | ||
2512 | if( selectNode->getObject()->permMove() ) | ||
2513 | { | ||
2514 | return selectNode; | ||
2515 | break; | ||
2516 | } | ||
2517 | } | ||
2518 | |||
2519 | return NULL; | ||
2520 | } | ||
2521 | |||
2522 | //----------------------------------------------------------------------------- | ||
2523 | // getFirstDeleteableObject() | ||
2524 | //----------------------------------------------------------------------------- | ||
2525 | LLViewerObject* LLSelectMgr::getFirstDeleteableObject(BOOL get_root) | ||
2526 | { | ||
2527 | //RN: don't currently support deletion of child objects, as that requires separating them first | ||
2528 | // then derezzing to trash | ||
2529 | get_root = TRUE; | ||
2530 | |||
2531 | LLViewerObject* object = NULL; | ||
2532 | if (get_root) | ||
2533 | { | ||
2534 | for(LLViewerObject* current = getFirstRootObject(); | ||
2535 | current != NULL; | ||
2536 | current = getNextRootObject()) | ||
2537 | { | ||
2538 | // you can delete an object if permissions allow it, you are | ||
2539 | // the owner, you are an officer in the group that owns the | ||
2540 | // object, or you are not the owner but it is on land you own | ||
2541 | // or land owned by your group. (whew!) | ||
2542 | if( (current->permModify()) | ||
2543 | || (current->permYouOwner()) | ||
2544 | || (!current->permAnyOwner()) // public | ||
2545 | || (current->isOverAgentOwnedLand()) | ||
2546 | || (current->isOverGroupOwnedLand()) | ||
2547 | ) | ||
2548 | { | ||
2549 | |||
2550 | if( !current->isAttachment() ) | ||
2551 | { | ||
2552 | object = current; | ||
2553 | break; | ||
2554 | } | ||
2555 | } | ||
2556 | } | ||
2557 | } | ||
2558 | else | ||
2559 | { | ||
2560 | for(LLViewerObject* current = getFirstObject(); | ||
2561 | current != NULL; | ||
2562 | current = getNextObject()) | ||
2563 | { | ||
2564 | // you can delete an object if permissions allow it, you are | ||
2565 | // the owner, you are an officer in the group that owns the | ||
2566 | // object, or you are not the owner but it is on land you own | ||
2567 | // or land owned by your group. (whew!) | ||
2568 | if( (current->permModify()) | ||
2569 | || (current->permYouOwner()) | ||
2570 | || (!current->permAnyOwner()) // public | ||
2571 | || (current->isOverAgentOwnedLand()) | ||
2572 | || (current->isOverGroupOwnedLand()) | ||
2573 | ) | ||
2574 | { | ||
2575 | if( !current->isAttachment() ) | ||
2576 | { | ||
2577 | object = current; | ||
2578 | break; | ||
2579 | } | ||
2580 | } | ||
2581 | } | ||
2582 | } | ||
2583 | |||
2584 | return object; | ||
2585 | } | ||
2586 | |||
2587 | //----------------------------------------------------------------------------- | ||
2588 | // getFirstCopyableObject() | ||
2589 | //----------------------------------------------------------------------------- | ||
2590 | LLViewerObject* LLSelectMgr::getFirstCopyableObject(BOOL get_root) | ||
2591 | { | ||
2592 | LLViewerObject* object = NULL; | ||
2593 | for(LLViewerObject* cur = mSelectedObjects.getFirstObject(); cur; cur = mSelectedObjects.getNextObject()) | ||
2594 | { | ||
2595 | if( cur->permCopy() && !cur->isAttachment()) | ||
2596 | { | ||
2597 | object = cur; | ||
2598 | break; | ||
2599 | } | ||
2600 | } | ||
2601 | |||
2602 | if (get_root && object) | ||
2603 | { | ||
2604 | LLViewerObject *parent; | ||
2605 | while ((parent = (LLViewerObject*)object->getParent())) | ||
2606 | { | ||
2607 | if (parent->isSelected()) | ||
2608 | { | ||
2609 | object = parent; | ||
2610 | } | ||
2611 | else | ||
2612 | { | ||
2613 | break; | ||
2614 | } | ||
2615 | } | ||
2616 | } | ||
2617 | |||
2618 | return object; | ||
2619 | } | ||
2620 | |||
2621 | //----------------------------------------------------------------------------- | ||
2622 | // areMultpleEditableObjectsSelected() | ||
2623 | //----------------------------------------------------------------------------- | ||
2624 | BOOL LLSelectMgr::areMultpleEditableObjectsSelected() | ||
2625 | { | ||
2626 | S32 count = 0; | ||
2627 | for( LLViewerObject* cur = mSelectedObjects.getFirstObject(); cur; cur = mSelectedObjects.getNextObject() ) | ||
2628 | { | ||
2629 | if( cur->permModify() ) | ||
2630 | { | ||
2631 | count++; | ||
2632 | if( count > 1 ) | ||
2633 | { | ||
2634 | return TRUE; | ||
2635 | } | ||
2636 | } | ||
2637 | } | ||
2638 | return FALSE; | ||
2639 | } | ||
2640 | |||
2641 | //----------------------------------------------------------------------------- | ||
2642 | // selectGetAllRootsValid() | 2314 | // selectGetAllRootsValid() |
2643 | // Returns true if the viewer has information on all selected objects | 2315 | // Returns true if the viewer has information on all selected objects |
2644 | //----------------------------------------------------------------------------- | 2316 | //----------------------------------------------------------------------------- |
2645 | BOOL LLSelectMgr::selectGetAllRootsValid() | 2317 | BOOL LLSelectMgr::selectGetAllRootsValid() |
2646 | { | 2318 | { |
2647 | for( LLSelectNode* node = getFirstRootNode(); node; node = getNextRootNode() ) | 2319 | for( LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() ) |
2648 | { | 2320 | { |
2649 | 2321 | ||
2650 | if( !node->mValid ) | 2322 | if( !node->mValid ) |
@@ -2667,7 +2339,7 @@ BOOL LLSelectMgr::selectGetAllRootsValid() | |||
2667 | //----------------------------------------------------------------------------- | 2339 | //----------------------------------------------------------------------------- |
2668 | BOOL LLSelectMgr::selectGetAllValid() | 2340 | BOOL LLSelectMgr::selectGetAllValid() |
2669 | { | 2341 | { |
2670 | for( LLSelectNode* node = getFirstNode(); node; node = getNextNode() ) | 2342 | for( LLSelectNode* node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() ) |
2671 | { | 2343 | { |
2672 | 2344 | ||
2673 | if( !node->mValid ) | 2345 | if( !node->mValid ) |
@@ -2690,7 +2362,7 @@ BOOL LLSelectMgr::selectGetAllValid() | |||
2690 | //----------------------------------------------------------------------------- | 2362 | //----------------------------------------------------------------------------- |
2691 | BOOL LLSelectMgr::selectGetModify() | 2363 | BOOL LLSelectMgr::selectGetModify() |
2692 | { | 2364 | { |
2693 | for( LLSelectNode* node = getFirstNode(); node; node = getNextNode() ) | 2365 | for( LLSelectNode* node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() ) |
2694 | { | 2366 | { |
2695 | if( !node->mValid ) | 2367 | if( !node->mValid ) |
2696 | { | 2368 | { |
@@ -2712,7 +2384,7 @@ BOOL LLSelectMgr::selectGetModify() | |||
2712 | //----------------------------------------------------------------------------- | 2384 | //----------------------------------------------------------------------------- |
2713 | BOOL LLSelectMgr::selectGetRootsModify() | 2385 | BOOL LLSelectMgr::selectGetRootsModify() |
2714 | { | 2386 | { |
2715 | for( LLSelectNode* node = getFirstRootNode(); node; node = getNextRootNode() ) | 2387 | for( LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() ) |
2716 | { | 2388 | { |
2717 | if( !node->mValid ) | 2389 | if( !node->mValid ) |
2718 | { | 2390 | { |
@@ -2735,7 +2407,7 @@ BOOL LLSelectMgr::selectGetRootsModify() | |||
2735 | //----------------------------------------------------------------------------- | 2407 | //----------------------------------------------------------------------------- |
2736 | BOOL LLSelectMgr::selectGetRootsTransfer() | 2408 | BOOL LLSelectMgr::selectGetRootsTransfer() |
2737 | { | 2409 | { |
2738 | for(LLSelectNode* node = getFirstRootNode(); node; node = getNextRootNode()) | 2410 | for(LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode()) |
2739 | { | 2411 | { |
2740 | if(!node->mValid) | 2412 | if(!node->mValid) |
2741 | { | 2413 | { |
@@ -2756,7 +2428,7 @@ BOOL LLSelectMgr::selectGetRootsTransfer() | |||
2756 | //----------------------------------------------------------------------------- | 2428 | //----------------------------------------------------------------------------- |
2757 | BOOL LLSelectMgr::selectGetRootsCopy() | 2429 | BOOL LLSelectMgr::selectGetRootsCopy() |
2758 | { | 2430 | { |
2759 | for(LLSelectNode* node = getFirstRootNode(); node; node = getNextRootNode()) | 2431 | for(LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode()) |
2760 | { | 2432 | { |
2761 | if(!node->mValid) | 2433 | if(!node->mValid) |
2762 | { | 2434 | { |
@@ -2777,8 +2449,8 @@ BOOL LLSelectMgr::selectGetRootsCopy() | |||
2777 | //----------------------------------------------------------------------------- | 2449 | //----------------------------------------------------------------------------- |
2778 | BOOL LLSelectMgr::selectGetCreator(LLUUID& id, LLString& name) | 2450 | BOOL LLSelectMgr::selectGetCreator(LLUUID& id, LLString& name) |
2779 | { | 2451 | { |
2780 | LLSelectNode* node = getFirstRootNode(); | 2452 | LLSelectNode* node = mSelectedObjects->getFirstRootNode(); |
2781 | if(!node) node = getFirstNode(); | 2453 | if(!node) node = mSelectedObjects->getFirstNode(); |
2782 | if(!node) return FALSE; | 2454 | if(!node) return FALSE; |
2783 | if(!node->mValid) return FALSE; | 2455 | if(!node->mValid) return FALSE; |
2784 | LLViewerObject* obj = node->getObject(); | 2456 | LLViewerObject* obj = node->getObject(); |
@@ -2788,7 +2460,7 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& id, LLString& name) | |||
2788 | id = node->mPermissions->getCreator(); | 2460 | id = node->mPermissions->getCreator(); |
2789 | 2461 | ||
2790 | BOOL identical = TRUE; | 2462 | BOOL identical = TRUE; |
2791 | for ( node = getNextRootNode(); node; node = getNextRootNode() ) | 2463 | for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() ) |
2792 | { | 2464 | { |
2793 | if (!node->mValid) | 2465 | if (!node->mValid) |
2794 | { | 2466 | { |
@@ -2805,8 +2477,8 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& id, LLString& name) | |||
2805 | 2477 | ||
2806 | if (identical) | 2478 | if (identical) |
2807 | { | 2479 | { |
2808 | char firstname[DB_FIRST_NAME_BUF_SIZE]; | 2480 | char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ |
2809 | char lastname[DB_LAST_NAME_BUF_SIZE]; | 2481 | char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ |
2810 | gCacheName->getName(id, firstname, lastname); | 2482 | gCacheName->getName(id, firstname, lastname); |
2811 | name.assign( firstname ); | 2483 | name.assign( firstname ); |
2812 | name.append( " " ); | 2484 | name.append( " " ); |
@@ -2827,8 +2499,8 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& id, LLString& name) | |||
2827 | //----------------------------------------------------------------------------- | 2499 | //----------------------------------------------------------------------------- |
2828 | BOOL LLSelectMgr::selectGetOwner(LLUUID& id, LLString& name) | 2500 | BOOL LLSelectMgr::selectGetOwner(LLUUID& id, LLString& name) |
2829 | { | 2501 | { |
2830 | LLSelectNode* node = getFirstRootNode(); | 2502 | LLSelectNode* node = mSelectedObjects->getFirstRootNode(); |
2831 | if(!node) node = getFirstNode(); | 2503 | if(!node) node = mSelectedObjects->getFirstNode(); |
2832 | if(!node) return FALSE; | 2504 | if(!node) return FALSE; |
2833 | if(!node->mValid) return FALSE; | 2505 | if(!node->mValid) return FALSE; |
2834 | LLViewerObject* obj = node->getObject(); | 2506 | LLViewerObject* obj = node->getObject(); |
@@ -2840,7 +2512,7 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& id, LLString& name) | |||
2840 | node->mPermissions->getOwnership(id, group_owner); | 2512 | node->mPermissions->getOwnership(id, group_owner); |
2841 | 2513 | ||
2842 | BOOL identical = TRUE; | 2514 | BOOL identical = TRUE; |
2843 | for ( node = getNextRootNode(); node; node = getNextRootNode() ) | 2515 | for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() ) |
2844 | { | 2516 | { |
2845 | if (!node->mValid) | 2517 | if (!node->mValid) |
2846 | { | 2518 | { |
@@ -2868,8 +2540,8 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& id, LLString& name) | |||
2868 | } | 2540 | } |
2869 | else if(!public_owner) | 2541 | else if(!public_owner) |
2870 | { | 2542 | { |
2871 | char firstname[DB_FIRST_NAME_BUF_SIZE]; | 2543 | char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ |
2872 | char lastname[DB_LAST_NAME_BUF_SIZE]; | 2544 | char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ |
2873 | gCacheName->getName(id, firstname, lastname); | 2545 | gCacheName->getName(id, firstname, lastname); |
2874 | name.assign( firstname ); | 2546 | name.assign( firstname ); |
2875 | name.append( " " ); | 2547 | name.append( " " ); |
@@ -2895,8 +2567,8 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& id, LLString& name) | |||
2895 | //----------------------------------------------------------------------------- | 2567 | //----------------------------------------------------------------------------- |
2896 | BOOL LLSelectMgr::selectGetLastOwner(LLUUID& id, LLString& name) | 2568 | BOOL LLSelectMgr::selectGetLastOwner(LLUUID& id, LLString& name) |
2897 | { | 2569 | { |
2898 | LLSelectNode* node = getFirstRootNode(); | 2570 | LLSelectNode* node = mSelectedObjects->getFirstRootNode(); |
2899 | if(!node) node = getFirstNode(); | 2571 | if(!node) node = mSelectedObjects->getFirstNode(); |
2900 | if(!node) return FALSE; | 2572 | if(!node) return FALSE; |
2901 | if(!node->mValid) return FALSE; | 2573 | if(!node->mValid) return FALSE; |
2902 | LLViewerObject* obj = node->getObject(); | 2574 | LLViewerObject* obj = node->getObject(); |
@@ -2906,7 +2578,7 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& id, LLString& name) | |||
2906 | id = node->mPermissions->getLastOwner(); | 2578 | id = node->mPermissions->getLastOwner(); |
2907 | 2579 | ||
2908 | BOOL identical = TRUE; | 2580 | BOOL identical = TRUE; |
2909 | for ( node = getNextRootNode(); node; node = getNextRootNode() ) | 2581 | for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() ) |
2910 | { | 2582 | { |
2911 | if (!node->mValid) | 2583 | if (!node->mValid) |
2912 | { | 2584 | { |
@@ -2927,8 +2599,8 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& id, LLString& name) | |||
2927 | { | 2599 | { |
2928 | if(!public_owner) | 2600 | if(!public_owner) |
2929 | { | 2601 | { |
2930 | char firstname[DB_FIRST_NAME_BUF_SIZE]; | 2602 | char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ |
2931 | char lastname[DB_LAST_NAME_BUF_SIZE]; | 2603 | char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ |
2932 | gCacheName->getName(id, firstname, lastname); | 2604 | gCacheName->getName(id, firstname, lastname); |
2933 | name.assign( firstname ); | 2605 | name.assign( firstname ); |
2934 | name.append( " " ); | 2606 | name.append( " " ); |
@@ -2954,8 +2626,8 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& id, LLString& name) | |||
2954 | //----------------------------------------------------------------------------- | 2626 | //----------------------------------------------------------------------------- |
2955 | BOOL LLSelectMgr::selectGetGroup(LLUUID& id) | 2627 | BOOL LLSelectMgr::selectGetGroup(LLUUID& id) |
2956 | { | 2628 | { |
2957 | LLSelectNode* node = getFirstRootNode(); | 2629 | LLSelectNode* node = mSelectedObjects->getFirstRootNode(); |
2958 | if(!node) node = getFirstNode(); | 2630 | if(!node) node = mSelectedObjects->getFirstNode(); |
2959 | if(!node) return FALSE; | 2631 | if(!node) return FALSE; |
2960 | if(!node->mValid) return FALSE; | 2632 | if(!node->mValid) return FALSE; |
2961 | LLViewerObject* obj = node->getObject(); | 2633 | LLViewerObject* obj = node->getObject(); |
@@ -2965,7 +2637,7 @@ BOOL LLSelectMgr::selectGetGroup(LLUUID& id) | |||
2965 | id = node->mPermissions->getGroup(); | 2637 | id = node->mPermissions->getGroup(); |
2966 | 2638 | ||
2967 | BOOL identical = TRUE; | 2639 | BOOL identical = TRUE; |
2968 | for ( node = getNextRootNode(); node; node = getNextRootNode() ) | 2640 | for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() ) |
2969 | { | 2641 | { |
2970 | if (!node->mValid) | 2642 | if (!node->mValid) |
2971 | { | 2643 | { |
@@ -2990,8 +2662,8 @@ BOOL LLSelectMgr::selectGetGroup(LLUUID& id) | |||
2990 | //----------------------------------------------------------------------------- | 2662 | //----------------------------------------------------------------------------- |
2991 | BOOL LLSelectMgr::selectIsGroupOwned() | 2663 | BOOL LLSelectMgr::selectIsGroupOwned() |
2992 | { | 2664 | { |
2993 | LLSelectNode* node = getFirstRootNode(); | 2665 | LLSelectNode* node = mSelectedObjects->getFirstRootNode(); |
2994 | if(!node) node = getFirstNode(); | 2666 | if(!node) node = mSelectedObjects->getFirstNode(); |
2995 | if(!node) return FALSE; | 2667 | if(!node) return FALSE; |
2996 | if(!node->mValid) return FALSE; | 2668 | if(!node->mValid) return FALSE; |
2997 | LLViewerObject* obj = node->getObject(); | 2669 | LLViewerObject* obj = node->getObject(); |
@@ -3002,7 +2674,7 @@ BOOL LLSelectMgr::selectIsGroupOwned() | |||
3002 | 2674 | ||
3003 | if(is_group_owned) | 2675 | if(is_group_owned) |
3004 | { | 2676 | { |
3005 | for ( node = getNextRootNode(); node; node = getNextRootNode() ) | 2677 | for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() ) |
3006 | { | 2678 | { |
3007 | if (!node->mValid) | 2679 | if (!node->mValid) |
3008 | { | 2680 | { |
@@ -3031,7 +2703,7 @@ BOOL LLSelectMgr::selectIsGroupOwned() | |||
3031 | //----------------------------------------------------------------------------- | 2703 | //----------------------------------------------------------------------------- |
3032 | BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off) | 2704 | BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off) |
3033 | { | 2705 | { |
3034 | LLSelectNode* node = getFirstRootNode(); | 2706 | LLSelectNode* node = mSelectedObjects->getFirstRootNode(); |
3035 | if (!node) return FALSE; | 2707 | if (!node) return FALSE; |
3036 | if (!node->mValid) return FALSE; | 2708 | if (!node->mValid) return FALSE; |
3037 | 2709 | ||
@@ -3040,7 +2712,7 @@ BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off) | |||
3040 | U32 mask_or = 0x00000000; | 2712 | U32 mask_or = 0x00000000; |
3041 | BOOL all_valid = TRUE; | 2713 | BOOL all_valid = TRUE; |
3042 | 2714 | ||
3043 | for ( node = getFirstRootNode(); node; node = getNextRootNode() ) | 2715 | for ( node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() ) |
3044 | { | 2716 | { |
3045 | if (!node->mValid) | 2717 | if (!node->mValid) |
3046 | { | 2718 | { |
@@ -3094,17 +2766,17 @@ BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off) | |||
3094 | 2766 | ||
3095 | BOOL LLSelectMgr::selectGetOwnershipCost(S32* out_cost) | 2767 | BOOL LLSelectMgr::selectGetOwnershipCost(S32* out_cost) |
3096 | { | 2768 | { |
3097 | return mSelectedObjects.getOwnershipCost(*out_cost); | 2769 | return mSelectedObjects->getOwnershipCost(*out_cost); |
3098 | } | 2770 | } |
3099 | 2771 | ||
3100 | BOOL LLSelectMgr::selectGetPermissions(LLPermissions& perm) | 2772 | BOOL LLSelectMgr::selectGetPermissions(LLPermissions& perm) |
3101 | { | 2773 | { |
3102 | LLSelectNode* node = getFirstRootNode(); | 2774 | LLSelectNode* node = mSelectedObjects->getFirstRootNode(); |
3103 | if (!node) return FALSE; | 2775 | if (!node) return FALSE; |
3104 | if (!node->mValid) return FALSE; | 2776 | if (!node->mValid) return FALSE; |
3105 | BOOL valid = TRUE; | 2777 | BOOL valid = TRUE; |
3106 | perm = *(node->mPermissions); | 2778 | perm = *(node->mPermissions); |
3107 | for(node = getNextRootNode(); node != NULL; node = getNextRootNode()) | 2779 | for(node = mSelectedObjects->getNextRootNode(); node != NULL; node = mSelectedObjects->getNextRootNode()) |
3108 | { | 2780 | { |
3109 | if(!node->mValid) | 2781 | if(!node->mValid) |
3110 | { | 2782 | { |
@@ -3124,9 +2796,9 @@ void LLSelectMgr::selectDelete() | |||
3124 | BOOL locked_but_deleteable_object = FALSE; | 2796 | BOOL locked_but_deleteable_object = FALSE; |
3125 | BOOL no_copy_but_deleteable_object = FALSE; | 2797 | BOOL no_copy_but_deleteable_object = FALSE; |
3126 | BOOL all_owned_by_you = TRUE; | 2798 | BOOL all_owned_by_you = TRUE; |
3127 | for(LLViewerObject* obj = getFirstObject(); | 2799 | for(LLViewerObject* obj = mSelectedObjects->getFirstObject(); |
3128 | obj != NULL; | 2800 | obj != NULL; |
3129 | obj = getNextObject()) | 2801 | obj = mSelectedObjects->getNextObject()) |
3130 | { | 2802 | { |
3131 | if( obj->isAttachment() ) | 2803 | if( obj->isAttachment() ) |
3132 | { | 2804 | { |
@@ -3156,6 +2828,8 @@ void LLSelectMgr::selectDelete() | |||
3156 | return; | 2828 | return; |
3157 | } | 2829 | } |
3158 | 2830 | ||
2831 | LLObjectSelectionHandle* selection_handlep = new LLObjectSelectionHandle(getSelection()); | ||
2832 | |||
3159 | if(locked_but_deleteable_object || | 2833 | if(locked_but_deleteable_object || |
3160 | no_copy_but_deleteable_object || | 2834 | no_copy_but_deleteable_object || |
3161 | !all_owned_by_you) | 2835 | !all_owned_by_you) |
@@ -3172,49 +2846,49 @@ void LLSelectMgr::selectDelete() | |||
3172 | //Locked only | 2846 | //Locked only |
3173 | gViewerWindow->alertXml( "ConfirmObjectDeleteLock", | 2847 | gViewerWindow->alertXml( "ConfirmObjectDeleteLock", |
3174 | &LLSelectMgr::confirmDelete, | 2848 | &LLSelectMgr::confirmDelete, |
3175 | this); | 2849 | selection_handlep); |
3176 | } | 2850 | } |
3177 | else if(!locked_but_deleteable_object && no_copy_but_deleteable_object && all_owned_by_you) | 2851 | else if(!locked_but_deleteable_object && no_copy_but_deleteable_object && all_owned_by_you) |
3178 | { | 2852 | { |
3179 | //No Copy only | 2853 | //No Copy only |
3180 | gViewerWindow->alertXml( "ConfirmObjectDeleteNoCopy", | 2854 | gViewerWindow->alertXml( "ConfirmObjectDeleteNoCopy", |
3181 | &LLSelectMgr::confirmDelete, | 2855 | &LLSelectMgr::confirmDelete, |
3182 | this); | 2856 | selection_handlep); |
3183 | } | 2857 | } |
3184 | else if(!locked_but_deleteable_object && !no_copy_but_deleteable_object && !all_owned_by_you) | 2858 | else if(!locked_but_deleteable_object && !no_copy_but_deleteable_object && !all_owned_by_you) |
3185 | { | 2859 | { |
3186 | //not owned only | 2860 | //not owned only |
3187 | gViewerWindow->alertXml( "ConfirmObjectDeleteNoOwn", | 2861 | gViewerWindow->alertXml( "ConfirmObjectDeleteNoOwn", |
3188 | &LLSelectMgr::confirmDelete, | 2862 | &LLSelectMgr::confirmDelete, |
3189 | this); | 2863 | selection_handlep); |
3190 | } | 2864 | } |
3191 | else if(locked_but_deleteable_object && no_copy_but_deleteable_object && all_owned_by_you) | 2865 | else if(locked_but_deleteable_object && no_copy_but_deleteable_object && all_owned_by_you) |
3192 | { | 2866 | { |
3193 | //locked and no copy | 2867 | //locked and no copy |
3194 | gViewerWindow->alertXml( "ConfirmObjectDeleteLockNoCopy", | 2868 | gViewerWindow->alertXml( "ConfirmObjectDeleteLockNoCopy", |
3195 | &LLSelectMgr::confirmDelete, | 2869 | &LLSelectMgr::confirmDelete, |
3196 | this); | 2870 | selection_handlep); |
3197 | } | 2871 | } |
3198 | else if(locked_but_deleteable_object && !no_copy_but_deleteable_object && !all_owned_by_you) | 2872 | else if(locked_but_deleteable_object && !no_copy_but_deleteable_object && !all_owned_by_you) |
3199 | { | 2873 | { |
3200 | //locked and not owned | 2874 | //locked and not owned |
3201 | gViewerWindow->alertXml( "ConfirmObjectDeleteLockNoOwn", | 2875 | gViewerWindow->alertXml( "ConfirmObjectDeleteLockNoOwn", |
3202 | &LLSelectMgr::confirmDelete, | 2876 | &LLSelectMgr::confirmDelete, |
3203 | this); | 2877 | selection_handlep); |
3204 | } | 2878 | } |
3205 | else if(!locked_but_deleteable_object && no_copy_but_deleteable_object && !all_owned_by_you) | 2879 | else if(!locked_but_deleteable_object && no_copy_but_deleteable_object && !all_owned_by_you) |
3206 | { | 2880 | { |
3207 | //no copy and not owned | 2881 | //no copy and not owned |
3208 | gViewerWindow->alertXml( "ConfirmObjectDeleteNoCopyNoOwn", | 2882 | gViewerWindow->alertXml( "ConfirmObjectDeleteNoCopyNoOwn", |
3209 | &LLSelectMgr::confirmDelete, | 2883 | &LLSelectMgr::confirmDelete, |
3210 | this); | 2884 | selection_handlep); |
3211 | } | 2885 | } |
3212 | else | 2886 | else |
3213 | { | 2887 | { |
3214 | //locked, no copy and not owned | 2888 | //locked, no copy and not owned |
3215 | gViewerWindow->alertXml( "ConfirmObjectDeleteLockNoCopyNoOwn", | 2889 | gViewerWindow->alertXml( "ConfirmObjectDeleteLockNoCopyNoOwn", |
3216 | &LLSelectMgr::confirmDelete, | 2890 | &LLSelectMgr::confirmDelete, |
3217 | this); | 2891 | selection_handlep); |
3218 | } | 2892 | } |
3219 | 2893 | ||
3220 | 2894 | ||
@@ -3222,15 +2896,22 @@ void LLSelectMgr::selectDelete() | |||
3222 | } | 2896 | } |
3223 | else | 2897 | else |
3224 | { | 2898 | { |
3225 | confirmDelete(0, (void*)this); | 2899 | confirmDelete(0, (void*)selection_handlep); |
3226 | } | 2900 | } |
3227 | } | 2901 | } |
3228 | 2902 | ||
3229 | // static | 2903 | // static |
3230 | void LLSelectMgr::confirmDelete(S32 option, void* data) | 2904 | void LLSelectMgr::confirmDelete(S32 option, void* data) |
3231 | { | 2905 | { |
3232 | LLSelectMgr* self = (LLSelectMgr*)data; | 2906 | LLObjectSelectionHandle handle = *(LLObjectSelectionHandle*)data; |
3233 | if(!self) return; | 2907 | delete (LLObjectSelectionHandle*)data; |
2908 | |||
2909 | if (!handle->getObjectCount()) | ||
2910 | { | ||
2911 | llwarns << "Nothing to delete!" << llendl; | ||
2912 | return; | ||
2913 | } | ||
2914 | |||
3234 | switch(option) | 2915 | switch(option) |
3235 | { | 2916 | { |
3236 | case 0: | 2917 | case 0: |
@@ -3239,19 +2920,19 @@ void LLSelectMgr::confirmDelete(S32 option, void* data) | |||
3239 | LLUUID trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); | 2920 | LLUUID trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); |
3240 | // attempt to derez into the trash. | 2921 | // attempt to derez into the trash. |
3241 | LLDeRezInfo* info = new LLDeRezInfo(DRD_TRASH, trash_id); | 2922 | LLDeRezInfo* info = new LLDeRezInfo(DRD_TRASH, trash_id); |
3242 | self->sendListToRegions("DeRezObject", | 2923 | gSelectMgr->sendListToRegions("DeRezObject", |
3243 | packDeRezHeader, | 2924 | packDeRezHeader, |
3244 | packObjectLocalID, | 2925 | packObjectLocalID, |
3245 | (void*)info, | 2926 | (void*)info, |
3246 | SEND_ONLY_ROOTS); | 2927 | SEND_ONLY_ROOTS); |
3247 | // VEFFECT: Delete Object - one effect for all deletes | 2928 | // VEFFECT: Delete Object - one effect for all deletes |
3248 | if (self->mSelectType != SELECT_TYPE_HUD) | 2929 | if (gSelectMgr->mSelectedObjects->mSelectType != SELECT_TYPE_HUD) |
3249 | { | 2930 | { |
3250 | LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); | 2931 | LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); |
3251 | effectp->setPositionGlobal( self->getSelectionCenterGlobal() ); | 2932 | effectp->setPositionGlobal( gSelectMgr->getSelectionCenterGlobal() ); |
3252 | effectp->setColor(LLColor4U(gAgent.getEffectColor())); | 2933 | effectp->setColor(LLColor4U(gAgent.getEffectColor())); |
3253 | F32 duration = 0.5f; | 2934 | F32 duration = 0.5f; |
3254 | duration += self->getObjectCount() / 64.f; | 2935 | duration += gSelectMgr->mSelectedObjects->getObjectCount() / 64.f; |
3255 | effectp->setDuration(duration); | 2936 | effectp->setDuration(duration); |
3256 | } | 2937 | } |
3257 | 2938 | ||
@@ -3259,7 +2940,7 @@ void LLSelectMgr::confirmDelete(S32 option, void* data) | |||
3259 | 2940 | ||
3260 | // Keep track of how many objects have been deleted. | 2941 | // Keep track of how many objects have been deleted. |
3261 | F64 obj_delete_count = gViewerStats->getStat(LLViewerStats::ST_OBJECT_DELETE_COUNT); | 2942 | F64 obj_delete_count = gViewerStats->getStat(LLViewerStats::ST_OBJECT_DELETE_COUNT); |
3262 | obj_delete_count += self->getObjectCount(); | 2943 | obj_delete_count += gSelectMgr->mSelectedObjects->getObjectCount(); |
3263 | gViewerStats->setStat(LLViewerStats::ST_OBJECT_DELETE_COUNT, obj_delete_count ); | 2944 | gViewerStats->setStat(LLViewerStats::ST_OBJECT_DELETE_COUNT, obj_delete_count ); |
3264 | } | 2945 | } |
3265 | break; | 2946 | break; |
@@ -3289,7 +2970,7 @@ BOOL LLSelectMgr::selectIsForSale(S32& price) | |||
3289 | price = 0; | 2970 | price = 0; |
3290 | 2971 | ||
3291 | LLSelectNode *node; | 2972 | LLSelectNode *node; |
3292 | for (node = getFirstRootNode(); node; node = getNextRootNode() ) | 2973 | for (node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() ) |
3293 | { | 2974 | { |
3294 | if (node->mSaleInfo.isForSale()) | 2975 | if (node->mSaleInfo.isForSale()) |
3295 | { | 2976 | { |
@@ -3306,12 +2987,12 @@ BOOL LLSelectMgr::selectIsForSale(S32& price) | |||
3306 | // accumulated sale info. | 2987 | // accumulated sale info. |
3307 | BOOL LLSelectMgr::selectGetSaleInfo(LLSaleInfo& sale_info) | 2988 | BOOL LLSelectMgr::selectGetSaleInfo(LLSaleInfo& sale_info) |
3308 | { | 2989 | { |
3309 | LLSelectNode* node = getFirstRootNode(); | 2990 | LLSelectNode* node = mSelectedObjects->getFirstRootNode(); |
3310 | if (!node) return FALSE; | 2991 | if (!node) return FALSE; |
3311 | if (!node->mValid) return FALSE; | 2992 | if (!node->mValid) return FALSE; |
3312 | BOOL valid = TRUE; | 2993 | BOOL valid = TRUE; |
3313 | sale_info = node->mSaleInfo; | 2994 | sale_info = node->mSaleInfo; |
3314 | for(node = getNextRootNode(); node != NULL; node = getNextRootNode()) | 2995 | for(node = mSelectedObjects->getNextRootNode(); node != NULL; node = mSelectedObjects->getNextRootNode()) |
3315 | { | 2996 | { |
3316 | if(!node->mValid) | 2997 | if(!node->mValid) |
3317 | { | 2998 | { |
@@ -3325,12 +3006,12 @@ BOOL LLSelectMgr::selectGetSaleInfo(LLSaleInfo& sale_info) | |||
3325 | 3006 | ||
3326 | BOOL LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& ag_perm) | 3007 | BOOL LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& ag_perm) |
3327 | { | 3008 | { |
3328 | LLSelectNode* node = getFirstNode(); | 3009 | LLSelectNode* node = mSelectedObjects->getFirstNode(); |
3329 | if (!node) return FALSE; | 3010 | if (!node) return FALSE; |
3330 | if (!node->mValid) return FALSE; | 3011 | if (!node->mValid) return FALSE; |
3331 | BOOL valid = TRUE; | 3012 | BOOL valid = TRUE; |
3332 | ag_perm = node->mAggregatePerm; | 3013 | ag_perm = node->mAggregatePerm; |
3333 | for(node = getNextNode(); node != NULL; node = getNextNode()) | 3014 | for(node = mSelectedObjects->getNextNode(); node != NULL; node = mSelectedObjects->getNextNode()) |
3334 | { | 3015 | { |
3335 | if(!node->mValid) | 3016 | if(!node->mValid) |
3336 | { | 3017 | { |
@@ -3344,12 +3025,12 @@ BOOL LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& ag_perm) | |||
3344 | 3025 | ||
3345 | BOOL LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm) | 3026 | BOOL LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm) |
3346 | { | 3027 | { |
3347 | LLSelectNode* node = getFirstNode(); | 3028 | LLSelectNode* node = mSelectedObjects->getFirstNode(); |
3348 | if (!node) return FALSE; | 3029 | if (!node) return FALSE; |
3349 | if (!node->mValid) return FALSE; | 3030 | if (!node->mValid) return FALSE; |
3350 | BOOL valid = TRUE; | 3031 | BOOL valid = TRUE; |
3351 | ag_perm = node->getObject()->permYouOwner() ? node->mAggregateTexturePermOwner : node->mAggregateTexturePerm; | 3032 | ag_perm = node->getObject()->permYouOwner() ? node->mAggregateTexturePermOwner : node->mAggregateTexturePerm; |
3352 | for(node = getNextNode(); node != NULL; node = getNextNode()) | 3033 | for(node = mSelectedObjects->getNextNode(); node != NULL; node = mSelectedObjects->getNextNode()) |
3353 | { | 3034 | { |
3354 | if(!node->mValid) | 3035 | if(!node->mValid) |
3355 | { | 3036 | { |
@@ -3362,12 +3043,6 @@ BOOL LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& a | |||
3362 | } | 3043 | } |
3363 | 3044 | ||
3364 | 3045 | ||
3365 | // returns TRUE is any node is currenly worn as an attachment | ||
3366 | BOOL LLSelectMgr::selectionIsAttachment() | ||
3367 | { | ||
3368 | return (mSelectType == SELECT_TYPE_ATTACHMENT || mSelectType == SELECT_TYPE_HUD); | ||
3369 | } | ||
3370 | |||
3371 | //-------------------------------------------------------------------- | 3046 | //-------------------------------------------------------------------- |
3372 | // Duplicate objects | 3047 | // Duplicate objects |
3373 | //-------------------------------------------------------------------- | 3048 | //-------------------------------------------------------------------- |
@@ -3383,7 +3058,7 @@ struct LLDuplicateData | |||
3383 | 3058 | ||
3384 | void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy) | 3059 | void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy) |
3385 | { | 3060 | { |
3386 | if (selectionIsAttachment()) | 3061 | if (mSelectedObjects->isAttachment()) |
3387 | { | 3062 | { |
3388 | //RN: do not duplicate attachments | 3063 | //RN: do not duplicate attachments |
3389 | make_ui_sound("UISndInvalidOp"); | 3064 | make_ui_sound("UISndInvalidOp"); |
@@ -3403,7 +3078,7 @@ void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy) | |||
3403 | } | 3078 | } |
3404 | else | 3079 | else |
3405 | { | 3080 | { |
3406 | for (LLSelectNode* node = getFirstRootNode(); node; node = getNextRootNode()) | 3081 | for (LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode()) |
3407 | { | 3082 | { |
3408 | node->mDuplicated = TRUE; | 3083 | node->mDuplicated = TRUE; |
3409 | node->mDuplicatePos = node->getObject()->getPositionGlobal(); | 3084 | node->mDuplicatePos = node->getObject()->getPositionGlobal(); |
@@ -3414,7 +3089,7 @@ void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy) | |||
3414 | 3089 | ||
3415 | void LLSelectMgr::repeatDuplicate() | 3090 | void LLSelectMgr::repeatDuplicate() |
3416 | { | 3091 | { |
3417 | if (selectionIsAttachment()) | 3092 | if (mSelectedObjects->isAttachment()) |
3418 | { | 3093 | { |
3419 | //RN: do not duplicate attachments | 3094 | //RN: do not duplicate attachments |
3420 | make_ui_sound("UISndInvalidOp"); | 3095 | make_ui_sound("UISndInvalidOp"); |
@@ -3424,7 +3099,7 @@ void LLSelectMgr::repeatDuplicate() | |||
3424 | LLSelectNode* node; | 3099 | LLSelectNode* node; |
3425 | LLDynamicArray<LLViewerObject*> non_duplicated_objects; | 3100 | LLDynamicArray<LLViewerObject*> non_duplicated_objects; |
3426 | 3101 | ||
3427 | for (node = getFirstRootNode(); node; node = getNextRootNode()) | 3102 | for (node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode()) |
3428 | { | 3103 | { |
3429 | if (!node->mDuplicated) | 3104 | if (!node->mDuplicated) |
3430 | { | 3105 | { |
@@ -3447,7 +3122,7 @@ void LLSelectMgr::repeatDuplicate() | |||
3447 | sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, &data, SEND_ONLY_ROOTS); | 3122 | sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, &data, SEND_ONLY_ROOTS); |
3448 | 3123 | ||
3449 | // move current selection based on delta from duplication position and update duplication position | 3124 | // move current selection based on delta from duplication position and update duplication position |
3450 | for (node = getFirstRootNode(); node; node = getNextRootNode()) | 3125 | for (node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode()) |
3451 | { | 3126 | { |
3452 | if (node->mDuplicated) | 3127 | if (node->mDuplicated) |
3453 | { | 3128 | { |
@@ -3502,7 +3177,7 @@ void LLSelectMgr::selectDuplicateOnRay(const LLVector3 &ray_start_region, | |||
3502 | BOOL copy_rotates, | 3177 | BOOL copy_rotates, |
3503 | BOOL select_copy) | 3178 | BOOL select_copy) |
3504 | { | 3179 | { |
3505 | if (selectionIsAttachment()) | 3180 | if (mSelectedObjects->isAttachment()) |
3506 | { | 3181 | { |
3507 | // do not duplicate attachments | 3182 | // do not duplicate attachments |
3508 | make_ui_sound("UISndInvalidOp"); | 3183 | make_ui_sound("UISndInvalidOp"); |
@@ -3714,7 +3389,7 @@ struct LLPermData | |||
3714 | }; | 3389 | }; |
3715 | 3390 | ||
3716 | // TODO: Make this able to fail elegantly. | 3391 | // TODO: Make this able to fail elegantly. |
3717 | void LLSelectMgr::setObjectPermissions(U8 field, | 3392 | void LLSelectMgr::selectionSetObjectPermissions(U8 field, |
3718 | BOOL set, | 3393 | BOOL set, |
3719 | U32 mask, | 3394 | U32 mask, |
3720 | BOOL override) | 3395 | BOOL override) |
@@ -3751,7 +3426,7 @@ void LLSelectMgr::sendSelect() | |||
3751 | 3426 | ||
3752 | void LLSelectMgr::deselectAll() | 3427 | void LLSelectMgr::deselectAll() |
3753 | { | 3428 | { |
3754 | if (!mSelectedObjects.getNumNodes()) | 3429 | if (!mSelectedObjects->getNumNodes()) |
3755 | { | 3430 | { |
3756 | return; | 3431 | return; |
3757 | } | 3432 | } |
@@ -3772,42 +3447,29 @@ void LLSelectMgr::deselectAll() | |||
3772 | updateSelectionCenter(); | 3447 | updateSelectionCenter(); |
3773 | } | 3448 | } |
3774 | 3449 | ||
3775 | void LLSelectMgr::deselectTransient() | 3450 | void LLSelectMgr::deselectUnused() |
3776 | { | 3451 | { |
3777 | std::set<LLViewerObject*> objects_to_deselect; | 3452 | // no more outstanding references to this selection |
3778 | LLSelectNode *nodep; | 3453 | if (mSelectedObjects->getNumRefs() == 1) |
3779 | for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode()) | ||
3780 | { | ||
3781 | if (nodep->isTransient()) | ||
3782 | { | ||
3783 | objects_to_deselect.insert(nodep->getObject()); | ||
3784 | } | ||
3785 | } | ||
3786 | |||
3787 | std::set<LLViewerObject*>::iterator iter; | ||
3788 | for (iter = objects_to_deselect.begin(); | ||
3789 | iter != objects_to_deselect.end(); | ||
3790 | ++iter) | ||
3791 | { | 3454 | { |
3792 | deselectObjectOnly(*iter); | 3455 | deselectAll(); |
3793 | } | 3456 | } |
3794 | |||
3795 | gHUDManager->clearJoints(); | ||
3796 | updateSelectionCenter(); | ||
3797 | } | 3457 | } |
3798 | 3458 | ||
3799 | void LLSelectMgr::convertTransient() | 3459 | void LLSelectMgr::convertTransient() |
3800 | { | 3460 | { |
3801 | LLSelectNode *nodep; | 3461 | // use STL-style iteration to avoid recursive iteration problems |
3802 | for (nodep = mSelectedObjects.getFirstNode(); nodep; nodep = mSelectedObjects.getNextNode()) | 3462 | LLObjectSelection::iterator node_it; |
3463 | for (node_it = mSelectedObjects->begin(); node_it != mSelectedObjects->end(); ++node_it) | ||
3803 | { | 3464 | { |
3465 | LLSelectNode *nodep = *node_it; | ||
3804 | nodep->setTransient(FALSE); | 3466 | nodep->setTransient(FALSE); |
3805 | } | 3467 | } |
3806 | } | 3468 | } |
3807 | 3469 | ||
3808 | void LLSelectMgr::deselectAllIfTooFar() | 3470 | void LLSelectMgr::deselectAllIfTooFar() |
3809 | { | 3471 | { |
3810 | if (isEmpty() || mSelectType == SELECT_TYPE_HUD) | 3472 | if (mSelectedObjects->isEmpty() || mSelectedObjects->mSelectType == SELECT_TYPE_HUD) |
3811 | { | 3473 | { |
3812 | return; | 3474 | return; |
3813 | } | 3475 | } |
@@ -3844,10 +3506,10 @@ void LLSelectMgr::deselectAllIfTooFar() | |||
3844 | } | 3506 | } |
3845 | 3507 | ||
3846 | 3508 | ||
3847 | void LLSelectMgr::setObjectName(const LLString& name) | 3509 | void LLSelectMgr::selectionSetObjectName(const LLString& name) |
3848 | { | 3510 | { |
3849 | // we only work correctly if 1 object is selected. | 3511 | // we only work correctly if 1 object is selected. |
3850 | if(getRootObjectCount() == 1) | 3512 | if(mSelectedObjects->getRootObjectCount() == 1) |
3851 | { | 3513 | { |
3852 | sendListToRegions("ObjectName", | 3514 | sendListToRegions("ObjectName", |
3853 | packAgentAndSessionID, | 3515 | packAgentAndSessionID, |
@@ -3855,7 +3517,7 @@ void LLSelectMgr::setObjectName(const LLString& name) | |||
3855 | (void*)name.c_str(), | 3517 | (void*)name.c_str(), |
3856 | SEND_ONLY_ROOTS); | 3518 | SEND_ONLY_ROOTS); |
3857 | } | 3519 | } |
3858 | else if(getObjectCount() == 1) | 3520 | else if(mSelectedObjects->getObjectCount() == 1) |
3859 | { | 3521 | { |
3860 | sendListToRegions("ObjectName", | 3522 | sendListToRegions("ObjectName", |
3861 | packAgentAndSessionID, | 3523 | packAgentAndSessionID, |
@@ -3865,10 +3527,10 @@ void LLSelectMgr::setObjectName(const LLString& name) | |||
3865 | } | 3527 | } |
3866 | } | 3528 | } |
3867 | 3529 | ||
3868 | void LLSelectMgr::setObjectDescription(const LLString& desc) | 3530 | void LLSelectMgr::selectionSetObjectDescription(const LLString& desc) |
3869 | { | 3531 | { |
3870 | // we only work correctly if 1 object is selected. | 3532 | // we only work correctly if 1 object is selected. |
3871 | if(getRootObjectCount() == 1) | 3533 | if(mSelectedObjects->getRootObjectCount() == 1) |
3872 | { | 3534 | { |
3873 | sendListToRegions("ObjectDescription", | 3535 | sendListToRegions("ObjectDescription", |
3874 | packAgentAndSessionID, | 3536 | packAgentAndSessionID, |
@@ -3876,7 +3538,7 @@ void LLSelectMgr::setObjectDescription(const LLString& desc) | |||
3876 | (void*)desc.c_str(), | 3538 | (void*)desc.c_str(), |
3877 | SEND_ONLY_ROOTS); | 3539 | SEND_ONLY_ROOTS); |
3878 | } | 3540 | } |
3879 | else if(getObjectCount() == 1) | 3541 | else if(mSelectedObjects->getObjectCount() == 1) |
3880 | { | 3542 | { |
3881 | sendListToRegions("ObjectDescription", | 3543 | sendListToRegions("ObjectDescription", |
3882 | packAgentAndSessionID, | 3544 | packAgentAndSessionID, |
@@ -3886,11 +3548,11 @@ void LLSelectMgr::setObjectDescription(const LLString& desc) | |||
3886 | } | 3548 | } |
3887 | } | 3549 | } |
3888 | 3550 | ||
3889 | void LLSelectMgr::setObjectCategory(const LLCategory& category) | 3551 | void LLSelectMgr::selectionSetObjectCategory(const LLCategory& category) |
3890 | { | 3552 | { |
3891 | // for now, we only want to be able to set one root category at | 3553 | // for now, we only want to be able to set one root category at |
3892 | // a time. | 3554 | // a time. |
3893 | if(getRootObjectCount() != 1) return; | 3555 | if(mSelectedObjects->getRootObjectCount() != 1) return; |
3894 | sendListToRegions("ObjectCategory", | 3556 | sendListToRegions("ObjectCategory", |
3895 | packAgentAndSessionID, | 3557 | packAgentAndSessionID, |
3896 | packObjectCategory, | 3558 | packObjectCategory, |
@@ -3898,10 +3560,10 @@ void LLSelectMgr::setObjectCategory(const LLCategory& category) | |||
3898 | SEND_ONLY_ROOTS); | 3560 | SEND_ONLY_ROOTS); |
3899 | } | 3561 | } |
3900 | 3562 | ||
3901 | void LLSelectMgr::setObjectSaleInfo(const LLSaleInfo& sale_info) | 3563 | void LLSelectMgr::selectionSetObjectSaleInfo(const LLSaleInfo& sale_info) |
3902 | { | 3564 | { |
3903 | // Only one sale info at a time for now | 3565 | // Only one sale info at a time for now |
3904 | if(getRootObjectCount() != 1) return; | 3566 | if(mSelectedObjects->getRootObjectCount() != 1) return; |
3905 | sendListToRegions("ObjectSaleInfo", | 3567 | sendListToRegions("ObjectSaleInfo", |
3906 | packAgentAndSessionID, | 3568 | packAgentAndSessionID, |
3907 | packObjectSaleInfo, | 3569 | packObjectSaleInfo, |
@@ -3915,16 +3577,17 @@ void LLSelectMgr::setObjectSaleInfo(const LLSaleInfo& sale_info) | |||
3915 | 3577 | ||
3916 | void LLSelectMgr::sendAttach(U8 attachment_point) | 3578 | void LLSelectMgr::sendAttach(U8 attachment_point) |
3917 | { | 3579 | { |
3918 | LLViewerObject* attach_object = mSelectedObjects.getFirstRootObject(); | 3580 | LLViewerObject* attach_object = mSelectedObjects->getFirstRootObject(); |
3919 | 3581 | ||
3920 | if (!attach_object || !gAgent.getAvatarObject() || mSelectType != SELECT_TYPE_WORLD) | 3582 | if (!attach_object || !gAgent.getAvatarObject() || mSelectedObjects->mSelectType != SELECT_TYPE_WORLD) |
3921 | { | 3583 | { |
3922 | return; | 3584 | return; |
3923 | } | 3585 | } |
3924 | 3586 | ||
3925 | BOOL build_mode = gToolMgr->inEdit(); | 3587 | BOOL build_mode = gToolMgr->inEdit(); |
3926 | // Special case: Attach to default location for this object. | 3588 | // Special case: Attach to default location for this object. |
3927 | if (0 == attachment_point) | 3589 | if (0 == attachment_point || |
3590 | gAgent.getAvatarObject()->mAttachmentPoints.getIfThere(attachment_point)) | ||
3928 | { | 3591 | { |
3929 | sendListToRegions( | 3592 | sendListToRegions( |
3930 | "ObjectAttach", | 3593 | "ObjectAttach", |
@@ -3937,53 +3600,11 @@ void LLSelectMgr::sendAttach(U8 attachment_point) | |||
3937 | deselectAll(); | 3600 | deselectAll(); |
3938 | } | 3601 | } |
3939 | } | 3602 | } |
3940 | else | ||
3941 | { | ||
3942 | LLViewerJointAttachment* attachment = gAgent.getAvatarObject()->mAttachmentPoints.getIfThere(attachment_point); | ||
3943 | if (attachment) | ||
3944 | { | ||
3945 | LLQuaternion object_world_rot = attach_object->getRenderRotation(); | ||
3946 | LLQuaternion attachment_pt__world_rot = attachment->getWorldRotation(); | ||
3947 | LLQuaternion local_rot = object_world_rot * ~attachment_pt__world_rot; | ||
3948 | |||
3949 | F32 x,y,z; | ||
3950 | local_rot.getEulerAngles(&x, &y, &z); | ||
3951 | // snap to nearest 90 degree rotation | ||
3952 | // make sure all euler angles are positive | ||
3953 | if (x < F_PI_BY_TWO) x += F_TWO_PI; | ||
3954 | if (y < F_PI_BY_TWO) y += F_TWO_PI; | ||
3955 | if (z < F_PI_BY_TWO) z += F_TWO_PI; | ||
3956 | |||
3957 | // add 45 degrees so that rounding down becomes rounding off | ||
3958 | x += F_PI_BY_TWO / 2.f; | ||
3959 | y += F_PI_BY_TWO / 2.f; | ||
3960 | z += F_PI_BY_TWO / 2.f; | ||
3961 | // round down to nearest multiple of 90 degrees | ||
3962 | x -= fmodf(x, F_PI_BY_TWO); | ||
3963 | y -= fmodf(y, F_PI_BY_TWO); | ||
3964 | z -= fmodf(z, F_PI_BY_TWO); | ||
3965 | |||
3966 | // pass the requested rotation on to the simulator | ||
3967 | local_rot.setQuat(x, y, z); | ||
3968 | attach_object->setRotation(local_rot); | ||
3969 | |||
3970 | sendListToRegions( | ||
3971 | "ObjectAttach", | ||
3972 | packAgentIDAndSessionAndAttachment, | ||
3973 | packObjectIDAndRotation, | ||
3974 | &attachment_point, | ||
3975 | SEND_ONLY_ROOTS ); | ||
3976 | if (!build_mode) | ||
3977 | { | ||
3978 | deselectAll(); | ||
3979 | } | ||
3980 | } | ||
3981 | } | ||
3982 | } | 3603 | } |
3983 | 3604 | ||
3984 | void LLSelectMgr::sendDetach() | 3605 | void LLSelectMgr::sendDetach() |
3985 | { | 3606 | { |
3986 | if (!mSelectedObjects.getNumNodes() || mSelectType == SELECT_TYPE_WORLD) | 3607 | if (!mSelectedObjects->getNumNodes() || mSelectedObjects->mSelectType == SELECT_TYPE_WORLD) |
3987 | { | 3608 | { |
3988 | return; | 3609 | return; |
3989 | } | 3610 | } |
@@ -3999,7 +3620,7 @@ void LLSelectMgr::sendDetach() | |||
3999 | 3620 | ||
4000 | void LLSelectMgr::sendDropAttachment() | 3621 | void LLSelectMgr::sendDropAttachment() |
4001 | { | 3622 | { |
4002 | if (!mSelectedObjects.getNumNodes() || mSelectType == SELECT_TYPE_WORLD) | 3623 | if (!mSelectedObjects->getNumNodes() || mSelectedObjects->mSelectType == SELECT_TYPE_WORLD) |
4003 | { | 3624 | { |
4004 | return; | 3625 | return; |
4005 | } | 3626 | } |
@@ -4018,7 +3639,7 @@ void LLSelectMgr::sendDropAttachment() | |||
4018 | 3639 | ||
4019 | void LLSelectMgr::sendLink() | 3640 | void LLSelectMgr::sendLink() |
4020 | { | 3641 | { |
4021 | if (!mSelectedObjects.getNumNodes()) | 3642 | if (!mSelectedObjects->getNumNodes()) |
4022 | { | 3643 | { |
4023 | return; | 3644 | return; |
4024 | } | 3645 | } |
@@ -4033,7 +3654,7 @@ void LLSelectMgr::sendLink() | |||
4033 | 3654 | ||
4034 | void LLSelectMgr::sendDelink() | 3655 | void LLSelectMgr::sendDelink() |
4035 | { | 3656 | { |
4036 | if (!mSelectedObjects.getNumNodes()) | 3657 | if (!mSelectedObjects->getNumNodes()) |
4037 | { | 3658 | { |
4038 | return; | 3659 | return; |
4039 | } | 3660 | } |
@@ -4055,7 +3676,7 @@ void LLSelectMgr::sendDelink() | |||
4055 | 3676 | ||
4056 | void LLSelectMgr::sendHinge(U8 type) | 3677 | void LLSelectMgr::sendHinge(U8 type) |
4057 | { | 3678 | { |
4058 | if (!mSelectedObjects.getNumNodes()) | 3679 | if (!mSelectedObjects->getNumNodes()) |
4059 | { | 3680 | { |
4060 | return; | 3681 | return; |
4061 | } | 3682 | } |
@@ -4071,7 +3692,7 @@ void LLSelectMgr::sendHinge(U8 type) | |||
4071 | 3692 | ||
4072 | void LLSelectMgr::sendDehinge() | 3693 | void LLSelectMgr::sendDehinge() |
4073 | { | 3694 | { |
4074 | if (!mSelectedObjects.getNumNodes()) | 3695 | if (!mSelectedObjects->getNumNodes()) |
4075 | { | 3696 | { |
4076 | return; | 3697 | return; |
4077 | } | 3698 | } |
@@ -4086,7 +3707,7 @@ void LLSelectMgr::sendDehinge() | |||
4086 | 3707 | ||
4087 | void LLSelectMgr::sendSelect() | 3708 | void LLSelectMgr::sendSelect() |
4088 | { | 3709 | { |
4089 | if (!mSelectedObjects.getNumNodes()) | 3710 | if (!mSelectedObjects->getNumNodes()) |
4090 | { | 3711 | { |
4091 | return; | 3712 | return; |
4092 | } | 3713 | } |
@@ -4116,7 +3737,7 @@ void LLSelectMgr::selectionDump() | |||
4116 | { | 3737 | { |
4117 | LLViewerObject *object; | 3738 | LLViewerObject *object; |
4118 | 3739 | ||
4119 | for (object = getFirstObject(); object; object = getNextObject() ) | 3740 | for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
4120 | { | 3741 | { |
4121 | object->dump(); | 3742 | object->dump(); |
4122 | } | 3743 | } |
@@ -4125,7 +3746,7 @@ void LLSelectMgr::selectionDump() | |||
4125 | void LLSelectMgr::saveSelectedObjectColors() | 3746 | void LLSelectMgr::saveSelectedObjectColors() |
4126 | { | 3747 | { |
4127 | LLSelectNode* selectNode; | 3748 | LLSelectNode* selectNode; |
4128 | for (selectNode = getFirstNode(); selectNode; selectNode = getNextNode() ) | 3749 | for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode() ) |
4129 | { | 3750 | { |
4130 | selectNode->saveColors(); | 3751 | selectNode->saveColors(); |
4131 | } | 3752 | } |
@@ -4136,7 +3757,7 @@ void LLSelectMgr::saveSelectedObjectTextures() | |||
4136 | LLSelectNode* selectNode; | 3757 | LLSelectNode* selectNode; |
4137 | 3758 | ||
4138 | // invalidate current selection so we update saved textures | 3759 | // invalidate current selection so we update saved textures |
4139 | for (selectNode = getFirstNode(); selectNode; selectNode = getNextNode() ) | 3760 | for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode() ) |
4140 | { | 3761 | { |
4141 | selectNode->mValid = FALSE; | 3762 | selectNode->mValid = FALSE; |
4142 | } | 3763 | } |
@@ -4152,13 +3773,13 @@ void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type) | |||
4152 | { | 3773 | { |
4153 | LLSelectNode* selectNode; | 3774 | LLSelectNode* selectNode; |
4154 | 3775 | ||
4155 | if (isEmpty()) | 3776 | if (mSelectedObjects->isEmpty()) |
4156 | { | 3777 | { |
4157 | // nothing selected, so nothing to save | 3778 | // nothing selected, so nothing to save |
4158 | return; | 3779 | return; |
4159 | } | 3780 | } |
4160 | 3781 | ||
4161 | for (selectNode = getFirstNode(); selectNode; selectNode = getNextNode() ) | 3782 | for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode() ) |
4162 | { | 3783 | { |
4163 | LLViewerObject* object; | 3784 | LLViewerObject* object; |
4164 | object = selectNode->getObject(); | 3785 | object = selectNode->getObject(); |
@@ -4168,7 +3789,10 @@ void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type) | |||
4168 | if (object->isRootEdit()) | 3789 | if (object->isRootEdit()) |
4169 | { | 3790 | { |
4170 | LLXform* parent_xform = object->mDrawable->getXform()->getParent(); | 3791 | LLXform* parent_xform = object->mDrawable->getXform()->getParent(); |
4171 | selectNode->mSavedPositionGlobal = gAgent.getPosGlobalFromAgent((object->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition()); | 3792 | if (parent_xform) |
3793 | { | ||
3794 | selectNode->mSavedPositionGlobal = gAgent.getPosGlobalFromAgent((object->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition()); | ||
3795 | } | ||
4172 | } | 3796 | } |
4173 | else | 3797 | else |
4174 | { | 3798 | { |
@@ -4189,42 +3813,6 @@ void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type) | |||
4189 | selectNode->mSavedScale = object->getScale(); | 3813 | selectNode->mSavedScale = object->getScale(); |
4190 | selectNode->saveTextureScaleRatios(); | 3814 | selectNode->saveTextureScaleRatios(); |
4191 | 3815 | ||
4192 | if (object->isAttachment() && | ||
4193 | action_type != SELECT_ACTION_TYPE_PICK) | ||
4194 | { | ||
4195 | LLSelectAction* selectAction = new LLSelectAction(); | ||
4196 | selectAction->mActionType = action_type; | ||
4197 | selectAction->mPosition = object->getPosition(); | ||
4198 | selectAction->mRotation = object->getRotation(); | ||
4199 | selectAction->mScale = object->getScale(); | ||
4200 | selectAction->mObjectID = object->getID(); | ||
4201 | selectAction->mIndividualSelection = selectNode->mIndividualSelection; | ||
4202 | |||
4203 | mUndoQueue.push_back(selectAction); | ||
4204 | |||
4205 | while ((mUndoQueue.size() > (U32)MAX_ACTION_QUEUE_SIZE)) | ||
4206 | { | ||
4207 | LLSelectAction* action = mUndoQueue.front(); | ||
4208 | mUndoQueue.pop_front(); | ||
4209 | delete action; | ||
4210 | } | ||
4211 | |||
4212 | // remove this object from the redo queue | ||
4213 | std::deque<LLSelectAction*>::iterator it; | ||
4214 | for (it = mRedoQueue.begin(); it != mRedoQueue.end();) | ||
4215 | { | ||
4216 | if ((*it)->mObjectID == object->getID()) | ||
4217 | { | ||
4218 | LLSelectAction* actionp = *it; | ||
4219 | it = mRedoQueue.erase(it); | ||
4220 | delete actionp; | ||
4221 | } | ||
4222 | else | ||
4223 | { | ||
4224 | ++it; | ||
4225 | } | ||
4226 | } | ||
4227 | } | ||
4228 | } | 3816 | } |
4229 | mSavedSelectionBBox = getBBoxOfSelection(); | 3817 | mSavedSelectionBBox = getBBoxOfSelection(); |
4230 | } | 3818 | } |
@@ -4233,7 +3821,7 @@ void LLSelectMgr::selectionUpdatePhysics(BOOL physics) | |||
4233 | { | 3821 | { |
4234 | LLViewerObject *object; | 3822 | LLViewerObject *object; |
4235 | 3823 | ||
4236 | for (object = getFirstObject(); object; object = getNextObject() ) | 3824 | for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
4237 | { | 3825 | { |
4238 | if ( !object->permModify() // preemptive permissions check | 3826 | if ( !object->permModify() // preemptive permissions check |
4239 | || !(object->isRoot() // don't send for child objects | 3827 | || !(object->isRoot() // don't send for child objects |
@@ -4249,7 +3837,7 @@ void LLSelectMgr::selectionUpdateTemporary(BOOL is_temporary) | |||
4249 | { | 3837 | { |
4250 | LLViewerObject *object; | 3838 | LLViewerObject *object; |
4251 | 3839 | ||
4252 | for (object = getFirstObject(); object; object = getNextObject() ) | 3840 | for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
4253 | { | 3841 | { |
4254 | if ( !object->permModify() // preemptive permissions check | 3842 | if ( !object->permModify() // preemptive permissions check |
4255 | || !(object->isRoot() // don't send for child objects | 3843 | || !(object->isRoot() // don't send for child objects |
@@ -4265,7 +3853,7 @@ void LLSelectMgr::selectionUpdatePhantom(BOOL is_phantom) | |||
4265 | { | 3853 | { |
4266 | LLViewerObject *object; | 3854 | LLViewerObject *object; |
4267 | 3855 | ||
4268 | for (object = getFirstObject(); object; object = getNextObject() ) | 3856 | for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
4269 | { | 3857 | { |
4270 | if ( !object->permModify() // preemptive permissions check | 3858 | if ( !object->permModify() // preemptive permissions check |
4271 | || !(object->isRoot() // don't send for child objects | 3859 | || !(object->isRoot() // don't send for child objects |
@@ -4281,7 +3869,7 @@ void LLSelectMgr::selectionUpdateCastShadows(BOOL cast_shadows) | |||
4281 | { | 3869 | { |
4282 | LLViewerObject *object; | 3870 | LLViewerObject *object; |
4283 | 3871 | ||
4284 | for (object = getFirstObject(); object; object = getNextObject() ) | 3872 | for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
4285 | { | 3873 | { |
4286 | if ( !object->permModify() // preemptive permissions check | 3874 | if ( !object->permModify() // preemptive permissions check |
4287 | || object->isJointChild()) | 3875 | || object->isJointChild()) |
@@ -4505,70 +4093,81 @@ void LLSelectMgr::sendListToRegions(const LLString& message_name, | |||
4505 | S32 packets_sent = 0; | 4093 | S32 packets_sent = 0; |
4506 | S32 objects_in_this_packet = 0; | 4094 | S32 objects_in_this_packet = 0; |
4507 | 4095 | ||
4096 | |||
4097 | //clear update override data (allow next update through) | ||
4098 | for (node = mSelectedObjects->getFirstNode(); | ||
4099 | node; | ||
4100 | node = mSelectedObjects->getNextNode()) | ||
4101 | { | ||
4102 | node->mLastPositionLocal.setVec(0,0,0); | ||
4103 | node->mLastRotation = LLQuaternion(); | ||
4104 | node->mLastScale.setVec(0,0,0); | ||
4105 | } | ||
4106 | |||
4508 | std::queue<LLSelectNode*> nodes_to_send; | 4107 | std::queue<LLSelectNode*> nodes_to_send; |
4509 | 4108 | ||
4510 | switch(send_type) | 4109 | switch(send_type) |
4511 | { | 4110 | { |
4512 | case SEND_ONLY_ROOTS: | 4111 | case SEND_ONLY_ROOTS: |
4513 | node = mSelectedObjects.getFirstRootNode(); | 4112 | node = mSelectedObjects->getFirstRootNode(); |
4514 | while(node) | 4113 | while(node) |
4515 | { | 4114 | { |
4516 | nodes_to_send.push(node); | 4115 | nodes_to_send.push(node); |
4517 | node = mSelectedObjects.getNextRootNode(); | 4116 | node = mSelectedObjects->getNextRootNode(); |
4518 | } | 4117 | } |
4519 | break; | 4118 | break; |
4520 | case SEND_INDIVIDUALS: | 4119 | case SEND_INDIVIDUALS: |
4521 | node = mSelectedObjects.getFirstNode(); | 4120 | node = mSelectedObjects->getFirstNode(); |
4522 | while(node) | 4121 | while(node) |
4523 | { | 4122 | { |
4524 | nodes_to_send.push(node); | 4123 | nodes_to_send.push(node); |
4525 | node = mSelectedObjects.getNextNode(); | 4124 | node = mSelectedObjects->getNextNode(); |
4526 | } | 4125 | } |
4527 | break; | 4126 | break; |
4528 | case SEND_ROOTS_FIRST: | 4127 | case SEND_ROOTS_FIRST: |
4529 | // first roots... | 4128 | // first roots... |
4530 | node = mSelectedObjects.getFirstNode(); | 4129 | node = mSelectedObjects->getFirstNode(); |
4531 | while(node) | 4130 | while(node) |
4532 | { | 4131 | { |
4533 | if (node->getObject()->isRootEdit()) | 4132 | if (node->getObject()->isRootEdit()) |
4534 | { | 4133 | { |
4535 | nodes_to_send.push(node); | 4134 | nodes_to_send.push(node); |
4536 | } | 4135 | } |
4537 | node = mSelectedObjects.getNextNode(); | 4136 | node = mSelectedObjects->getNextNode(); |
4538 | } | 4137 | } |
4539 | 4138 | ||
4540 | // then children... | 4139 | // then children... |
4541 | node = mSelectedObjects.getFirstNode(); | 4140 | node = mSelectedObjects->getFirstNode(); |
4542 | while(node) | 4141 | while(node) |
4543 | { | 4142 | { |
4544 | if (!node->getObject()->isRootEdit()) | 4143 | if (!node->getObject()->isRootEdit()) |
4545 | { | 4144 | { |
4546 | nodes_to_send.push(node); | 4145 | nodes_to_send.push(node); |
4547 | } | 4146 | } |
4548 | node = mSelectedObjects.getNextNode(); | 4147 | node = mSelectedObjects->getNextNode(); |
4549 | } | 4148 | } |
4550 | break; | 4149 | break; |
4551 | case SEND_CHILDREN_FIRST: | 4150 | case SEND_CHILDREN_FIRST: |
4552 | // first children... | 4151 | // first children... |
4553 | node = mSelectedObjects.getFirstNode(); | 4152 | node = mSelectedObjects->getFirstNode(); |
4554 | while(node) | 4153 | while(node) |
4555 | { | 4154 | { |
4556 | if (!node->getObject()->isRootEdit()) | 4155 | if (!node->getObject()->isRootEdit()) |
4557 | { | 4156 | { |
4558 | nodes_to_send.push(node); | 4157 | nodes_to_send.push(node); |
4559 | } | 4158 | } |
4560 | node = mSelectedObjects.getNextNode(); | 4159 | node = mSelectedObjects->getNextNode(); |
4561 | } | 4160 | } |
4562 | 4161 | ||
4563 | // ...then roots | 4162 | // ...then roots |
4564 | node = mSelectedObjects.getFirstNode(); | 4163 | node = mSelectedObjects->getFirstNode(); |
4565 | while(node) | 4164 | while(node) |
4566 | { | 4165 | { |
4567 | if (node->getObject()->isRootEdit()) | 4166 | if (node->getObject()->isRootEdit()) |
4568 | { | 4167 | { |
4569 | nodes_to_send.push(node); | 4168 | nodes_to_send.push(node); |
4570 | } | 4169 | } |
4571 | node = mSelectedObjects.getNextNode(); | 4170 | node = mSelectedObjects->getNextNode(); |
4572 | } | 4171 | } |
4573 | break; | 4172 | break; |
4574 | 4173 | ||
@@ -4720,14 +4319,14 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data | |||
4720 | 4319 | ||
4721 | msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id, i); | 4320 | msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id, i); |
4722 | 4321 | ||
4723 | char name[DB_INV_ITEM_NAME_BUF_SIZE]; | 4322 | char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ |
4724 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, i); | 4323 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name, i); |
4725 | char desc[DB_INV_ITEM_DESC_BUF_SIZE]; | 4324 | char desc[DB_INV_ITEM_DESC_BUF_SIZE]; /* Flawfinder: ignore */ |
4726 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, DB_INV_ITEM_DESC_BUF_SIZE, desc, i); | 4325 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, DB_INV_ITEM_DESC_BUF_SIZE, desc, i); |
4727 | 4326 | ||
4728 | char touch_name[DB_INV_ITEM_NAME_BUF_SIZE]; | 4327 | char touch_name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ |
4729 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_TouchName, DB_INV_ITEM_NAME_BUF_SIZE, touch_name, i); | 4328 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_TouchName, DB_INV_ITEM_NAME_BUF_SIZE, touch_name, i); |
4730 | char sit_name[DB_INV_ITEM_DESC_BUF_SIZE]; | 4329 | char sit_name[DB_INV_ITEM_DESC_BUF_SIZE]; /* Flawfinder: ignore */ |
4731 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_SitName, DB_INV_ITEM_DESC_BUF_SIZE, sit_name, i); | 4330 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_SitName, DB_INV_ITEM_DESC_BUF_SIZE, sit_name, i); |
4732 | 4331 | ||
4733 | //unpack TE IDs | 4332 | //unpack TE IDs |
@@ -4741,7 +4340,7 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data | |||
4741 | for (S32 buf_offset = 0; buf_offset < size; buf_offset += UUID_BYTES) | 4340 | for (S32 buf_offset = 0; buf_offset < size; buf_offset += UUID_BYTES) |
4742 | { | 4341 | { |
4743 | LLUUID id; | 4342 | LLUUID id; |
4744 | memcpy(id.mData, packed_buffer + buf_offset, UUID_BYTES); | 4343 | memcpy(id.mData, packed_buffer + buf_offset, UUID_BYTES); /* Flawfinder: ignore */ |
4745 | texture_ids.push_back(id); | 4344 | texture_ids.push_back(id); |
4746 | } | 4345 | } |
4747 | } | 4346 | } |
@@ -4750,9 +4349,9 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data | |||
4750 | // Iterate through nodes at end, since it can be on both the regular AND hover list | 4349 | // Iterate through nodes at end, since it can be on both the regular AND hover list |
4751 | BOOL found = FALSE; | 4350 | BOOL found = FALSE; |
4752 | LLSelectNode* node; | 4351 | LLSelectNode* node; |
4753 | for (node = gSelectMgr->mSelectedObjects.getFirstNode(); | 4352 | for (node = gSelectMgr->mSelectedObjects->getFirstNode(); |
4754 | node; | 4353 | node; |
4755 | node = gSelectMgr->mSelectedObjects.getNextNode()) | 4354 | node = gSelectMgr->mSelectedObjects->getNextNode()) |
4756 | { | 4355 | { |
4757 | if (node->getObject()->mID == id) | 4356 | if (node->getObject()->mID == id) |
4758 | { | 4357 | { |
@@ -4874,10 +4473,10 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use | |||
4874 | msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id ); | 4473 | msg->getUUIDFast(_PREHASH_ObjectData, _PREHASH_LastOwnerID, last_owner_id ); |
4875 | 4474 | ||
4876 | // unpack name & desc | 4475 | // unpack name & desc |
4877 | char name[DB_INV_ITEM_NAME_BUF_SIZE]; | 4476 | char name[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ |
4878 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name); | 4477 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Name, DB_INV_ITEM_NAME_BUF_SIZE, name); |
4879 | 4478 | ||
4880 | char desc[DB_INV_ITEM_DESC_BUF_SIZE]; | 4479 | char desc[DB_INV_ITEM_DESC_BUF_SIZE]; /* Flawfinder: ignore */ |
4881 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, DB_INV_ITEM_DESC_BUF_SIZE, desc); | 4480 | msg->getStringFast(_PREHASH_ObjectData, _PREHASH_Description, DB_INV_ITEM_DESC_BUF_SIZE, desc); |
4882 | 4481 | ||
4883 | // the reporter widget askes the server for info about picked objects | 4482 | // the reporter widget askes the server for info about picked objects |
@@ -4887,8 +4486,8 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use | |||
4887 | LLFloaterReporter *reporterp = LLFloaterReporter::getReporter(report_type); | 4486 | LLFloaterReporter *reporterp = LLFloaterReporter::getReporter(report_type); |
4888 | if (reporterp) | 4487 | if (reporterp) |
4889 | { | 4488 | { |
4890 | char first_name[DB_FIRST_NAME_BUF_SIZE]; | 4489 | char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ |
4891 | char last_name[DB_LAST_NAME_BUF_SIZE]; | 4490 | char last_name[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ |
4892 | gCacheName->getName(owner_id, first_name, last_name); | 4491 | gCacheName->getName(owner_id, first_name, last_name); |
4893 | LLString fullname(first_name); | 4492 | LLString fullname(first_name); |
4894 | fullname.append(" "); | 4493 | fullname.append(" "); |
@@ -4900,9 +4499,9 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use | |||
4900 | // Now look through all of the hovered nodes | 4499 | // Now look through all of the hovered nodes |
4901 | BOOL found = FALSE; | 4500 | BOOL found = FALSE; |
4902 | LLSelectNode* node; | 4501 | LLSelectNode* node; |
4903 | for (node = gSelectMgr->mHoverObjects.getFirstNode(); | 4502 | for (node = gSelectMgr->mHoverObjects->getFirstNode(); |
4904 | node; | 4503 | node; |
4905 | node = gSelectMgr->mHoverObjects.getNextNode()) | 4504 | node = gSelectMgr->mHoverObjects->getNextNode()) |
4906 | { | 4505 | { |
4907 | if (node->getObject()->mID == id) | 4506 | if (node->getObject()->mID == id) |
4908 | { | 4507 | { |
@@ -4985,7 +4584,7 @@ void LLSelectMgr::updateSilhouettes() | |||
4985 | 4584 | ||
4986 | if((cameraPos - mLastCameraPos).magVecSquared() > SILHOUETTE_UPDATE_THRESHOLD_SQUARED * currentCameraZoom * currentCameraZoom) | 4585 | if((cameraPos - mLastCameraPos).magVecSquared() > SILHOUETTE_UPDATE_THRESHOLD_SQUARED * currentCameraZoom * currentCameraZoom) |
4987 | { | 4586 | { |
4988 | for (node = mSelectedObjects.getFirstNode(); node; node = mSelectedObjects.getNextNode() ) | 4587 | for (node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() ) |
4989 | { | 4588 | { |
4990 | if (node->getObject()) | 4589 | if (node->getObject()) |
4991 | { | 4590 | { |
@@ -4998,7 +4597,7 @@ void LLSelectMgr::updateSilhouettes() | |||
4998 | 4597 | ||
4999 | LLDynamicArray<LLViewerObject*> changed_objects; | 4598 | LLDynamicArray<LLViewerObject*> changed_objects; |
5000 | 4599 | ||
5001 | if (mSelectedObjects.getNumNodes()) | 4600 | if (mSelectedObjects->getNumNodes()) |
5002 | { | 4601 | { |
5003 | //gGLSPipelineSelection.set(); | 4602 | //gGLSPipelineSelection.set(); |
5004 | 4603 | ||
@@ -5007,7 +4606,7 @@ void LLSelectMgr::updateSilhouettes() | |||
5007 | 4606 | ||
5008 | for (S32 pass = 0; pass < 2; pass++) | 4607 | for (S32 pass = 0; pass < 2; pass++) |
5009 | { | 4608 | { |
5010 | for (node = mSelectedObjects.getFirstNode(); node; node = mSelectedObjects.getNextNode() ) | 4609 | for (node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() ) |
5011 | { | 4610 | { |
5012 | LLViewerObject* objectp = node->getObject(); | 4611 | LLViewerObject* objectp = node->getObject(); |
5013 | 4612 | ||
@@ -5023,7 +4622,7 @@ void LLSelectMgr::updateSilhouettes() | |||
5023 | || objectp->isChanged(LLXform::SILHOUETTE) | 4622 | || objectp->isChanged(LLXform::SILHOUETTE) |
5024 | || (objectp->getParent() && objectp->getParent()->isChanged(LLXform::SILHOUETTE))) | 4623 | || (objectp->getParent() && objectp->getParent()->isChanged(LLXform::SILHOUETTE))) |
5025 | { | 4624 | { |
5026 | if (num_sils_genned++ < MAX_SILS_PER_FRAME && objectp->mDrawable->isVisible()) | 4625 | if (num_sils_genned++ < MAX_SILS_PER_FRAME)// && objectp->mDrawable->isVisible()) |
5027 | { | 4626 | { |
5028 | generateSilhouette(node, gCamera->getOrigin()); | 4627 | generateSilhouette(node, gCamera->getOrigin()); |
5029 | changed_objects.put(objectp); | 4628 | changed_objects.put(objectp); |
@@ -5077,7 +4676,7 @@ void LLSelectMgr::updateSilhouettes() | |||
5077 | // remove highlight nodes not in roots list | 4676 | // remove highlight nodes not in roots list |
5078 | LLDynamicArray<LLSelectNode*> remove_these_nodes; | 4677 | LLDynamicArray<LLSelectNode*> remove_these_nodes; |
5079 | LLDynamicArray<LLViewerObject*> remove_these_roots; | 4678 | LLDynamicArray<LLViewerObject*> remove_these_roots; |
5080 | for (LLSelectNode* nodep = mHighlightedObjects.getFirstNode(); nodep; nodep = mHighlightedObjects.getNextNode()) | 4679 | for (LLSelectNode* nodep = mHighlightedObjects->getFirstNode(); nodep; nodep = mHighlightedObjects->getNextNode()) |
5081 | { | 4680 | { |
5082 | LLViewerObject* objectp = nodep->getObject(); | 4681 | LLViewerObject* objectp = nodep->getObject(); |
5083 | if (objectp->isRoot() || !select_linked_set) | 4682 | if (objectp->isRoot() || !select_linked_set) |
@@ -5106,7 +4705,7 @@ void LLSelectMgr::updateSilhouettes() | |||
5106 | S32 i; | 4705 | S32 i; |
5107 | for (i = 0; i < remove_these_nodes.count(); i++) | 4706 | for (i = 0; i < remove_these_nodes.count(); i++) |
5108 | { | 4707 | { |
5109 | mHighlightedObjects.removeNode(remove_these_nodes[i]); | 4708 | mHighlightedObjects->removeNode(remove_these_nodes[i]); |
5110 | } | 4709 | } |
5111 | 4710 | ||
5112 | // remove all root objects already being highlighted | 4711 | // remove all root objects already being highlighted |
@@ -5128,7 +4727,7 @@ void LLSelectMgr::updateSilhouettes() | |||
5128 | continue; | 4727 | continue; |
5129 | } | 4728 | } |
5130 | 4729 | ||
5131 | mHighlightedObjects.addNode(rect_select_node); | 4730 | mHighlightedObjects->addNode(rect_select_node); |
5132 | 4731 | ||
5133 | if (!select_linked_set) | 4732 | if (!select_linked_set) |
5134 | { | 4733 | { |
@@ -5147,7 +4746,7 @@ void LLSelectMgr::updateSilhouettes() | |||
5147 | 4746 | ||
5148 | rect_select_node = new LLSelectNode(objectp->mChildList[i], TRUE); | 4747 | rect_select_node = new LLSelectNode(objectp->mChildList[i], TRUE); |
5149 | rect_select_node->selectAllTEs(TRUE); | 4748 | rect_select_node->selectAllTEs(TRUE); |
5150 | mHighlightedObjects.addNode(rect_select_node); | 4749 | mHighlightedObjects->addNode(rect_select_node); |
5151 | } | 4750 | } |
5152 | } | 4751 | } |
5153 | } | 4752 | } |
@@ -5158,7 +4757,7 @@ void LLSelectMgr::updateSilhouettes() | |||
5158 | //BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL); | 4757 | //BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL); |
5159 | for (S32 pass = 0; pass < 2; pass++) | 4758 | for (S32 pass = 0; pass < 2; pass++) |
5160 | { | 4759 | { |
5161 | for (node = mHighlightedObjects.getFirstNode(); node; node = mHighlightedObjects.getNextNode() ) | 4760 | for (node = mHighlightedObjects->getFirstNode(); node; node = mHighlightedObjects->getNextNode() ) |
5162 | { | 4761 | { |
5163 | LLViewerObject* objectp = node->getObject(); | 4762 | LLViewerObject* objectp = node->getObject(); |
5164 | 4763 | ||
@@ -5207,7 +4806,7 @@ void LLSelectMgr::updateSilhouettes() | |||
5207 | } | 4806 | } |
5208 | else | 4807 | else |
5209 | { | 4808 | { |
5210 | mHighlightedObjects.deleteAllNodes(); | 4809 | mHighlightedObjects->deleteAllNodes(); |
5211 | } | 4810 | } |
5212 | 4811 | ||
5213 | for (S32 i = 0; i < changed_objects.count(); i++) | 4812 | for (S32 i = 0; i < changed_objects.count(); i++) |
@@ -5254,13 +4853,12 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) | |||
5254 | glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f); | 4853 | glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f); |
5255 | glScalef(cur_zoom, cur_zoom, cur_zoom); | 4854 | glScalef(cur_zoom, cur_zoom, cur_zoom); |
5256 | } | 4855 | } |
5257 | if (mSelectedObjects.getNumNodes()) | 4856 | if (mSelectedObjects->getNumNodes()) |
5258 | { | 4857 | { |
5259 | glPushAttrib(GL_FOG_BIT); | ||
5260 | LLUUID inspect_item_id = LLFloaterInspect::getSelectedUUID(); | 4858 | LLUUID inspect_item_id = LLFloaterInspect::getSelectedUUID(); |
5261 | for (S32 pass = 0; pass < 2; pass++) | 4859 | for (S32 pass = 0; pass < 2; pass++) |
5262 | { | 4860 | { |
5263 | for (node = mSelectedObjects.getFirstNode(); node; node = mSelectedObjects.getNextNode() ) | 4861 | for (node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() ) |
5264 | { | 4862 | { |
5265 | LLViewerObject* objectp = node->getObject(); | 4863 | LLViewerObject* objectp = node->getObject(); |
5266 | if (objectp->isHUDAttachment() != for_hud) | 4864 | if (objectp->isHUDAttachment() != for_hud) |
@@ -5288,16 +4886,15 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) | |||
5288 | } | 4886 | } |
5289 | } | 4887 | } |
5290 | } | 4888 | } |
5291 | glPopAttrib(); | ||
5292 | } | 4889 | } |
5293 | 4890 | ||
5294 | if (mHighlightedObjects.getNumNodes()) | 4891 | if (mHighlightedObjects->getNumNodes()) |
5295 | { | 4892 | { |
5296 | // render silhouettes for highlighted objects | 4893 | // render silhouettes for highlighted objects |
5297 | BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL); | 4894 | BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL); |
5298 | for (S32 pass = 0; pass < 2; pass++) | 4895 | for (S32 pass = 0; pass < 2; pass++) |
5299 | { | 4896 | { |
5300 | for (node = mHighlightedObjects.getFirstNode(); node; node = mHighlightedObjects.getNextNode() ) | 4897 | for (node = mHighlightedObjects->getFirstNode(); node; node = mHighlightedObjects->getNextNode() ) |
5301 | { | 4898 | { |
5302 | LLViewerObject* objectp = node->getObject(); | 4899 | LLViewerObject* objectp = node->getObject(); |
5303 | if (objectp->isHUDAttachment() != for_hud) | 4900 | if (objectp->isHUDAttachment() != for_hud) |
@@ -5706,12 +5303,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) | |||
5706 | } | 5303 | } |
5707 | 5304 | ||
5708 | BOOL is_hud_object = objectp->isHUDAttachment(); | 5305 | BOOL is_hud_object = objectp->isHUDAttachment(); |
5709 | 5306 | ||
5710 | if (!drawable->isVisible() && !is_hud_object) | ||
5711 | { | ||
5712 | return; | ||
5713 | } | ||
5714 | |||
5715 | if (mSilhouetteVertices.size() == 0 || mSilhouetteNormals.size() != mSilhouetteVertices.size()) | 5307 | if (mSilhouetteVertices.size() == 0 || mSilhouetteNormals.size() != mSilhouetteVertices.size()) |
5716 | { | 5308 | { |
5717 | return; | 5309 | return; |
@@ -5742,7 +5334,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) | |||
5742 | else | 5334 | else |
5743 | { | 5335 | { |
5744 | LLVector3 view_vector = gCamera->getOrigin() - objectp->getRenderPosition(); | 5336 | LLVector3 view_vector = gCamera->getOrigin() - objectp->getRenderPosition(); |
5745 | silhouette_thickness = drawable->mDistanceWRTCamera * LLSelectMgr::sHighlightThickness * (gCamera->getView() / gCamera->getDefaultFOV()); | 5337 | silhouette_thickness = view_vector.magVec() * LLSelectMgr::sHighlightThickness * (gCamera->getView() / gCamera->getDefaultFOV()); |
5746 | } | 5338 | } |
5747 | F32 animationTime = (F32)LLFrameTimer::getElapsedSeconds(); | 5339 | F32 animationTime = (F32)LLFrameTimer::getElapsedSeconds(); |
5748 | 5340 | ||
@@ -5768,7 +5360,6 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) | |||
5768 | S32 i = 0; | 5360 | S32 i = 0; |
5769 | for (S32 seg_num = 0; seg_num < (S32)mSilhouetteSegments.size(); seg_num++) | 5361 | for (S32 seg_num = 0; seg_num < (S32)mSilhouetteSegments.size(); seg_num++) |
5770 | { | 5362 | { |
5771 | // S32 first_i = i; | ||
5772 | for(; i < mSilhouetteSegments[seg_num]; i++) | 5363 | for(; i < mSilhouetteSegments[seg_num]; i++) |
5773 | { | 5364 | { |
5774 | u_coord += u_divisor * LLSelectMgr::sHighlightUScale; | 5365 | u_coord += u_divisor * LLSelectMgr::sHighlightUScale; |
@@ -5777,11 +5368,6 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) | |||
5777 | glTexCoord2f( u_coord, v_coord ); | 5368 | glTexCoord2f( u_coord, v_coord ); |
5778 | glVertex3fv( mSilhouetteVertices[i].mV ); | 5369 | glVertex3fv( mSilhouetteVertices[i].mV ); |
5779 | } | 5370 | } |
5780 | |||
5781 | /*u_coord += u_divisor * LLSelectMgr::sHighlightUScale; | ||
5782 | glColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); | ||
5783 | glTexCoord2f( u_coord, v_coord ); | ||
5784 | glVertex3fv( mSilhouetteVertices[first_i].mV );*/ | ||
5785 | } | 5371 | } |
5786 | } | 5372 | } |
5787 | glEnd(); | 5373 | glEnd(); |
@@ -5789,7 +5375,6 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) | |||
5789 | } | 5375 | } |
5790 | 5376 | ||
5791 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 5377 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
5792 | //glAlphaFunc(GL_GREATER, LLSelectMgr::sHighlightAlphaTest); | ||
5793 | glBegin(GL_TRIANGLES); | 5378 | glBegin(GL_TRIANGLES); |
5794 | { | 5379 | { |
5795 | S32 i = 0; | 5380 | S32 i = 0; |
@@ -5908,7 +5493,11 @@ void LLSelectMgr::updateSelectionCenter() | |||
5908 | const F32 MOVE_SELECTION_THRESHOLD = 1.f; // Movement threshold in meters for updating selection | 5493 | const F32 MOVE_SELECTION_THRESHOLD = 1.f; // Movement threshold in meters for updating selection |
5909 | // center (tractor beam) | 5494 | // center (tractor beam) |
5910 | 5495 | ||
5911 | LLViewerObject* object = mSelectedObjects.getFirstObject(); | 5496 | //override any object updates received |
5497 | //for selected objects | ||
5498 | gSelectMgr->overrideObjectUpdates(); | ||
5499 | |||
5500 | LLViewerObject* object = mSelectedObjects->getFirstObject(); | ||
5912 | if (!object) | 5501 | if (!object) |
5913 | { | 5502 | { |
5914 | // nothing selected, probably grabbing | 5503 | // nothing selected, probably grabbing |
@@ -5925,9 +5514,9 @@ void LLSelectMgr::updateSelectionCenter() | |||
5925 | } | 5514 | } |
5926 | else | 5515 | else |
5927 | { | 5516 | { |
5928 | mSelectType = getSelectTypeForObject(object); | 5517 | mSelectedObjects->mSelectType = getSelectTypeForObject(object); |
5929 | 5518 | ||
5930 | if (mSelectType == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) | 5519 | if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) |
5931 | { | 5520 | { |
5932 | mPauseRequest = gAgent.getAvatarObject()->requestPause(); | 5521 | mPauseRequest = gAgent.getAvatarObject()->requestPause(); |
5933 | } | 5522 | } |
@@ -5936,7 +5525,7 @@ void LLSelectMgr::updateSelectionCenter() | |||
5936 | mPauseRequest = NULL; | 5525 | mPauseRequest = NULL; |
5937 | } | 5526 | } |
5938 | 5527 | ||
5939 | if (mSelectType != SELECT_TYPE_HUD && gAgent.getAvatarObject()) | 5528 | if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && gAgent.getAvatarObject()) |
5940 | { | 5529 | { |
5941 | // reset hud ZOOM | 5530 | // reset hud ZOOM |
5942 | gAgent.getAvatarObject()->mHUDTargetZoom = 1.f; | 5531 | gAgent.getAvatarObject()->mHUDTargetZoom = 1.f; |
@@ -5952,11 +5541,11 @@ void LLSelectMgr::updateSelectionCenter() | |||
5952 | gHUDManager->clearJoints(); | 5541 | gHUDManager->clearJoints(); |
5953 | LLDynamicArray < LLViewerObject *> jointed_objects; | 5542 | LLDynamicArray < LLViewerObject *> jointed_objects; |
5954 | 5543 | ||
5955 | for (object = mSelectedObjects.getFirstObject(); object; object = mSelectedObjects.getNextObject() ) | 5544 | for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() ) |
5956 | { | 5545 | { |
5957 | LLViewerObject *myAvatar = gAgent.getAvatarObject(); | 5546 | LLViewerObject *myAvatar = gAgent.getAvatarObject(); |
5958 | LLViewerObject *root = object->getRootEdit(); | 5547 | LLViewerObject *root = object->getRootEdit(); |
5959 | if (mSelectType == SELECT_TYPE_WORLD && // not an attachment | 5548 | if (mSelectedObjects->mSelectType == SELECT_TYPE_WORLD && // not an attachment |
5960 | !root->isChild(myAvatar) && // not the object you're sitting on | 5549 | !root->isChild(myAvatar) && // not the object you're sitting on |
5961 | !object->isAvatar()) // not another avatar | 5550 | !object->isAvatar()) // not another avatar |
5962 | { | 5551 | { |
@@ -5981,9 +5570,9 @@ void LLSelectMgr::updateSelectionCenter() | |||
5981 | } | 5570 | } |
5982 | } | 5571 | } |
5983 | 5572 | ||
5984 | if ( !(gAgentID == LLUUID::null) ) | 5573 | if ( !(gAgentID == LLUUID::null) && gToolMgr) |
5985 | { | 5574 | { |
5986 | LLTool *tool = gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) ); | 5575 | LLTool *tool = gToolMgr->getCurrentTool(); |
5987 | if (mShowSelection) | 5576 | if (mShowSelection) |
5988 | { | 5577 | { |
5989 | LLVector3d select_center_global; | 5578 | LLVector3d select_center_global; |
@@ -6010,7 +5599,7 @@ void LLSelectMgr::updateSelectionCenter() | |||
6010 | } | 5599 | } |
6011 | 5600 | ||
6012 | // give up edit menu if no objects selected | 5601 | // give up edit menu if no objects selected |
6013 | if (gEditMenuHandler == this && getObjectCount() == 0) | 5602 | if (gEditMenuHandler == this && mSelectedObjects->getObjectCount() == 0) |
6014 | { | 5603 | { |
6015 | gEditMenuHandler = NULL; | 5604 | gEditMenuHandler = NULL; |
6016 | } | 5605 | } |
@@ -6020,7 +5609,7 @@ void LLSelectMgr::updatePointAt() | |||
6020 | { | 5609 | { |
6021 | if (mShowSelection) | 5610 | if (mShowSelection) |
6022 | { | 5611 | { |
6023 | if (getObjectCount()) | 5612 | if (mSelectedObjects->getObjectCount()) |
6024 | { | 5613 | { |
6025 | LLVector3 select_offset; | 5614 | LLVector3 select_offset; |
6026 | LLViewerObject *click_object = gObjectList.findObject(gLastHitObjectID); | 5615 | LLViewerObject *click_object = gObjectList.findObject(gLastHitObjectID); |
@@ -6036,8 +5625,8 @@ void LLSelectMgr::updatePointAt() | |||
6036 | else | 5625 | else |
6037 | { | 5626 | { |
6038 | // didn't click on an object this time, revert to pointing at center of first object | 5627 | // didn't click on an object this time, revert to pointing at center of first object |
6039 | gAgent.setPointAt(POINTAT_TARGET_SELECT, getFirstObject()); | 5628 | gAgent.setPointAt(POINTAT_TARGET_SELECT, mSelectedObjects->getFirstObject()); |
6040 | gAgent.setLookAt(LOOKAT_TARGET_SELECT, getFirstObject()); | 5629 | gAgent.setLookAt(LOOKAT_TARGET_SELECT, mSelectedObjects->getFirstObject()); |
6041 | } | 5630 | } |
6042 | } | 5631 | } |
6043 | else | 5632 | else |
@@ -6067,7 +5656,7 @@ LLBBox LLSelectMgr::getBBoxOfSelection() const | |||
6067 | //----------------------------------------------------------------------------- | 5656 | //----------------------------------------------------------------------------- |
6068 | BOOL LLSelectMgr::canUndo() | 5657 | BOOL LLSelectMgr::canUndo() |
6069 | { | 5658 | { |
6070 | return getFirstEditableObject() != NULL; | 5659 | return mSelectedObjects->getFirstEditableObject() != NULL; |
6071 | } | 5660 | } |
6072 | 5661 | ||
6073 | //----------------------------------------------------------------------------- | 5662 | //----------------------------------------------------------------------------- |
@@ -6085,7 +5674,7 @@ void LLSelectMgr::undo() | |||
6085 | //----------------------------------------------------------------------------- | 5674 | //----------------------------------------------------------------------------- |
6086 | BOOL LLSelectMgr::canRedo() | 5675 | BOOL LLSelectMgr::canRedo() |
6087 | { | 5676 | { |
6088 | return getFirstEditableObject() != NULL; | 5677 | return mSelectedObjects->getFirstEditableObject() != NULL; |
6089 | } | 5678 | } |
6090 | 5679 | ||
6091 | //----------------------------------------------------------------------------- | 5680 | //----------------------------------------------------------------------------- |
@@ -6103,7 +5692,7 @@ void LLSelectMgr::redo() | |||
6103 | //----------------------------------------------------------------------------- | 5692 | //----------------------------------------------------------------------------- |
6104 | BOOL LLSelectMgr::canDoDelete() | 5693 | BOOL LLSelectMgr::canDoDelete() |
6105 | { | 5694 | { |
6106 | return getFirstDeleteableObject() != NULL; | 5695 | return mSelectedObjects->getFirstDeleteableObject() != NULL; |
6107 | } | 5696 | } |
6108 | 5697 | ||
6109 | //----------------------------------------------------------------------------- | 5698 | //----------------------------------------------------------------------------- |
@@ -6119,7 +5708,7 @@ void LLSelectMgr::doDelete() | |||
6119 | //----------------------------------------------------------------------------- | 5708 | //----------------------------------------------------------------------------- |
6120 | BOOL LLSelectMgr::canDeselect() | 5709 | BOOL LLSelectMgr::canDeselect() |
6121 | { | 5710 | { |
6122 | return !isEmpty(); | 5711 | return !mSelectedObjects->isEmpty(); |
6123 | } | 5712 | } |
6124 | 5713 | ||
6125 | //----------------------------------------------------------------------------- | 5714 | //----------------------------------------------------------------------------- |
@@ -6134,7 +5723,7 @@ void LLSelectMgr::deselect() | |||
6134 | //----------------------------------------------------------------------------- | 5723 | //----------------------------------------------------------------------------- |
6135 | BOOL LLSelectMgr::canDuplicate() | 5724 | BOOL LLSelectMgr::canDuplicate() |
6136 | { | 5725 | { |
6137 | return getFirstCopyableObject() != NULL; | 5726 | return mSelectedObjects->getFirstCopyableObject() != NULL; |
6138 | } | 5727 | } |
6139 | //----------------------------------------------------------------------------- | 5728 | //----------------------------------------------------------------------------- |
6140 | // duplicate() | 5729 | // duplicate() |
@@ -6144,125 +5733,6 @@ void LLSelectMgr::duplicate() | |||
6144 | LLVector3 offset(0.5f, 0.5f, 0.f); | 5733 | LLVector3 offset(0.5f, 0.5f, 0.f); |
6145 | selectDuplicate(offset, TRUE); | 5734 | selectDuplicate(offset, TRUE); |
6146 | } | 5735 | } |
6147 | //----------------------------------------------------------------------------- | ||
6148 | // undoRedo() | ||
6149 | //----------------------------------------------------------------------------- | ||
6150 | U32 LLSelectMgr::undoRedo(std::deque<LLSelectAction*> &queue_src, std::deque<LLSelectAction*> &queue_dst, const LLUUID &object_id) | ||
6151 | { | ||
6152 | if (queue_src.size() == 0) | ||
6153 | { | ||
6154 | return 0; | ||
6155 | } | ||
6156 | |||
6157 | U32 update_type = 0; | ||
6158 | std::deque<LLSelectAction*> temp_queue; | ||
6159 | LLSelectAction* src_actionp = queue_src.back(); | ||
6160 | |||
6161 | while (src_actionp->mObjectID != object_id) | ||
6162 | { | ||
6163 | temp_queue.push_back(src_actionp); | ||
6164 | queue_src.pop_back(); | ||
6165 | if (!queue_src.size()) | ||
6166 | { | ||
6167 | // put everything back | ||
6168 | LLSelectAction* actionp; | ||
6169 | while (temp_queue.size()) | ||
6170 | { | ||
6171 | actionp = temp_queue.back(); | ||
6172 | temp_queue.pop_back(); | ||
6173 | queue_src.push_back(actionp); | ||
6174 | } | ||
6175 | return 0; | ||
6176 | } | ||
6177 | src_actionp = queue_src.back(); | ||
6178 | } | ||
6179 | |||
6180 | if(src_actionp) | ||
6181 | { | ||
6182 | LLSelectAction* dst_actionp = new LLSelectAction(); | ||
6183 | dst_actionp->mActionType = src_actionp->mActionType; | ||
6184 | dst_actionp->mObjectID = src_actionp->mObjectID; | ||
6185 | dst_actionp->mIndividualSelection = src_actionp->mIndividualSelection; | ||
6186 | |||
6187 | LLViewerObject* object = gObjectList.findObject(src_actionp->mObjectID); | ||
6188 | if (object && object->mDrawable.notNull()) | ||
6189 | { | ||
6190 | LLVector3 old_position_local = object->getPosition(); | ||
6191 | |||
6192 | switch(src_actionp->mActionType) | ||
6193 | { | ||
6194 | case SELECT_ACTION_TYPE_MOVE: | ||
6195 | dst_actionp->mPosition = object->mDrawable->getPosition(); | ||
6196 | object->setPosition(src_actionp->mPosition, TRUE); | ||
6197 | if (object->isRootEdit() && src_actionp->mIndividualSelection) | ||
6198 | { | ||
6199 | // counter-translate children | ||
6200 | LLVector3 parent_offset = (src_actionp->mPosition - old_position_local) * ~object->getRotation(); | ||
6201 | |||
6202 | // counter-translate child objects if we are moving the root as an individual | ||
6203 | for (U32 child_num = 0; child_num < object->mChildList.size(); child_num++) | ||
6204 | { | ||
6205 | LLViewerObject* childp = object->mChildList[child_num]; | ||
6206 | childp->setPosition(childp->getPosition() - parent_offset); | ||
6207 | } | ||
6208 | } | ||
6209 | update_type |= UPD_POSITION; | ||
6210 | break; | ||
6211 | case SELECT_ACTION_TYPE_ROTATE: | ||
6212 | dst_actionp->mPosition = object->mDrawable->getPosition(); | ||
6213 | dst_actionp->mRotation = object->mDrawable->getRotation(); | ||
6214 | object->setRotation(src_actionp->mRotation, TRUE); | ||
6215 | object->setPosition(src_actionp->mPosition, TRUE); | ||
6216 | if (object->isRootEdit() && src_actionp->mIndividualSelection) | ||
6217 | { | ||
6218 | // counter-translate and rotate children | ||
6219 | LLVector3 parent_offset = (src_actionp->mPosition - old_position_local) * ~object->getRotation(); | ||
6220 | |||
6221 | for (U32 child_num = 0; child_num < object->mChildList.size(); child_num++) | ||
6222 | { | ||
6223 | LLViewerObject* childp = object->mChildList[child_num]; | ||
6224 | LLQuaternion delta_rot_inv = dst_actionp->mRotation * ~src_actionp->mRotation; | ||
6225 | childp->setPosition((childp->getPosition() * delta_rot_inv) - parent_offset); | ||
6226 | childp->setRotation(childp->getRotation() * delta_rot_inv ); | ||
6227 | } | ||
6228 | } | ||
6229 | update_type |= UPD_ROTATION | UPD_POSITION; | ||
6230 | break; | ||
6231 | case SELECT_ACTION_TYPE_SCALE: | ||
6232 | dst_actionp->mPosition = object->mDrawable->getPosition(); | ||
6233 | dst_actionp->mScale = object->getScale(); | ||
6234 | object->setScale(src_actionp->mScale, TRUE); | ||
6235 | object->setPosition(src_actionp->mPosition, TRUE); | ||
6236 | update_type |= UPD_SCALE | UPD_POSITION; | ||
6237 | break; | ||
6238 | default: | ||
6239 | // do nothing | ||
6240 | break; | ||
6241 | } | ||
6242 | } | ||
6243 | queue_src.pop_back(); | ||
6244 | delete src_actionp; | ||
6245 | queue_dst.push_back(dst_actionp); | ||
6246 | while (queue_dst.size() > (U32)MAX_ACTION_QUEUE_SIZE) | ||
6247 | { | ||
6248 | LLSelectAction* action = queue_dst.front(); | ||
6249 | queue_dst.pop_front(); | ||
6250 | delete action; | ||
6251 | } | ||
6252 | |||
6253 | } | ||
6254 | |||
6255 | // put everything back | ||
6256 | LLSelectAction* actionp; | ||
6257 | while (temp_queue.size()) | ||
6258 | { | ||
6259 | actionp = temp_queue.back(); | ||
6260 | temp_queue.pop_back(); | ||
6261 | queue_src.push_back(actionp); | ||
6262 | } | ||
6263 | |||
6264 | return update_type; | ||
6265 | } | ||
6266 | 5736 | ||
6267 | ESelectType LLSelectMgr::getSelectTypeForObject(LLViewerObject* object) | 5737 | ESelectType LLSelectMgr::getSelectTypeForObject(LLViewerObject* object) |
6268 | { | 5738 | { |
@@ -6287,7 +5757,7 @@ ESelectType LLSelectMgr::getSelectTypeForObject(LLViewerObject* object) | |||
6287 | void LLSelectMgr::validateSelection() | 5757 | void LLSelectMgr::validateSelection() |
6288 | { | 5758 | { |
6289 | LLViewerObject* objectp; | 5759 | LLViewerObject* objectp; |
6290 | for (objectp = getFirstObject(); objectp; objectp = getNextObject()) | 5760 | for (objectp = mSelectedObjects->getFirstObject(); objectp; objectp = mSelectedObjects->getNextObject()) |
6291 | { | 5761 | { |
6292 | if (!canSelectObject(objectp)) | 5762 | if (!canSelectObject(objectp)) |
6293 | { | 5763 | { |
@@ -6323,64 +5793,71 @@ BOOL LLSelectMgr::canSelectObject(LLViewerObject* object) | |||
6323 | if (object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) return FALSE; | 5793 | if (object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) return FALSE; |
6324 | 5794 | ||
6325 | ESelectType selection_type = getSelectTypeForObject(object); | 5795 | ESelectType selection_type = getSelectTypeForObject(object); |
6326 | if (getObjectCount() > 0 && mSelectType != selection_type) return FALSE; | 5796 | if (mSelectedObjects->getObjectCount() > 0 && mSelectedObjects->mSelectType != selection_type) return FALSE; |
6327 | 5797 | ||
6328 | return TRUE; | 5798 | return TRUE; |
6329 | } | 5799 | } |
6330 | 5800 | ||
6331 | LLSelectNodeList::LLSelectNodeList() : std::list<LLSelectNode*>() | 5801 | LLObjectSelection::LLObjectSelection() : |
5802 | std::list<LLSelectNode*>(), | ||
5803 | LLRefCount(), | ||
5804 | mCurrentNode(end()), | ||
5805 | mCurrentTE(-1), | ||
5806 | mSelectType(SELECT_TYPE_WORLD) | ||
6332 | { | 5807 | { |
6333 | mCurrentTE = -1; | ||
6334 | mCurrentNode = end(); | ||
6335 | } | 5808 | } |
6336 | 5809 | ||
6337 | LLSelectNodeList::~LLSelectNodeList() | 5810 | LLObjectSelection::~LLObjectSelection() |
6338 | { | 5811 | { |
6339 | std::for_each(begin(), end(), DeletePointer()); | 5812 | std::for_each(begin(), end(), DeletePointer()); |
6340 | } | 5813 | } |
6341 | 5814 | ||
6342 | void LLSelectNodeList::updateEffects() | 5815 | void LLObjectSelection::updateEffects() |
6343 | { | 5816 | { |
6344 | } | 5817 | } |
6345 | 5818 | ||
6346 | S32 LLSelectNodeList::getNumNodes() | 5819 | S32 LLObjectSelection::getNumNodes() |
6347 | { | 5820 | { |
6348 | return size(); | 5821 | return size(); |
6349 | } | 5822 | } |
6350 | 5823 | ||
6351 | void LLSelectNodeList::addNode(LLSelectNode *nodep) | 5824 | void LLObjectSelection::addNode(LLSelectNode *nodep) |
6352 | { | 5825 | { |
6353 | push_front(nodep); | 5826 | push_front(nodep); |
6354 | mSelectNodeMap[nodep->getObject()] = nodep; | 5827 | mSelectNodeMap[nodep->getObject()] = nodep; |
6355 | } | 5828 | } |
6356 | 5829 | ||
6357 | void LLSelectNodeList::addNodeAtEnd(LLSelectNode *nodep) | 5830 | void LLObjectSelection::addNodeAtEnd(LLSelectNode *nodep) |
6358 | { | 5831 | { |
6359 | push_back(nodep); | 5832 | push_back(nodep); |
6360 | mSelectNodeMap[nodep->getObject()] = nodep; | 5833 | mSelectNodeMap[nodep->getObject()] = nodep; |
6361 | } | 5834 | } |
6362 | 5835 | ||
6363 | void LLSelectNodeList::removeNode(LLSelectNode *nodep) | 5836 | void LLObjectSelection::removeNode(LLSelectNode *nodep) |
6364 | { | 5837 | { |
6365 | std::list<LLSelectNode*>::iterator iter; | 5838 | std::list<LLSelectNode*>::iterator iter = begin(); |
6366 | for (iter = begin(); iter != end(); ++iter) | 5839 | while(iter != end()) |
6367 | { | 5840 | { |
6368 | if ((*iter) == nodep) | 5841 | if ((*iter) == nodep) |
6369 | { | 5842 | { |
6370 | mSelectNodeMap.erase(nodep->getObject()); | 5843 | mSelectNodeMap.erase(nodep->getObject()); |
6371 | erase(iter++); | 5844 | iter = erase(iter); |
5845 | } | ||
5846 | else | ||
5847 | { | ||
5848 | ++iter; | ||
6372 | } | 5849 | } |
6373 | } | 5850 | } |
6374 | } | 5851 | } |
6375 | 5852 | ||
6376 | void LLSelectNodeList::deleteAllNodes() | 5853 | void LLObjectSelection::deleteAllNodes() |
6377 | { | 5854 | { |
6378 | std::for_each(begin(), end(), DeletePointer()); | 5855 | std::for_each(begin(), end(), DeletePointer()); |
6379 | clear(); | 5856 | clear(); |
6380 | mSelectNodeMap.clear(); | 5857 | mSelectNodeMap.clear(); |
6381 | } | 5858 | } |
6382 | 5859 | ||
6383 | LLSelectNode* LLSelectNodeList::findNode(LLViewerObject* objectp) | 5860 | LLSelectNode* LLObjectSelection::findNode(LLViewerObject* objectp) |
6384 | { | 5861 | { |
6385 | std::map<LLViewerObject*, LLSelectNode*>::iterator found_it = mSelectNodeMap.find(objectp); | 5862 | std::map<LLViewerObject*, LLSelectNode*>::iterator found_it = mSelectNodeMap.find(objectp); |
6386 | if (found_it != mSelectNodeMap.end()) | 5863 | if (found_it != mSelectNodeMap.end()) |
@@ -6393,7 +5870,7 @@ LLSelectNode* LLSelectNodeList::findNode(LLViewerObject* objectp) | |||
6393 | //----------------------------------------------------------------------------- | 5870 | //----------------------------------------------------------------------------- |
6394 | // getFirstNode() | 5871 | // getFirstNode() |
6395 | //----------------------------------------------------------------------------- | 5872 | //----------------------------------------------------------------------------- |
6396 | LLSelectNode *LLSelectNodeList::getFirstNode() | 5873 | LLSelectNode *LLObjectSelection::getFirstNode() |
6397 | { | 5874 | { |
6398 | mCurrentNode = begin();//getFirstData(); | 5875 | mCurrentNode = begin();//getFirstData(); |
6399 | 5876 | ||
@@ -6414,7 +5891,7 @@ LLSelectNode *LLSelectNodeList::getFirstNode() | |||
6414 | //----------------------------------------------------------------------------- | 5891 | //----------------------------------------------------------------------------- |
6415 | // getCurrentNode() | 5892 | // getCurrentNode() |
6416 | //----------------------------------------------------------------------------- | 5893 | //----------------------------------------------------------------------------- |
6417 | LLSelectNode *LLSelectNodeList::getCurrentNode() | 5894 | LLSelectNode *LLObjectSelection::getCurrentNode() |
6418 | { | 5895 | { |
6419 | while (mCurrentNode != end() && !(*mCurrentNode)->getObject()) | 5896 | while (mCurrentNode != end() && !(*mCurrentNode)->getObject()) |
6420 | { | 5897 | { |
@@ -6432,7 +5909,7 @@ LLSelectNode *LLSelectNodeList::getCurrentNode() | |||
6432 | //----------------------------------------------------------------------------- | 5909 | //----------------------------------------------------------------------------- |
6433 | // getNextNode() | 5910 | // getNextNode() |
6434 | //----------------------------------------------------------------------------- | 5911 | //----------------------------------------------------------------------------- |
6435 | LLSelectNode *LLSelectNodeList::getNextNode() | 5912 | LLSelectNode *LLObjectSelection::getNextNode() |
6436 | { | 5913 | { |
6437 | ++mCurrentNode; | 5914 | ++mCurrentNode; |
6438 | 5915 | ||
@@ -6454,7 +5931,7 @@ LLSelectNode *LLSelectNodeList::getNextNode() | |||
6454 | //----------------------------------------------------------------------------- | 5931 | //----------------------------------------------------------------------------- |
6455 | // getFirstObject() | 5932 | // getFirstObject() |
6456 | //----------------------------------------------------------------------------- | 5933 | //----------------------------------------------------------------------------- |
6457 | LLViewerObject* LLSelectNodeList::getFirstObject() | 5934 | LLViewerObject* LLObjectSelection::getFirstObject() |
6458 | { | 5935 | { |
6459 | mCurrentNode = begin(); | 5936 | mCurrentNode = begin(); |
6460 | 5937 | ||
@@ -6476,7 +5953,7 @@ LLViewerObject* LLSelectNodeList::getFirstObject() | |||
6476 | //----------------------------------------------------------------------------- | 5953 | //----------------------------------------------------------------------------- |
6477 | // getNextObject() | 5954 | // getNextObject() |
6478 | //----------------------------------------------------------------------------- | 5955 | //----------------------------------------------------------------------------- |
6479 | LLViewerObject* LLSelectNodeList::getNextObject() | 5956 | LLViewerObject* LLObjectSelection::getNextObject() |
6480 | { | 5957 | { |
6481 | ++mCurrentNode;// = getNextData(); | 5958 | ++mCurrentNode;// = getNextData(); |
6482 | 5959 | ||
@@ -6499,7 +5976,7 @@ LLViewerObject* LLSelectNodeList::getNextObject() | |||
6499 | //----------------------------------------------------------------------------- | 5976 | //----------------------------------------------------------------------------- |
6500 | // getPrimaryTE() | 5977 | // getPrimaryTE() |
6501 | //----------------------------------------------------------------------------- | 5978 | //----------------------------------------------------------------------------- |
6502 | void LLSelectNodeList::getPrimaryTE(LLViewerObject* *object, S32 *te) | 5979 | void LLObjectSelection::getPrimaryTE(LLViewerObject* *object, S32 *te) |
6503 | { | 5980 | { |
6504 | // initialize object and te | 5981 | // initialize object and te |
6505 | *te = 0; | 5982 | *te = 0; |
@@ -6554,7 +6031,7 @@ void LLSelectNodeList::getPrimaryTE(LLViewerObject* *object, S32 *te) | |||
6554 | //----------------------------------------------------------------------------- | 6031 | //----------------------------------------------------------------------------- |
6555 | // getFirstTE() | 6032 | // getFirstTE() |
6556 | //----------------------------------------------------------------------------- | 6033 | //----------------------------------------------------------------------------- |
6557 | void LLSelectNodeList::getFirstTE(LLViewerObject* *object, S32 *te) | 6034 | void LLObjectSelection::getFirstTE(LLViewerObject* *object, S32 *te) |
6558 | { | 6035 | { |
6559 | // start with first face | 6036 | // start with first face |
6560 | mCurrentTE = 0; | 6037 | mCurrentTE = 0; |
@@ -6608,7 +6085,7 @@ void LLSelectNodeList::getFirstTE(LLViewerObject* *object, S32 *te) | |||
6608 | //----------------------------------------------------------------------------- | 6085 | //----------------------------------------------------------------------------- |
6609 | // getNextFace() | 6086 | // getNextFace() |
6610 | //----------------------------------------------------------------------------- | 6087 | //----------------------------------------------------------------------------- |
6611 | void LLSelectNodeList::getNextTE(LLViewerObject* *object, S32 *te) | 6088 | void LLObjectSelection::getNextTE(LLViewerObject* *object, S32 *te) |
6612 | { | 6089 | { |
6613 | // try next face | 6090 | // try next face |
6614 | mCurrentTE++; | 6091 | mCurrentTE++; |
@@ -6651,7 +6128,7 @@ void LLSelectNodeList::getNextTE(LLViewerObject* *object, S32 *te) | |||
6651 | return; | 6128 | return; |
6652 | } | 6129 | } |
6653 | 6130 | ||
6654 | void LLSelectNodeList::getCurrentTE(LLViewerObject* *object, S32 *te) | 6131 | void LLObjectSelection::getCurrentTE(LLViewerObject* *object, S32 *te) |
6655 | { | 6132 | { |
6656 | if (mCurrentNode != end()) | 6133 | if (mCurrentNode != end()) |
6657 | { | 6134 | { |
@@ -6667,7 +6144,7 @@ void LLSelectNodeList::getCurrentTE(LLViewerObject* *object, S32 *te) | |||
6667 | //----------------------------------------------------------------------------- | 6144 | //----------------------------------------------------------------------------- |
6668 | // getFirstRootNode() | 6145 | // getFirstRootNode() |
6669 | //----------------------------------------------------------------------------- | 6146 | //----------------------------------------------------------------------------- |
6670 | LLSelectNode *LLSelectNodeList::getFirstRootNode() | 6147 | LLSelectNode *LLObjectSelection::getFirstRootNode() |
6671 | { | 6148 | { |
6672 | LLSelectNode *cur_node = getFirstNode(); | 6149 | LLSelectNode *cur_node = getFirstNode(); |
6673 | 6150 | ||
@@ -6686,7 +6163,7 @@ LLSelectNode *LLSelectNodeList::getFirstRootNode() | |||
6686 | //----------------------------------------------------------------------------- | 6163 | //----------------------------------------------------------------------------- |
6687 | // getNextRootNode() | 6164 | // getNextRootNode() |
6688 | //----------------------------------------------------------------------------- | 6165 | //----------------------------------------------------------------------------- |
6689 | LLSelectNode *LLSelectNodeList::getNextRootNode() | 6166 | LLSelectNode *LLObjectSelection::getNextRootNode() |
6690 | { | 6167 | { |
6691 | LLSelectNode *cur_node = getNextNode(); | 6168 | LLSelectNode *cur_node = getNextNode(); |
6692 | 6169 | ||
@@ -6704,7 +6181,7 @@ LLSelectNode *LLSelectNodeList::getNextRootNode() | |||
6704 | //----------------------------------------------------------------------------- | 6181 | //----------------------------------------------------------------------------- |
6705 | // getFirstRootObject() | 6182 | // getFirstRootObject() |
6706 | //----------------------------------------------------------------------------- | 6183 | //----------------------------------------------------------------------------- |
6707 | LLViewerObject *LLSelectNodeList::getFirstRootObject() | 6184 | LLViewerObject *LLObjectSelection::getFirstRootObject() |
6708 | { | 6185 | { |
6709 | LLSelectNode *node = getFirstRootNode(); | 6186 | LLSelectNode *node = getFirstRootNode(); |
6710 | 6187 | ||
@@ -6722,7 +6199,7 @@ LLViewerObject *LLSelectNodeList::getFirstRootObject() | |||
6722 | //----------------------------------------------------------------------------- | 6199 | //----------------------------------------------------------------------------- |
6723 | // getNextRootObject() | 6200 | // getNextRootObject() |
6724 | //----------------------------------------------------------------------------- | 6201 | //----------------------------------------------------------------------------- |
6725 | LLViewerObject *LLSelectNodeList::getNextRootObject() | 6202 | LLViewerObject *LLObjectSelection::getNextRootObject() |
6726 | { | 6203 | { |
6727 | LLSelectNode *node = getNextRootNode(); | 6204 | LLSelectNode *node = getNextRootNode(); |
6728 | 6205 | ||
@@ -6739,7 +6216,7 @@ LLViewerObject *LLSelectNodeList::getNextRootObject() | |||
6739 | //----------------------------------------------------------------------------- | 6216 | //----------------------------------------------------------------------------- |
6740 | // isEmpty() | 6217 | // isEmpty() |
6741 | //----------------------------------------------------------------------------- | 6218 | //----------------------------------------------------------------------------- |
6742 | BOOL LLSelectNodeList::isEmpty() | 6219 | BOOL LLObjectSelection::isEmpty() |
6743 | { | 6220 | { |
6744 | return (size() == 0); | 6221 | return (size() == 0); |
6745 | } | 6222 | } |
@@ -6747,7 +6224,7 @@ BOOL LLSelectNodeList::isEmpty() | |||
6747 | //----------------------------------------------------------------------------- | 6224 | //----------------------------------------------------------------------------- |
6748 | // getOwnershipCost() | 6225 | // getOwnershipCost() |
6749 | //----------------------------------------------------------------------------- | 6226 | //----------------------------------------------------------------------------- |
6750 | BOOL LLSelectNodeList::getOwnershipCost(S32 &cost) | 6227 | BOOL LLObjectSelection::getOwnershipCost(S32 &cost) |
6751 | { | 6228 | { |
6752 | S32 count = 0; | 6229 | S32 count = 0; |
6753 | for( LLSelectNode* nodep = getFirstNode(); nodep; nodep = getNextNode() ) | 6230 | for( LLSelectNode* nodep = getFirstNode(); nodep; nodep = getNextNode() ) |
@@ -6759,3 +6236,341 @@ BOOL LLSelectNodeList::getOwnershipCost(S32 &cost) | |||
6759 | 6236 | ||
6760 | return (count > 0); | 6237 | return (count > 0); |
6761 | } | 6238 | } |
6239 | |||
6240 | |||
6241 | |||
6242 | //----------------------------------------------------------------------------- | ||
6243 | // getObjectCount() | ||
6244 | //----------------------------------------------------------------------------- | ||
6245 | S32 LLObjectSelection::getObjectCount() | ||
6246 | { | ||
6247 | return getNumNodes(); | ||
6248 | } | ||
6249 | |||
6250 | |||
6251 | //----------------------------------------------------------------------------- | ||
6252 | // getTECount() | ||
6253 | //----------------------------------------------------------------------------- | ||
6254 | S32 LLObjectSelection::getTECount() | ||
6255 | { | ||
6256 | S32 count = 0; | ||
6257 | |||
6258 | LLSelectNode* nodep; | ||
6259 | for (nodep = getFirstNode(); nodep; nodep = getNextNode() ) | ||
6260 | { | ||
6261 | if (nodep->getObject()) | ||
6262 | { | ||
6263 | S32 num_tes = nodep->getObject()->getNumTEs(); | ||
6264 | for (S32 te = 0; te < num_tes; te++) | ||
6265 | { | ||
6266 | if (nodep->isTESelected(te)) | ||
6267 | { | ||
6268 | count++; | ||
6269 | } | ||
6270 | } | ||
6271 | } | ||
6272 | } | ||
6273 | |||
6274 | return count; | ||
6275 | } | ||
6276 | |||
6277 | //----------------------------------------------------------------------------- | ||
6278 | // getRootObjectCount() | ||
6279 | //----------------------------------------------------------------------------- | ||
6280 | S32 LLObjectSelection::getRootObjectCount() | ||
6281 | { | ||
6282 | LLSelectNode *nodep; | ||
6283 | |||
6284 | S32 count = 0; | ||
6285 | for(nodep = getFirstRootNode(); nodep; nodep = getNextRootNode()) | ||
6286 | { | ||
6287 | ++count; | ||
6288 | } | ||
6289 | return count; | ||
6290 | } | ||
6291 | |||
6292 | bool LLObjectSelection::applyToObjects(LLSelectedObjectFunctor* func) | ||
6293 | { | ||
6294 | bool result = true; | ||
6295 | LLViewerObject* object; | ||
6296 | for (object = getFirstObject(); object != NULL; object = getNextObject()) | ||
6297 | { | ||
6298 | result = result && func->apply(object); | ||
6299 | } | ||
6300 | return result; | ||
6301 | } | ||
6302 | |||
6303 | bool LLObjectSelection::applyToRootObjects(LLSelectedObjectFunctor* func) | ||
6304 | { | ||
6305 | bool result = true; | ||
6306 | LLViewerObject* object; | ||
6307 | for (object = getFirstRootObject(); | ||
6308 | object != NULL; | ||
6309 | object = getNextRootObject()) | ||
6310 | { | ||
6311 | result = result && func->apply(object); | ||
6312 | } | ||
6313 | return result; | ||
6314 | } | ||
6315 | |||
6316 | bool LLObjectSelection::applyToNodes(LLSelectedNodeFunctor *func) | ||
6317 | { | ||
6318 | bool result = true; | ||
6319 | LLSelectNode* node; | ||
6320 | for (node = getFirstNode(); node != NULL; node = getNextNode()) | ||
6321 | { | ||
6322 | result = result && func->apply(node); | ||
6323 | } | ||
6324 | return result; | ||
6325 | } | ||
6326 | |||
6327 | //----------------------------------------------------------------------------- | ||
6328 | // contains() | ||
6329 | //----------------------------------------------------------------------------- | ||
6330 | BOOL LLObjectSelection::contains(LLViewerObject* object) | ||
6331 | { | ||
6332 | return findNode(object) != NULL; | ||
6333 | } | ||
6334 | |||
6335 | |||
6336 | //----------------------------------------------------------------------------- | ||
6337 | // contains() | ||
6338 | //----------------------------------------------------------------------------- | ||
6339 | BOOL LLObjectSelection::contains(LLViewerObject* object, S32 te) | ||
6340 | { | ||
6341 | LLSelectNode *nodep; | ||
6342 | if (te == SELECT_ALL_TES) | ||
6343 | { | ||
6344 | // ...all faces | ||
6345 | for (nodep = getFirstNode(); nodep; nodep = getNextNode() ) | ||
6346 | { | ||
6347 | if (nodep->getObject() == object) | ||
6348 | { | ||
6349 | BOOL all_selected = TRUE; | ||
6350 | for (S32 i = 0; i < SELECT_MAX_TES; i++) | ||
6351 | { | ||
6352 | all_selected = all_selected && nodep->isTESelected(i); | ||
6353 | } | ||
6354 | return all_selected; | ||
6355 | } | ||
6356 | } | ||
6357 | return FALSE; | ||
6358 | } | ||
6359 | else | ||
6360 | { | ||
6361 | // ...one face | ||
6362 | for (nodep = getFirstNode(); nodep; nodep = getNextNode() ) | ||
6363 | { | ||
6364 | if (nodep->getObject() == object && nodep->isTESelected(te)) | ||
6365 | { | ||
6366 | return TRUE; | ||
6367 | } | ||
6368 | } | ||
6369 | return FALSE; | ||
6370 | } | ||
6371 | } | ||
6372 | |||
6373 | // returns TRUE is any node is currenly worn as an attachment | ||
6374 | BOOL LLObjectSelection::isAttachment() | ||
6375 | { | ||
6376 | return (mSelectType == SELECT_TYPE_ATTACHMENT || mSelectType == SELECT_TYPE_HUD); | ||
6377 | } | ||
6378 | |||
6379 | //----------------------------------------------------------------------------- | ||
6380 | // getFirstMoveableNode() | ||
6381 | //----------------------------------------------------------------------------- | ||
6382 | LLSelectNode* LLObjectSelection::getFirstMoveableNode(BOOL get_root) | ||
6383 | { | ||
6384 | LLSelectNode* selectNode = NULL; | ||
6385 | |||
6386 | if (get_root) | ||
6387 | { | ||
6388 | for(selectNode = getFirstRootNode(); selectNode; selectNode = getNextRootNode()) | ||
6389 | { | ||
6390 | if( selectNode->getObject()->permMove() ) | ||
6391 | { | ||
6392 | return selectNode; | ||
6393 | break; | ||
6394 | } | ||
6395 | } | ||
6396 | } | ||
6397 | for(selectNode = getFirstNode(); selectNode; selectNode = getNextNode()) | ||
6398 | { | ||
6399 | if( selectNode->getObject()->permMove() ) | ||
6400 | { | ||
6401 | return selectNode; | ||
6402 | break; | ||
6403 | } | ||
6404 | } | ||
6405 | |||
6406 | return NULL; | ||
6407 | } | ||
6408 | |||
6409 | //----------------------------------------------------------------------------- | ||
6410 | // getFirstCopyableObject() | ||
6411 | //----------------------------------------------------------------------------- | ||
6412 | LLViewerObject* LLObjectSelection::getFirstCopyableObject(BOOL get_root) | ||
6413 | { | ||
6414 | LLViewerObject* object = NULL; | ||
6415 | for(LLViewerObject* cur = getFirstObject(); cur; cur = getNextObject()) | ||
6416 | { | ||
6417 | if( cur->permCopy() && !cur->isAttachment()) | ||
6418 | { | ||
6419 | object = cur; | ||
6420 | break; | ||
6421 | } | ||
6422 | } | ||
6423 | |||
6424 | if (get_root && object) | ||
6425 | { | ||
6426 | LLViewerObject *parent; | ||
6427 | while ((parent = (LLViewerObject*)object->getParent())) | ||
6428 | { | ||
6429 | if (parent->isSelected()) | ||
6430 | { | ||
6431 | object = parent; | ||
6432 | } | ||
6433 | else | ||
6434 | { | ||
6435 | break; | ||
6436 | } | ||
6437 | } | ||
6438 | } | ||
6439 | |||
6440 | return object; | ||
6441 | } | ||
6442 | |||
6443 | |||
6444 | //----------------------------------------------------------------------------- | ||
6445 | // getFirstDeleteableObject() | ||
6446 | //----------------------------------------------------------------------------- | ||
6447 | LLViewerObject* LLObjectSelection::getFirstDeleteableObject(BOOL get_root) | ||
6448 | { | ||
6449 | //RN: don't currently support deletion of child objects, as that requires separating them first | ||
6450 | // then derezzing to trash | ||
6451 | get_root = TRUE; | ||
6452 | |||
6453 | LLViewerObject* object = NULL; | ||
6454 | if (get_root) | ||
6455 | { | ||
6456 | for(LLViewerObject* current = getFirstRootObject(); | ||
6457 | current != NULL; | ||
6458 | current = getNextRootObject()) | ||
6459 | { | ||
6460 | // you can delete an object if permissions allow it, you are | ||
6461 | // the owner, you are an officer in the group that owns the | ||
6462 | // object, or you are not the owner but it is on land you own | ||
6463 | // or land owned by your group. (whew!) | ||
6464 | if( (current->permModify()) | ||
6465 | || (current->permYouOwner()) | ||
6466 | || (!current->permAnyOwner()) // public | ||
6467 | || (current->isOverAgentOwnedLand()) | ||
6468 | || (current->isOverGroupOwnedLand()) | ||
6469 | ) | ||
6470 | { | ||
6471 | |||
6472 | if( !current->isAttachment() ) | ||
6473 | { | ||
6474 | object = current; | ||
6475 | break; | ||
6476 | } | ||
6477 | } | ||
6478 | } | ||
6479 | } | ||
6480 | else | ||
6481 | { | ||
6482 | for(LLViewerObject* current = getFirstObject(); | ||
6483 | current != NULL; | ||
6484 | current = getNextObject()) | ||
6485 | { | ||
6486 | // you can delete an object if permissions allow it, you are | ||
6487 | // the owner, you are an officer in the group that owns the | ||
6488 | // object, or you are not the owner but it is on land you own | ||
6489 | // or land owned by your group. (whew!) | ||
6490 | if( (current->permModify()) | ||
6491 | || (current->permYouOwner()) | ||
6492 | || (!current->permAnyOwner()) // public | ||
6493 | || (current->isOverAgentOwnedLand()) | ||
6494 | || (current->isOverGroupOwnedLand()) | ||
6495 | ) | ||
6496 | { | ||
6497 | if( !current->isAttachment() ) | ||
6498 | { | ||
6499 | object = current; | ||
6500 | break; | ||
6501 | } | ||
6502 | } | ||
6503 | } | ||
6504 | } | ||
6505 | |||
6506 | return object; | ||
6507 | } | ||
6508 | |||
6509 | |||
6510 | //----------------------------------------------------------------------------- | ||
6511 | // getFirstEditableObject() | ||
6512 | //----------------------------------------------------------------------------- | ||
6513 | LLViewerObject* LLObjectSelection::getFirstEditableObject(BOOL get_root) | ||
6514 | { | ||
6515 | LLViewerObject* object = NULL; | ||
6516 | for(LLViewerObject* cur = getFirstObject(); cur; cur = getNextObject()) | ||
6517 | { | ||
6518 | if( cur->permModify() ) | ||
6519 | { | ||
6520 | object = cur; | ||
6521 | break; | ||
6522 | } | ||
6523 | } | ||
6524 | |||
6525 | if (get_root && object) | ||
6526 | { | ||
6527 | LLViewerObject *parent; | ||
6528 | while ((parent = (LLViewerObject*)object->getParent())) | ||
6529 | { | ||
6530 | if (parent->isSelected()) | ||
6531 | { | ||
6532 | object = parent; | ||
6533 | } | ||
6534 | else | ||
6535 | { | ||
6536 | break; | ||
6537 | } | ||
6538 | } | ||
6539 | } | ||
6540 | |||
6541 | return object; | ||
6542 | } | ||
6543 | |||
6544 | //----------------------------------------------------------------------------- | ||
6545 | // getFirstMoveableObject() | ||
6546 | //----------------------------------------------------------------------------- | ||
6547 | LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_root) | ||
6548 | { | ||
6549 | LLViewerObject* object = NULL; | ||
6550 | for(LLViewerObject* cur = getFirstObject(); cur; cur = getNextObject()) | ||
6551 | { | ||
6552 | if( cur->permMove() ) | ||
6553 | { | ||
6554 | object = cur; | ||
6555 | break; | ||
6556 | } | ||
6557 | } | ||
6558 | |||
6559 | if (get_root && object && !object->isJointChild()) | ||
6560 | { | ||
6561 | LLViewerObject *parent; | ||
6562 | while ((parent = (LLViewerObject*)object->getParent())) | ||
6563 | { | ||
6564 | if (parent->isSelected()) | ||
6565 | { | ||
6566 | object = parent; | ||
6567 | } | ||
6568 | else | ||
6569 | { | ||
6570 | break; | ||
6571 | } | ||
6572 | } | ||
6573 | } | ||
6574 | |||
6575 | return object; | ||
6576 | } | ||