From 6fe434957cb3c3b41853aa8f289d3fd203eb8566 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Sun, 11 Jul 2021 02:21:59 -0400 Subject: [PATCH] Optimizations to tools floater object panel draw and update --- indra/newview/llpanelobject.cpp | 41 ++++++++++++--------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index cd2764ade4d..c39f4356f63 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -1104,15 +1104,14 @@ void LLPanelObject::getState( ) BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; isMesh = (sculpt_stitching == LL_SCULPT_TYPE_MESH); - LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control"); - if(mTextureCtrl) + if(mCtrlSculptTexture) { - mTextureCtrl->setTentative(FALSE); - mTextureCtrl->setEnabled(editable && !isMesh); + mCtrlSculptTexture->setTentative(FALSE); + mCtrlSculptTexture->setEnabled(editable && !isMesh); if (editable) - mTextureCtrl->setImageAssetID(sculpt_params->getSculptTexture()); + mCtrlSculptTexture->setImageAssetID(sculpt_params->getSculptTexture()); else - mTextureCtrl->setImageAssetID(LLUUID::null); + mCtrlSculptTexture->setImageAssetID(LLUUID::null); } mComboBaseType->setEnabled(!isMesh); @@ -1794,18 +1793,18 @@ void LLPanelObject::refresh() F32 max_scale = get_default_max_prim_scale(LLPickInfo::isFlora(mObject)); - getChild<LLSpinCtrl>("Scale X")->setMaxValue(max_scale); - getChild<LLSpinCtrl>("Scale Y")->setMaxValue(max_scale); - getChild<LLSpinCtrl>("Scale Z")->setMaxValue(max_scale); + mCtrlScaleX->setMaxValue(max_scale); + mCtrlScaleY->setMaxValue(max_scale); + mCtrlScaleZ->setMaxValue(max_scale); } void LLPanelObject::draw() { - const LLColor4 white( 1.0f, 1.0f, 1.0f, 1); - const LLColor4 red( 1.0f, 0.25f, 0.f, 1); - const LLColor4 green( 0.f, 1.0f, 0.f, 1); - const LLColor4 blue( 0.f, 0.5f, 1.0f, 1); + static const LLColor4 white( 1.0f, 1.0f, 1.0f, 1); + static const LLColor4 red( 1.0f, 0.25f, 0.f, 1); + static const LLColor4 green( 0.f, 1.0f, 0.f, 1); + static const LLColor4 blue( 0.f, 0.5f, 1.0f, 1); // Tune the colors of the labels LLTool* tool = LLToolMgr::getInstance()->getCurrentTool(); @@ -1969,11 +1968,8 @@ void LLPanelObject::onCommitPhantom( LLUICtrl* ctrl, void* userdata ) void LLPanelObject::onSelectSculpt(const LLSD& data) { - LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control"); - - if (mTextureCtrl) { - mSculptTextureRevert = mTextureCtrl->getImageAssetID(); + mSculptTextureRevert = mCtrlSculptTexture->getImageAssetID(); } sendSculpt(); @@ -1987,13 +1983,10 @@ void LLPanelObject::onCommitSculpt( const LLSD& data ) BOOL LLPanelObject::onDropSculpt(LLInventoryItem* item) { - LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control"); - - if (mTextureCtrl) { LLUUID asset = item->getAssetUUID(); - mTextureCtrl->setImageAssetID(asset); + mCtrlSculptTexture->setImageAssetID(asset); mSculptTextureRevert = asset; } @@ -2003,15 +1996,11 @@ BOOL LLPanelObject::onDropSculpt(LLInventoryItem* item) void LLPanelObject::onCancelSculpt(const LLSD& data) { - LLTextureCtrl* mTextureCtrl = getChild<LLTextureCtrl>("sculpt texture control"); - if(!mTextureCtrl) - return; - if(mSculptTextureRevert == LLUUID::null) { mSculptTextureRevert = LLUUID(SCULPT_DEFAULT_TEXTURE); } - mTextureCtrl->setImageAssetID(mSculptTextureRevert); + mCtrlSculptTexture->setImageAssetID(mSculptTextureRevert); sendSculpt(); } -- GitLab