From 6175e8147ff85073c67de89f08e5ecea891e1ef8 Mon Sep 17 00:00:00 2001 From: leyla_linden Date: Tue, 21 Dec 2010 17:01:03 -0800 Subject: fixed wizard model not previewing issues and added pan/zoom --- indra/newview/llfloatermodelpreview.cpp | 50 +++++----- indra/newview/llfloatermodelwizard.cpp | 103 +++++++++++++++++++++ indra/newview/llfloatermodelwizard.h | 7 ++ .../skins/default/xui/en/floater_model_wizard.xml | 19 +--- 4 files changed, 138 insertions(+), 41 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 85d0ae02cf..0dc021c44b 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3339,13 +3339,38 @@ void LLModelPreview::updateStatusMessages() } - else if (mFMP->childGetValue("lod_auto_generate").asBoolean()) + else if (mFMP->childGetValue("lod_none").asBoolean()) { for (U32 i = 0; i < num_file_controls; ++i) { mFMP->childDisable(file_controls[i]); } + for (U32 i = 0; i < num_lod_controls; ++i) + { + mFMP->childDisable(lod_controls[i]); + } + + if (!mModel[mPreviewLOD].empty()) + { + mModel[mPreviewLOD].clear(); + mScene[mPreviewLOD].clear(); + mVertexBuffer[mPreviewLOD].clear(); + + //this can cause phasing issues with the UI, so reenter this function and return + updateStatusMessages(); + return; + } + + + } + else + { // auto generate, also the default case for wizard which has no radio selection + for (U32 i = 0; i < num_file_controls; ++i) + { + mFMP->childDisable(file_controls[i]); + } + for (U32 i = 0; i < num_lod_controls; ++i) { mFMP->childEnable(lod_controls[i]); @@ -3380,29 +3405,6 @@ void LLModelPreview::updateStatusMessages() } } } - else - { // "None" is chosen - for (U32 i = 0; i < num_file_controls; ++i) - { - mFMP->childDisable(file_controls[i]); - } - - for (U32 i = 0; i < num_lod_controls; ++i) - { - mFMP->childDisable(lod_controls[i]); - } - - if (!mModel[mPreviewLOD].empty()) - { - mModel[mPreviewLOD].clear(); - mScene[mPreviewLOD].clear(); - mVertexBuffer[mPreviewLOD].clear(); - - //this can cause phasing issues with the UI, so reenter this function and return - updateStatusMessages(); - return; - } - } if (mFMP->childGetValue("physics_load_from_file").asBoolean()) { diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 6a92e43d1a..aca5d67e60 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -36,6 +36,8 @@ #include "llfloatermodelpreview.h" #include "llfloaterreg.h" #include "llslider.h" +#include "lltoolmgr.h" +#include "llviewerwindow.h" static const std::string stateNames[]={ @@ -125,6 +127,107 @@ bool LLFloaterModelWizard::onEnableBack() return true; } + +//----------------------------------------------------------------------------- +// handleMouseDown() +//----------------------------------------------------------------------------- +BOOL LLFloaterModelWizard::handleMouseDown(S32 x, S32 y, MASK mask) +{ + if (mPreviewRect.pointInRect(x, y)) + { + bringToFront( x, y ); + gFocusMgr.setMouseCapture(this); + gViewerWindow->hideCursor(); + mLastMouseX = x; + mLastMouseY = y; + return TRUE; + } + + return LLFloater::handleMouseDown(x, y, mask); +} + +//----------------------------------------------------------------------------- +// handleMouseUp() +//----------------------------------------------------------------------------- +BOOL LLFloaterModelWizard::handleMouseUp(S32 x, S32 y, MASK mask) +{ + gFocusMgr.setMouseCapture(FALSE); + gViewerWindow->showCursor(); + return LLFloater::handleMouseUp(x, y, mask); +} + +//----------------------------------------------------------------------------- +// handleHover() +//----------------------------------------------------------------------------- +BOOL LLFloaterModelWizard::handleHover (S32 x, S32 y, MASK mask) +{ + MASK local_mask = mask & ~MASK_ALT; + + if (mModelPreview && hasMouseCapture()) + { + if (local_mask == MASK_PAN) + { + // pan here + mModelPreview->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; + + mModelPreview->rotate(yaw_radians, pitch_radians); + } + else + { + + F32 yaw_radians = (F32)(x - mLastMouseX) * -0.01f; + F32 zoom_amt = (F32)(y - mLastMouseY) * 0.02f; + + mModelPreview->rotate(yaw_radians, 0.f); + mModelPreview->zoom(zoom_amt); + } + + + mModelPreview->refresh(); + + LLUI::setMousePositionLocal(this, mLastMouseX, mLastMouseY); + } + + if (!mPreviewRect.pointInRect(x, y) || !mModelPreview) + { + 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 LLFloaterModelWizard::handleScrollWheel(S32 x, S32 y, S32 clicks) +{ + if (mPreviewRect.pointInRect(x, y) && mModelPreview) + { + mModelPreview->zoom((F32)clicks * -0.2f); + mModelPreview->refresh(); + } + + return TRUE; +} + + BOOL LLFloaterModelWizard::postBuild() { LLView* preview_panel = getChild("preview_panel"); diff --git a/indra/newview/llfloatermodelwizard.h b/indra/newview/llfloatermodelwizard.h index ab69d93b63..b7fd28aa9d 100644 --- a/indra/newview/llfloatermodelwizard.h +++ b/indra/newview/llfloatermodelwizard.h @@ -36,6 +36,11 @@ public: /*virtual*/ BOOL postBuild(); void draw(); + 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); + private: enum EWizardState { @@ -62,6 +67,8 @@ private: LLRect mPreviewRect; int mState; + S32 mLastMouseX; + S32 mLastMouseY; }; diff --git a/indra/newview/skins/default/xui/en/floater_model_wizard.xml b/indra/newview/skins/default/xui/en/floater_model_wizard.xml index 18dc33a23a..f5eda05f1a 100644 --- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml +++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml @@ -208,23 +208,8 @@ left="10" word_wrap="true"> Note: - Advanced users familiar with 3d content creation tools may prefer to use the Advanced Mesh Import window. +Advanced users familiar with 3d content creation tools may prefer to use the Advanced Mesh Import window. - - - High - - - Medium - - - Lowest - - - Low - - @@ -390,7 +375,7 @@ layout="topleft" left="220" max_val="2" - initial_vauel="1" + initial_value="1" min_val="0" name="accuracy_slider" show_text="false" -- cgit v1.2.3