summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleyla_linden <none@none>2010-12-21 17:01:03 -0800
committerleyla_linden <none@none>2010-12-21 17:01:03 -0800
commit6175e8147ff85073c67de89f08e5ecea891e1ef8 (patch)
treed374000efbbb2e866123d68d883c3fcdaa718fd3
parent4e98895719d963a72346a7bf59323cdb602f98dd (diff)
fixed wizard model not previewing issues and added pan/zoom
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp50
-rw-r--r--indra/newview/llfloatermodelwizard.cpp103
-rw-r--r--indra/newview/llfloatermodelwizard.h7
-rw-r--r--indra/newview/skins/default/xui/en/floater_model_wizard.xml19
4 files changed, 138 insertions, 41 deletions
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,7 +3339,7 @@ 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)
{
@@ -3348,6 +3348,31 @@ void LLModelPreview::updateStatusMessages()
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<LLView>("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.
</text>
- <combo_box left_pad="0" top_delta="0" follows="left|top" list_position="below" height="18"
- name="preview_lod_combo_2" width="90" tool_tip="LOD to view in preview render">
- <combo_item name="high">
- High
- </combo_item>
- <combo_item name="medium">
- Medium
- </combo_item>
- <combo_item name="lowest">
- Lowest
- </combo_item>
- <combo_item name="low">
- Low
- </combo_item>
- </combo_box>
</panel>
</panel>
@@ -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"