Fix findChild during draw in the tools floater

master
Rye Mutt 2024-08-18 21:41:53 -04:00
parent e5748df9a5
commit 934e1f665f
2 changed files with 37 additions and 24 deletions

View File

@ -284,6 +284,15 @@ 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")));
mTextBulldozer = getChild<LLTextBox>("Bulldozer:");
mTextDozerSize = getChild<LLTextBox>("Dozer Size:");
mTextDozerStrength = getChild<LLTextBox>("Strength:");
mSliderZoom = getChild<LLSlider>("slider zoom");
mTextSelectionCount = getChild<LLTextBox>("selection_count");
mTextSelectionEmpty = getChild<LLTextBox>("selection_empty");
mTextSelectionFaces = getChild<LLTextBox>("selection_faces");
mCostTextBorder = getChild<LLViewBorder>("cost_text_border");
mTab = getChild<LLTabContainer>("Object Info Tabs");
@ -450,10 +459,10 @@ void LLFloaterTools::refresh()
{
std::string obj_count_string;
LLResMgr::getInstance()->getIntegerString(obj_count_string, LLSelectMgr::getInstance()->getSelection()->getRootObjectCount());
getChild<LLUICtrl>("selection_count")->setTextArg("[OBJ_COUNT]", obj_count_string);
mTextSelectionCount->setTextArg("[OBJ_COUNT]", obj_count_string);
std::string prim_count_string;
LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount());
getChild<LLUICtrl>("selection_count")->setTextArg("[PRIM_COUNT]", prim_count_string);
mTextSelectionCount->setTextArg("[PRIM_COUNT]", prim_count_string);
// calculate selection rendering cost
if (sShowObjectCost)
@ -521,23 +530,18 @@ void LLFloaterTools::refresh()
}
}
}
childSetTextArg("selection_faces", "[FACES_STRING]", faces_str);
mTextSelectionFaces->setTextArg("[FACES_STRING]", faces_str);
}
bool show_faces = (object_count == 1)
&& LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool();
getChildView("selection_faces")->setVisible(show_faces);
mTextSelectionFaces->setVisible(show_faces);
LLStringUtil::format_map_t selection_args;
selection_args["OBJ_COUNT"] = llformat("%.1d", link_count);
selection_args["LAND_IMPACT"] = llformat("%.1d", (S32)link_cost);
std::ostringstream selection_info;
selection_info << getString("status_selectcount", selection_args);
getChild<LLTextBox>("selection_count")->setText(selection_info.str());
mTextSelectionCount->setText(getString("status_selectcount", selection_args));
}
@ -618,8 +622,9 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
mBtnFocus ->setToggleState( focus_visible );
mRadioGroupFocus->setVisible( focus_visible );
getChildView("slider zoom")->setVisible( focus_visible);
getChildView("slider zoom")->setEnabled(gCameraBtnZoom);
mSliderZoom->setVisible( focus_visible);
mSliderZoom->setEnabled(gCameraBtnZoom);
if (!gCameraBtnOrbit &&
!gCameraBtnPan &&
@ -644,7 +649,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
}
// multiply by correction factor because volume sliders go [0, 0.5]
getChild<LLUICtrl>("slider zoom")->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f);
mSliderZoom->setValue(gAgentCamera.getCameraZoomFraction() * 0.5f);
// Move buttons
bool move_visible = (tool == LLToolGrab::getInstance());
@ -832,22 +837,22 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
}
if (mSliderDozerSize)
{
mSliderDozerSize ->setVisible( land_visible );
getChildView("Bulldozer:")->setVisible( land_visible);
getChildView("Dozer Size:")->setVisible( land_visible);
mSliderDozerSize->setVisible( land_visible );
mTextBulldozer->setVisible( land_visible);
mTextDozerSize->setVisible( land_visible);
}
if (mSliderDozerForce)
{
mSliderDozerForce ->setVisible( land_visible );
getChildView("Strength:")->setVisible( land_visible);
mSliderDozerForce->setVisible( land_visible );
mTextDozerStrength->setVisible( land_visible);
}
bool have_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty();
getChildView("selection_count")->setVisible(!land_visible && have_selection);
getChildView("selection_faces")->setVisible(LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()
mTextSelectionCount->setVisible(!land_visible && have_selection);
mTextSelectionFaces->setVisible(LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()
&& LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1);
getChildView("selection_empty")->setVisible(!land_visible && !have_selection);
mTextSelectionEmpty->setVisible(!land_visible && !have_selection);
mTab->setVisible(!land_visible);
mPanelLandInfo->setVisible(land_visible);

View File

@ -148,6 +148,11 @@ public:
LLButton *mBtnDuplicate;
LLButton *mBtnDuplicateInPlace;
LLTextBox* mTextSelectionCount = nullptr;
LLTextBox* mTextSelectionEmpty = nullptr;
LLTextBox* mTextSelectionFaces = nullptr;
LLSlider* mSliderZoom = nullptr;
// Create buttons
LLCheckBoxCtrl *mCheckSticky;
LLCheckBoxCtrl *mCheckCopySelection;
@ -155,9 +160,12 @@ public:
LLCheckBoxCtrl *mCheckCopyRotates;
// Land buttons
LLRadioGroup* mRadioGroupLand;
LLSlider *mSliderDozerSize;
LLSlider *mSliderDozerForce;
LLRadioGroup* mRadioGroupLand = nullptr;
LLSlider *mSliderDozerSize = nullptr;
LLSlider *mSliderDozerForce = nullptr;
LLTextBox* mTextBulldozer = nullptr;
LLTextBox* mTextDozerSize = nullptr;
LLTextBox* mTextDozerStrength = nullptr;
LLButton *mBtnApplyToSelection;