diff options
-rwxr-xr-x | indra/newview/llfloatermodelpreview.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llfloatermodelpreview.h | 16 | ||||
-rw-r--r-- | indra/newview/llfloatermodelwizard.cpp | 52 | ||||
-rw-r--r-- | indra/newview/llfloatermodelwizard.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_model_wizard.xml | 200 |
5 files changed, 235 insertions, 56 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index c0b5b7cfa6..c948efe17f 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -340,6 +340,7 @@ BOOL LLFloaterModelPreview::postBuild() mModelPreview = new LLModelPreview(512, 512, this); mModelPreview->setPreviewTarget(16.f); + mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5)); //set callbacks for left click on line editor rows for (U32 i = 0; i <= LLModel::LOD_HIGH; i++) @@ -1664,6 +1665,8 @@ void LLModelLoader::run() setLoadState( ERROR_PARSING ); return; } + setLoadState( DONE ); + processElement(scene); doOnIdleOneTime(boost::bind(&LLModelPreview::loadModelCallback,mPreview,mLod)); @@ -2245,18 +2248,24 @@ U32 LLModelPreview::calcResourceCost() //mFMP->childSetTextArg(info_name[LLModel::LOD_PHYSICS], "[HULLS]", llformat("%d",num_hulls)); //mFMP->childSetTextArg(info_name[LLModel::LOD_PHYSICS], "[POINTS]", llformat("%d",num_points)); - mFMP->childSetTextArg("streaming cost", "[COST]", llformat("%.3f", streaming_cost)); - mFMP->childSetTextArg("physics cost", "[COST]", llformat("%.3f", physics_cost)); F32 scale = mFMP->childGetValue("import_scale").asReal()*2.f; - mFMP->childSetTextArg("import_dimensions", "[X]", llformat("%.3f", mPreviewScale[0]*scale)); - mFMP->childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", mPreviewScale[1]*scale)); - mFMP->childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", mPreviewScale[2]*scale)); + + mDetailsSignal(mPreviewScale[0]*scale, mPreviewScale[1]*scale, mPreviewScale[2]*scale, streaming_cost, physics_cost); updateStatusMessages(); return cost; } +void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost) +{ + childSetTextArg("import_dimensions", "[X]", llformat("%.3f", x)); + childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", y)); + childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", z)); + childSetTextArg("streaming cost", "[COST]", llformat("%.3f", streaming_cost)); + childSetTextArg("physics cost", "[COST]", llformat("%.3f", physics_cost)); +} + void LLModelPreview::rebuildUploadData() { assert_main_thread(); diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 04e5b9591c..63377bb1d6 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -152,6 +152,8 @@ public: static void onMouseCaptureLostModelPreview(LLMouseHandler*); static void setUploadAmount(S32 amount) { sUploadAmount = amount; } + + void setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost); static void onBrowseLOD(void* data); @@ -247,9 +249,10 @@ private: class LLModelPreview : public LLViewerDynamicTexture, public LLMutex -{ - public: - +{ + typedef boost::signals2::signal<void (F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost)> details_signal_t; + +public: LLModelPreview(S32 width, S32 height, LLFloater* fmp); virtual ~LLModelPreview(); @@ -282,9 +285,10 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex bool containsRiggedAsset( void ); void clearGLODGroup(); - static void textureLoadedCallback( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); - + + boost::signals2::connection setDetailsCallback( const details_signal_t::slot_type& cb ){ return mDetailsSignal.connect(cb); } + protected: friend class LLFloaterModelPreview; friend class LLFloaterModelWizard; @@ -336,6 +340,8 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex //map of vertex buffers to models (one vertex buffer in vector per face in model std::map<LLModel*, std::vector<LLPointer<LLVertexBuffer> > > mVertexBuffer[LLModel::NUM_LODS+1]; + + details_signal_t mDetailsSignal; }; diff --git a/indra/newview/llfloatermodelwizard.cpp b/indra/newview/llfloatermodelwizard.cpp index fe53eafa40..19bdea5f44 100644 --- a/indra/newview/llfloatermodelwizard.cpp +++ b/indra/newview/llfloatermodelwizard.cpp @@ -30,6 +30,7 @@ #include "llbutton.h" #include "lldrawable.h" +#include "llcheckboxctrl.h" #include "llcombobox.h" #include "llfloater.h" #include "llfloatermodelwizard.h" @@ -71,8 +72,15 @@ void LLFloaterModelWizard::setState(int state) } } + if (state == CHOOSE_FILE) + { + getChildView("back")->setEnabled(false); + } + if (state == OPTIMIZE) { + getChildView("back")->setEnabled(true); + //mModelPreview->mModel[lod].clear(); mModelPreview->genLODs(-1); mModelPreview->mViewOption["show_physics"] = false; } @@ -423,6 +431,7 @@ BOOL LLFloaterModelWizard::postBuild() childSetValue("import_scale", (F32) 0.67335826); getChild<LLUICtrl>("browse")->setCommitCallback(boost::bind(&LLFloaterModelWizard::loadModel, this)); + //getChild<LLUICtrl>("lod_file")->setCommitCallback(boost::bind(&LLFloaterModelWizard::loadModel, this)); getChild<LLUICtrl>("cancel")->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickCancel, this)); getChild<LLUICtrl>("close")->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickCancel, this)); getChild<LLUICtrl>("back")->setCommitCallback(boost::bind(&LLFloaterModelWizard::onClickBack, this)); @@ -441,6 +450,8 @@ BOOL LLFloaterModelWizard::postBuild() mModelPreview = new LLModelPreview(512, 512, this); mModelPreview->setPreviewTarget(16.f); + mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelWizard::setDetails, this, _1, _2, _3, _4, _5)); + center(); @@ -455,6 +466,25 @@ BOOL LLFloaterModelWizard::postBuild() return TRUE; } + +void LLFloaterModelWizard::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost) +{ + // iterate through all the panels, setting the dimensions + for(size_t t=0; t<LL_ARRAY_SIZE(stateNames); ++t) + { + LLPanel *panel = getChild<LLPanel>(stateNames[t]+"_panel"); + if (panel) + { + panel->childSetText("dimension_x", llformat("%.1f", x)); + panel->childSetText("dimension_y", llformat("%.1f", y)); + panel->childSetText("dimension_z", llformat("%.1f", z)); + panel->childSetTextArg("streaming cost", "[COST]", llformat("%.3f", streaming_cost)); + panel->childSetTextArg("physics cost", "[COST]", llformat("%.3f", physics_cost)); + } + } +} + + void LLFloaterModelWizard::onUpload() { mModelPreview->rebuildUploadData(); @@ -492,8 +522,30 @@ void LLFloaterModelWizard::onPreviewLODCommit(LLUICtrl* ctrl) mModelPreview->setPreviewLOD(which_mode); } +void LLFloaterModelWizard::refresh() +{ + if (mState == CHOOSE_FILE) + { + bool model_loaded = false; + + if (mModelPreview && mModelPreview->mModelLoader && mModelPreview->mModelLoader->getLoadState() == LLModelLoader::DONE) + { + model_loaded = true; + } + + getChildView("next")->setEnabled(model_loaded); + } + if (mState == REVIEW) + { + getChildView("upload")->setEnabled(getChild<LLCheckBoxCtrl>("confirm_checkbox")->getValue().asBoolean()); + } + +} + void LLFloaterModelWizard::draw() { + refresh(); + LLFloater::draw(); LLRect r = getRect(); diff --git a/indra/newview/llfloatermodelwizard.h b/indra/newview/llfloatermodelwizard.h index eaf188ed40..335f4f4b56 100644 --- a/indra/newview/llfloatermodelwizard.h +++ b/indra/newview/llfloatermodelwizard.h @@ -57,13 +57,15 @@ public: virtual ~LLFloaterModelWizard(); /*virtual*/ BOOL postBuild(); void draw(); + void refresh(); 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 setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost); + void initDecompControls(); LLPhysicsDecomp::decomp_params mDecompParams; 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 e2ec557b06..d8492a10bb 100644 --- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml +++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml @@ -190,21 +190,49 @@ <text top_pad="10" width="130" - height="15" + height="14" left="340" text_color="White" word_wrap="true"> Dimensions (meters): </text> <text - top_pad="2" + top_pad="0" width="160" height="15" - name="import_dimensions" + font="SansSerifSmallBold" + text_color="White" + name="dimensions" left_delta="0"> - X: [X] |Y: [Y] |Z: [Z] + X: Y: Z: </text> <text + top_delta="0" + width="160" + height="15" + name="dimension_dividers" + left_delta="41"> + | | + </text> + <text + top_delta="0" + width="160" + height="15" + name="dimension_x" + left="356"/> + <text + top_delta="0" + width="160" + height="15" + name="dimension_y" + left="403"/> + <text + top_delta="0" + width="160" + height="15" + name="dimension_z" + left="450"/> + <text top="100" width="320" height="15" @@ -397,29 +425,66 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se width="290" /> <text font="SansSerifSmall" - top_pad="1" + top_pad="0" width="300" left_delta="6" height="4">' ' '</text> - <text top_delta="25" width="100" text_color="White" left_delta="50" height="20">Resource Cost:</text> + + + <icon + top_pad="10" + left_delta="0" + width="280" + height="2" + image_name="model_wizard\divider_line.png"/> + + <text top_delta="25" width="200" text_color="White" left_delta="50" name="streaming cost" height="20">Resource Cost: [COST]</text> <text top_delta="25" width="100" text_color="White" left_delta="0" height="20">Upload Fee:</text> <text - top_pad="15" - width="130" - height="15" - left="10" - text_color="White" - word_wrap="true"> + top_pad="5" + width="130" + height="14" + left="10" + text_color="White" + word_wrap="true"> Dimensions (meters): </text> <text top_pad="0" width="160" height="15" - name="import_dimensions" + font="SansSerifSmallBold" + text_color="White" + name="dimensions" left_delta="0"> - X: [X] |Y: [Y] |Z: [Z] + X: Y: Z: + </text> + <text + top_delta="0" + width="160" + height="15" + name="dimension_dividers" + left_delta="41"> + | | </text> + <text + top_delta="0" + width="160" + height="15" + name="dimension_x" + left_delta="-25"/> + <text + top_delta="0" + width="160" + height="15" + name="dimension_y" + left_delta="46"/> + <text + top_delta="0" + width="160" + height="15" + name="dimension_z" + left_delta="46"/> </panel> </panel> @@ -466,7 +531,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se <panel top_delta="40" left="15" - height="245" + height="265" width="500" name="content" bg_opaque_color="DkGray2" @@ -499,9 +564,18 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se <text top_pad="10" width="110" halign="center" word_wrap="true" left="25" height="40">Recommended for solid objects</text> <text top_delta="0" width="110" halign="center" word_wrap="true" left="190" height="40">Recommended for buildings</text> <text top_delta="0" width="110" halign="center" word_wrap="true" left="350" height="40">Recommended for vehicles</text> - <text top_delta="60" width="100" text_color="White" left="160" height="20">Resource Cost:</text> - <text top_delta="20" width="100" text_color="White" left_delta="0" height="20">Physics Cost:</text> - <text top_delta="20" width="100" text_color="White" left_delta="0" height="20">Upload Fee:</text> + + + <icon + top_pad="5" + left="15" + width="470" + height="2" + image_name="model_wizard\divider_line.png"/> + + <text top_delta="20" width="180" text_color="White" left="160" name="streaming cost" height="20">Resource Cost: [COST]</text> + <text top_delta="26" width="180" text_color="White" left_delta="0" name="physics cost" height="20">Physics Cost: [COST]</text> + <text top_delta="26" width="180" text_color="White" left_delta="0" height="20">Upload Fee:</text> </panel> </panel> @@ -511,7 +585,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se height="388" top_delta="0" name="review_panel" - visible="false" + visible="true" width="530" left="0"> <panel @@ -538,7 +612,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se <text top_pad="14" width="460" - height="20" + height="24" font="SansSerifSmall" layout="topleft" name="description" @@ -546,8 +620,14 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se left_delta="10"> Review the details below then click. Upload to upload your model. Your L$ balance will be charged when you click Upload. </text> + <icon + top_pad="10" + left="20" + width="495" + height="2" + image_name="model_wizard\divider_line.png"/> <panel - top_delta="40" + top_pad="5" left="15" height="245" width="500" @@ -555,7 +635,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se <text top="10" left="10" width="85" text_color="White" follows="left|top" height="15" name="lod_label"> Model Preview: </text> - <combo_box left_pad="5" top_delta="-2" follows="left|top" list_position="below" height="18" + <combo_box left_pad="5" top_delta="-5" follows="left|top" list_position="below" height="22" name="preview_lod_combo" width="90" tool_tip="LOD to view in preview render"> <combo_item name="high"> High @@ -580,32 +660,61 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se height="190" follows="all" width="190"> - </panel> - <text - top_pad="8" - width="130" - height="15" - left="10" - text_color="White" - word_wrap="true"> - Dimensions (meters): - </text> - <text - top_pad="0" - width="160" - height="15" - name="import_dimensions" - left_delta="0"> - X: [X] |Y: [Y] |Z: [Z] - </text> + </panel> + <text + top_pad="8" + width="130" + height="14" + left="10" + text_color="White" + word_wrap="true"> + Dimensions (meters): + </text> + <text + top_pad="0" + width="160" + height="15" + font="SansSerifSmallBold" + text_color="White" + name="dimensions" + left_delta="0"> + X: Y: Z: + </text> + <text + top_delta="0" + width="160" + height="15" + name="dimension_dividers" + left_delta="41"> + | | + </text> + <text + top_delta="0" + width="160" + height="15" + name="dimension_x" + left_delta="-25"/> + <text + top_delta="0" + width="160" + height="15" + name="dimension_y" + left_delta="46"/> + <text + top_delta="0" + width="160" + height="15" + name="dimension_z" + left_delta="46"/> </panel> <text - width="200" + width="300" height="12" top="125" + name="streaming cost" left="230" font="SansSerifSmallBold" - text_color="White">Resource Cost:</text> + text_color="White">Resource Cost: [COST]</text> <text width="285" height="30" @@ -614,12 +723,13 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se word_wrap="true" font="SansSerifItalic">This is the cost to your Region's prim/object limit, at default scale</text> <text - width="200" + width="300" height="12" + name="physics cost" top_pad="10" left_delta="0" font="SansSerifSmallBold" - text_color="White">Physics Cost:</text> + text_color="White">Physics Cost: [COST]</text> <text width="285" height="30" @@ -663,7 +773,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se height="388" top_delta="0" name="upload_panel" - visible="true" + visible="false" width="530" left="0"> <panel |