diff options
| author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2009-11-02 14:17:24 -0500 |
|---|---|---|
| committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2009-11-02 14:17:24 -0500 |
| commit | 0a7ac2fc170d0a2144eca924f5a0b8ffa8363ce4 (patch) | |
| tree | 4b224e6b5e55d37690b4639e05b893cd04a4058e /indra/newview/llviewermediafocus.cpp | |
| parent | 86b1ee7703bb57c6b1e1c068cda02bfb9ed0721e (diff) | |
| parent | 3783852444825edf420e6109927df21fd004c3e7 (diff) | |
merge
Diffstat (limited to 'indra/newview/llviewermediafocus.cpp')
| -rw-r--r-- | indra/newview/llviewermediafocus.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp index 0ef4679057..2f7040aaa3 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,46 @@ 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(); + } + } + } +} + +LLUUID LLViewerMediaFocus::getControlsMediaID() +{ + if(getFocusedMediaImpl()) + { + return mFocusedImplID; + } + else if(getHoverMediaImpl()) + { + return mHoverImplID; + } + + return LLUUID::null; +} |
