From 8eff717612f595f854bee5aa12696237e3e418f2 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Thu, 28 Feb 2013 23:37:23 -0500 Subject: [PATCH] [Issue 662] STORM-1265: Combine Terrain and Ground Textures tabs in Region/Estate floater --- indra/newview/llfloaterregioninfo.cpp | 242 ++++---- indra/newview/llfloaterregioninfo.h | 25 +- .../xui/en-us/panel_region_terrain.xml | 522 ++++++++++++++++-- .../xui/en-us/panel_region_texture.xml | 98 ---- 4 files changed, 585 insertions(+), 302 deletions(-) delete mode 100644 indra/newview/skins/default/xui/en-us/panel_region_texture.xml diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index d40a3bcc4..67c43bb6a 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -199,10 +199,6 @@ BOOL LLFloaterRegionInfo::postBuild() LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_terrain.xml"); mTab->addTabPanel(panel, panel->getLabel(), FALSE); - panel = new LLPanelRegionTextureInfo; - mInfoPanels.push_back(panel); - LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_region_texture.xml"); - mTab->addTabPanel(panel, panel->getLabel(), FALSE); panel = new LLPanelRegionDebugInfo; mInfoPanels.push_back(panel); @@ -421,6 +417,23 @@ LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant() return panel; } +// static +LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain() +{ + LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); + if (!floater) + { + llassert(floater); + return NULL; + } + + LLTabContainer* tab_container = floater->getChild("region_panels"); + LLPanelRegionTerrainInfo* panel = + dynamic_cast(tab_container->getChild("Terrain")); + llassert(panel); + return panel; +} + void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region) { if (!region) @@ -1022,127 +1035,7 @@ void LLPanelRegionDebugInfo::onClickCancelRestart(void* data) } -///////////////////////////////////////////////////////////////////////////// -// LLPanelRegionTextureInfo -// -LLPanelRegionTextureInfo::LLPanelRegionTextureInfo() : LLPanelRegionInfo() -{ - // nothing. -} - -bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region) -{ - BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); - setCtrlsEnabled(allow_modify); - childDisable("apply_btn"); - - if (region) - { - childSetValue("region_text", LLSD(region->getName())); - } - else - { - childSetValue("region_text", LLSD("")); - } - - if (!region) return LLPanelRegionInfo::refreshFromRegion(region); - - LLVLComposition* compp = region->getComposition(); - LLTextureCtrl* texture_ctrl; - std::string buffer; - for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) - { - buffer = llformat("texture_detail_%d", i); - texture_ctrl = getChild(buffer); - if(texture_ctrl) - { - lldebugs << "Detail Texture " << i << ": " - << compp->getDetailTextureID(i) << llendl; - LLUUID tmp_id(compp->getDetailTextureID(i)); - texture_ctrl->setImageAssetID(tmp_id); - } - } - - for(S32 i = 0; i < CORNER_COUNT; ++i) - { - buffer = llformat("height_start_spin_%d", i); - childSetValue(buffer, LLSD(compp->getStartHeight(i))); - buffer = llformat("height_range_spin_%d", i); - childSetValue(buffer, LLSD(compp->getHeightRange(i))); - } - - // Call the parent for common book-keeping - return LLPanelRegionInfo::refreshFromRegion(region); -} - - -BOOL LLPanelRegionTextureInfo::postBuild() -{ - LLPanelRegionInfo::postBuild(); - std::string buffer; - for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) - { - buffer = llformat("texture_detail_%d", i); - initCtrl(buffer); - } - - for(S32 i = 0; i < CORNER_COUNT; ++i) - { - buffer = llformat("height_start_spin_%d", i); - initCtrl(buffer); - buffer = llformat("height_range_spin_%d", i); - initCtrl(buffer); - } - - return LLPanelRegionInfo::postBuild(); -} - -BOOL LLPanelRegionTextureInfo::sendUpdate() -{ - llinfos << "LLPanelRegionTextureInfo::sendUpdate()" << llendl; - - // Make sure user hasn't chosen wacky textures. - if (!validateTextureSizes()) - { - return FALSE; - } - - LLTextureCtrl* texture_ctrl; - std::string buffer; - std::string id_str; - LLMessageSystem* msg = gMessageSystem; - strings_t strings; - - LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); - - for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) - { - buffer = llformat("texture_detail_%d", i); - texture_ctrl = getChild(buffer); - if(texture_ctrl) - { - LLUUID tmp_id(texture_ctrl->getImageAssetID()); - tmp_id.toString(id_str); - buffer = llformat("%d %s", i, id_str.c_str()); - strings.push_back(buffer); - } - } - sendEstateOwnerMessage(msg, "texturedetail", invoice, strings); - strings.clear(); - for(S32 i = 0; i < CORNER_COUNT; ++i) - { - buffer = llformat("height_start_spin_%d", i); - std::string buffer2 = llformat("height_range_spin_%d", i); - std::string buffer3 = llformat("%d %f %f", i, (F32)childGetValue(buffer).asReal(), (F32)childGetValue(buffer2).asReal()); - strings.push_back(buffer3); - } - sendEstateOwnerMessage(msg, "textureheights", invoice, strings); - strings.clear(); - sendEstateOwnerMessage(msg, "texturecommit", invoice, strings); - return TRUE; -} - -BOOL LLPanelRegionTextureInfo::validateTextureSizes() +BOOL LLPanelRegionTerrainInfo::validateTextureSizes() { for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { @@ -1211,11 +1104,26 @@ BOOL LLPanelRegionTerrainInfo::postBuild() childSetCommitCallback("use_estate_sun_check", onChangeUseEstateTime, this); initCtrl("sun_hour_slider"); + std::string buffer; + for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) + { + buffer = llformat("texture_detail_%d", i); + initCtrl(buffer); + } + + for(S32 i = 0; i < CORNER_COUNT; ++i) + { + buffer = llformat("height_start_spin_%d", i); + initCtrl(buffer); + buffer = llformat("height_range_spin_%d", i); + initCtrl(buffer); + } + childSetAction("download_raw_btn", onClickDownloadRaw, this); childSetAction("upload_raw_btn", onClickUploadRaw, this); childSetAction("bake_terrain_btn", onClickBakeTerrain, this); - return TRUE; + return LLPanelRegionInfo::postBuild(); } // virtual @@ -1229,6 +1137,39 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) getChildView("apply_btn")->setEnabled(FALSE); + if (region) + { + getChild("region_text")->setValue(LLSD(region->getName())); + + LLVLComposition* compp = region->getComposition(); + LLTextureCtrl* texture_ctrl; + std::string buffer; + for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) + { + buffer = llformat("texture_detail_%d", i); + texture_ctrl = getChild(buffer); + if(texture_ctrl) + { + lldebugs << "Detail Texture " << i << ": " + << compp->getDetailTextureID(i) << llendl; + LLUUID tmp_id(compp->getDetailTextureID(i)); + texture_ctrl->setImageAssetID(tmp_id); + } + } + + for(S32 i = 0; i < CORNER_COUNT; ++i) + { + buffer = llformat("height_start_spin_%d", i); + getChild(buffer)->setValue(LLSD(compp->getStartHeight(i))); + buffer = llformat("height_range_spin_%d", i); + getChild(buffer)->setValue(LLSD(compp->getHeightRange(i))); + } + } + else + { + lldebugs << "no region set" << llendl; + getChild("region_text")->setValue(LLSD("")); + } getChildView("download_raw_btn")->setEnabled(owner_or_god); getChildView("upload_raw_btn")->setEnabled(owner_or_god); @@ -1259,6 +1200,52 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() // and sync the region with it region_info.sendRegionTerrain(invoice); + // ======================================= + // Assemble and send texturedetail message + + // Make sure user hasn't chosen wacky textures. + if (!validateTextureSizes()) + { + return FALSE; + } + + LLTextureCtrl* texture_ctrl; + std::string id_str; + LLMessageSystem* msg = gMessageSystem; + + for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) + { + buffer = llformat("texture_detail_%d", i); + texture_ctrl = getChild(buffer); + if(texture_ctrl) + { + LLUUID tmp_id(texture_ctrl->getImageAssetID()); + tmp_id.toString(id_str); + buffer = llformat("%d %s", i, id_str.c_str()); + strings.push_back(buffer); + } + } + sendEstateOwnerMessage(msg, "texturedetail", invoice, strings); + strings.clear(); + + // ======================================== + // Assemble and send textureheights message + + for(S32 i = 0; i < CORNER_COUNT; ++i) + { + buffer = llformat("height_start_spin_%d", i); + std::string buffer2 = llformat("height_range_spin_%d", i); + std::string buffer3 = llformat("%d %f %f", i, (F32)getChild(buffer)->getValue().asReal(), (F32)getChild(buffer2)->getValue().asReal()); + strings.push_back(buffer3); + } + sendEstateOwnerMessage(msg, "textureheights", invoice, strings); + strings.clear(); + + // ======================================== + // Send texturecommit message + + sendEstateOwnerMessage(msg, "texturecommit", invoice, strings); + // Grab estate information in case the user decided to set the // region back to estate time. JC LLFloaterRegionInfo* floater = LLFloaterRegionInfo::getInstance(); @@ -2476,7 +2463,7 @@ const std::string LLPanelEstateInfo::getOwnerName() const void LLPanelEstateInfo::setOwnerName(const std::string& name) { - childSetValue("estate_owner", LLSD(name)); + getChild("estate_owner")->setValue(LLSD(name)); } void LLPanelEstateInfo::setAccessAllowedEnabled(bool enable_agent, @@ -2556,6 +2543,7 @@ void LLPanelEstateInfo::clearAccessLists() { name_list->deleteAllItems(); } + updateControls(gAgent.getRegion()); } // enables/disables the "remove" button for the various allow/ban lists diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index afd553888..7c6780c3f 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -57,7 +57,6 @@ class AIFilePicker; class LLPanelRegionGeneralInfo; class LLPanelRegionDebugInfo; -class LLPanelRegionTextureInfo; class LLPanelRegionTerrainInfo; class LLPanelEstateInfo; class LLPanelEstateCovenant; @@ -87,6 +86,7 @@ public: static LLPanelEstateInfo* getPanelEstate(); static LLPanelEstateCovenant* getPanelCovenant(); + static LLPanelRegionTerrainInfo* getPanelRegionTerrain(); // from LLPanel virtual void refresh(); @@ -213,23 +213,6 @@ private: ///////////////////////////////////////////////////////////////////////////// -class LLPanelRegionTextureInfo : public LLPanelRegionInfo -{ -public: - LLPanelRegionTextureInfo(); - ~LLPanelRegionTextureInfo() {} - - virtual BOOL postBuild(); // LLPanel - - virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator - -protected: - virtual BOOL sendUpdate(); - BOOL validateTextureSizes(); -}; - -///////////////////////////////////////////////////////////////////////////// - class LLPanelRegionTerrainInfo : public LLPanelRegionInfo { LOG_CLASS(LLPanelRegionTerrainInfo); @@ -242,10 +225,14 @@ public: virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator + BOOL validateTextureSizes(); + protected: - virtual BOOL sendUpdate(); static void onChangeUseEstateTime(LLUICtrl* ctrl, void* user_data); + //static void onChangeAnything(LLUICtrl* ctrl, void* userData); // callback for any change, to enable commit button + + virtual BOOL sendUpdate(); static void onClickDownloadRaw(void*); void onClickDownloadRaw_continued(AIFilePicker* filepicker); diff --git a/indra/newview/skins/default/xui/en-us/panel_region_terrain.xml b/indra/newview/skins/default/xui/en-us/panel_region_terrain.xml index e93e87cd6..1d0d034f3 100644 --- a/indra/newview/skins/default/xui/en-us/panel_region_terrain.xml +++ b/indra/newview/skins/default/xui/en-us/panel_region_terrain.xml @@ -1,60 +1,466 @@ - - - Region: - - - unknown - - -