STORM-1330 WIP Switched the Terrain tab of the Region/Estate floater to using the region info model.
parent
424366a66f
commit
7aa7ee6838
|
|
@ -342,6 +342,9 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
|
|||
LLViewerRegion* region = gAgent.getRegion();
|
||||
BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate());
|
||||
|
||||
// *TODO: Replace parcing msg with accessing the region info model.
|
||||
LLRegionInfoModel& region_info = LLRegionInfoModel::instance();
|
||||
|
||||
// extract message
|
||||
std::string sim_name;
|
||||
std::string sim_type = LLTrans::getString("land_type_unknown");
|
||||
|
|
@ -413,9 +416,9 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg)
|
|||
panel = tab->getChild<LLPanel>("Terrain");
|
||||
|
||||
panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name));
|
||||
panel->getChild<LLUICtrl>("water_height_spin")->setValue(LLSD(water_height));
|
||||
panel->getChild<LLUICtrl>("terrain_raise_spin")->setValue(LLSD(terrain_raise_limit));
|
||||
panel->getChild<LLUICtrl>("terrain_lower_spin")->setValue(LLSD(terrain_lower_limit));
|
||||
panel->getChild<LLUICtrl>("water_height_spin")->setValue(region_info.mWaterHeight);
|
||||
panel->getChild<LLUICtrl>("terrain_raise_spin")->setValue(region_info.mTerrainRaiseLimit);
|
||||
panel->getChild<LLUICtrl>("terrain_lower_spin")->setValue(region_info.mTerrainLowerLimit);
|
||||
|
||||
panel->setCtrlsEnabled(allow_modify);
|
||||
|
||||
|
|
@ -1276,50 +1279,14 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate()
|
|||
strings_t strings;
|
||||
LLUUID invoice(LLFloaterRegionInfo::getLastInvoice());
|
||||
|
||||
// ==========================================
|
||||
// Assemble and send setregionterrain message
|
||||
// "setregionterrain"
|
||||
// strings[0] = float water height
|
||||
// strings[1] = float terrain raise
|
||||
// strings[2] = float terrain lower
|
||||
// strings[3] = 'Y' use estate time
|
||||
// strings[4] = 'Y' fixed sun
|
||||
// strings[5] = float sun_hour
|
||||
// strings[6] = from estate, 'Y' use global time
|
||||
// strings[7] = from estate, 'Y' fixed sun
|
||||
// strings[8] = from estate, float sun_hour
|
||||
|
||||
// update the model
|
||||
LLRegionInfoModel& region_info = LLRegionInfoModel::instance();
|
||||
bool region_use_estate_sun = region_info.mUseEstateSun;
|
||||
bool region_use_fixed_sun = region_info.getUseFixedSun(); // *TODO: take into account region environment settings
|
||||
F32 region_sun_hour = region_info.mSunHour;
|
||||
region_info.mWaterHeight = (F32) getChild<LLUICtrl>("water_height_spin")->getValue().asReal();
|
||||
region_info.mTerrainRaiseLimit = (F32) getChild<LLUICtrl>("terrain_raise_spin")->getValue().asReal();
|
||||
region_info.mTerrainLowerLimit = (F32) getChild<LLUICtrl>("terrain_lower_spin")->getValue().asReal();
|
||||
|
||||
// *NOTE: this resets estate sun info.
|
||||
BOOL estate_global_time = true;
|
||||
BOOL estate_fixed_sun = false;
|
||||
F32 estate_sun_hour = 0.f;
|
||||
|
||||
buffer = llformat("%f", (F32)getChild<LLUICtrl>("water_height_spin")->getValue().asReal());
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", (F32)getChild<LLUICtrl>("terrain_raise_spin")->getValue().asReal());
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", (F32)getChild<LLUICtrl>("terrain_lower_spin")->getValue().asReal());
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (region_use_estate_sun ? "Y" : "N"));
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (region_use_fixed_sun ? "Y" : "N"));
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", region_sun_hour);
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (estate_global_time ? "Y" : "N") );
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") );
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", estate_sun_hour);
|
||||
strings.push_back(buffer);
|
||||
|
||||
sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings);
|
||||
strings.clear();
|
||||
// and sync the region with it
|
||||
region_info.sendRegionTerrain(invoice);
|
||||
|
||||
// =======================================
|
||||
// Assemble and send texturedetail message
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@
|
|||
#include "message.h"
|
||||
#include "llregionflags.h"
|
||||
|
||||
// viewers
|
||||
// viewer
|
||||
#include "llagent.h"
|
||||
#include "llviewerregion.h"
|
||||
|
||||
void LLRegionInfoModel::reset()
|
||||
{
|
||||
|
|
@ -70,7 +72,52 @@ boost::signals2::connection LLRegionInfoModel::setUpdateCallback(const update_si
|
|||
return mUpdateSignal.connect(cb);
|
||||
}
|
||||
|
||||
bool LLRegionInfoModel::getUseFixedSun()
|
||||
void LLRegionInfoModel::sendRegionTerrain(const LLUUID& invoice) const
|
||||
{
|
||||
std::string buffer;
|
||||
std::vector<std::string> strings;
|
||||
|
||||
// ==========================================
|
||||
// Assemble and send setregionterrain message
|
||||
// "setregionterrain"
|
||||
// strings[0] = float water height
|
||||
// strings[1] = float terrain raise
|
||||
// strings[2] = float terrain lower
|
||||
// strings[3] = 'Y' use estate time
|
||||
// strings[4] = 'Y' fixed sun
|
||||
// strings[5] = float sun_hour
|
||||
// strings[6] = from estate, 'Y' use global time
|
||||
// strings[7] = from estate, 'Y' fixed sun
|
||||
// strings[8] = from estate, float sun_hour
|
||||
|
||||
// *NOTE: this resets estate sun info.
|
||||
BOOL estate_global_time = true;
|
||||
BOOL estate_fixed_sun = false;
|
||||
F32 estate_sun_hour = 0.f;
|
||||
|
||||
buffer = llformat("%f", mWaterHeight);
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", mTerrainRaiseLimit);
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", mTerrainLowerLimit);
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (mUseEstateSun ? "Y" : "N"));
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (getUseFixedSun() ? "Y" : "N"));
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", mSunHour);
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (estate_global_time ? "Y" : "N") );
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") );
|
||||
strings.push_back(buffer);
|
||||
buffer = llformat("%f", estate_sun_hour);
|
||||
strings.push_back(buffer);
|
||||
|
||||
sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings);
|
||||
}
|
||||
|
||||
bool LLRegionInfoModel::getUseFixedSun() const
|
||||
{
|
||||
return mRegionFlags & REGION_FLAGS_SUN_FIXED;
|
||||
}
|
||||
|
|
@ -110,3 +157,47 @@ void LLRegionInfoModel::update(LLMessageSystem* msg)
|
|||
// Let interested parties know that region info has been updated.
|
||||
mUpdateSignal();
|
||||
}
|
||||
|
||||
// static
|
||||
void LLRegionInfoModel::sendEstateOwnerMessage(
|
||||
LLMessageSystem* msg,
|
||||
const std::string& request,
|
||||
const LLUUID& invoice,
|
||||
const std::vector<std::string>& strings)
|
||||
{
|
||||
LLViewerRegion* cur_region = gAgent.getRegion();
|
||||
|
||||
if (!cur_region)
|
||||
{
|
||||
llwarns << "Agent region not set" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
llinfos << "Sending estate request '" << request << "'" << llendl;
|
||||
msg->newMessage("EstateOwnerMessage");
|
||||
msg->nextBlockFast(_PREHASH_AgentData);
|
||||
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
|
||||
msg->nextBlock("MethodData");
|
||||
msg->addString("Method", request);
|
||||
msg->addUUID("Invoice", invoice);
|
||||
|
||||
if (strings.empty())
|
||||
{
|
||||
msg->nextBlock("ParamList");
|
||||
msg->addString("Parameter", NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::string>::const_iterator it = strings.begin();
|
||||
std::vector<std::string>::const_iterator end = strings.end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
msg->nextBlock("ParamList");
|
||||
msg->addString("Parameter", *it);
|
||||
}
|
||||
}
|
||||
|
||||
msg->sendReliable(cur_region->getHost());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ public:
|
|||
typedef boost::signals2::signal<void()> update_signal_t;
|
||||
boost::signals2::connection setUpdateCallback(const update_signal_t::slot_type& cb);
|
||||
|
||||
bool getUseFixedSun();
|
||||
void sendRegionTerrain(const LLUUID& invoice) const; /// upload region terrain data
|
||||
|
||||
bool getUseFixedSun() const;
|
||||
|
||||
// *TODO: Add getters and make the data private.
|
||||
U8 mSimAccess;
|
||||
|
|
@ -73,11 +75,22 @@ protected:
|
|||
friend class LLViewerRegion;
|
||||
|
||||
LLRegionInfoModel();
|
||||
|
||||
/**
|
||||
* Refresh model with data from the incoming server message.
|
||||
*/
|
||||
void update(LLMessageSystem* msg);
|
||||
|
||||
private:
|
||||
void reset();
|
||||
|
||||
// *FIXME: Duplicated code from LLPanelRegionInfo
|
||||
static void sendEstateOwnerMessage(
|
||||
LLMessageSystem* msg,
|
||||
const std::string& request,
|
||||
const LLUUID& invoice,
|
||||
const std::vector<std::string>& strings);
|
||||
|
||||
update_signal_t mUpdateSignal;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -645,10 +645,10 @@ void LLViewerRegion::processRegionInfo(LLMessageSystem* msg, void**)
|
|||
{
|
||||
// send it to 'observers'
|
||||
// *TODO: switch the floaters to using LLRegionInfoModel
|
||||
LLRegionInfoModel::instance().update(msg);
|
||||
LLFloaterGodTools::processRegionInfo(msg);
|
||||
LLFloaterRegionInfo::processRegionInfo(msg);
|
||||
LLFloaterReporter::processRegionInfo(msg);
|
||||
LLRegionInfoModel::instance().update(msg);
|
||||
}
|
||||
|
||||
void LLViewerRegion::setCacheID(const LLUUID& id)
|
||||
|
|
|
|||
Loading…
Reference in New Issue