diff options
| author | cosmic-linden <111533034+cosmic-linden@users.noreply.github.com> | 2024-03-11 09:32:20 -0700 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-11 09:32:20 -0700 | 
| commit | 5fca8915d8f44cdb2a4f7bb4715d61ba47043e5d (patch) | |
| tree | fe2161365a426845d0216b745c57e2c36ccc9fcd /indra | |
| parent | c1bde75768e1374d4f094936d52ed29f6f5d3cba (diff) | |
| parent | b84d76e243ed54b1d7db6401b78ce9122714b6e4 (diff) | |
Merge pull request #954 from secondlife/v-712
PBR Terrain UI second pass: review follow-up
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 106 | ||||
| -rw-r--r-- | indra/newview/llfloaterregioninfo.h | 7 | 
2 files changed, 41 insertions, 72 deletions
| diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 6e8e37621e..454842999d 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1314,10 +1314,9 @@ void LLPanelRegionDebugInfo::onClickDebugConsole(void* data)  BOOL LLPanelRegionTerrainInfo::validateTextureSizes()  { -	LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type"); -    if (material_type_ctrl) +    if (mMaterialTypeCtrl)      { -        const LLTerrainMaterials::Type material_type = material_type_from_ctrl(material_type_ctrl); +        const LLTerrainMaterials::Type material_type = material_type_from_ctrl(mMaterialTypeCtrl);          const bool is_material_selected = material_type == LLTerrainMaterials::Type::PBR;          if (is_material_selected) { return TRUE; }      } @@ -1325,9 +1324,7 @@ BOOL LLPanelRegionTerrainInfo::validateTextureSizes()      static const S32 MAX_TERRAIN_TEXTURE_SIZE = 1024;  	for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)  	{ -		std::string buffer; -		buffer = llformat("texture_detail_%d", i); -		LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>(buffer); +        LLTextureCtrl* texture_ctrl = mTextureDetailCtrl[i];  		if (!texture_ctrl) continue;  		LLUUID image_asset_id = texture_ctrl->getImageAssetID(); @@ -1410,7 +1407,8 @@ BOOL LLPanelRegionTerrainInfo::postBuild()  	initCtrl("terrain_raise_spin");  	initCtrl("terrain_lower_spin"); -    getChild<LLUICtrl>("terrain_material_type")->setCommitCallback(boost::bind(&LLPanelRegionTerrainInfo::onSelectMaterialType, this)); +    mMaterialTypeCtrl = findChild<LLCheckBoxCtrl>("terrain_material_type"); +    if (mMaterialTypeCtrl) { mMaterialTypeCtrl->setCommitCallback(boost::bind(&LLPanelRegionTerrainInfo::onSelectMaterialType, this)); }  	std::string buffer; @@ -1418,11 +1416,13 @@ BOOL LLPanelRegionTerrainInfo::postBuild()  	{  		buffer = llformat("texture_detail_%d", i);  		initCtrl(buffer); +        mTextureDetailCtrl[i] = findChild<LLTextureCtrl>(buffer);  	}  	for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)  	{  		buffer = llformat("material_detail_%d", i);  		initCtrl(buffer); +        mMaterialDetailCtrl[i] = findChild<LLTextureCtrl>(buffer);  	}  	for(S32 i = 0; i < CORNER_COUNT; ++i) @@ -1440,11 +1440,6 @@ BOOL LLPanelRegionTerrainInfo::postBuild()  	mAskedTextureHeights = false;  	mConfirmedTextureHeights = false; -    if (!mRegionChangedSlot.connected()) -    { -        mRegionChangedSlot = gAgent.addRegionChangedCallback(boost::bind(&LLPanelRegionTerrainInfo::onRegionChanged,this)); -    } -  	return LLPanelRegionInfo::postBuild();  } @@ -1456,19 +1451,15 @@ void LLPanelRegionTerrainInfo::onSelectMaterialType()  void LLPanelRegionTerrainInfo::updateForMaterialType()  { -    LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type"); -    if (!material_type_ctrl) { return; } -    const LLTerrainMaterials::Type material_type = material_type_from_ctrl(material_type_ctrl); +    if (!mMaterialTypeCtrl) { return; } +    const LLTerrainMaterials::Type material_type = material_type_from_ctrl(mMaterialTypeCtrl);      const bool show_texture_controls = material_type == LLTerrainMaterials::Type::TEXTURE;      const bool show_material_controls = material_type == LLTerrainMaterials::Type::PBR;      // Toggle visibility of correct swatches -    std::string buffer; -    LLTextureCtrl* texture_ctrl;      for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)      { -        buffer = llformat("texture_detail_%d", i); -        texture_ctrl = getChild<LLTextureCtrl>(buffer); +        LLTextureCtrl* texture_ctrl = mTextureDetailCtrl[i];          if (texture_ctrl)          {              texture_ctrl->setVisible(show_texture_controls); @@ -1476,42 +1467,20 @@ void LLPanelRegionTerrainInfo::updateForMaterialType()      }      for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)      { -        buffer = llformat("material_detail_%d", i); -        texture_ctrl = getChild<LLTextureCtrl>(buffer); -        if (texture_ctrl) +        LLTextureCtrl* material_ctrl = mMaterialDetailCtrl[i]; +        if (material_ctrl)          { -            texture_ctrl->setVisible(show_material_controls); +            material_ctrl->setVisible(show_material_controls);          }      }      // Toggle visibility of labels -    LLUICtrl* texture_label = getChild<LLUICtrl>("detail_texture_text"); +    LLUICtrl* texture_label = findChild<LLUICtrl>("detail_texture_text");  	if (texture_label) { texture_label->setVisible(show_texture_controls); } -    LLUICtrl* material_label = getChild<LLUICtrl>("detail_material_text"); +    LLUICtrl* material_label = findChild<LLUICtrl>("detail_material_text");  	if (material_label) { material_label->setVisible(show_material_controls); }  } -void LLPanelRegionTerrainInfo::onRegionChanged() -{ -    LLViewerRegion *region = gAgent.getRegion(); -    if (!region) { return; } - -    if (region->simulatorFeaturesReceived()) -    { -        onSimulatorFeaturesReceived(region->getRegionID(), region); -    } -    else -    { -        // See "RenderTerrainPBREnabled" in LLViewerRegion::setSimulatorFeatures -        region->setSimulatorFeaturesReceivedCallback(boost::bind(&LLPanelRegionTerrainInfo::onSimulatorFeaturesReceived,this,_1, _2)); -    } -} - -void LLPanelRegionTerrainInfo::onSimulatorFeaturesReceived(const LLUUID& region_id, LLViewerRegion* regionp) -{ -    refresh(); -} -  // virtual  bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)  { @@ -1558,22 +1527,21 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)              reset_material_swatches = !set_material_swatches;          } -		LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type"); -		if (material_type_ctrl) { material_type_to_ctrl(material_type_ctrl, material_type); } -		updateForMaterialType(); -        material_type_ctrl->setVisible(feature_pbr_terrain_enabled); +        if (mMaterialTypeCtrl) +        { +            material_type_to_ctrl(mMaterialTypeCtrl, material_type); +            updateForMaterialType(); +            mMaterialTypeCtrl->setVisible(feature_pbr_terrain_enabled); +        } -		LLTextureCtrl* asset_ctrl; -		std::string buffer;          if (set_texture_swatches)          {              for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)              { -                buffer = llformat("texture_detail_%d", i); -                asset_ctrl = getChild<LLTextureCtrl>(buffer); +                LLTextureCtrl* asset_ctrl = mTextureDetailCtrl[i];                  if(asset_ctrl)                  { -                    LL_DEBUGS() << "Detail Texture " << i << ": " +                    LL_DEBUGS("Terrain", "Texture") << "Detail Texture " << i << ": "                               << compp->getDetailAssetID(i) << LL_ENDL;                      LLUUID tmp_id(compp->getDetailAssetID(i));                      asset_ctrl->setImageAssetID(tmp_id); @@ -1584,11 +1552,10 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)          {              for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)              { -                buffer = llformat("material_detail_%d", i); -                asset_ctrl = getChild<LLTextureCtrl>(buffer); +                LLTextureCtrl* asset_ctrl = mMaterialDetailCtrl[i];                  if(asset_ctrl)                  { -                    LL_DEBUGS() << "Detail Material " << i << ": " +                    LL_DEBUGS("Terrain", "Material") << "Detail Material " << i << ": "                               << compp->getDetailAssetID(i) << LL_ENDL;                      LLUUID tmp_id(compp->getDetailAssetID(i));                      asset_ctrl->setImageAssetID(tmp_id); @@ -1599,8 +1566,9 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)          {              for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)              { -                buffer = llformat("texture_detail_%d", i); -                asset_ctrl = getChild<LLTextureCtrl>(buffer); +                LL_DEBUGS("Terrain", "Texture") << "Reset Texture swatch " << i +                         << LL_ENDL; +                LLTextureCtrl* asset_ctrl = mTextureDetailCtrl[i];                  if(asset_ctrl)                  {                      asset_ctrl->setImageAssetID(mLastSetTextures[i]); @@ -1611,8 +1579,9 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)          {              for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)              { -                buffer = llformat("material_detail_%d", i); -                asset_ctrl = getChild<LLTextureCtrl>(buffer); +                LL_DEBUGS("Terrain", "Material") << "Reset Material swatch " << i +                         << LL_ENDL; +                LLTextureCtrl* asset_ctrl = mMaterialDetailCtrl[i];                  if(asset_ctrl)                  {                      asset_ctrl->setImageAssetID(mLastSetMaterials[i]); @@ -1620,6 +1589,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)              }          } +		std::string buffer;  		for(S32 i = 0; i < CORNER_COUNT; ++i)      	{  			buffer = llformat("height_start_spin_%d", i); @@ -1686,25 +1656,23 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()  		}  	} -	LLTextureCtrl* asset_ctrl;  	std::string id_str;  	LLMessageSystem* msg = gMessageSystem;      // Send either material IDs instead of texture IDs depending on -    // terrain_material_type - they both occupy the same slot. -	LLCheckBoxCtrl* material_type_ctrl = getChild<LLCheckBoxCtrl>("terrain_material_type"); -    const LLTerrainMaterials::Type material_type = material_type_ctrl ? material_type_from_ctrl(material_type_ctrl) : LLTerrainMaterials::Type::TEXTURE; +    // material_type - they both occupy the same slot. +    const LLTerrainMaterials::Type material_type = mMaterialTypeCtrl ? material_type_from_ctrl(mMaterialTypeCtrl) : LLTerrainMaterials::Type::TEXTURE;      for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)      { +        LLTextureCtrl* asset_ctrl;          if (material_type == LLTerrainMaterials::Type::PBR)          { -            buffer = llformat("material_detail_%d", i); +            asset_ctrl = mMaterialDetailCtrl[i];          }          else          { -            buffer = llformat("texture_detail_%d", i); +            asset_ctrl = mTextureDetailCtrl[i];          } -        asset_ctrl = getChild<LLTextureCtrl>(buffer);          if (!asset_ctrl) { continue; } diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 315c6aca0f..99774e5db3 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -56,6 +56,7 @@ class LLRadioGroup;  class LLSliderCtrl;  class LLSpinCtrl;  class LLTextBox; +class LLTextureCtrl;  class LLPanelRegionGeneralInfo;  class LLPanelRegionDebugInfo; @@ -249,8 +250,6 @@ public:  	BOOL postBuild() override; -    void onRegionChanged(); -    void onSimulatorFeaturesReceived(const LLUUID& region_id, LLViewerRegion* regionp);      bool refreshFromRegion(LLViewerRegion* region) override;                // refresh local settings from region update from simulator  	void setEnvControls(bool available);									// Whether environment settings are available for this region @@ -274,7 +273,9 @@ protected:  private:  	bool mConfirmedTextureHeights;  	bool mAskedTextureHeights; -    boost::signals2::connection mRegionChangedSlot; +    LLCheckBoxCtrl* mMaterialTypeCtrl = nullptr; +    LLTextureCtrl* mTextureDetailCtrl[LLTerrainMaterials::ASSET_COUNT]; +    LLTextureCtrl* mMaterialDetailCtrl[LLTerrainMaterials::ASSET_COUNT];      LLUUID mLastSetTextures[LLTerrainMaterials::ASSET_COUNT];      LLUUID mLastSetMaterials[LLTerrainMaterials::ASSET_COUNT];  }; | 
