diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 6ddd6c12f..74c144e6e 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -416,7 +416,8 @@ void LLFloaterAvatarList::updateAvatarList() // Skip if avatar is dead(what's that?) // or if the avatar is ourselves. - if (avatarp->isDead() || avatarp->isSelf()) + // or if the avatar is a dummy + if (avatarp->isDead() || avatarp->isSelf() || avatarp->mIsDummy) { continue; } diff --git a/indra/newview/llfloaterexploreanimations.cpp b/indra/newview/llfloaterexploreanimations.cpp index c52cf0391..104b999d2 100644 --- a/indra/newview/llfloaterexploreanimations.cpp +++ b/indra/newview/llfloaterexploreanimations.cpp @@ -7,6 +7,9 @@ #include "llfloateranimpreview.h" #include "llvoavatar.h" #include "lllocalinventory.h" +#include "llviewercamera.h" +#include "llviewerwindow.h" +#include "lltoolmgr.h" // #include "llfloatertools.h" #include "llselectmgr.h" @@ -24,6 +27,9 @@ LLAnimHistoryItem::LLAnimHistoryItem(LLUUID assetid) LLFloaterExploreAnimations::LLFloaterExploreAnimations(LLUUID avatarid) : LLFloater() { + mLastMouseX = 0; + mLastMouseY = 0; + LLFloaterExploreAnimations::sInstance = this; mAvatarID = avatarid; mAnimPreview = new LLPreviewAnimation(256, 256); @@ -48,6 +54,8 @@ BOOL LLFloaterExploreAnimations::postBuild(void) childSetAction("copy_uuid_btn", onClickCopyUUID, this); childSetAction("open_btn", onClickOpen, this); childSetAction("jelly_roll_btn", onClickJellyRoll, this); + LLRect r = getRect(); + mPreviewRect.set(r.getWidth() - 266, r.getHeight() - 25, r.getWidth() - 10, r.getHeight() - 256); update(); return TRUE; } @@ -90,6 +98,7 @@ void LLFloaterExploreAnimations::draw() LLFloater::draw(); LLRect r = getRect(); + mPreviewRect.set(r.getWidth() - 266, r.getHeight() - 25, r.getWidth() - 10, r.getHeight() - 256); gGL.color3f(1.f, 1.f, 1.f); @@ -98,13 +107,13 @@ void LLFloaterExploreAnimations::draw() gGL.begin( LLRender::QUADS ); { gGL.texCoord2f(0.f, 1.f); - gGL.vertex2i(r.getWidth() - 266, r.getHeight() - 25); + gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mTop); gGL.texCoord2f(0.f, 0.f); - gGL.vertex2i(r.getWidth() - 266, r.getHeight() - 256); + gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mBottom); gGL.texCoord2f(1.f, 0.f); - gGL.vertex2i(r.getWidth() - 10, r.getHeight() - 256); + gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mBottom); gGL.texCoord2f(1.f, 1.f); - gGL.vertex2i(r.getWidth() - 10, r.getHeight() - 25); + gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mTop); } gGL.end(); @@ -306,5 +315,106 @@ void LLFloaterExploreAnimations::onClickJellyRoll(void* data) createy->childSetValue("type_combo", "animatn"); createy->childSetText("creator_id_line", LLFloaterNewLocalInventory::sLastCreatorId.asString()); } +//----------------------------------------------------------------------------- +// handleMouseDown() +//----------------------------------------------------------------------------- +BOOL LLFloaterExploreAnimations::handleMouseDown(S32 x, S32 y, MASK mask) +{ + if (mPreviewRect.pointInRect(x, y)) + { + //llinfos << "lolwut" << llendl; + bringToFront( x, y ); + gFocusMgr.setMouseCapture(this); + gViewerWindow->hideCursor(); + mLastMouseX = x; + mLastMouseY = y; + return TRUE; + } + return LLFloater::handleMouseDown(x, y, mask); +} + +//----------------------------------------------------------------------------- +// handleMouseUp() +//----------------------------------------------------------------------------- +BOOL LLFloaterExploreAnimations::handleMouseUp(S32 x, S32 y, MASK mask) +{ + //llinfos << "lolwut pear" << llendl; + gFocusMgr.setMouseCapture(FALSE); + gViewerWindow->showCursor(); + return LLFloater::handleMouseUp(x, y, mask); +} + +//----------------------------------------------------------------------------- +// handleHover() +//----------------------------------------------------------------------------- +BOOL LLFloaterExploreAnimations::handleHover(S32 x, S32 y, MASK mask) +{ + MASK local_mask = mask & ~MASK_ALT; + + if (mAnimPreview && hasMouseCapture()) + { + if (local_mask == MASK_PAN) + { + // pan here + mAnimPreview->pan((F32)(x - mLastMouseX) * -0.005f, (F32)(y - mLastMouseY) * -0.005f); + } + else if (local_mask == MASK_ORBIT) + { + F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f; + F32 pitch_radians = (F32)(y - mLastMouseY) * 0.02f; + + mAnimPreview->rotate(yaw_radians, pitch_radians); + } + else + { + F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f; + F32 zoom_amt = (F32)(y - mLastMouseY) * 0.02f; + + mAnimPreview->rotate(yaw_radians, 0.f); + mAnimPreview->zoom(zoom_amt); + } + + mAnimPreview->requestUpdate(); + + LLUI::setCursorPositionLocal(this, mLastMouseX, mLastMouseY); + } + + if (!mPreviewRect.pointInRect(x, y) || !mAnimPreview) + { + return LLFloater::handleHover(x, y, mask); + } + else if (local_mask == MASK_ORBIT) + { + gViewerWindow->setCursor(UI_CURSOR_TOOLCAMERA); + } + else if (local_mask == MASK_PAN) + { + gViewerWindow->setCursor(UI_CURSOR_TOOLPAN); + } + else + { + gViewerWindow->setCursor(UI_CURSOR_TOOLZOOMIN); + } + + return TRUE; +} + +//----------------------------------------------------------------------------- +// handleScrollWheel() +//----------------------------------------------------------------------------- +BOOL LLFloaterExploreAnimations::handleScrollWheel(S32 x, S32 y, S32 clicks) +{ + mAnimPreview->zoom((F32)clicks * -0.2f); + mAnimPreview->requestUpdate(); + return TRUE; +} + +//----------------------------------------------------------------------------- +// onMouseCaptureLost() +//----------------------------------------------------------------------------- +void LLFloaterExploreAnimations::onMouseCaptureLost() +{ + gViewerWindow->showCursor(); +} // diff --git a/indra/newview/llfloaterexploreanimations.h b/indra/newview/llfloaterexploreanimations.h index 03b7b0f53..0ee24b3fb 100644 --- a/indra/newview/llfloaterexploreanimations.h +++ b/indra/newview/llfloaterexploreanimations.h @@ -42,6 +42,12 @@ public: static void onClickOpen(void* data); static void onClickJellyRoll(void* data); + BOOL handleMouseDown(S32 x, S32 y, MASK mask); + BOOL handleMouseUp(S32 x, S32 y, MASK mask); + BOOL handleHover(S32 x, S32 y, MASK mask); + BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + void onMouseCaptureLost(); + static void startAnim(LLUUID avatarid, LLUUID assetid); static void stopAnim(LLUUID avatarid, LLUUID assetid); @@ -52,6 +58,9 @@ private: protected: void draw(); + LLRect mPreviewRect; + S32 mLastMouseX; + S32 mLastMouseY; }; #endif diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 502ecce4c..07e316a46 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8270,7 +8270,7 @@ void initialize_menus() addMenu(new LLAvatarEject(), "Avatar.Eject"); addMenu(new LLAvatarSendIM(), "Avatar.SendIM"); addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse"); - + addMenu(new LLAvatarAnims(),"Avatar.Anims"); addMenu(new LLObjectEnableMute(), "Avatar.EnableMute"); addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend"); addMenu(new LLAvatarEnableFreezeEject(), "Avatar.EnableFreezeEject"); diff --git a/indra/newview/skins/default/xui/en-us/floater_explore_animations.xml b/indra/newview/skins/default/xui/en-us/floater_explore_animations.xml new file mode 100644 index 000000000..36b645465 --- /dev/null +++ b/indra/newview/skins/default/xui/en-us/floater_explore_animations.xml @@ -0,0 +1,17 @@ + + + + + + +