On a double-click in the nearby media list, try to focus/zoom in on the prim holding the media.

meow-7.2.2
Monroe Linden 2009-10-30 17:46:48 -07:00
parent 123db56856
commit 9e602de33a
4 changed files with 47 additions and 0 deletions

View File

@ -2073,6 +2073,19 @@ const std::list< LLVOVolume* >* LLViewerMediaImpl::getObjectList() const
return &mObjectList ;
}
LLVOVolume *LLViewerMediaImpl::getSomeObject()
{
LLVOVolume *result = NULL;
std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
if(iter != mObjectList.end())
{
result = *iter;
}
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
//static
void LLViewerMedia::toggleMusicPlay(void*)

View File

@ -250,6 +250,7 @@ public:
void addObject(LLVOVolume* obj) ;
void removeObject(LLVOVolume* obj) ;
const std::list< LLVOVolume* >* getObjectList() const ;
LLVOVolume *getSomeObject();
void setUpdated(BOOL updated) ;
BOOL isUpdated() ;

View File

@ -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();
}
}
}
}

View File

@ -81,6 +81,9 @@ public:
LLViewerMediaImpl* getHoverMediaImpl();
LLViewerObject* getHoverObject();
S32 getHoverFace() { return mHoverObjectFace; }
// Try to focus/zoom on the specified media (if it's on an object in world).
void focusZoomOnMedia(LLUUID media_id);
protected:
/*virtual*/ void onFocusReceived();