summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermediafocus.cpp
diff options
context:
space:
mode:
authorMonroe Linden <monroe@lindenlab.com>2009-10-30 17:46:48 -0700
committerMonroe Linden <monroe@lindenlab.com>2009-10-30 17:46:48 -0700
commit9e602de33ae85bc78d6aa3c6bf45e29af7727796 (patch)
treec33d060db8b0ee0c4abaebe3f5ff1539529db672 /indra/newview/llviewermediafocus.cpp
parent123db56856ef0451e28fe7ac7ce3bcc27d3066f1 (diff)
On a double-click in the nearby media list, try to focus/zoom in on the prim holding the media.
Diffstat (limited to 'indra/newview/llviewermediafocus.cpp')
-rw-r--r--indra/newview/llviewermediafocus.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp
index 0ef4679057..ffdac35e71 100644
--- a/indra/newview/llviewermediafocus.cpp
+++ b/indra/newview/llviewermediafocus.cpp
@@ -50,6 +50,7 @@
#include "llmediaentry.h"
#include "llkeyboard.h"
#include "lltoolmgr.h"
+#include "llvovolume.h"
//
// LLViewerMediaFocus
@@ -473,3 +474,32 @@ LLViewerObject* LLViewerMediaFocus::getHoverObject()
{
return gObjectList.findObject(mHoverObjectID);
}
+
+void LLViewerMediaFocus::focusZoomOnMedia(LLUUID media_id)
+{
+ LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(media_id);
+
+ if(impl)
+ {
+ // Get the first object from the media impl's object list. This is completely arbitrary, but should suffice.
+ LLVOVolume *obj = impl->getSomeObject();
+ if(obj)
+ {
+ // This media is attached to at least one object. Figure out which face it's on.
+ S32 face = obj->getFaceIndexWithMediaImpl(impl, -1);
+
+ // We don't have a proper pick normal here, and finding a face's real normal is... complicated.
+ // For now, use +z to look at the top of the object.
+ LLVector3 normal(0.0f, 0.0f, 1.0f);
+
+ // Attempt to focus/zoom on that face.
+ setFocusFace(obj, face, impl, normal);
+
+ if(mMediaControls.get())
+ {
+ mMediaControls.get()->resetZoomLevel();
+ mMediaControls.get()->nextZoomLevel();
+ }
+ }
+ }
+}