diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloatermodelpreview.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llfloatermodelwizard.cpp | 55 | ||||
-rw-r--r-- | indra/newview/llfloatermodelwizard.h | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_model_wizard.xml | 6 |
4 files changed, 54 insertions, 26 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 06a1225905..8e0ad54931 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4765,7 +4765,18 @@ BOOL LLModelPreview::render() glClear(GL_DEPTH_BUFFER_BIT); - LLRect preview_rect = mFMP->getChildView("preview_panel")->getRect(); + LLRect preview_rect; + + LLFloaterModelWizard* floater_wizard = dynamic_cast<LLFloaterModelWizard*>(mFMP); + if (floater_wizard) + { + preview_rect = floater_wizard->getPreviewRect(); + } + else + { + preview_rect = mFMP->getChildView("preview_panel")->getRect(); + } + F32 aspect = (F32) preview_rect.getWidth()/preview_rect.getHeight(); LLViewerCamera::getInstance()->setAspect(aspect); diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index 61b8032625..32b8850803 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -58,6 +58,9 @@ LLFloaterModelWizard::LLFloaterModelWizard(const LLSD& key) ,mRecalculatingPhysicsBtn(NULL) ,mCalculateWeightsBtn(NULL) ,mCalculatingWeightsBtn(NULL) + ,mChooseFilePreviewPanel(NULL) + ,mOptimizePreviewPanel(NULL) + ,mPhysicsPreviewPanel(NULL) { mLastEnabledState = CHOOSE_FILE; sInstance = this; @@ -86,10 +89,14 @@ void LLFloaterModelWizard::setState(int state) } } + LLView* current_preview_panel = NULL; + if (state == CHOOSE_FILE) { mModelPreview->mViewOption["show_physics"] = false; + current_preview_panel = mChooseFilePreviewPanel; + getChildView("close")->setVisible(false); getChildView("back")->setVisible(true); getChildView("back")->setEnabled(false); @@ -109,6 +116,8 @@ void LLFloaterModelWizard::setState(int state) mModelPreview->mViewOption["show_physics"] = false; + current_preview_panel = mOptimizePreviewPanel; + getChildView("back")->setVisible(true); getChildView("back")->setEnabled(true); getChildView("close")->setVisible(false); @@ -128,6 +137,8 @@ void LLFloaterModelWizard::setState(int state) mModelPreview->mViewOption["show_physics"] = true; + current_preview_panel = mPhysicsPreviewPanel; + getChildView("next")->setVisible(false); getChildView("upload")->setVisible(false); getChildView("close")->setVisible(false); @@ -164,6 +175,20 @@ void LLFloaterModelWizard::setState(int state) mCalculatingWeightsBtn->setVisible(false); } + if (current_preview_panel) + { + LLRect rect; + current_preview_panel->localRectToOtherView(current_preview_panel->getLocalRect(), &rect, this); + + // Reduce the preview rect by 1 px to fit the borders + rect.stretch(-1); + + if (rect != mPreviewRect) + { + mPreviewRect = rect; + mModelPreview->refresh(); + } + } updateButtons(); } @@ -508,8 +533,6 @@ void LLFloaterModelWizard::DecompRequest::completed() BOOL LLFloaterModelWizard::postBuild() { - LLView* preview_panel = getChildView("preview_panel"); - childSetValue("import_scale", (F32) 0.67335826); getChild<LLUICtrl>("browse")->setCommitCallback(boost::bind(&LLFloaterModelWizard::loadModel, this)); @@ -537,13 +560,14 @@ BOOL LLFloaterModelWizard::postBuild() mCalculatingWeightsBtn = getChild<LLButton>("calculating"); + mChooseFilePreviewPanel = getChild<LLView>("choose_file_preview_panel"); + mOptimizePreviewPanel = getChild<LLView>("optimize_preview_panel"); + mPhysicsPreviewPanel = getChild<LLView>("physics_preview_panel"); + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; enable_registrar.add("Next.OnEnable", boost::bind(&LLFloaterModelWizard::onEnableNext, this)); enable_registrar.add("Back.OnEnable", boost::bind(&LLFloaterModelWizard::onEnableBack, this)); - - - mPreviewRect = preview_panel->getRect(); mModelPreview = new LLModelPreview(512, 512, this); mModelPreview->setPreviewTarget(16.f); @@ -648,29 +672,16 @@ void LLFloaterModelWizard::draw() gGL.getTexUnit(0)->bind(mModelPreview); - LLView *view = getChildView(stateNames[mState]+"_panel"); - LLView* preview_panel = view->getChildView("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(item_rect.mLeft, item_rect.mTop-1); + gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mTop); gGL.texCoord2f(0.f, 0.f); - gGL.vertex2i(item_rect.mLeft, item_rect.mBottom); + gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mBottom); gGL.texCoord2f(1.f, 0.f); - gGL.vertex2i(item_rect.mRight-1, item_rect.mBottom); + gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mBottom); gGL.texCoord2f(1.f, 1.f); - gGL.vertex2i(item_rect.mRight-1, item_rect.mTop-1); + gGL.vertex2i(mPreviewRect.mRight, mPreviewRect.mTop); } gGL.end(); diff --git a/indra/newview/llfloatermodelwizard.h b/indra/newview/llfloatermodelwizard.h index c32977f4b0..409451e1b6 100644 --- a/indra/newview/llfloatermodelwizard.h +++ b/indra/newview/llfloatermodelwizard.h @@ -68,6 +68,8 @@ public: void modelLoadedCallback(); void initDecompControls(); + const LLRect& getPreviewRect() const { return mPreviewRect; } + LLPhysicsDecomp::decomp_params mDecompParams; std::set<LLPointer<DecompRequest> > mCurRequest; std::string mStatusMessage; @@ -111,6 +113,10 @@ private: LLButton* mRecalculatingPhysicsBtn; LLButton* mCalculateWeightsBtn; LLButton* mCalculatingWeightsBtn; + + LLView* mChooseFilePreviewPanel; + LLView* mOptimizePreviewPanel; + LLView* mPhysicsPreviewPanel; }; 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 1d6ded5391..9f7c79ada4 100644 --- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml +++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml @@ -207,7 +207,7 @@ <panel top="30" right="-10" - name="preview_panel" + name="choose_file_preview_panel" bevel_style="none" highlight_light_color="0.09 0.09 0.09 1" border="true" @@ -460,7 +460,7 @@ Higher prim weight</text> <panel right="-10" top="32" - name="preview_panel" + name="optimize_preview_panel" bevel_style="none" highlight_light_color="0.09 0.09 0.09 1" border_style="line" @@ -598,7 +598,7 @@ Buildings</text> <panel right="-10" top="32" - name="preview_panel" + name="physics_preview_panel" bevel_style="none" highlight_light_color="0.09 0.09 0.09 1" border_style="line" |