summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterregioninfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rw-r--r--indra/newview/llfloaterregioninfo.cpp639
1 files changed, 397 insertions, 242 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 8d2efc79db..df4acfac5e 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -61,6 +61,7 @@
#include "llfloatergroups.h"
#include "llfloaterreg.h"
#include "llfloaterregiondebugconsole.h"
+#include "llfloaterregionrestartschedule.h"
#include "llfloatertelehub.h"
#include "llgltfmateriallist.h"
#include "llinventorymodel.h"
@@ -68,6 +69,7 @@
#include "llnamelistctrl.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
+#include "llpbrterrainfeatures.h"
#include "llregioninfomodel.h"
#include "llscrolllistitem.h"
#include "llsliderctrl.h"
@@ -146,40 +148,6 @@ public:
static LLSD getIDs( sparam_t::const_iterator it, sparam_t::const_iterator end, S32 count );
};
-
-/*
-void unpack_request_params(
- LLMessageSystem* msg,
- LLDispatcher::sparam_t& strings,
- LLDispatcher::iparam_t& integers)
-{
- char str_buf[MAX_STRING];
- S32 str_count = msg->getNumberOfBlocksFast(_PREHASH_StringData);
- S32 i;
- for (i = 0; i < str_count; ++i)
- {
- // we treat the SParam as binary data (since it might be an
- // LLUUID in compressed form which may have embedded \0's,)
- str_buf[0] = '\0';
- S32 data_size = msg->getSizeFast(_PREHASH_StringData, i, _PREHASH_SParam);
- if (data_size >= 0)
- {
- msg->getBinaryDataFast(_PREHASH_StringData, _PREHASH_SParam,
- str_buf, data_size, i, MAX_STRING - 1);
- strings.push_back(std::string(str_buf, data_size));
- }
- }
-
- U32 int_buf;
- S32 int_count = msg->getNumberOfBlocksFast(_PREHASH_IntegerData);
- for (i = 0; i < int_count; ++i)
- {
- msg->getU32("IntegerData", "IParam", int_buf, i);
- integers.push_back(int_buf);
- }
-}
-*/
-
class LLPanelRegionEnvironment : public LLPanelEnvironmentInfo
{
public:
@@ -195,7 +163,7 @@ public:
bool refreshFromRegion(LLViewerRegion* region);
- virtual BOOL postBuild() override;
+ virtual bool postBuild() override;
virtual void onOpen(const LLSD& key) override {};
virtual S32 getParcelId() override { return INVALID_PARCEL_ID; }
@@ -233,7 +201,7 @@ LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed)
mRegionChangedCallback()
{}
-BOOL LLFloaterRegionInfo::postBuild()
+bool LLFloaterRegionInfo::postBuild()
{
mTab = getChild<LLTabContainer>("region_panels");
mTab->setCommitCallback(boost::bind(&LLFloaterRegionInfo::onTabSelected, this, _2));
@@ -257,13 +225,23 @@ BOOL LLFloaterRegionInfo::postBuild()
panel = new LLPanelRegionGeneralInfo;
mInfoPanels.push_back(panel);
- panel->getCommitCallbackRegistrar().add("RegionInfo.ManageTelehub", boost::bind(&LLPanelRegionInfo::onClickManageTelehub, panel));
+ panel->getCommitCallbackRegistrar().add("RegionInfo.ManageTelehub", { boost::bind(&LLPanelRegionInfo::onClickManageTelehub, panel) });
+ panel->getCommitCallbackRegistrar().add("RegionInfo.ManageRestart", { boost::bind(&LLPanelRegionInfo::onClickManageRestartSchedule, panel) });
panel->buildFromFile("panel_region_general.xml");
mTab->addTabPanel(panel);
panel = new LLPanelRegionTerrainInfo;
mInfoPanels.push_back(panel);
- panel->buildFromFile("panel_region_terrain.xml");
+ static LLCachedControl<bool> feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false);
+ static LLCachedControl<bool> feature_pbr_terrain_transforms_enabled(gSavedSettings, "RenderTerrainPBRTransformsEnabled", false);
+ if (!feature_pbr_terrain_transforms_enabled() || !feature_pbr_terrain_enabled())
+ {
+ panel->buildFromFile("panel_region_terrain.xml");
+ }
+ else
+ {
+ panel->buildFromFile("panel_region_terrain_texture_transform.xml");
+ }
mTab->addTabPanel(panel);
mEnvironmentPanel = new LLPanelRegionEnvironment;
@@ -278,7 +256,7 @@ BOOL LLFloaterRegionInfo::postBuild()
if(gDisconnected)
{
- return TRUE;
+ return true;
}
if(!gAgent.getRegionCapability("RegionExperiences").empty())
@@ -296,7 +274,7 @@ BOOL LLFloaterRegionInfo::postBuild()
// Request region info when agent region changes.
mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionInfo::onRegionChanged, this));
- return TRUE;
+ return true;
}
LLFloaterRegionInfo::~LLFloaterRegionInfo()
@@ -314,8 +292,8 @@ void LLFloaterRegionInfo::onOpen(const LLSD& key)
disableTabCtrls();
return;
}
- refreshFromRegion(gAgent.getRegion());
- requestRegionInfo();
+ refreshFromRegion(gAgent.getRegion(), ERefreshFromRegionPhase::BeforeRequestRegionInfo);
+ requestRegionInfo(true);
if (!mGodLevelChangeSlot.connected())
{
@@ -335,20 +313,22 @@ void LLFloaterRegionInfo::onRegionChanged()
{
if (getVisible()) //otherwise onOpen will do request
{
- requestRegionInfo();
+ requestRegionInfo(false);
}
}
-void LLFloaterRegionInfo::requestRegionInfo()
+void LLFloaterRegionInfo::requestRegionInfo(bool is_opening)
{
+ mIsRegionInfoRequestedFromOpening = is_opening;
+
LLTabContainer* tab = findChild<LLTabContainer>("region_panels");
if (tab)
{
- tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Access")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("General")->setCtrlsEnabled(false);
+ tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(false);
+ tab->getChild<LLPanel>("Terrain")->setAllChildrenEnabled(false, true);
+ tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(false);
+ tab->getChild<LLPanel>("Access")->setCtrlsEnabled(false);
}
// Must allow anyone to request the RegionInfo data
@@ -419,7 +399,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
LLViewerRegion* region = gAgent.getRegion();
- BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
+ bool allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
// *TODO: Replace parsing msg with accessing the region info model.
LLRegionInfoModel& region_info = LLRegionInfoModel::instance();
@@ -435,7 +415,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
F32 water_height;
F32 terrain_raise_limit;
F32 terrain_lower_limit;
- BOOL use_estate_sun;
+ bool use_estate_sun;
F32 sun_hour;
msg->getString("RegionInfo", "SimName", sim_name);
msg->getU8("RegionInfo", "MaxAgents", agent_limit);
@@ -497,22 +477,21 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
panel->getChild<LLUICtrl>("region_type")->setValue(LLSD(sim_type));
panel->getChild<LLUICtrl>("version_channel_text")->setValue(gLastVersionChannel);
- panel->getChild<LLUICtrl>("block_terraform_check")->setValue((region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("block_fly_check")->setValue((region_flags & REGION_FLAGS_BLOCK_FLY) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("block_fly_over_check")->setValue((region_flags & REGION_FLAGS_BLOCK_FLYOVER) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("allow_damage_check")->setValue((region_flags & REGION_FLAGS_ALLOW_DAMAGE) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("restrict_pushobject")->setValue((region_flags & REGION_FLAGS_RESTRICT_PUSHOBJECT) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("allow_land_resell_check")->setValue((region_flags & REGION_FLAGS_BLOCK_LAND_RESELL) ? FALSE : TRUE );
- panel->getChild<LLUICtrl>("allow_parcel_changes_check")->setValue((region_flags & REGION_FLAGS_ALLOW_PARCEL_CHANGES) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("block_parcel_search_check")->setValue((region_flags & REGION_FLAGS_BLOCK_PARCEL_SEARCH) ? TRUE : FALSE );
- panel->getChild<LLUICtrl>("agent_limit_spin")->setValue(LLSD((F32)agent_limit) );
- panel->getChild<LLUICtrl>("object_bonus_spin")->setValue(LLSD(object_bonus_factor) );
- panel->getChild<LLUICtrl>("access_combo")->setValue(LLSD(sim_access) );
-
- panel->getChild<LLSpinCtrl>("agent_limit_spin")->setMaxValue(hard_agent_limit);
-
- LLPanelRegionGeneralInfo* panel_general = LLFloaterRegionInfo::getPanelGeneral();
- if (panel)
+ panel->getChild<LLUICtrl>("block_terraform_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_TERRAFORM));
+ panel->getChild<LLUICtrl>("block_fly_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_FLY));
+ panel->getChild<LLUICtrl>("block_fly_over_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_FLYOVER));
+ panel->getChild<LLUICtrl>("allow_damage_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_ALLOW_DAMAGE));
+ panel->getChild<LLUICtrl>("restrict_pushobject")->setValue(is_flag_set(region_flags, REGION_FLAGS_RESTRICT_PUSHOBJECT));
+ panel->getChild<LLUICtrl>("allow_land_resell_check")->setValue(!is_flag_set(region_flags, REGION_FLAGS_BLOCK_LAND_RESELL));
+ panel->getChild<LLUICtrl>("allow_parcel_changes_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_ALLOW_PARCEL_CHANGES));
+ panel->getChild<LLUICtrl>("block_parcel_search_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_PARCEL_SEARCH));
+ panel->getChild<LLUICtrl>("agent_limit_spin")->setValue(LLSD((F32)agent_limit));
+ panel->getChild<LLUICtrl>("object_bonus_spin")->setValue(LLSD(object_bonus_factor));
+ panel->getChild<LLUICtrl>("access_combo")->setValue(LLSD(sim_access));
+
+ panel->getChild<LLSpinCtrl>("agent_limit_spin")->setMaxValue((F32)hard_agent_limit);
+
+ if (LLPanelRegionGeneralInfo* panel_general = LLFloaterRegionInfo::getPanelGeneral())
{
panel_general->setObjBonusFactor(object_bonus_factor);
}
@@ -521,7 +500,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
U32 parent_estate_id;
msg->getU32("RegionInfo", "ParentEstateID", parent_estate_id);
- BOOL teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that
+ bool teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that
panel->getChildView("access_combo")->setEnabled(gAgent.isGodlike() || (region && region->canManageEstate() && !teen_grid));
panel->setCtrlsEnabled(allow_modify);
@@ -530,9 +509,9 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
panel = tab->getChild<LLPanel>("Debug");
panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name) );
- panel->getChild<LLUICtrl>("disable_scripts_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_SCRIPTS) ? TRUE : FALSE )) );
- panel->getChild<LLUICtrl>("disable_collisions_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_COLLISIONS) ? TRUE : FALSE )) );
- panel->getChild<LLUICtrl>("disable_physics_check")->setValue(LLSD((BOOL)((region_flags & REGION_FLAGS_SKIP_PHYSICS) ? TRUE : FALSE )) );
+ panel->getChild<LLUICtrl>("disable_scripts_check")->setValue(LLSD((bool)(region_flags & REGION_FLAGS_SKIP_SCRIPTS)));
+ panel->getChild<LLUICtrl>("disable_collisions_check")->setValue(LLSD((bool)(region_flags & REGION_FLAGS_SKIP_COLLISIONS)));
+ panel->getChild<LLUICtrl>("disable_physics_check")->setValue(LLSD((bool)(region_flags & REGION_FLAGS_SKIP_PHYSICS)));
panel->setCtrlsEnabled(allow_modify);
// TERRAIN PANEL
@@ -543,17 +522,35 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
panel->getChild<LLUICtrl>("terrain_raise_spin")->setValue(region_info.mTerrainRaiseLimit);
panel->getChild<LLUICtrl>("terrain_lower_spin")->setValue(region_info.mTerrainLowerLimit);
- panel->setCtrlsEnabled(allow_modify);
+ panel->setAllChildrenEnabled(allow_modify, true);
if (floater->getVisible())
{
// Note: region info also causes LLRegionInfoModel::instance().update(msg); -> requestRegion(); -> changed message
// we need to know env version here and in update(msg) to know when to request and when not to, when to filter 'changed'
- floater->refreshFromRegion(gAgent.getRegion());
+ ERefreshFromRegionPhase phase = floater->mIsRegionInfoRequestedFromOpening ?
+ ERefreshFromRegionPhase::AfterRequestRegionInfo :
+ ERefreshFromRegionPhase::NotFromFloaterOpening;
+ floater->refreshFromRegion(gAgent.getRegion(), phase);
} // else will rerequest on onOpen either way
}
// static
+void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region)
+{
+ if (region != gAgent.getRegion())
+ return;
+
+ if (LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info"))
+ {
+ if (floater->getVisible() && region == gAgent.getRegion())
+ {
+ floater->refreshFromRegion(region, ERefreshFromRegionPhase::NotFromFloaterOpening);
+ }
+ }
+}
+
+// static
LLPanelEstateInfo* LLFloaterRegionInfo::getPanelEstate()
{
LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
@@ -642,12 +639,12 @@ void LLFloaterRegionInfo::disableTabCtrls()
{
LLTabContainer* tab = getChild<LLTabContainer>("region_panels");
- tab->getChild<LLPanel>("General")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Terrain")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("panel_env_info")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(FALSE);
- tab->getChild<LLPanel>("Access")->setCtrlsEnabled(FALSE);
+ tab->getChild<LLPanel>("General")->setCtrlsEnabled(false);
+ tab->getChild<LLPanel>("Debug")->setCtrlsEnabled(false);
+ tab->getChild<LLPanel>("Terrain")->setAllChildrenEnabled(false, true);
+ tab->getChild<LLPanel>("panel_env_info")->setCtrlsEnabled(false);
+ tab->getChild<LLPanel>("Estate")->setCtrlsEnabled(false);
+ tab->getChild<LLPanel>("Access")->setCtrlsEnabled(false);
}
void LLFloaterRegionInfo::onTabSelected(const LLSD& param)
@@ -656,7 +653,7 @@ void LLFloaterRegionInfo::onTabSelected(const LLSD& param)
active_panel->onOpen(LLSD());
}
-void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region)
+void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region, ERefreshFromRegionPhase phase)
{
if (!region)
{
@@ -666,7 +663,7 @@ void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region)
// call refresh from region on all panels
for (const auto& infoPanel : mInfoPanels)
{
- infoPanel->refreshFromRegion(region);
+ infoPanel->refreshFromRegion(region, phase);
}
mEnvironmentPanel->refreshFromRegion(region);
}
@@ -699,7 +696,7 @@ void LLFloaterRegionInfo::onGodLevelChange(U8 god_level)
LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
if (floater && floater->getVisible())
{
- refreshFromRegion(gAgent.getRegion());
+ refreshFromRegion(gAgent.getRegion(), ERefreshFromRegionPhase::NotFromFloaterOpening);
}
}
@@ -750,7 +747,7 @@ void LLPanelRegionInfo::onChangeText(LLLineEditor* caller, void* user_data)
// virtual
-BOOL LLPanelRegionInfo::postBuild()
+bool LLPanelRegionInfo::postBuild()
{
// If the panel has an Apply button, set a callback for it.
LLUICtrl* apply_btn = findChild<LLUICtrl>("apply_btn");
@@ -760,7 +757,7 @@ BOOL LLPanelRegionInfo::postBuild()
}
refresh();
- return TRUE;
+ return true;
}
// virtual
@@ -769,7 +766,7 @@ void LLPanelRegionInfo::updateChild(LLUICtrl* child_ctr)
}
// virtual
-bool LLPanelRegionInfo::refreshFromRegion(LLViewerRegion* region)
+bool LLPanelRegionInfo::refreshFromRegion(LLViewerRegion* region, ERefreshFromRegionPhase phase)
{
if (region) mHost = region->getHost();
return true;
@@ -797,18 +794,16 @@ void LLPanelRegionInfo::sendEstateOwnerMessage(
}
else
{
- strings_t::const_iterator it = strings.begin();
- strings_t::const_iterator end = strings.end();
- for(; it != end; ++it)
+ for (const std::string& string : strings)
{
msg->nextBlock("ParamList");
- msg->addString("Parameter", *it);
+ msg->addString("Parameter", string);
}
}
msg->sendReliable(mHost);
}
-void LLPanelRegionInfo::enableButton(const std::string& btn_name, BOOL enable)
+void LLPanelRegionInfo::enableButton(const std::string& btn_name, bool enable)
{
LLView* button = findChildView(btn_name);
if (button) button->setEnabled(enable);
@@ -817,7 +812,7 @@ void LLPanelRegionInfo::enableButton(const std::string& btn_name, BOOL enable)
void LLPanelRegionInfo::disableButton(const std::string& btn_name)
{
LLView* button = findChildView(btn_name);
- if (button) button->setEnabled(FALSE);
+ if (button) button->setEnabled(false);
}
void LLPanelRegionInfo::initCtrl(const std::string& name)
@@ -825,20 +820,47 @@ void LLPanelRegionInfo::initCtrl(const std::string& name)
getChild<LLUICtrl>(name)->setCommitCallback(boost::bind(&LLPanelRegionInfo::onChangeAnything, this));
}
+template<typename CTRL>
+void LLPanelRegionInfo::initAndSetCtrl(CTRL*& ctrl, const std::string& name)
+{
+ ctrl = findChild<CTRL>(name);
+ if (ctrl)
+ ctrl->setCommitCallback(boost::bind(&LLPanelRegionInfo::onChangeAnything, this));
+}
+
void LLPanelRegionInfo::onClickManageTelehub()
{
LLFloaterReg::hideInstance("region_info");
LLFloaterReg::showInstance("telehubs");
}
+void LLPanelRegionInfo::onClickManageRestartSchedule()
+{
+ LLFloater* floaterp = mFloaterRestartScheduleHandle.get();
+ // Show the dialog
+ if (!floaterp)
+ {
+ floaterp = new LLFloaterRegionRestartSchedule(this);
+ }
+
+ if (floaterp->getVisible())
+ {
+ floaterp->closeFloater();
+ }
+ else
+ {
+ floaterp->openFloater();
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////
// LLPanelRegionGeneralInfo
//
-bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region)
+bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region, ERefreshFromRegionPhase phase)
{
- BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
+ bool allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
setCtrlsEnabled(allow_modify);
- getChildView("apply_btn")->setEnabled(FALSE);
+ getChildView("apply_btn")->setEnabled(false);
getChildView("access_text")->setEnabled(allow_modify);
// getChildView("access_combo")->setEnabled(allow_modify);
// now set in processRegionInfo for teen grid detection
@@ -846,13 +868,15 @@ bool LLPanelRegionGeneralInfo::refreshFromRegion(LLViewerRegion* region)
getChildView("kick_all_btn")->setEnabled(allow_modify);
getChildView("im_btn")->setEnabled(allow_modify);
getChildView("manage_telehub_btn")->setEnabled(allow_modify);
+ getChildView("manage_restart_btn")->setEnabled(allow_modify);
+ getChildView("manage_restart_btn")->setVisible(LLFloaterRegionRestartSchedule::canUse());
// Data gets filled in by processRegionInfo
- return LLPanelRegionInfo::refreshFromRegion(region);
+ return LLPanelRegionInfo::refreshFromRegion(region, phase);
}
-BOOL LLPanelRegionGeneralInfo::postBuild()
+bool LLPanelRegionGeneralInfo::postBuild()
{
// Enable the "Apply" button if something is changed. JC
initCtrl("block_terraform_check");
@@ -879,7 +903,7 @@ BOOL LLPanelRegionGeneralInfo::postBuild()
}
refresh();
- return TRUE;
+ return true;
}
void LLPanelRegionGeneralInfo::onBtnSet()
@@ -919,7 +943,7 @@ void LLPanelRegionGeneralInfo::onClickKick()
LLView * button = findChild<LLButton>("kick_btn");
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1),
- FALSE, TRUE, FALSE, parent_floater->getName(), button);
+ false, true, false, parent_floater->getName(), button);
if (child_floater)
{
parent_floater->addDependentFloater(child_floater);
@@ -1024,7 +1048,7 @@ bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const L
// strings[7] = restrict pushobject
// strings[8] = 'Y' - allow parcel subdivide, 'N' - not
// strings[9] = 'Y' - block parcel search, 'N' - allow
-BOOL LLPanelRegionGeneralInfo::sendUpdate()
+bool LLPanelRegionGeneralInfo::sendUpdate()
{
LL_INFOS() << "LLPanelRegionGeneralInfo::sendUpdate()" << LL_ENDL;
@@ -1093,13 +1117,13 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate()
LLNotificationsUtil::add("RegionMaturityChange");
}
- return TRUE;
+ return true;
}
/////////////////////////////////////////////////////////////////////////////
// LLPanelRegionDebugInfo
/////////////////////////////////////////////////////////////////////////////
-BOOL LLPanelRegionDebugInfo::postBuild()
+bool LLPanelRegionDebugInfo::postBuild()
{
LLPanelRegionInfo::postBuild();
initCtrl("disable_scripts_check");
@@ -1114,16 +1138,16 @@ BOOL LLPanelRegionDebugInfo::postBuild()
childSetAction("cancel_restart_btn", onClickCancelRestart, this);
childSetAction("region_debug_console_btn", onClickDebugConsole, this);
- return TRUE;
+ return true;
}
// virtual
-bool LLPanelRegionDebugInfo::refreshFromRegion(LLViewerRegion* region)
+bool LLPanelRegionDebugInfo::refreshFromRegion(LLViewerRegion* region, ERefreshFromRegionPhase phase)
{
- BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
+ bool allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
setCtrlsEnabled(allow_modify);
- getChildView("apply_btn")->setEnabled(FALSE);
- getChildView("target_avatar_name")->setEnabled(FALSE);
+ getChildView("apply_btn")->setEnabled(false);
+ getChildView("target_avatar_name")->setEnabled(false);
getChildView("choose_avatar_btn")->setEnabled(allow_modify);
getChildView("return_scripts")->setEnabled(allow_modify && !mTargetAvatar.isNull());
@@ -1136,11 +1160,11 @@ bool LLPanelRegionDebugInfo::refreshFromRegion(LLViewerRegion* region)
getChildView("cancel_restart_btn")->setEnabled(allow_modify);
getChildView("region_debug_console_btn")->setEnabled(allow_modify);
- return LLPanelRegionInfo::refreshFromRegion(region);
+ return LLPanelRegionInfo::refreshFromRegion(region, phase);
}
// virtual
-BOOL LLPanelRegionDebugInfo::sendUpdate()
+bool LLPanelRegionDebugInfo::sendUpdate()
{
LL_INFOS() << "LLPanelRegionDebugInfo::sendUpdate" << LL_ENDL;
strings_t strings;
@@ -1157,7 +1181,7 @@ BOOL LLPanelRegionDebugInfo::sendUpdate()
LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
sendEstateOwnerMessage(gMessageSystem, "setregiondebug", invoice, strings);
- return TRUE;
+ return true;
}
void LLPanelRegionDebugInfo::onClickChooseAvatar()
@@ -1165,7 +1189,7 @@ void LLPanelRegionDebugInfo::onClickChooseAvatar()
LLView * button = findChild<LLButton>("choose_avatar_btn");
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
LLFloater * child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, this, _1, _2),
- FALSE, TRUE, FALSE, parent_floater->getName(), button);
+ false, true, false, parent_floater->getName(), button);
if (child_floater)
{
parent_floater->addDependentFloater(child_floater);
@@ -1178,7 +1202,7 @@ void LLPanelRegionDebugInfo::callbackAvatarID(const uuid_vec_t& ids, const std::
if (ids.empty() || names.empty()) return;
mTargetAvatar = ids[0];
getChild<LLUICtrl>("target_avatar_name")->setValue(LLSD(names[0].getCompleteName()));
- refreshFromRegion( gAgent.getRegion() );
+ refreshFromRegion(gAgent.getRegion(), ERefreshFromRegionPhase::NotFromFloaterOpening);
}
// static
@@ -1468,7 +1492,7 @@ bool LLPanelRegionTerrainInfo::validateMaterials()
return valid;
}
-BOOL LLPanelRegionTerrainInfo::validateTextureHeights()
+bool LLPanelRegionTerrainInfo::validateTextureHeights()
{
for (S32 i = 0; i < CORNER_COUNT; ++i)
{
@@ -1477,11 +1501,11 @@ BOOL LLPanelRegionTerrainInfo::validateTextureHeights()
if (getChild<LLUICtrl>(low)->getValue().asReal() > getChild<LLUICtrl>(high)->getValue().asReal())
{
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
/////////////////////////////////////////////////////////////////////////////
@@ -1494,17 +1518,23 @@ LLPanelRegionTerrainInfo::LLPanelRegionTerrainInfo()
const LLUUID (&default_textures)[LLVLComposition::ASSET_COUNT] = LLVLComposition::getDefaultTextures();
for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
+ mTextureDetailCtrl[i] = nullptr;
+ mMaterialDetailCtrl[i] = nullptr;
+
mLastSetTextures[i] = default_textures[i];
- }
- for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
- {
mLastSetMaterials[i] = BLANK_MATERIAL_ASSET_ID;
+
+ mMaterialScaleUCtrl[i] = nullptr;
+ mMaterialScaleVCtrl[i] = nullptr;
+ mMaterialRotationCtrl[i] = nullptr;
+ mMaterialOffsetUCtrl[i] = nullptr;
+ mMaterialOffsetVCtrl[i] = nullptr;
}
}
// Initialize statics
-BOOL LLPanelRegionTerrainInfo::postBuild()
+bool LLPanelRegionTerrainInfo::postBuild()
{
LLPanelRegionInfo::postBuild();
@@ -1519,15 +1549,18 @@ BOOL LLPanelRegionTerrainInfo::postBuild()
for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
{
- 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);
+ initAndSetCtrl(mTextureDetailCtrl[i], llformat("texture_detail_%d", i));
+ if (mTextureDetailCtrl[i])
+ {
+ mTextureDetailCtrl[i]->setBakeTextureEnabled(false);
+ }
+ initMaterialCtrl(mMaterialDetailCtrl[i], llformat("material_detail_%d", i), i);
+
+ initAndSetCtrl(mMaterialScaleUCtrl[i], llformat("terrain%dScaleU", i));
+ initAndSetCtrl(mMaterialScaleVCtrl[i], llformat("terrain%dScaleV", i));
+ initAndSetCtrl(mMaterialRotationCtrl[i], llformat("terrain%dRotation", i));
+ initAndSetCtrl(mMaterialOffsetUCtrl[i], llformat("terrain%dOffsetU", i));
+ initAndSetCtrl(mMaterialOffsetVCtrl[i], llformat("terrain%dOffsetV", i));
}
for(S32 i = 0; i < CORNER_COUNT; ++i)
@@ -1579,6 +1612,17 @@ void LLPanelRegionTerrainInfo::updateForMaterialType()
}
}
+ // Toggle visibility of terrain tabs
+ LLTabContainer* terrain_tabs = findChild<LLTabContainer>("terrain_tabs");
+ if (terrain_tabs)
+ {
+ LLPanel* pbr_terrain_repeats_tab = findChild<LLPanel>("terrain_transform_panel");
+ if (pbr_terrain_repeats_tab)
+ {
+ terrain_tabs->setTabVisibility(pbr_terrain_repeats_tab, show_material_controls);
+ }
+ }
+
// Toggle visibility of labels
LLUICtrl* texture_label = findChild<LLUICtrl>("detail_texture_text");
if (texture_label) { texture_label->setVisible(show_texture_controls); }
@@ -1600,15 +1644,15 @@ void LLPanelRegionTerrainInfo::updateForMaterialType()
}
// virtual
-bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
+bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region, ERefreshFromRegionPhase phase)
{
- BOOL owner_or_god = gAgent.isGodlike()
+ bool owner_or_god = gAgent.isGodlike()
|| (region && (region->getOwner() == gAgent.getID()));
- BOOL owner_or_god_or_manager = owner_or_god
+ bool owner_or_god_or_manager = owner_or_god
|| (region && region->isEstateManager());
- setCtrlsEnabled(owner_or_god_or_manager);
+ setAllChildrenEnabled(owner_or_god_or_manager, true);
- getChildView("apply_btn")->setEnabled(FALSE);
+ getChildView("apply_btn")->setEnabled(false);
if (region)
{
@@ -1618,8 +1662,8 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
static LLCachedControl<bool> feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false);
- const bool textures_ready = compp->texturesReady(false, false);
- const bool materials_ready = feature_pbr_terrain_enabled && compp->materialsReady(false, false);
+ const bool textures_ready = compp->makeTexturesReady(false, false);
+ const bool materials_ready = feature_pbr_terrain_enabled() && compp->makeMaterialsReady(false, false);
bool set_texture_swatches;
bool set_material_swatches;
@@ -1649,7 +1693,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
{
material_type_to_ctrl(mMaterialTypeCtrl, material_type);
updateForMaterialType();
- mMaterialTypeCtrl->setVisible(feature_pbr_terrain_enabled);
+ mMaterialTypeCtrl->setVisible(feature_pbr_terrain_enabled());
}
if (set_texture_swatches)
@@ -1707,6 +1751,21 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
}
}
+ for(S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
+ {
+ if (!mMaterialScaleUCtrl[i] || !mMaterialScaleVCtrl[i] || !mMaterialRotationCtrl[i] || !mMaterialOffsetUCtrl[i] || !mMaterialOffsetVCtrl[i]) { continue; }
+ const LLGLTFMaterial* mat_override = compp->getMaterialOverride(i);
+ if (!mat_override) { mat_override = &LLGLTFMaterial::sDefault; }
+
+ // Assume all texture transforms have the same value
+ const LLGLTFMaterial::TextureTransform& transform = mat_override->mTextureTransform[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR];
+ mMaterialScaleUCtrl[i]->setValue(transform.mScale.mV[VX]);
+ mMaterialScaleVCtrl[i]->setValue(transform.mScale.mV[VY]);
+ mMaterialRotationCtrl[i]->setValue(transform.mRotation * RAD_TO_DEG);
+ mMaterialOffsetUCtrl[i]->setValue(transform.mOffset.mV[VX]);
+ mMaterialOffsetVCtrl[i]->setValue(transform.mOffset.mV[VY]);
+ }
+
std::string buffer;
for(S32 i = 0; i < CORNER_COUNT; ++i)
{
@@ -1729,25 +1788,32 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region)
getChildView("upload_raw_btn")->setEnabled(owner_or_god);
getChildView("bake_terrain_btn")->setEnabled(owner_or_god);
- return LLPanelRegionInfo::refreshFromRegion(region);
+ return LLPanelRegionInfo::refreshFromRegion(region, phase);
}
// virtual
-BOOL LLPanelRegionTerrainInfo::sendUpdate()
+bool LLPanelRegionTerrainInfo::sendUpdate()
{
- LL_INFOS() << "LLPanelRegionTerrainInfo::sendUpdate" << LL_ENDL;
+ LL_INFOS() << __FUNCTION__ << LL_ENDL;
+
+ LLUICtrl* apply_btn = getChild<LLUICtrl>("apply_btn");
+ if (apply_btn && !apply_btn->getEnabled())
+ {
+ LL_WARNS() << "Duplicate update, ignored" << LL_ENDL;
+ return false;
+ }
// Make sure user hasn't chosen wacky textures.
if (!validateTextureSizes())
{
- return FALSE;
+ return false;
}
// Prevent applying unsupported alpha blend/double-sided materials
if (!validateMaterials())
{
- return FALSE;
+ return false;
}
// Check if terrain Elevation Ranges are correct
@@ -1757,11 +1823,11 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
{
LLNotificationsUtil::add("ConfirmTextureHeights", LLSD(), LLSD(), boost::bind(&LLPanelRegionTerrainInfo::callbackTextureHeights, this, _1, _2));
mAskedTextureHeights = true;
- return FALSE;
+ return false;
}
else if (!mConfirmedTextureHeights)
{
- return FALSE;
+ return false;
}
}
@@ -1837,7 +1903,77 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
sendEstateOwnerMessage(msg, "texturecommit", invoice, strings);
- return TRUE;
+ // ========================================
+ // POST to ModifyRegion endpoint, if enabled
+
+ static LLCachedControl<bool> feature_pbr_terrain_transforms_enabled(gSavedSettings, "RenderTerrainPBRTransformsEnabled", false);
+ if (material_type == LLTerrainMaterials::Type::PBR && feature_pbr_terrain_transforms_enabled())
+ {
+ LLTerrainMaterials composition;
+ for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i)
+ {
+ LLPointer<LLGLTFMaterial> mat_override = new LLGLTFMaterial();
+
+ const bool transform_controls_valid = mMaterialScaleUCtrl[i] && mMaterialScaleVCtrl[i] && mMaterialRotationCtrl[i] && mMaterialOffsetUCtrl[i] && mMaterialOffsetVCtrl[i];
+ if (transform_controls_valid)
+ {
+ // Set texture transforms for all texture infos to the same value,
+ // because the PBR terrain shader doesn't currently support
+ // different transforms per texture info. See also
+ // LLDrawPoolTerrain::renderFullShaderPBR .
+ for (U32 tt = 0; tt < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++tt)
+ {
+ LLGLTFMaterial::TextureTransform& transform = mat_override->mTextureTransform[tt];
+ transform.mScale.mV[VX] = (F32)mMaterialScaleUCtrl[i]->getValue().asReal();
+ transform.mScale.mV[VY] = (F32)mMaterialScaleVCtrl[i]->getValue().asReal();
+ transform.mRotation = (F32)mMaterialRotationCtrl[i]->getValue().asReal() * DEG_TO_RAD;
+ transform.mOffset.mV[VX] = (F32)mMaterialOffsetUCtrl[i]->getValue().asReal();
+ transform.mOffset.mV[VY] = (F32)mMaterialOffsetVCtrl[i]->getValue().asReal();
+ }
+ }
+
+ if (*mat_override == LLGLTFMaterial::sDefault) { mat_override = nullptr; }
+ composition.setMaterialOverride(i, mat_override.get());
+ }
+
+ // queueModify leads to a few messages being sent back and forth:
+ // viewer: POST ModifyRegion
+ // simulator: RegionHandshake
+ // viewer: GET ModifyRegion
+ LLViewerRegion* region = gAgent.getRegion();
+ llassert(region);
+ if (region)
+ {
+ LLPBRTerrainFeatures::queueModify(*region, composition);
+ }
+ }
+
+ return true;
+}
+
+void LLPanelRegionTerrainInfo::initMaterialCtrl(LLTextureCtrl*& ctrl, const std::string& name, S32 index)
+{
+ ctrl = findChild<LLTextureCtrl>(name, true);
+ if (!ctrl) return;
+
+ // consume cancel events, otherwise they will trigger commit callbacks
+ ctrl->setOnCancelCallback([](LLUICtrl* ctrl, const LLSD& param) {});
+ ctrl->setCommitCallback(
+ [this, index](LLUICtrl* ctrl, const LLSD& param)
+ {
+ if (!mMaterialScaleUCtrl[index]
+ || !mMaterialScaleVCtrl[index]
+ || !mMaterialRotationCtrl[index]
+ || !mMaterialOffsetUCtrl[index]
+ || !mMaterialOffsetVCtrl[index]) return;
+
+ mMaterialScaleUCtrl[index]->setValue(1.f);
+ mMaterialScaleVCtrl[index]->setValue(1.f);
+ mMaterialRotationCtrl[index]->setValue(0.f);
+ mMaterialOffsetUCtrl[index]->setValue(0.f);
+ mMaterialOffsetVCtrl[index]->setValue(0.f);
+ onChangeAnything();
+ });
}
bool LLPanelRegionTerrainInfo::callbackTextureHeights(const LLSD& notification, const LLSD& response)
@@ -1853,7 +1989,7 @@ bool LLPanelRegionTerrainInfo::callbackTextureHeights(const LLSD& notification,
}
else if (option == 2) // don't ask
{
- gSavedSettings.setBOOL("RegionCheckTextureHeights", FALSE);
+ gSavedSettings.setBOOL("RegionCheckTextureHeights", false);
mConfirmedTextureHeights = true;
}
@@ -1968,7 +2104,7 @@ void LLPanelEstateInfo::onClickKickUser()
LLView * button = findChild<LLButton>("kick_user_from_estate_btn");
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1),
- FALSE, TRUE, FALSE, parent_floater->getName(), button);
+ false, true, false, parent_floater->getName(), button);
if (child_floater)
{
parent_floater->addDependentFloater(child_floater);
@@ -2109,38 +2245,40 @@ void LLPanelEstateInfo::updateEstateName(const std::string& name)
void LLPanelEstateInfo::updateControls(LLViewerRegion* region)
{
- BOOL god = gAgent.isGodlike();
- BOOL owner = (region && (region->getOwner() == gAgent.getID()));
- BOOL manager = (region && region->isEstateManager());
+ bool god = gAgent.isGodlike();
+ bool owner = (region && (region->getOwner() == gAgent.getID()));
+ bool manager = (region && region->isEstateManager());
setCtrlsEnabled(god || owner || manager);
- getChildView("apply_btn")->setEnabled(FALSE);
- getChildView("estate_owner")->setEnabled(TRUE);
+ getChildView("apply_btn")->setEnabled(false);
+ getChildView("estate_owner")->setEnabled(true);
getChildView("message_estate_btn")->setEnabled(god || owner || manager);
getChildView("kick_user_from_estate_btn")->setEnabled(god || owner || manager);
refresh();
}
-bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region)
+bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region, ERefreshFromRegionPhase phase)
{
updateControls(region);
// let the parent class handle the general data collection.
- bool rv = LLPanelRegionInfo::refreshFromRegion(region);
-
- // We want estate info. To make sure it works across region
- // boundaries and multiple packets, we add a serial number to the
- // integers and track against that on update.
- strings_t strings;
- //integers_t integers;
- //LLFloaterRegionInfo::incrementSerial();
- LLFloaterRegionInfo::nextInvoice();
- LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
- //integers.push_back(LLFloaterRegionInfo::());::getPanelEstate();
+ bool rv = LLPanelRegionInfo::refreshFromRegion(region, phase);
+ if (phase != ERefreshFromRegionPhase::BeforeRequestRegionInfo)
+ {
+ // We want estate info. To make sure it works across region
+ // boundaries and multiple packets, we add a serial number to the
+ // integers and track against that on update.
+ strings_t strings;
+ //integers_t integers;
+ //LLFloaterRegionInfo::incrementSerial();
+ LLFloaterRegionInfo::nextInvoice();
+ LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
+ //integers.push_back(LLFloaterRegionInfo::());::getPanelEstate();
- sendEstateOwnerMessage(gMessageSystem, "getinfo", invoice, strings);
+ sendEstateOwnerMessage(gMessageSystem, "getinfo", invoice, strings);
+ }
refresh();
@@ -2160,7 +2298,7 @@ bool LLPanelEstateInfo::estateUpdate(LLMessageSystem* msg)
}
-BOOL LLPanelEstateInfo::postBuild()
+bool LLPanelEstateInfo::postBuild()
{
// set up the callbacks for the generic controls
initCtrl("externally_visible_radio");
@@ -2176,7 +2314,7 @@ BOOL LLPanelEstateInfo::postBuild()
getChild<LLUICtrl>("parcel_access_override")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeAccessOverride, this));
- getChild<LLUICtrl>("externally_visible_radio")->setFocus(TRUE);
+ getChild<LLUICtrl>("externally_visible_radio")->setFocus(true);
getChild<LLTextBox>("estate_owner")->setIsFriendCallback(LLAvatarActions::isFriend);
@@ -2188,13 +2326,12 @@ void LLPanelEstateInfo::refresh()
// Disable access restriction controls if they make no sense.
bool public_access = ("estate_public_access" == getChild<LLUICtrl>("externally_visible_radio")->getValue().asString());
- getChildView("Only Allow")->setEnabled(public_access);
getChildView("limit_payment")->setEnabled(public_access);
getChildView("limit_age_verified")->setEnabled(public_access);
getChildView("limit_bots")->setEnabled(public_access);
// if this is set to false, then the limit fields are meaningless and should be turned off
- if (public_access == false)
+ if (!public_access)
{
getChild<LLUICtrl>("limit_payment")->setValue(false);
getChild<LLUICtrl>("limit_age_verified")->setValue(false);
@@ -2222,7 +2359,7 @@ void LLPanelEstateInfo::refreshFromEstate()
refresh();
}
-BOOL LLPanelEstateInfo::sendUpdate()
+bool LLPanelEstateInfo::sendUpdate()
{
LL_INFOS() << "LLPanelEsateInfo::sendUpdate()" << LL_ENDL;
@@ -2239,7 +2376,7 @@ BOOL LLPanelEstateInfo::sendUpdate()
// for normal estates, just make the change
LLNotifications::instance().forceResponse(params, 0);
}
- return TRUE;
+ return true;
}
bool LLPanelEstateInfo::callbackChangeLindenEstate(const LLSD& notification, const LLSD& response)
@@ -2362,7 +2499,7 @@ LLPanelEstateCovenant::LLPanelEstateCovenant()
}
// virtual
-bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region)
+bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region, ERefreshFromRegionPhase phase)
{
LLTextBox* region_name = getChild<LLTextBox>("region_name_text");
if (region_name)
@@ -2408,13 +2545,17 @@ bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region)
getChild<LLButton>("reset_covenant")->setEnabled(gAgent.isGodlike() || (region && region->canManageEstate()));
// let the parent class handle the general data collection.
- bool rv = LLPanelRegionInfo::refreshFromRegion(region);
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessage("EstateCovenantRequest");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->sendReliable(region->getHost());
+ bool rv = LLPanelRegionInfo::refreshFromRegion(region, phase);
+
+ if (phase != ERefreshFromRegionPhase::AfterRequestRegionInfo)
+ {
+ gMessageSystem->newMessage("EstateCovenantRequest");
+ gMessageSystem->nextBlockFast(_PREHASH_AgentData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ gMessageSystem->sendReliable(region->getHost());
+ }
+
return rv;
}
@@ -2426,7 +2567,7 @@ bool LLPanelEstateCovenant::estateUpdate(LLMessageSystem* msg)
}
// virtual
-BOOL LLPanelEstateCovenant::postBuild()
+bool LLPanelEstateCovenant::postBuild()
{
mEstateNameText = getChild<LLTextBox>("estate_name_text");
mEstateOwnerText = getChild<LLTextBox>("estate_owner_text");
@@ -2446,7 +2587,7 @@ void LLPanelEstateCovenant::updateChild(LLUICtrl* child_ctrl)
}
// virtual
-BOOL LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+bool LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
@@ -2457,7 +2598,7 @@ BOOL LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop
if (!gAgent.canManageEstate())
{
*accept = ACCEPT_NO;
- return TRUE;
+ return true;
}
switch(cargo_type)
@@ -2477,7 +2618,7 @@ BOOL LLPanelEstateCovenant::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop
break;
}
- return TRUE;
+ return true;
}
// static
@@ -2526,7 +2667,7 @@ bool LLPanelEstateCovenant::confirmResetCovenantCallback(const LLSD& notificatio
void LLPanelEstateCovenant::loadInvItem(LLInventoryItem *itemp)
{
- const BOOL high_priority = TRUE;
+ const bool high_priority = true;
if (itemp)
{
gAssetStorage->getInvItemAsset(gAgent.getRegionHost(),
@@ -2638,9 +2779,9 @@ void LLPanelEstateCovenant::sendChangeCovenantID(const LLUUID &asset_id)
}
// virtual
-BOOL LLPanelEstateCovenant::sendUpdate()
+bool LLPanelEstateCovenant::sendUpdate()
{
- return TRUE;
+ return true;
}
std::string LLPanelEstateCovenant::getEstateName() const
@@ -2654,6 +2795,16 @@ void LLPanelEstateCovenant::setEstateName(const std::string& name)
}
// static
+void LLPanelEstateCovenant::updateCovenant(const LLTextBase* source, const LLUUID& asset_id)
+{
+ if (LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant())
+ {
+ panelp->mEditor->copyContents(source);
+ panelp->setCovenantID(asset_id);
+ }
+}
+
+// static
void LLPanelEstateCovenant::updateCovenantText(const std::string& string, const LLUUID& asset_id)
{
LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant();
@@ -2807,13 +2958,13 @@ bool LLDispatchSetEstateExperience::operator()(
return true;
}
-BOOL LLPanelRegionExperiences::postBuild()
+bool LLPanelRegionExperiences::postBuild()
{
mAllowed = setupList("panel_allowed", ESTATE_EXPERIENCE_ALLOWED_ADD, ESTATE_EXPERIENCE_ALLOWED_REMOVE);
mTrusted = setupList("panel_trusted", ESTATE_EXPERIENCE_TRUSTED_ADD, ESTATE_EXPERIENCE_TRUSTED_REMOVE);
mBlocked = setupList("panel_blocked", ESTATE_EXPERIENCE_BLOCKED_ADD, ESTATE_EXPERIENCE_BLOCKED_REMOVE);
- getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(TRUE);
+ getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(true);
getChild<LLTextBox>("experiences_help_text")->setText(getString("estate_caption"));
getChild<LLTextBox>("trusted_text_help")->setText(getString("trusted_estate_text"));
getChild<LLTextBox>("allowed_text_help")->setText(getString("allowed_estate_text"));
@@ -2952,9 +3103,9 @@ std::string LLPanelRegionExperiences::regionCapabilityQuery(LLViewerRegion* regi
return region->getCapability(cap);
}
-bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region)
+bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region, ERefreshFromRegionPhase phase)
{
- BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
+ bool allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
mAllowed->loading();
mAllowed->setReadonly(!allow_modify);
@@ -2975,10 +3126,13 @@ bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region)
mTrusted->loading();
mTrusted->setReadonly(!allow_modify);
- LLExperienceCache::instance().getRegionExperiences(boost::bind(&LLPanelRegionExperiences::regionCapabilityQuery, region, _1),
- boost::bind(&LLPanelRegionExperiences::infoCallback, getDerivedHandle<LLPanelRegionExperiences>(), _1));
+ if (phase != ERefreshFromRegionPhase::AfterRequestRegionInfo)
+ {
+ LLExperienceCache::instance().getRegionExperiences(boost::bind(&LLPanelRegionExperiences::regionCapabilityQuery, region, _1),
+ boost::bind(&LLPanelRegionExperiences::infoCallback, getDerivedHandle<LLPanelRegionExperiences>(), _1));
+ }
- return LLPanelRegionInfo::refreshFromRegion(region);
+ return LLPanelRegionInfo::refreshFromRegion(region, phase);
}
LLSD LLPanelRegionExperiences::addIds(LLPanelExperienceListEditor* panel)
@@ -2993,7 +3147,7 @@ LLSD LLPanelRegionExperiences::addIds(LLPanelExperienceListEditor* panel)
}
-BOOL LLPanelRegionExperiences::sendUpdate()
+bool LLPanelRegionExperiences::sendUpdate()
{
LLViewerRegion* region = gAgent.getRegion();
@@ -3006,7 +3160,7 @@ BOOL LLPanelRegionExperiences::sendUpdate()
LLExperienceCache::instance().setRegionExperiences(boost::bind(&LLPanelRegionExperiences::regionCapabilityQuery, region, _1),
content, boost::bind(&LLPanelRegionExperiences::infoCallback, getDerivedHandle<LLPanelRegionExperiences>(), _1));
- return TRUE;
+ return true;
}
void LLPanelRegionExperiences::itemChanged( U32 event_type, const LLUUID& id )
@@ -3071,13 +3225,13 @@ LLPanelEstateAccess::LLPanelEstateAccess()
: LLPanelRegionInfo(), mPendingUpdate(false)
{}
-BOOL LLPanelEstateAccess::postBuild()
+bool LLPanelEstateAccess::postBuild()
{
getChild<LLUICtrl>("allowed_avatar_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1));
LLNameListCtrl *avatar_name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list");
if (avatar_name_list)
{
- avatar_name_list->setCommitOnSelectionChange(TRUE);
+ avatar_name_list->setCommitOnSelectionChange(true);
avatar_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS);
}
@@ -3090,7 +3244,7 @@ BOOL LLPanelEstateAccess::postBuild()
LLNameListCtrl* group_name_list = getChild<LLNameListCtrl>("allowed_group_name_list");
if (group_name_list)
{
- group_name_list->setCommitOnSelectionChange(TRUE);
+ group_name_list->setCommitOnSelectionChange(true);
group_name_list->setMaxItemCount(ESTATE_MAX_ACCESS_IDS);
}
@@ -3103,7 +3257,7 @@ BOOL LLPanelEstateAccess::postBuild()
LLNameListCtrl* banned_name_list = getChild<LLNameListCtrl>("banned_avatar_name_list");
if (banned_name_list)
{
- banned_name_list->setCommitOnSelectionChange(TRUE);
+ banned_name_list->setCommitOnSelectionChange(true);
banned_name_list->setMaxItemCount(ESTATE_MAX_BANNED_IDS);
}
@@ -3116,36 +3270,41 @@ BOOL LLPanelEstateAccess::postBuild()
LLNameListCtrl* manager_name_list = getChild<LLNameListCtrl>("estate_manager_name_list");
if (manager_name_list)
{
- manager_name_list->setCommitOnSelectionChange(TRUE);
+ manager_name_list->setCommitOnSelectionChange(true);
manager_name_list->setMaxItemCount(ESTATE_MAX_MANAGERS * 4); // Allow extras for dupe issue
}
childSetAction("add_estate_manager_btn", boost::bind(&LLPanelEstateAccess::onClickAddEstateManager, this));
childSetAction("remove_estate_manager_btn", boost::bind(&LLPanelEstateAccess::onClickRemoveEstateManager, this));
- return TRUE;
+ return true;
}
void LLPanelEstateAccess::updateControls(LLViewerRegion* region)
{
- BOOL god = gAgent.isGodlike();
- BOOL owner = (region && (region->getOwner() == gAgent.getID()));
- BOOL manager = (region && region->isEstateManager());
- BOOL enable_cotrols = god || owner || manager;
+ bool god = gAgent.isGodlike();
+ bool owner = (region && (region->getOwner() == gAgent.getID()));
+ bool manager = (region && region->isEstateManager());
+ bool enable_cotrols = god || owner || manager;
setCtrlsEnabled(enable_cotrols);
- BOOL has_allowed_avatar = getChild<LLNameListCtrl>("allowed_avatar_name_list")->getFirstSelected() ? TRUE : FALSE;
- BOOL has_allowed_group = getChild<LLNameListCtrl>("allowed_group_name_list")->getFirstSelected() ? TRUE : FALSE;
- BOOL has_banned_agent = getChild<LLNameListCtrl>("banned_avatar_name_list")->getFirstSelected() ? TRUE : FALSE;
- BOOL has_estate_manager = getChild<LLNameListCtrl>("estate_manager_name_list")->getFirstSelected() ? TRUE : FALSE;
+ LLNameListCtrl* allowedAvatars = getChild<LLNameListCtrl>("allowed_avatar_name_list");
+ LLNameListCtrl* allowedGroups = getChild<LLNameListCtrl>("allowed_group_name_list");
+ LLNameListCtrl* bannedAvatars = getChild<LLNameListCtrl>("banned_avatar_name_list");
+ LLNameListCtrl* estateManagers = getChild<LLNameListCtrl>("estate_manager_name_list");
+
+ bool has_allowed_avatar = allowedAvatars->getFirstSelected();
+ bool has_allowed_group = allowedGroups->getFirstSelected();
+ bool has_banned_agent = bannedAvatars->getFirstSelected();
+ bool has_estate_manager = estateManagers->getFirstSelected();
getChildView("add_allowed_avatar_btn")->setEnabled(enable_cotrols);
getChildView("remove_allowed_avatar_btn")->setEnabled(has_allowed_avatar && enable_cotrols);
- getChildView("allowed_avatar_name_list")->setEnabled(enable_cotrols);
+ allowedAvatars->setEnabled(enable_cotrols);
getChildView("add_allowed_group_btn")->setEnabled(enable_cotrols);
getChildView("remove_allowed_group_btn")->setEnabled(has_allowed_group && enable_cotrols);
- getChildView("allowed_group_name_list")->setEnabled(enable_cotrols);
+ allowedGroups->setEnabled(enable_cotrols);
// Can't ban people from mainland, orientation islands, etc. because this
// creates much network traffic and server load.
@@ -3154,12 +3313,12 @@ void LLPanelEstateAccess::updateControls(LLViewerRegion* region)
bool enable_ban = enable_cotrols && !linden_estate;
getChildView("add_banned_avatar_btn")->setEnabled(enable_ban);
getChildView("remove_banned_avatar_btn")->setEnabled(has_banned_agent && enable_ban);
- getChildView("banned_avatar_name_list")->setEnabled(enable_cotrols);
+ bannedAvatars->setEnabled(enable_cotrols);
// estate managers can't add estate managers
getChildView("add_estate_manager_btn")->setEnabled(god || owner);
getChildView("remove_estate_manager_btn")->setEnabled(has_estate_manager && (god || owner));
- getChildView("estate_manager_name_list")->setEnabled(god || owner);
+ estateManagers->setEnabled(god || owner);
if (enable_cotrols != mCtrlsEnabled)
{
@@ -3400,7 +3559,7 @@ bool LLPanelEstateAccess::accessAddCore2(const LLSD& notification, const LLSD& r
// avatar picker yes multi-select, yes close-on-select
LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateAccess::accessAddCore3, _1, _2, (void*)change_info),
- TRUE, TRUE, FALSE, parent_floater_name, button);
+ true, true, false, parent_floater_name, button);
//Allows the closed parent floater to close the child floater (avatar picker)
if (child_floater)
@@ -3866,7 +4025,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url)
LLUUID id = (*it)["id"].asUUID();
allowed_agent_name_list->addNameItem(id);
}
- allowed_agent_name_list->sortByName(TRUE);
+ allowed_agent_name_list->sortByName(true);
}
LLNameListCtrl* banned_agent_name_list = panel->getChild<LLNameListCtrl>("banned_avatar_name_list");
@@ -3909,7 +4068,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url)
banned_agent_name_list->addElement(item);
}
- banned_agent_name_list->sortByName(TRUE);
+ banned_agent_name_list->sortByName(true);
}
LLNameListCtrl* allowed_group_name_list = panel->getChild<LLNameListCtrl>("allowed_group_name_list");
@@ -3928,7 +4087,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url)
LLUUID id = (*it)["id"].asUUID();
allowed_group_name_list->addGroupNameItem(id);
}
- allowed_group_name_list->sortByName(TRUE);
+ allowed_group_name_list->sortByName(true);
}
LLNameListCtrl* estate_manager_name_list = panel->getChild<LLNameListCtrl>("estate_manager_name_list");
@@ -3947,7 +4106,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url)
LLUUID id = (*it)["agent_id"].asUUID();
estate_manager_name_list->addNameItem(id);
}
- estate_manager_name_list->sortByName(TRUE);
+ estate_manager_name_list->sortByName(true);
}
@@ -3992,7 +4151,7 @@ void LLPanelEstateAccess::searchAgent(LLNameListCtrl* listCtrl, const std::strin
}
else
{
- listCtrl->deselectAllItems(TRUE);
+ listCtrl->deselectAllItems(true);
}
}
@@ -4000,35 +4159,32 @@ void LLPanelEstateAccess::copyListToClipboard(std::string list_name)
{
LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
if (!panel) return;
- LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>(list_name);
- if (!name_list) return;
+ LLNameListCtrl* name_list = panel->getChild<LLNameListCtrl>(list_name);
std::vector<LLScrollListItem*> list_vector = name_list->getAllData();
- if (list_vector.size() == 0) return;
+ if (list_vector.empty())
+ return;
LLSD::String list_to_copy;
- for (std::vector<LLScrollListItem*>::const_iterator iter = list_vector.begin();
- iter != list_vector.end();
- iter++)
+ for (LLScrollListItem* item : list_vector)
{
- LLScrollListItem *item = (*iter);
if (item)
{
+ if (!list_to_copy.empty())
+ {
+ list_to_copy += "\n";
+ }
list_to_copy += item->getColumn(0)->getValue().asString();
}
- if (std::next(iter) != list_vector.end())
- {
- list_to_copy += "\n";
- }
}
- LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, list_to_copy.length());
+ LLClipboard::instance().copyToClipboard(utf8str_to_wstring(list_to_copy), 0, static_cast<S32>(list_to_copy.length()));
}
-bool LLPanelEstateAccess::refreshFromRegion(LLViewerRegion* region)
+bool LLPanelEstateAccess::refreshFromRegion(LLViewerRegion* region, ERefreshFromRegionPhase phase)
{
updateLists();
- return LLPanelRegionInfo::refreshFromRegion(region);
+ return LLPanelRegionInfo::refreshFromRegion(region, phase);
}
//=========================================================================
@@ -4046,21 +4202,21 @@ LLPanelRegionEnvironment::~LLPanelRegionEnvironment()
mCommitConnect.disconnect();
}
-BOOL LLPanelRegionEnvironment::postBuild()
+bool LLPanelRegionEnvironment::postBuild()
{
LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
if (!LLPanelEnvironmentInfo::postBuild())
- return FALSE;
+ return false;
- getChild<LLUICtrl>(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT));
- getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(TRUE);
- getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(TRUE);
+ mBtnUseDefault->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT));
+ mCheckAllowOverride->setVisible(true);
+ mPanelEnvAltitudes->setVisible(true);
- getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setCommitCallback([this](LLUICtrl *, const LLSD &value){ onChkAllowOverride(value.asBoolean()); });
+ mCheckAllowOverride->setCommitCallback([this](LLUICtrl *, const LLSD &value){ onChkAllowOverride(value.asBoolean()); });
mCommitConnect = estate_info.setCommitCallback(boost::bind(&LLPanelRegionEnvironment::refreshFromEstate, this));
- return TRUE;
+ return true;
}
@@ -4079,7 +4235,7 @@ void LLPanelRegionEnvironment::refresh()
LLPanelEnvironmentInfo::refresh();
- getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride);
+ mCheckAllowOverride->setValue(mAllowOverride);
}
bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region)
@@ -4120,7 +4276,7 @@ void LLPanelRegionEnvironment::refreshFromSource()
}
LLEnvironment::instance().requestRegion(
- [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
+ [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { onEnvironmentReceived(that_h, parcel_id, envifo); });
setControlsEnabled(false);
}
@@ -4145,7 +4301,7 @@ bool LLPanelRegionEnvironment::confirmUpdateEstateEnvironment(const LLSD& notifi
case 1:
mAllowOverride = mAllowOverrideRestore;
- getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride);
+ mCheckAllowOverride->setValue(mAllowOverride);
break;
default:
break;
@@ -4159,7 +4315,6 @@ void LLPanelRegionEnvironment::onChkAllowOverride(bool value)
mAllowOverrideRestore = mAllowOverride;
mAllowOverride = value;
-
std::string notification("EstateParcelEnvironmentOverride");
if (LLPanelEstateInfo::isLindenEstate())
notification = "ChangeLindenEstate";