Commit cea38227 authored by Rye Mutt's avatar Rye Mutt 🍞
Browse files

Introduce Cinder's support code for WindLightRefresh on OpenSim

parent 24145936
......@@ -1077,6 +1077,11 @@ void LLAgent::removeRegionChangedCallback(boost::signals2::connection callback)
mRegionChangedSignal.disconnect(callback);
}
void LLAgent::regionChanged()
{
mRegionChangedSignal();
}
//-----------------------------------------------------------------------------
// inPrelude()
//-----------------------------------------------------------------------------
......
......@@ -266,6 +266,8 @@ public:
// Capability
std::string getRegionCapability(const std::string &name); // short hand for if (getRegion()) { getRegion()->getCapability(name) }
void regionChanged();
/**
* Register a boost callback to be called when the agent changes regions
* Note that if you need to access a capability for the region, you may need to wait
......
......@@ -734,3 +734,50 @@ void LLEnvManagerNew::onRegionChange()
<< LL_ENDL;
}
}
class WindLightRefresh : public LLHTTPNode
{
/*virtual*/ void post(
LLHTTPNode::ResponsePtr response,
const LLSD& context,
const LLSD& input) const
{
if (!input || !context || !input.isMap() || !input.has("body")) {
LL_INFOS() << "malformed WindLightRefresh!" << LL_ENDL;
return;
}
//std::string dump = input["body"].asString();
//LL_WARNS() << dump << LL_ENDL;
LLSD body = input["body"];
LLEnvManagerNew* env = LLEnvManagerNew::getInstance();
LLViewerRegion* regionp = gAgent.getRegion();
LLUUID region_uuid = regionp ? regionp->getRegionID() : LLUUID::null;
env->mNewRegionPrefs.clear();
env->mCurRegionUUID = region_uuid;
if(body.has("Interpolate")) {
if(body["Interpolate"].asInteger() == 1) {
env->mInterpNextChangeMessage = true;
}
else {
env->mInterpNextChangeMessage = false;
}
}
else {
env->mInterpNextChangeMessage = true;
}
LL_INFOS() << "Windlight Refresh , interpolate:" << env->mInterpNextChangeMessage << LL_ENDL;
env->requestRegionSettings();
// This causes the windlight editor and others to update since the windlight has changed!
gAgent.regionChanged();
}
};
LLHTTPRegistration<WindLightRefresh>
gHTTPRegistrationWindLightRefresh(
"/message/WindLightRefresh");
......@@ -34,6 +34,7 @@
class LLWLParamManager;
class LLWaterParamManager;
class LLWLAnimator;
class WindLightRefresh;
// generic key
struct LLEnvKey
......@@ -324,6 +325,9 @@ private:
bool useRegionSky();
bool useRegionWater();
private:
friend class WindLightRefresh;
bool useDefaultSky();
bool useDefaultWater();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment