From db1af2445dac667eb24c69d005509b8ff007cc9e Mon Sep 17 00:00:00 2001 From: leyla_linden Date: Thu, 9 Dec 2010 17:30:17 -0800 Subject: Initial code for the upload model wizard - loading model is working, not much else --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloatermodelpreview.cpp | 39 ++-- indra/newview/llfloatermodelpreview.h | 23 +- indra/newview/llfloatermodelwizard.cpp | 112 ++++++++++ indra/newview/llfloatermodelwizard.h | 58 +++++ indra/newview/llviewerfloaterreg.cpp | 2 + .../default/textures/model_wizard/check_mark.png | Bin 0 -> 3166 bytes .../textures/model_wizard/left_button_disabled.png | Bin 0 -> 3576 bytes .../textures/model_wizard/left_button_off.png | Bin 0 -> 4309 bytes .../textures/model_wizard/left_button_over.png | Bin 0 -> 4272 bytes .../textures/model_wizard/left_button_press.png | Bin 0 -> 4278 bytes .../model_wizard/middle_button_disabled.png | Bin 0 -> 3425 bytes .../textures/model_wizard/middle_button_off.png | Bin 0 -> 4151 bytes .../textures/model_wizard/middle_button_over.png | Bin 0 -> 4137 bytes .../textures/model_wizard/middle_button_press.png | Bin 0 -> 4200 bytes .../textures/model_wizard/progress_bar_bg.png | Bin 0 -> 3180 bytes .../textures/model_wizard/progress_light.png | Bin 0 -> 2979 bytes .../model_wizard/right_button_disabled.png | Bin 0 -> 3169 bytes .../textures/model_wizard/right_button_off.png | Bin 0 -> 3845 bytes .../textures/model_wizard/right_button_over.png | Bin 0 -> 3867 bytes .../textures/model_wizard/right_button_press.png | Bin 0 -> 3915 bytes .../skins/default/xui/en/floater_model_wizard.xml | 247 +++++++++++++++++++++ indra/newview/skins/default/xui/en/menu_viewer.xml | 12 + 23 files changed, 469 insertions(+), 26 deletions(-) create mode 100644 indra/newview/llfloatermodelwizard.cpp create mode 100644 indra/newview/llfloatermodelwizard.h create mode 100644 indra/newview/skins/default/textures/model_wizard/check_mark.png create mode 100644 indra/newview/skins/default/textures/model_wizard/left_button_disabled.png create mode 100644 indra/newview/skins/default/textures/model_wizard/left_button_off.png create mode 100644 indra/newview/skins/default/textures/model_wizard/left_button_over.png create mode 100644 indra/newview/skins/default/textures/model_wizard/left_button_press.png create mode 100644 indra/newview/skins/default/textures/model_wizard/middle_button_disabled.png create mode 100644 indra/newview/skins/default/textures/model_wizard/middle_button_off.png create mode 100644 indra/newview/skins/default/textures/model_wizard/middle_button_over.png create mode 100644 indra/newview/skins/default/textures/model_wizard/middle_button_press.png create mode 100644 indra/newview/skins/default/textures/model_wizard/progress_bar_bg.png create mode 100644 indra/newview/skins/default/textures/model_wizard/progress_light.png create mode 100644 indra/newview/skins/default/textures/model_wizard/right_button_disabled.png create mode 100644 indra/newview/skins/default/textures/model_wizard/right_button_off.png create mode 100644 indra/newview/skins/default/textures/model_wizard/right_button_over.png create mode 100644 indra/newview/skins/default/textures/model_wizard/right_button_press.png create mode 100644 indra/newview/skins/default/xui/en/floater_model_wizard.xml (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 133f93ec1a..fd52c56a87 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -201,6 +201,7 @@ set(viewer_SOURCE_FILES llfloatermediasettings.cpp llfloatermemleak.cpp llfloatermodelpreview.cpp + llfloatermodelwizard.cpp llfloaternamedesc.cpp llfloaternotificationsconsole.cpp llfloateropenobject.cpp @@ -741,6 +742,7 @@ set(viewer_HEADER_FILES llfloatermediasettings.h llfloatermemleak.h llfloatermodelpreview.h + llfloatermodelwizard.h llfloaternamedesc.h llfloaternotificationsconsole.h llfloateropenobject.h diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 1e0624f8c4..0cfebdb399 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -212,24 +212,18 @@ BOOL stop_gloderror() return FALSE; } -class LLMeshFilePicker : public LLFilePickerThread -{ -public: - LLFloaterModelPreview* mFMP; - S32 mLOD; - LLMeshFilePicker(LLFloaterModelPreview* fmp, S32 lod) +LLMeshFilePicker::LLMeshFilePicker(LLModelPreview* mp, S32 lod) : LLFilePickerThread(LLFilePicker::FFLOAD_COLLADA) { - mFMP = fmp; + mMP = mp; mLOD = lod; } - - virtual void notify(const std::string& filename) - { - mFMP->mModelPreview->loadModel(mFile, mLOD); - } -}; + +void LLMeshFilePicker::notify(const std::string& filename) +{ + mMP->loadModel(mFile, mLOD); +} //----------------------------------------------------------------------------- @@ -242,7 +236,6 @@ LLFloater(key) mLastMouseX = 0; mLastMouseY = 0; mGLName = 0; - mLoading = FALSE; } //----------------------------------------------------------------------------- @@ -294,6 +287,7 @@ BOOL LLFloaterModelPreview::postBuild() mModelPreview = new LLModelPreview(512, 512, this); mModelPreview->setPreviewTarget(16.f); + mModelPreview->setAspect((F32) mPreviewRect.getWidth()/mPreviewRect.getHeight()); //set callbacks for left click on line editor rows for (U32 i = 0; i <= LLModel::LOD_HIGH; i++) @@ -348,9 +342,9 @@ LLFloaterModelPreview::~LLFloaterModelPreview() void LLFloaterModelPreview::loadModel(S32 lod) { - mLoading = TRUE; + mModelPreview->mLoading = true; - (new LLMeshFilePicker(this, lod))->getFile(); + (new LLMeshFilePicker(mModelPreview, lod))->getFile(); } void LLFloaterModelPreview::setLimit(S32 lod, S32 limit) @@ -493,7 +487,7 @@ void LLFloaterModelPreview::draw() mModelPreview->update(); - if (!mLoading) + if (!mModelPreview->mLoading) { childSetTextArg("status", "[STATUS]", getString("status_idle")); } @@ -1966,7 +1960,7 @@ LLColor4 LLModelLoader::getDaeColor(daeElement* element) // LLModelPreview //----------------------------------------------------------------------------- -LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloaterModelPreview* fmp) +LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex(NULL) { mNeedsUpdate = TRUE; @@ -1978,6 +1972,7 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloaterModelPreview* fmp mPreviewLOD = 0; mModelLoader = NULL; mDirty = false; + mLoading = false; for (U32 i = 0; i < LLModel::NUM_LODS; i++) { @@ -2216,7 +2211,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod) mFMP->closeFloater(false); } - mFMP->mLoading = false; + mLoading = false; return; } @@ -2339,7 +2334,7 @@ void LLModelPreview::loadModelCallback(S32 lod) resetPreviewTarget(); } - mFMP->mLoading = FALSE; + mLoading = false; refresh(); } @@ -3369,9 +3364,7 @@ BOOL LLModelPreview::render() glClear(GL_DEPTH_BUFFER_BIT); - F32 aspect = (F32) mFMP->mPreviewRect.getWidth()/mFMP->mPreviewRect.getHeight(); - - LLViewerCamera::getInstance()->setAspect(aspect); + LLViewerCamera::getInstance()->setAspect(mAspect); LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom); LLVector3 offset = mCameraOffset; diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 2e98b8eb18..b0317e3d2d 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -34,6 +34,7 @@ #include "llmeshrepository.h" #include "llmodel.h" #include "llthread.h" +#include "llviewermenufile.h" class LLComboBox; class LLJoint; @@ -202,7 +203,6 @@ protected: S32 mLastMouseY; LLRect mPreviewRect; U32 mGLName; - BOOL mLoading; static S32 sUploadAmount; LLPointer mCurRequest; @@ -210,11 +210,23 @@ protected: }; +class LLMeshFilePicker : public LLFilePickerThread +{ +public: + LLMeshFilePicker(LLModelPreview* mp, S32 lod); + virtual void notify(const std::string& filename); + +private: + LLModelPreview* mMP; + S32 mLOD; +}; + + class LLModelPreview : public LLViewerDynamicTexture, public LLMutex { public: - LLModelPreview(S32 width, S32 height, LLFloaterModelPreview* fmp); + LLModelPreview(S32 width, S32 height, LLFloater* fmp); virtual ~LLModelPreview(); void resetPreviewTarget(); @@ -244,15 +256,18 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex void clearIncompatible(S32 lod); void updateStatusMessages(); bool containsRiggedAsset( void ); + void setAspect(F32 aspect) { mAspect = aspect; }; + //void setLoading(bool loading) { mLoading = loading; }; static void textureLoadedCallback( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); protected: friend class LLFloaterModelPreview; + friend class LLFloaterModelWizard; friend class LLFloaterModelPreview::DecompRequest; friend class LLPhysicsDecomp; - LLFloaterModelPreview* mFMP; + LLFloater* mFMP; BOOL mNeedsUpdate; bool mDirty; @@ -268,6 +283,8 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex U32 mResourceCost; S32 mLimit[LLModel::NUM_LODS]; std::string mLODFile[LLModel::NUM_LODS]; + F32 mAspect; + bool mLoading; LLModelLoader* mModelLoader; diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp new file mode 100644 index 0000000000..416501cc8b --- /dev/null +++ b/indra/newview/llfloatermodelwizard.cpp @@ -0,0 +1,112 @@ +/** + * @file llfloatermodelwizard.cpp + * @author Leyla Farazha + * @brief Implementation of the LLFloaterModelWizard class. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" + +#include "lldrawable.h" +#include "llfloater.h" +#include "llfloatermodelwizard.h" +#include "llfloatermodelpreview.h" +#include "llfloaterreg.h" + + + +LLFloaterModelWizard::LLFloaterModelWizard(const LLSD& key) + : LLFloater(key) +{ +} + +void LLFloaterModelWizard::loadModel() +{ + mModelPreview->mLoading = TRUE; + + (new LLMeshFilePicker(mModelPreview, 3))->getFile(); +} + + +BOOL LLFloaterModelWizard::postBuild() +{ + LLView* preview_panel = getChild("preview_panel"); + + childSetValue("import_scale", (F32) 0.67335826); + + getChild("browse")->setCommitCallback(boost::bind(&LLFloaterModelWizard::loadModel, this)); + + mPreviewRect = preview_panel->getRect(); + + mModelPreview = new LLModelPreview(512, 512, this); + mModelPreview->setPreviewTarget(16.f); + mModelPreview->setAspect((F32) mPreviewRect.getWidth()/mPreviewRect.getHeight()); + + center(); + + return TRUE; +} + +void LLFloaterModelWizard::draw() +{ + LLFloater::draw(); + LLRect r = getRect(); + + mModelPreview->update(); + + if (mModelPreview) + { + gGL.color3f(1.f, 1.f, 1.f); + + gGL.getTexUnit(0)->bind(mModelPreview); + + + LLView* preview_panel = getChild("preview_panel"); + + LLRect rect = preview_panel->getRect(); + if (rect != mPreviewRect) + { + mModelPreview->refresh(); + mPreviewRect = preview_panel->getRect(); + } + + LLRect item_rect; + preview_panel->localRectToOtherView(preview_panel->getLocalRect(), &item_rect, this); + + gGL.begin( LLRender::QUADS ); + { + gGL.texCoord2f(0.f, 1.f); + gGL.vertex2i(mPreviewRect.mLeft, item_rect.mTop); + gGL.texCoord2f(0.f, 0.f); + gGL.vertex2i(mPreviewRect.mLeft, item_rect.mBottom); + gGL.texCoord2f(1.f, 0.f); + gGL.vertex2i(mPreviewRect.mRight, item_rect.mBottom); + gGL.texCoord2f(1.f, 1.f); + gGL.vertex2i(mPreviewRect.mRight, item_rect.mTop); + } + gGL.end(); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + } +} diff --git a/indra/newview/llfloatermodelwizard.h b/indra/newview/llfloatermodelwizard.h new file mode 100644 index 0000000000..c766697d47 --- /dev/null +++ b/indra/newview/llfloatermodelwizard.h @@ -0,0 +1,58 @@ +/** + * @file llfloatermodelwizard.h + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LLFLOATERMODELWIZARD_H +#define LLFLOATERMODELWIZARD_H + +class LLModelPreview; + +class LLFloaterModelWizard : public LLFloater +{ +public: + LLFloaterModelWizard(const LLSD& key); + virtual ~LLFloaterModelWizard() {}; + /*virtual*/ BOOL postBuild(); + void draw(); + void loadModel(); + //void onSave(); + //void onReset(); + //void onCancel(); + ///*virtual*/ void onOpen(const LLSD& key); + +private: + + LLModelPreview* mModelPreview; + LLRect mPreviewRect; +}; +/* +namespace LLFloaterDisplayNameUtil +{ + // Register with LLFloaterReg + void registerFloater(); +} +*/ + + +#endif diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 9ee446bc71..849ac7c830 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -72,6 +72,7 @@ #include "llfloaterlandholdings.h" #include "llfloatermap.h" #include "llfloatermemleak.h" +#include "llfloatermodelwizard.h" #include "llfloaternamedesc.h" #include "llfloaternotificationsconsole.h" #include "llfloateropenobject.h" @@ -251,6 +252,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("upload_image", "floater_image_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); LLFloaterReg::add("upload_model", "floater_model_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); + LLFloaterReg::add("upload_model_wizard", "floater_model_wizard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "upload"); LLFloaterReg::add("voice_controls", "floater_voice_controls.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/textures/model_wizard/check_mark.png b/indra/newview/skins/default/textures/model_wizard/check_mark.png new file mode 100644 index 0000000000..2c05297f4f Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/check_mark.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/left_button_disabled.png b/indra/newview/skins/default/textures/model_wizard/left_button_disabled.png new file mode 100644 index 0000000000..c7c0eaa96b Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/left_button_disabled.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/left_button_off.png b/indra/newview/skins/default/textures/model_wizard/left_button_off.png new file mode 100644 index 0000000000..4a73c254fc Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/left_button_off.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/left_button_over.png b/indra/newview/skins/default/textures/model_wizard/left_button_over.png new file mode 100644 index 0000000000..6fb5c432de Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/left_button_over.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/left_button_press.png b/indra/newview/skins/default/textures/model_wizard/left_button_press.png new file mode 100644 index 0000000000..fa18517933 Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/left_button_press.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/middle_button_disabled.png b/indra/newview/skins/default/textures/model_wizard/middle_button_disabled.png new file mode 100644 index 0000000000..bed1a701bd Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/middle_button_disabled.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/middle_button_off.png b/indra/newview/skins/default/textures/model_wizard/middle_button_off.png new file mode 100644 index 0000000000..57ce9af574 Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/middle_button_off.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/middle_button_over.png b/indra/newview/skins/default/textures/model_wizard/middle_button_over.png new file mode 100644 index 0000000000..2c43022f0e Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/middle_button_over.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/middle_button_press.png b/indra/newview/skins/default/textures/model_wizard/middle_button_press.png new file mode 100644 index 0000000000..6b8c1baca4 Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/middle_button_press.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/progress_bar_bg.png b/indra/newview/skins/default/textures/model_wizard/progress_bar_bg.png new file mode 100644 index 0000000000..d0b213cdc5 Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/progress_bar_bg.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/progress_light.png b/indra/newview/skins/default/textures/model_wizard/progress_light.png new file mode 100644 index 0000000000..019344f812 Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/progress_light.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/right_button_disabled.png b/indra/newview/skins/default/textures/model_wizard/right_button_disabled.png new file mode 100644 index 0000000000..51505e80c5 Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/right_button_disabled.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/right_button_off.png b/indra/newview/skins/default/textures/model_wizard/right_button_off.png new file mode 100644 index 0000000000..9f93efbd93 Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/right_button_off.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/right_button_over.png b/indra/newview/skins/default/textures/model_wizard/right_button_over.png new file mode 100644 index 0000000000..3a4ec1a315 Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/right_button_over.png differ diff --git a/indra/newview/skins/default/textures/model_wizard/right_button_press.png b/indra/newview/skins/default/textures/model_wizard/right_button_press.png new file mode 100644 index 0000000000..1f1b4c2ed5 Binary files /dev/null and b/indra/newview/skins/default/textures/model_wizard/right_button_press.png differ diff --git a/indra/newview/skins/default/xui/en/floater_model_wizard.xml b/indra/newview/skins/default/xui/en/floater_model_wizard.xml new file mode 100644 index 0000000000..3f11f7d4dd --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml @@ -0,0 +1,247 @@ + + + + + + Model Preview: + + + + + + + + + Dimensions (meters): + + + X: + + + Y: + + + Z: + + + Note: +Advanced users familiar with 3d content creation tools may prefer to use the Advanced Mesh Import window. + + +