Commits

Monroe Linden committed 74d47d5

Restore the media focus ring. This fixes DEV-42166.

Media focus is still tracked separately from LLSelectMgr (which was a change made during a refactor a while ago), but LLViewerMediaFocus now keeps LLSelectMgr updated with the current media focus when it changes.

Added a special case for media focus to LLSelectMgr::deselectAllIfTooFar(), since it was making the focus ring not show up when media focus was on distant media.

  • Participants
  • Parent commits 02aa0fd

Comments (0)

Files changed (3)

File indra/newview/llselectmgr.cpp

 	{
 		return;
 	}
-
+		
 	// Zap the angular velocity, as the sim will set it to zero
 	for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
 		 iter != mSelectedObjects->end(); iter++ )
 	LLVector3d selectionCenter = getSelectionCenterGlobal();
 	if (gSavedSettings.getBOOL("LimitSelectDistance")
 		&& (!mSelectedObjects->getPrimaryObject() || !mSelectedObjects->getPrimaryObject()->isAvatar())
+		&& (mSelectedObjects->getPrimaryObject() != LLViewerMediaFocus::getInstance()->getFocusedObject())
 		&& !mSelectedObjects->isAttachment()
 		&& !selectionCenter.isExactlyZero())
 	{
 		{
 			inspect_item_id = inspect_instance->getSelectedUUID();
 		}
+		LLUUID focus_item_id = LLViewerMediaFocus::getInstance()->getFocusedObjectID();
 		for (S32 pass = 0; pass < 2; pass++)
 		{
 			for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
 				{
 					continue;
 				}
-				if(objectp->getID() == inspect_item_id)
+				if (objectp->getID() == focus_item_id)
+				{
+					node->renderOneSilhouette(gFocusMgr.getFocusColor());
+				}
+				else if(objectp->getID() == inspect_item_id)
 				{
 					node->renderOneSilhouette(sHighlightInspectColor);
 				}
 		}
 	}
 
-#if 0	
-	// Hilight focused media object
-	{
-		LLViewerObject* objectp = LLViewerMediaFocus::getInstance()->getFocusedObject();
-		if(objectp)
-		{
-			// FIXME: how do I construct a silhouette for an object that's not selected?
-			// Would we need to add another LLObjectSelectionHandle for this purpose?
-			node->renderOneSilhouette(gFocusMgr.getFocusColor());
-		}
-	}
-#endif
-
 	if (for_hud && avatar)
 	{
 		glMatrixMode(GL_PROJECTION);

File indra/newview/llviewermediafocus.cpp

 	{
 		old_media_impl->focus(false);
 	}
+	
+	// Always clear the current selection.  If we're setting focus on a face, we'll reselect the correct object below.
+	LLSelectMgr::getInstance()->deselectAll();
+	mSelection = NULL;
 
 	if (media_impl.notNull() && objectp.notNull())
 	{
 		mFocusedObjectFace = face;
 		mFocusedObjectNormal = pick_normal;
 		
+		// Set the selection in the selection manager so we can draw the focus ring.
+		mSelection = LLSelectMgr::getInstance()->selectObjectOnly(objectp, face);
+
 		// Focusing on a media face clears its disable flag.
 		media_impl->setDisabled(false);
 

File indra/newview/llviewermediafocus.h

 	LLViewerMediaImpl* getFocusedMediaImpl();
 	LLViewerObject* getFocusedObject();
 	S32 getFocusedFace() { return mFocusedObjectFace; }
+	LLUUID getFocusedObjectID() { return mFocusedObjectID; }
 	
 	// These look up (by uuid) and return the values that were set with setHoverFace.  They will return null if the objects have been destroyed.
 	LLViewerMediaImpl* getHoverMediaImpl();
 private:
 	
 	LLHandle<LLPanelPrimMediaControls> mMediaControls;
+	LLObjectSelectionHandle mSelection;
 	
 	LLUUID mFocusedObjectID;
 	S32 mFocusedObjectFace;