mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
allow the use of Sky or water from a asset, not just full daycycle. This may need more work
This commit is contained in:
@@ -373,16 +373,52 @@ namespace OpenSim.Framework
|
||||
OSDMap map = osd as OSDMap;
|
||||
if (map == null)
|
||||
return false;
|
||||
if(!map.TryGetValue("type", out OSD tmp))
|
||||
if (!map.TryGetValue("type", out OSD tmp))
|
||||
return false;
|
||||
string type = tmp.AsString();
|
||||
if(type != "daycycle")
|
||||
if (type != "daycycle")
|
||||
return false;
|
||||
Cycle = new DayCycle();
|
||||
Cycle.FromOSD(map);
|
||||
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()
|
||||
{
|
||||
OSDMap env = new OSDMap();
|
||||
|
||||
Reference in New Issue
Block a user