allow the use of Sky or water from a asset, not just full daycycle. This may need more work
parent
f7104a66a5
commit
1f822c6077
|
@ -137,6 +137,59 @@ namespace OpenSim.Framework
|
||||||
array[3] = new OSDMap();
|
array[3] = new OSDMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool replaceWaterFromOSD(string name, OSDMap map)
|
||||||
|
{
|
||||||
|
WaterData water = new WaterData();
|
||||||
|
if(string.IsNullOrWhiteSpace(name))
|
||||||
|
name = "Water";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
water.FromOSD(name, map);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
waterframes.Clear();
|
||||||
|
waterframes[name] = water;
|
||||||
|
waterTrack.Clear();
|
||||||
|
TrackEntry t = new TrackEntry()
|
||||||
|
{
|
||||||
|
time = -1,
|
||||||
|
frameName = name
|
||||||
|
};
|
||||||
|
waterTrack.Add(t);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool replaceSkyFromOSD(string name, OSDMap map)
|
||||||
|
{
|
||||||
|
SkyData sky = new SkyData();
|
||||||
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
|
name = "Sky";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sky.FromOSD(name, map);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
skyframes.Clear();
|
||||||
|
skyframes[name] = sky;
|
||||||
|
|
||||||
|
TrackEntry t = new TrackEntry()
|
||||||
|
{
|
||||||
|
time = -1,
|
||||||
|
frameName = name
|
||||||
|
};
|
||||||
|
skyTrack0.Clear();
|
||||||
|
skyTrack0.Add(t);
|
||||||
|
skyTracks = new List<TrackEntry>[3];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void FromOSD(OSDMap map)
|
public void FromOSD(OSDMap map)
|
||||||
{
|
{
|
||||||
CompareTrackEntries cte = new CompareTrackEntries();
|
CompareTrackEntries cte = new CompareTrackEntries();
|
||||||
|
@ -188,9 +241,11 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
if (d.TryGetValue("key_name", out OSD dname))
|
if (d.TryGetValue("key_name", out OSD dname))
|
||||||
{
|
{
|
||||||
TrackEntry t = new TrackEntry();
|
TrackEntry t = new TrackEntry()
|
||||||
t.time = dtime;
|
{
|
||||||
t.frameName = dname;
|
time = dtime,
|
||||||
|
frameName = dname
|
||||||
|
};
|
||||||
waterTrack.Add(t);
|
waterTrack.Add(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,16 +373,52 @@ namespace OpenSim.Framework
|
||||||
OSDMap map = osd as OSDMap;
|
OSDMap map = osd as OSDMap;
|
||||||
if (map == null)
|
if (map == null)
|
||||||
return false;
|
return false;
|
||||||
if(!map.TryGetValue("type", out OSD tmp))
|
if (!map.TryGetValue("type", out OSD tmp))
|
||||||
return false;
|
return false;
|
||||||
string type = tmp.AsString();
|
string type = tmp.AsString();
|
||||||
if(type != "daycycle")
|
if (type != "daycycle")
|
||||||
return false;
|
return false;
|
||||||
Cycle = new DayCycle();
|
Cycle = new DayCycle();
|
||||||
Cycle.FromOSD(map);
|
Cycle.FromOSD(map);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool FromAssetOSD(string name, OSD osd)
|
||||||
|
{
|
||||||
|
OSDMap map = osd as OSDMap;
|
||||||
|
if (map == null)
|
||||||
|
return false;
|
||||||
|
if (!map.TryGetValue("type", out OSD tmp))
|
||||||
|
return false;
|
||||||
|
string type = tmp.AsString();
|
||||||
|
|
||||||
|
bool ok = false;
|
||||||
|
if (type == "water")
|
||||||
|
{
|
||||||
|
if (Cycle == null)
|
||||||
|
Cycle = new DayCycle();
|
||||||
|
ok = Cycle.replaceWaterFromOSD(name, map);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (type == "daycycle")
|
||||||
|
{
|
||||||
|
Cycle = new DayCycle();
|
||||||
|
Cycle.FromOSD(map);
|
||||||
|
ok = true;
|
||||||
|
}
|
||||||
|
else if(type == "sky")
|
||||||
|
{
|
||||||
|
if (Cycle == null)
|
||||||
|
Cycle = new DayCycle();
|
||||||
|
ok = Cycle.replaceSkyFromOSD(name, map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ok && !string.IsNullOrWhiteSpace(name))
|
||||||
|
Cycle.Name = name;
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
public OSD ToOSD()
|
public OSD ToOSD()
|
||||||
{
|
{
|
||||||
OSDMap env = new OSDMap();
|
OSDMap env = new OSDMap();
|
||||||
|
|
|
@ -594,16 +594,16 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OSD req = OSDParser.Deserialize(httpRequest.InputStream);
|
OSD req = OSDParser.Deserialize(httpRequest.InputStream);
|
||||||
if(req is OpenMetaverse.StructuredData.OSDMap)
|
if(req is OSDMap)
|
||||||
{
|
{
|
||||||
OSDMap map = req as OpenMetaverse.StructuredData.OSDMap;
|
OSDMap map = req as OSDMap;
|
||||||
if(map.TryGetValue("environment", out OSD env))
|
if(map.TryGetValue("environment", out OSD env))
|
||||||
{
|
{
|
||||||
if (VEnv == null)
|
if (VEnv == null)
|
||||||
// need a proper clone
|
// need a proper clone
|
||||||
VEnv = m_DefaultEnv.Clone();
|
VEnv = m_DefaultEnv.Clone();
|
||||||
|
|
||||||
OSDMap evmap = (OSDMap)env;
|
OSDMap evmap = env as OSDMap;
|
||||||
if(evmap.TryGetValue("day_asset", out OSD tmp) && !evmap.ContainsKey("day_cycle"))
|
if(evmap.TryGetValue("day_asset", out OSD tmp) && !evmap.ContainsKey("day_cycle"))
|
||||||
{
|
{
|
||||||
string id = tmp.AsString();
|
string id = tmp.AsString();
|
||||||
|
@ -616,7 +616,11 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OSD oenv = OSDParser.Deserialize(asset.Data);
|
OSD oenv = OSDParser.Deserialize(asset.Data);
|
||||||
VEnv.CycleFromOSD(oenv);
|
evmap.TryGetValue("day_name", out tmp);
|
||||||
|
if(tmp is OSDString)
|
||||||
|
VEnv.FromAssetOSD(tmp.AsString(), oenv);
|
||||||
|
else
|
||||||
|
VEnv.FromAssetOSD(null, oenv);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -624,7 +628,9 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VEnv.FromOSD(env);
|
else
|
||||||
|
VEnv.FromOSD(env);
|
||||||
|
|
||||||
if(lchannel == null)
|
if(lchannel == null)
|
||||||
{
|
{
|
||||||
StoreOnRegion(VEnv);
|
StoreOnRegion(VEnv);
|
||||||
|
|
Loading…
Reference in New Issue