diff options
Diffstat (limited to 'indra/newview/llfloatertools.cpp')
-rw-r--r-- | indra/newview/llfloatertools.cpp | 142 |
1 files changed, 48 insertions, 94 deletions
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 0d798afdcc..3e98cff9e6 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -36,7 +36,6 @@ #include "llagentcamera.h" #include "llbutton.h" #include "llcheckboxctrl.h" -#include "llcombobox.h" #include "lldraghandle.h" #include "llerror.h" #include "llfloaterbuildoptions.h" @@ -101,6 +100,7 @@ const std::string PANEL_NAMES[LLFloaterTools::PANEL_COUNT] = std::string("Content"), // PANEL_CONTENTS, }; + // Local prototypes void commit_select_component(void *data); void click_show_more(void*); @@ -116,7 +116,6 @@ void commit_radio_group_focus(LLUICtrl* ctrl); void commit_radio_group_move(LLUICtrl* ctrl); void commit_radio_group_edit(LLUICtrl* ctrl); void commit_radio_group_land(LLUICtrl* ctrl); -void commit_grid_mode(LLUICtrl *); void commit_slider_zoom(LLUICtrl *ctrl); @@ -234,7 +233,6 @@ BOOL LLFloaterTools::postBuild() getChild<LLUICtrl>("checkbox uniform")->setValue((BOOL)gSavedSettings.getBOOL("ScaleUniform")); mCheckStretchTexture = getChild<LLCheckBoxCtrl>("checkbox stretch textures"); getChild<LLUICtrl>("checkbox stretch textures")->setValue((BOOL)gSavedSettings.getBOOL("ScaleStretchTextures")); - mComboGridMode = getChild<LLComboBox>("combobox grid mode"); mCheckStretchUniformLabel = getChild<LLTextBox>("checkbox uniform label"); // @@ -269,6 +267,8 @@ BOOL LLFloaterTools::postBuild() // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here getChild<LLUICtrl>("slider force")->setValue(log10(gSavedSettings.getF32("LandBrushForce"))); + mCostTextBorder = getChild<LLViewBorder>("cost_text_border"); + mTab = getChild<LLTabContainer>("Object Info Tabs"); if(mTab) { @@ -311,7 +311,6 @@ LLFloaterTools::LLFloaterTools(const LLSD& key) mCheckSnapToGrid(NULL), mBtnGridOptions(NULL), mTitleMedia(NULL), - mComboGridMode(NULL), mCheckStretchUniform(NULL), mCheckStretchTexture(NULL), mCheckStretchUniformLabel(NULL), @@ -344,6 +343,7 @@ LLFloaterTools::LLFloaterTools(const LLSD& key) mPanelFace(NULL), mPanelLandInfo(NULL), + mCostTextBorder(NULL), mTabLand(NULL), mDirty(TRUE), mNeedMediaTitle(TRUE) @@ -367,7 +367,6 @@ LLFloaterTools::LLFloaterTools(const LLSD& key) mCommitCallbackRegistrar.add("BuildTool.selectComponent", boost::bind(&commit_select_component, this)); mCommitCallbackRegistrar.add("BuildTool.gridOptions", boost::bind(&LLFloaterTools::onClickGridOptions,this)); mCommitCallbackRegistrar.add("BuildTool.applyToSelection", boost::bind(&click_apply_to_selection, this)); - mCommitCallbackRegistrar.add("BuildTool.gridMode", boost::bind(&commit_grid_mode,_1)); mCommitCallbackRegistrar.add("BuildTool.commitRadioLand", boost::bind(&commit_radio_group_land,_1)); mCommitCallbackRegistrar.add("BuildTool.LandBrushForce", boost::bind(&commit_slider_dozer_force,_1)); mCommitCallbackRegistrar.add("BuildTool.AddMedia", boost::bind(&LLFloaterTools::onClickBtnAddMedia,this)); @@ -429,10 +428,10 @@ void LLFloaterTools::refresh() { std::string obj_count_string; LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount()); - getChild<LLUICtrl>("obj_count")->setTextArg("[COUNT]", obj_count_string); + getChild<LLUICtrl>("selection_count")->setTextArg("[OBJ_COUNT]", obj_count_string); std::string prim_count_string; LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount()); - getChild<LLUICtrl>("prim_count")->setTextArg("[COUNT]", prim_count_string); + getChild<LLUICtrl>("selection_count")->setTextArg("[PRIM_COUNT]", prim_count_string); // calculate selection rendering cost if (sShowObjectCost) @@ -451,55 +450,46 @@ void LLFloaterTools::refresh() else #endif { - // Get the number of objects selected - std::string root_object_count_string; - std::string object_count_string; - - LLResMgr::getInstance()->getIntegerString( - root_object_count_string, - LLSelectMgr::getInstance()->getSelection()->getRootObjectCount()); - LLResMgr::getInstance()->getIntegerString( - object_count_string, - LLSelectMgr::getInstance()->getSelection()->getObjectCount()); - - F32 obj_cost = - LLSelectMgr::getInstance()->getSelection()->getSelectedObjectCost(); - F32 link_cost = - LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetCost(); - F32 obj_physics_cost = - LLSelectMgr::getInstance()->getSelection()->getSelectedPhysicsCost(); - F32 link_physics_cost = - LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetPhysicsCost(); - - // Update the text for the counts - childSetTextArg( - "linked_set_count", - "[COUNT]", - root_object_count_string); - childSetTextArg("object_count", "[COUNT]", object_count_string); - - // Update the text for the resource costs - childSetTextArg("linked_set_cost","[COST]",llformat("%.1f", link_cost)); - childSetTextArg("object_cost", "[COST]", llformat("%.1f", obj_cost)); - childSetTextArg("linked_set_cost","[PHYSICS]",llformat("%.1f", link_physics_cost)); - childSetTextArg("object_cost", "[PHYSICS]", llformat("%.1f", obj_physics_cost)); - - // Display rendering cost if needed - if (sShowObjectCost) + F32 link_phys_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetPhysicsCost(); + F32 link_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetCost(); + S32 prim_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); + S32 link_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); + + LLStringUtil::format_map_t args; + args["OBJ_COUNT"] = llformat("%.1d", link_count); + args["PRIM_COUNT"] = llformat("%.1d", prim_count); + + std::ostringstream selection_info; + selection_info << getString("status_selectcount", args); + + bool show_prim_equiv = (link_cost != prim_count) && link_cost; + bool show_adv_weight = gSavedSettings.getBOOL("ShowAdvancedBuilderOptions"); + bool show_mesh_cost = gMeshRepo.meshRezEnabled(); + + if (show_prim_equiv && show_mesh_cost) { - std::string prim_cost_string; - LLResMgr::getInstance()->getIntegerString(prim_cost_string, calcRenderCost()); - getChild<LLUICtrl>("RenderingCost")->setTextArg("[COUNT]", prim_cost_string); + selection_info << ": "; + args["SEL_WEIGHT"] = llformat("%.1f", link_cost); + selection_info << getString("status_selectprimequiv", args); } + if (show_adv_weight) + { + show_prim_equiv ? (selection_info << ",") : (selection_info << "."); - // disable the object and prim counts if nothing selected - bool have_selection = ! LLSelectMgr::getInstance()->getSelection()->isEmpty(); - childSetEnabled("linked_set_count", have_selection); - childSetEnabled("object_count", have_selection); - childSetEnabled("linked_set_cost", have_selection); - childSetEnabled("object_cost", have_selection); - getChildView("RenderingCost")->setEnabled(have_selection && sShowObjectCost); + childSetTextArg("selection_weight", "[PHYS_WEIGHT]", llformat("%.1f", link_phys_cost)); + childSetTextArg("selection_weight", "[DISP_WEIGHT]", llformat("%.1d", calcRenderCost())); + } + else + { + selection_info<<"."; + } + getChild<LLTextBox>("selection_count")->setText(selection_info.str()); + + bool have_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty(); + childSetVisible("selection_count", have_selection); + childSetVisible("selection_weight", have_selection && show_adv_weight); + childSetVisible("selection_empty", !have_selection); } @@ -664,33 +654,6 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) mRadioGroupEdit->setValue("radio select face"); } - if (mComboGridMode) - { - mComboGridMode->setVisible( edit_visible ); - S32 index = mComboGridMode->getCurrentIndex(); - mComboGridMode->removeall(); - - switch (mObjectSelection->getSelectType()) - { - case SELECT_TYPE_HUD: - mComboGridMode->add(getString("grid_screen_text")); - mComboGridMode->add(getString("grid_local_text")); - //mComboGridMode->add(getString("grid_reference_text")); - break; - case SELECT_TYPE_WORLD: - mComboGridMode->add(getString("grid_world_text")); - mComboGridMode->add(getString("grid_local_text")); - mComboGridMode->add(getString("grid_reference_text")); - break; - case SELECT_TYPE_ATTACHMENT: - mComboGridMode->add(getString("grid_attachment_text")); - mComboGridMode->add(getString("grid_local_text")); - mComboGridMode->add(getString("grid_reference_text")); - break; - } - - mComboGridMode->setCurrentByIndex(index); - } // Snap to grid disabled for grab tool - very confusing if (mCheckSnapToGrid) mCheckSnapToGrid->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ ); if (mBtnGridOptions) mBtnGridOptions->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ ); @@ -739,6 +702,8 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) // Land buttons BOOL land_visible = (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance() ); + mCostTextBorder->setVisible(!land_visible); + if (mBtnLand) mBtnLand ->setToggleState( land_visible ); mRadioGroupLand->setVisible( land_visible ); @@ -791,15 +756,11 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) getChildView("Strength:")->setVisible( land_visible); } - bool show_mesh_cost = gMeshRepo.meshRezEnabled(); + bool have_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty(); - getChildView("obj_count")->setVisible( !land_visible && !show_mesh_cost); - getChildView("prim_count")->setVisible( !land_visible && !show_mesh_cost); - getChildView("linked_set_count")->setVisible( !land_visible && show_mesh_cost); - getChildView("linked_set_cost")->setVisible( !land_visible && show_mesh_cost); - getChildView("object_count")->setVisible( !land_visible && show_mesh_cost); - getChildView("object_cost")->setVisible( !land_visible && show_mesh_cost); - getChildView("RenderingCost")->setVisible( !land_visible && sShowObjectCost); + getChildView("selection_count")->setVisible(!land_visible && have_selection); + getChildView("selection_weight")->setVisible(!land_visible && have_selection && gSavedSettings.getBOOL("ShowAdvancedBuilderOptions")); + getChildView("selection_empty")->setVisible(!land_visible && !have_selection); mTab->setVisible(!land_visible); mPanelLandInfo->setVisible(land_visible); @@ -1032,13 +993,6 @@ void commit_select_component(void *data) } } -void commit_grid_mode(LLUICtrl *ctrl) -{ - LLComboBox* combo = (LLComboBox*)ctrl; - - LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex()); -} - // static void LLFloaterTools::setObjectType( LLPCode pcode ) { |