Compare commits
119 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e912e52e15 | ||
|
|
14b0c03d5b | ||
|
|
8414ec9429 | ||
|
|
ac03b1b82f | ||
|
|
d5c999553e | ||
|
|
371df42d3f | ||
|
|
a4a0396850 | ||
|
|
83ad75b997 | ||
|
|
3f45d4ba9d | ||
|
|
2fa8bc201a | ||
|
|
e6b99ec849 | ||
|
|
e5c665384c | ||
|
|
5bb1273b3d | ||
|
|
5629f5141e | ||
|
|
15aef01b34 | ||
|
|
67a010298f | ||
|
|
7c398a532b | ||
|
|
eefd39a0d5 | ||
|
|
176b1c85c0 | ||
|
|
2da6cfde80 | ||
|
|
8068c083f6 | ||
|
|
d31a951d94 | ||
|
|
2226dd1efb | ||
|
|
44699b07e4 | ||
|
|
6739f0752b | ||
|
|
1ebde81d6a | ||
|
|
195625b5e7 | ||
|
|
951c2702ff | ||
|
|
02b90df6ff | ||
|
|
f7c01c8e90 | ||
|
|
e8c964efaf | ||
|
|
74baab6f0f | ||
|
|
bff0ea2fc3 | ||
|
|
e474c19c40 | ||
|
|
a2a81f1bb7 | ||
|
|
c291284629 | ||
|
|
7f7ad71def | ||
|
|
7dfc0f30cc | ||
|
|
c14e67a8bb | ||
|
|
75b7e6009a | ||
|
|
63df56d613 | ||
|
|
f2e1f3e659 | ||
|
|
b1b7d3b004 | ||
|
|
f2c12d4fba | ||
|
|
3a60c9c8c8 | ||
|
|
44cd864205 | ||
|
|
f70d7013a5 | ||
|
|
ac1e902d59 | ||
|
|
b67bdee3cf | ||
|
|
83d4fa98f0 | ||
|
|
70a968b342 | ||
|
|
8e576f7511 | ||
|
|
4526424436 | ||
|
|
fd43620e87 | ||
|
|
56b8d331cb | ||
|
|
14bfba8b3b | ||
|
|
af8d3ae790 | ||
|
|
e6bb7e99be | ||
|
|
97c56adb9d | ||
|
|
f8612b0d1b | ||
|
|
a2a46a18ae | ||
|
|
1cf888b71f | ||
|
|
0109603cdc | ||
|
|
c7c750d127 | ||
|
|
b738b50cd6 | ||
|
|
351daf90f1 | ||
|
|
19d9acf63a | ||
|
|
eb40d3b6fc | ||
|
|
f5da23d9db | ||
|
|
b412bce095 | ||
|
|
0b57ddd753 | ||
|
|
d0a6d82a23 | ||
|
|
ba2792bd1f | ||
|
|
3f8c09e006 | ||
|
|
8f39268761 | ||
|
|
cd8c8d78a9 | ||
|
|
980678846d | ||
|
|
9a92d8d57e | ||
|
|
b155c601d7 | ||
|
|
536f2c085a | ||
|
|
2602d4f16e | ||
|
|
174addc426 | ||
|
|
849053681e | ||
|
|
a8d8ea7990 | ||
|
|
10e6493f9f | ||
|
|
8c4f911935 | ||
|
|
62bc85b5c7 | ||
|
|
76eba917f9 | ||
|
|
84a046eaf5 | ||
|
|
8d1d314f49 | ||
|
|
9395f12584 | ||
|
|
b97f58d597 | ||
|
|
30c36a3960 | ||
|
|
206eccc2b6 | ||
|
|
2358a623e3 | ||
|
|
87850bd6dc | ||
|
|
d80eda202f | ||
|
|
3edfa585ec | ||
|
|
fa13a6a8da | ||
|
|
9d5e7c89d9 | ||
|
|
590bf0bcc0 | ||
|
|
b199a2dea3 | ||
|
|
f1d4b8d83e | ||
|
|
0088661356 | ||
|
|
1a7e3cabc0 | ||
|
|
132d701b3e | ||
|
|
3b97241716 | ||
|
|
f82d090df3 | ||
|
|
7399d3e953 | ||
|
|
cab546ecee | ||
|
|
7dc1c7d841 | ||
|
|
fbff51f387 | ||
|
|
b714fb0c39 | ||
|
|
f37038013d | ||
|
|
5e98e2b7c7 | ||
|
|
35f8f3ff79 | ||
|
|
7ec8e7e025 | ||
|
|
c6efebdd8c | ||
|
|
760047abc5 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -26,9 +26,14 @@
|
||||
bin/Debug/*.dll
|
||||
bin/*.dll.mdb
|
||||
bin/*.db
|
||||
bin/*.db-journal
|
||||
bin/addin-db-*
|
||||
bin/*.dll
|
||||
bin/OpenSim.vshost.exe.config
|
||||
bin/OpenSim.32BitLaunch.vshost.exe.config
|
||||
bin/OpenSim.32BitLaunch.log
|
||||
UpgradeLog.XML
|
||||
_UpgradeReport_Files/
|
||||
bin/ScriptEngines/*-*-*-*-*
|
||||
bin/ScriptEngines/*.dll
|
||||
bin/ScriptEngines/*/*.dll
|
||||
@@ -61,6 +66,7 @@ Examples/*.dll
|
||||
OpenSim.build
|
||||
OpenSim.sln
|
||||
OpenSim.suo
|
||||
OpenSim.userprefs
|
||||
Prebuild/Prebuild.build
|
||||
Prebuild/Prebuild.sln
|
||||
TestResult.xml
|
||||
|
||||
@@ -135,14 +135,25 @@
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
<target name="torture" depends="build, find-nunit">
|
||||
<target name="test-stress" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.torture">
|
||||
<arg value="./bin/OpenSim.Tests.Torture.dll" />
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.stress">
|
||||
<arg value="./bin/OpenSim.Tests.Stress.dll" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests.torture)==0}" />
|
||||
<fail message="Failures reported in stress tests." unless="${int::parse(testresult.opensim.tests.stress)==0}" />
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
<target name="test-perf" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.tests.performance">
|
||||
<arg value="./bin/OpenSim.Tests.Performance.dll" />
|
||||
</exec>
|
||||
|
||||
<fail message="Failures reported in performance tests." unless="${int::parse(testresult.opensim.tests.performance)==0}" />
|
||||
<delete dir="%temp%"/>
|
||||
</target>
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ what it is today.
|
||||
* Fly-Man
|
||||
* Flyte Xevious
|
||||
* Garmin Kawaguichi
|
||||
* Gryc Ueusp
|
||||
* Imaze Rhiano
|
||||
* Intimidated
|
||||
* Jeremy Bongio (IBM)
|
||||
|
||||
@@ -312,14 +312,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
// Now that everything is setup we can proceed to
|
||||
// add THIS agent to the HTTP server's handler list
|
||||
|
||||
if (!AddAgentHandler(Rest.Name,this))
|
||||
{
|
||||
Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId);
|
||||
foreach (IRest handler in handlers)
|
||||
{
|
||||
handler.Close();
|
||||
}
|
||||
}
|
||||
// FIXME: If this code is ever to be re-enabled (most of it is disabled already) then this will
|
||||
// have to be handled through the AddHttpHandler interface.
|
||||
// if (!AddAgentHandler(Rest.Name,this))
|
||||
// {
|
||||
// Rest.Log.ErrorFormat("{0} Unable to activate handler interface", MsgId);
|
||||
// foreach (IRest handler in handlers)
|
||||
// {
|
||||
// handler.Close();
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -342,11 +344,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
{
|
||||
Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId);
|
||||
|
||||
try
|
||||
{
|
||||
RemoveAgentHandler(Rest.Name, this);
|
||||
}
|
||||
catch (KeyNotFoundException){}
|
||||
// FIXME: If this code is ever to be re-enabled (most of it is disabled already) then this will
|
||||
// have to be handled through the AddHttpHandler interface.
|
||||
// try
|
||||
// {
|
||||
// RemoveAgentHandler(Rest.Name, this);
|
||||
// }
|
||||
// catch (KeyNotFoundException){}
|
||||
|
||||
foreach (IRest handler in handlers)
|
||||
{
|
||||
|
||||
@@ -297,7 +297,9 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||
{
|
||||
if (!IsEnabled) return false;
|
||||
_agents.Add(agentName, handler);
|
||||
return _httpd.AddAgentHandler(agentName, handler);
|
||||
// return _httpd.AddAgentHandler(agentName, handler);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -316,7 +318,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||
if (_agents[agentName] == handler)
|
||||
{
|
||||
_agents.Remove(agentName);
|
||||
return _httpd.RemoveAgentHandler(agentName, handler);
|
||||
// return _httpd.RemoveAgentHandler(agentName, handler);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -358,10 +360,10 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||
_httpd.RemoveStreamHandler(h.HttpMethod, h.Path);
|
||||
}
|
||||
_handlers = null;
|
||||
foreach (KeyValuePair<string, IHttpAgentHandler> h in _agents)
|
||||
{
|
||||
_httpd.RemoveAgentHandler(h.Key, h.Value);
|
||||
}
|
||||
// foreach (KeyValuePair<string, IHttpAgentHandler> h in _agents)
|
||||
// {
|
||||
// _httpd.RemoveAgentHandler(h.Key, h.Value);
|
||||
// }
|
||||
_agents = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
|
||||
if (texture == null)
|
||||
{
|
||||
//m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
|
||||
// m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
|
||||
|
||||
// Fetch locally or remotely. Misses return a 404
|
||||
texture = m_assetService.Get(textureID.ToString());
|
||||
@@ -197,7 +197,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
}
|
||||
else // it was on the cache
|
||||
{
|
||||
//m_log.DebugFormat("[GETTEXTURE]: texture was in the cache");
|
||||
// m_log.DebugFormat("[GETTEXTURE]: texture was in the cache");
|
||||
WriteTextureData(httpRequest, httpResponse, texture, format);
|
||||
return true;
|
||||
}
|
||||
@@ -219,12 +219,30 @@ namespace OpenSim.Capabilities.Handlers
|
||||
int start, end;
|
||||
if (TryParseRange(range, out start, out end))
|
||||
{
|
||||
|
||||
// Before clamping start make sure we can satisfy it in order to avoid
|
||||
// sending back the last byte instead of an error status
|
||||
if (start >= texture.Data.Length)
|
||||
{
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
||||
m_log.DebugFormat(
|
||||
"[GETTEXTURE]: Client requested range for texture {0} starting at {1} but texture has end of {2}",
|
||||
texture.ID, start, texture.Data.Length);
|
||||
|
||||
// Stricly speaking, as per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, we should be sending back
|
||||
// Requested Range Not Satisfiable (416) here. However, it appears that at least recent implementations
|
||||
// of the Linden Lab viewer (3.2.1 and 3.3.4 and probably earlier), a viewer that has previously
|
||||
// received a very small texture may attempt to fetch bytes from the server past the
|
||||
// range of data that it received originally. Whether this happens appears to depend on whether
|
||||
// the viewer's estimation of how large a request it needs to make for certain discard levels
|
||||
// (http://wiki.secondlife.com/wiki/Image_System#Discard_Level_and_Mip_Mapping), chiefly discard
|
||||
// level 2. If this estimate is greater than the total texture size, returning a RequestedRangeNotSatisfiable
|
||||
// here will cause the viewer to treat the texture as bad and never display the full resolution
|
||||
// However, if we return PartialContent (or OK) instead, the viewer will display that resolution.
|
||||
|
||||
// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
||||
// response.AddHeader("Content-Range", String.Format("bytes */{0}", texture.Data.Length));
|
||||
// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||
response.ContentType = texture.Metadata.ContentType;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -232,12 +250,18 @@ namespace OpenSim.Capabilities.Handlers
|
||||
start = Utils.Clamp(start, 0, end);
|
||||
int len = end - start + 1;
|
||||
|
||||
//m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||
// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||
|
||||
// Always return PartialContent, even if the range covered the entire data length
|
||||
// We were accidentally sending back 404 before in this situation
|
||||
// https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the
|
||||
// entire range is requested, and viewer 3.2.2 (and very probably earlier) seems fine with this.
|
||||
//
|
||||
// We also do not want to send back OK even if the whole range was satisfiable since this causes
|
||||
// HTTP textures on at least Imprudence 1.4.0-beta2 to never display the final texture quality.
|
||||
// if (end > maxEnd)
|
||||
// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||
// else
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||
|
||||
response.ContentLength = len;
|
||||
|
||||
@@ -40,6 +40,11 @@ namespace OpenSim.Data
|
||||
public UUID folderID;
|
||||
public UUID agentID;
|
||||
public UUID parentFolderID;
|
||||
|
||||
public XInventoryFolder Clone()
|
||||
{
|
||||
return (XInventoryFolder)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public class XInventoryItem
|
||||
@@ -64,6 +69,11 @@ namespace OpenSim.Data
|
||||
public UUID avatarID;
|
||||
public UUID parentFolderID;
|
||||
public int inventoryGroupPermissions;
|
||||
|
||||
public XInventoryItem Clone()
|
||||
{
|
||||
return (XInventoryItem)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
public interface IXInventoryData
|
||||
|
||||
@@ -719,95 +719,99 @@ namespace OpenSim.Data.MySQL
|
||||
RegionLightShareData nWP = new RegionLightShareData();
|
||||
nWP.OnSave += StoreRegionWindlightSettings;
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
//No result, so store our default windlight profile and return it
|
||||
nWP.regionID = regionUUID;
|
||||
StoreRegionWindlightSettings(nWP);
|
||||
return nWP;
|
||||
}
|
||||
else
|
||||
{
|
||||
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
||||
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
||||
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
||||
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
||||
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
||||
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
||||
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
||||
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
||||
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
||||
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
||||
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
||||
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
||||
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
||||
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
||||
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
||||
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
||||
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
||||
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
||||
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
|
||||
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
||||
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
||||
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
||||
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
||||
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
||||
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
||||
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
||||
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
||||
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
||||
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
||||
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
||||
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
||||
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
||||
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
||||
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
||||
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
||||
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
||||
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
||||
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
||||
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
||||
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
||||
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
||||
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
||||
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
||||
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
||||
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
||||
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
||||
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
||||
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
||||
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
||||
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
||||
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
||||
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
||||
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
||||
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
||||
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
||||
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
|
||||
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
|
||||
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
|
||||
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
|
||||
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
|
||||
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
|
||||
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
|
||||
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
|
||||
nWP.valid = true;
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
{
|
||||
//No result, so store our default windlight profile and return it
|
||||
nWP.regionID = regionUUID;
|
||||
StoreRegionWindlightSettings(nWP);
|
||||
return nWP;
|
||||
}
|
||||
else
|
||||
{
|
||||
nWP.regionID = DBGuid.FromDB(result["region_id"]);
|
||||
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
||||
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
||||
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
||||
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
||||
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
||||
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
||||
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
||||
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
||||
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
||||
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
||||
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
||||
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
||||
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
||||
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
||||
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
||||
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
||||
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
||||
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
|
||||
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
||||
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
||||
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
||||
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
||||
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
||||
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
||||
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
||||
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
||||
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
||||
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
||||
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
||||
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
||||
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
||||
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
||||
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
||||
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
||||
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
||||
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
||||
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
||||
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
||||
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
||||
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
||||
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
||||
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
||||
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
||||
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
||||
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
||||
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
||||
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
||||
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
||||
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
||||
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
||||
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
||||
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
||||
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
||||
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
||||
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
|
||||
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
|
||||
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
|
||||
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
|
||||
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
|
||||
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
|
||||
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
|
||||
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
|
||||
nWP.valid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nWP;
|
||||
}
|
||||
|
||||
@@ -853,118 +857,124 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public void StoreRegionWindlightSettings(RegionLightShareData wl)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
||||
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
||||
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
||||
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
||||
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
||||
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
||||
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
||||
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
||||
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
||||
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
||||
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
||||
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
||||
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
||||
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
||||
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
||||
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
||||
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
||||
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
||||
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
||||
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
||||
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
||||
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
||||
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
||||
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
||||
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
||||
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
||||
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
||||
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
||||
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
||||
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
||||
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
||||
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
||||
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
||||
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
||||
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
||||
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
||||
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
||||
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
||||
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
||||
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
||||
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
||||
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
||||
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
||||
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
||||
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
||||
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
||||
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
||||
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
||||
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
||||
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
||||
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
||||
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
||||
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
||||
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
||||
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
||||
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
||||
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
||||
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
||||
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
||||
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
||||
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
||||
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
||||
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
||||
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
||||
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
||||
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
||||
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
||||
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
||||
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
||||
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
||||
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
||||
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
||||
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
||||
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
||||
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
||||
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
||||
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
||||
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
||||
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
||||
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
||||
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
||||
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
||||
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
||||
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
||||
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
||||
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
||||
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
||||
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
||||
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
||||
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
||||
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
||||
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
||||
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
||||
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
||||
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
||||
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
||||
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
||||
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
||||
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
||||
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
||||
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
||||
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
||||
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
||||
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
||||
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
||||
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
||||
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
||||
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
||||
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
||||
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
||||
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
||||
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
||||
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
||||
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
||||
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
||||
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
||||
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
||||
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
||||
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
||||
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
||||
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
||||
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
||||
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
||||
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
||||
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegionWindlightSettings(UUID regionID)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID";
|
||||
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -972,26 +982,29 @@ namespace OpenSim.Data.MySQL
|
||||
#region RegionEnvironmentSettings
|
||||
public string LoadRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionenvironment` where region_id = ?region_id";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionenvironment` where region_id = ?region_id";
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToString(result["llsd_settings"]);
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToString(result["llsd_settings"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -999,33 +1012,39 @@ namespace OpenSim.Data.MySQL
|
||||
|
||||
public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", regionUUID);
|
||||
cmd.Parameters.AddWithValue("llsd_settings", settings);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", regionUUID);
|
||||
cmd.Parameters.AddWithValue("llsd_settings", settings);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegionEnvironmentSettings(UUID regionUUID)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
lock (m_dbLock)
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id";
|
||||
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,14 @@ namespace OpenSim.Framework
|
||||
//
|
||||
public class Cache
|
||||
{
|
||||
/// <summary>
|
||||
/// Must only be accessed under lock.
|
||||
/// </summary>
|
||||
private List<CacheItemBase> m_Index = new List<CacheItemBase>();
|
||||
|
||||
/// <summary>
|
||||
/// Must only be accessed under m_Index lock.
|
||||
/// </summary>
|
||||
private Dictionary<string, CacheItemBase> m_Lookup =
|
||||
new Dictionary<string, CacheItemBase>();
|
||||
|
||||
@@ -320,19 +327,19 @@ namespace OpenSim.Framework
|
||||
{
|
||||
if (m_Lookup.ContainsKey(index))
|
||||
item = m_Lookup[index];
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
Expire(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
item.hits++;
|
||||
item.lastUsed = DateTime.Now;
|
||||
|
||||
Expire(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
item.hits++;
|
||||
item.lastUsed = DateTime.Now;
|
||||
|
||||
Expire(true);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -385,7 +392,10 @@ namespace OpenSim.Framework
|
||||
//
|
||||
public Object Find(Predicate<CacheItemBase> d)
|
||||
{
|
||||
CacheItemBase item = m_Index.Find(d);
|
||||
CacheItemBase item;
|
||||
|
||||
lock (m_Index)
|
||||
item = m_Index.Find(d);
|
||||
|
||||
if (item == null)
|
||||
return null;
|
||||
@@ -419,12 +429,12 @@ namespace OpenSim.Framework
|
||||
public virtual void Store(string index, Object data, Type container,
|
||||
Object[] parameters)
|
||||
{
|
||||
Expire(false);
|
||||
|
||||
CacheItemBase item;
|
||||
|
||||
lock (m_Index)
|
||||
{
|
||||
Expire(false);
|
||||
|
||||
if (m_Index.Contains(new CacheItemBase(index)))
|
||||
{
|
||||
if ((m_Flags & CacheFlags.AllowUpdate) != 0)
|
||||
@@ -450,9 +460,17 @@ namespace OpenSim.Framework
|
||||
m_Index.Add(item);
|
||||
m_Lookup[index] = item;
|
||||
}
|
||||
|
||||
item.Store(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expire items as appropriate.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Callers must lock m_Index.
|
||||
/// </remarks>
|
||||
/// <param name='getting'></param>
|
||||
protected virtual void Expire(bool getting)
|
||||
{
|
||||
if (getting && (m_Strategy == CacheStrategy.Aggressive))
|
||||
@@ -475,12 +493,10 @@ namespace OpenSim.Framework
|
||||
|
||||
switch (m_Strategy)
|
||||
{
|
||||
case CacheStrategy.Aggressive:
|
||||
if (Count < Size)
|
||||
return;
|
||||
case CacheStrategy.Aggressive:
|
||||
if (Count < Size)
|
||||
return;
|
||||
|
||||
lock (m_Index)
|
||||
{
|
||||
m_Index.Sort(new SortLRU());
|
||||
m_Index.Reverse();
|
||||
|
||||
@@ -490,7 +506,7 @@ namespace OpenSim.Framework
|
||||
|
||||
ExpireDelegate doExpire = OnExpire;
|
||||
|
||||
if (doExpire != null)
|
||||
if (doExpire != null)
|
||||
{
|
||||
List<CacheItemBase> candidates =
|
||||
m_Index.GetRange(target, Count - target);
|
||||
@@ -513,27 +529,34 @@ namespace OpenSim.Framework
|
||||
foreach (CacheItemBase item in m_Index)
|
||||
m_Lookup[item.uuid] = item;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Invalidate(string uuid)
|
||||
{
|
||||
if (!m_Lookup.ContainsKey(uuid))
|
||||
return;
|
||||
lock (m_Index)
|
||||
{
|
||||
if (!m_Lookup.ContainsKey(uuid))
|
||||
return;
|
||||
|
||||
CacheItemBase item = m_Lookup[uuid];
|
||||
m_Lookup.Remove(uuid);
|
||||
m_Index.Remove(item);
|
||||
CacheItemBase item = m_Lookup[uuid];
|
||||
m_Lookup.Remove(uuid);
|
||||
m_Index.Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
m_Index.Clear();
|
||||
m_Lookup.Clear();
|
||||
lock (m_Index)
|
||||
{
|
||||
m_Index.Clear();
|
||||
m_Lookup.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ namespace OpenSim.Framework
|
||||
public class Constants
|
||||
{
|
||||
public const uint RegionSize = 256;
|
||||
public const uint RegionHeight = 4096;
|
||||
public const byte TerrainPatchSize = 16;
|
||||
public const string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f";
|
||||
|
||||
|
||||
@@ -1033,7 +1033,21 @@ namespace OpenSim.Framework
|
||||
|
||||
void InPacket(object NewPack);
|
||||
void ProcessInPacket(Packet NewPack);
|
||||
|
||||
/// <summary>
|
||||
/// Close this client
|
||||
/// </summary>
|
||||
void Close();
|
||||
|
||||
/// <summary>
|
||||
/// Close this client
|
||||
/// </summary>
|
||||
/// <param name='force'>
|
||||
/// If true, attempts the close without checking active status. You do not want to try this except as a last
|
||||
/// ditch attempt where Active == false but the ScenePresence still exists.
|
||||
/// </param>
|
||||
void Close(bool force);
|
||||
|
||||
void Kick(string message);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -73,33 +73,27 @@ namespace OpenSim.Framework
|
||||
{
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id)
|
||||
public InventoryFolderBase(UUID id) : this()
|
||||
{
|
||||
ID = id;
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id, UUID owner)
|
||||
public InventoryFolderBase(UUID id, UUID owner) : this(id)
|
||||
{
|
||||
ID = id;
|
||||
Owner = owner;
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent)
|
||||
public InventoryFolderBase(UUID id, string name, UUID owner, UUID parent) : this(id, owner)
|
||||
{
|
||||
ID = id;
|
||||
Name = name;
|
||||
Owner = owner;
|
||||
ParentID = parent;
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
|
||||
public InventoryFolderBase(
|
||||
UUID id, string name, UUID owner, short type, UUID parent, ushort version) : this(id, name, owner, parent)
|
||||
{
|
||||
ID = id;
|
||||
Name = name;
|
||||
Owner = owner;
|
||||
Type = type;
|
||||
ParentID = parent;
|
||||
Version = version;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,10 +355,19 @@ Asset service request failures: {3}" + Environment.NewLine,
|
||||
sb.Append(Environment.NewLine);
|
||||
sb.Append(
|
||||
string.Format(
|
||||
"{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}",
|
||||
"{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}\n\n",
|
||||
inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime,
|
||||
netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime));
|
||||
sb.Append(Environment.NewLine);
|
||||
|
||||
foreach (KeyValuePair<string, Stat> kvp in StatsManager.RegisteredStats)
|
||||
{
|
||||
Stat stat = kvp.Value;
|
||||
|
||||
if (stat.Category == "scene" && stat.Verbosity == StatVerbosity.Info)
|
||||
{
|
||||
sb.AppendFormat("Slow frames ({0}): {1}\n", stat.Container, stat.Value);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
sb.Append(Environment.NewLine);
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
/// <summary>
|
||||
@@ -32,6 +35,14 @@ namespace OpenSim.Framework.Monitoring
|
||||
/// </summary>
|
||||
public class StatsManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Registered stats.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Do not add or remove from this dictionary.
|
||||
/// </remarks>
|
||||
public static Dictionary<string, Stat> RegisteredStats = new Dictionary<string, Stat>();
|
||||
|
||||
private static AssetStatsCollector assetStats;
|
||||
private static UserStatsCollector userStats;
|
||||
private static SimExtraStatsCollector simExtraStats = new SimExtraStatsCollector();
|
||||
@@ -61,5 +72,139 @@ namespace OpenSim.Framework.Monitoring
|
||||
|
||||
return userStats;
|
||||
}
|
||||
|
||||
public static bool RegisterStat(Stat stat)
|
||||
{
|
||||
lock (RegisteredStats)
|
||||
{
|
||||
if (RegisteredStats.ContainsKey(stat.UniqueName))
|
||||
{
|
||||
// XXX: For now just return false. This is to avoid problems in regression tests where all tests
|
||||
// in a class are run in the same instance of the VM.
|
||||
return false;
|
||||
|
||||
// throw new Exception(
|
||||
// "StatsManager already contains stat with ShortName {0} in Category {1}", stat.ShortName, stat.Category);
|
||||
}
|
||||
|
||||
// We take a replace-on-write approach here so that we don't need to generate a new Dictionary
|
||||
Dictionary<string, Stat> newRegisteredStats = new Dictionary<string, Stat>(RegisteredStats);
|
||||
newRegisteredStats[stat.UniqueName] = stat;
|
||||
RegisteredStats = newRegisteredStats;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool DeregisterStat(Stat stat)
|
||||
{
|
||||
lock (RegisteredStats)
|
||||
{
|
||||
if (!RegisteredStats.ContainsKey(stat.UniqueName))
|
||||
return false;
|
||||
|
||||
Dictionary<string, Stat> newRegisteredStats = new Dictionary<string, Stat>(RegisteredStats);
|
||||
newRegisteredStats.Remove(stat.UniqueName);
|
||||
RegisteredStats = newRegisteredStats;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verbosity of stat.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Info will always be displayed.
|
||||
/// </remarks>
|
||||
public enum StatVerbosity
|
||||
{
|
||||
Debug,
|
||||
Info
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Holds individual static details
|
||||
/// </summary>
|
||||
public class Stat
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique stat name used for indexing. Each ShortName in a Category must be unique.
|
||||
/// </summary>
|
||||
public string UniqueName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Category of this stat (e.g. cache, scene, etc).
|
||||
/// </summary>
|
||||
public string Category { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Containing name for this stat.
|
||||
/// FIXME: In the case of a scene, this is currently the scene name (though this leaves
|
||||
/// us with a to-be-resolved problem of non-unique region names).
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The container.
|
||||
/// </value>
|
||||
public string Container { get; private set; }
|
||||
|
||||
public StatVerbosity Verbosity { get; private set; }
|
||||
public string ShortName { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public string Description { get; private set; }
|
||||
public virtual string UnitName { get; private set; }
|
||||
|
||||
public virtual double Value { get; set; }
|
||||
|
||||
public Stat(
|
||||
string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description)
|
||||
{
|
||||
ShortName = shortName;
|
||||
Name = name;
|
||||
UnitName = unitName;
|
||||
Category = category;
|
||||
Container = container;
|
||||
Verbosity = verbosity;
|
||||
Description = description;
|
||||
|
||||
UniqueName = GenUniqueName(Container, Category, ShortName);
|
||||
}
|
||||
|
||||
public static string GenUniqueName(string container, string category, string shortName)
|
||||
{
|
||||
return string.Format("{0}+{1}+{2}", container, category, shortName);
|
||||
}
|
||||
}
|
||||
|
||||
public class PercentageStat : Stat
|
||||
{
|
||||
public int Antecedent { get; set; }
|
||||
public int Consequent { get; set; }
|
||||
|
||||
public override double Value
|
||||
{
|
||||
get
|
||||
{
|
||||
int c = Consequent;
|
||||
|
||||
// Avoid any chance of a multi-threaded divide-by-zero
|
||||
if (c == 0)
|
||||
return 0;
|
||||
|
||||
return (double)Antecedent / c;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
throw new Exception("Cannot set value on a PercentageStat");
|
||||
}
|
||||
}
|
||||
|
||||
public PercentageStat(
|
||||
string shortName, string name, string category, string container, StatVerbosity verbosity, string description)
|
||||
: base(shortName, name, " %", category, container, verbosity, description)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,17 @@ namespace OpenSim.Framework.Monitoring
|
||||
FirstTick = Environment.TickCount & Int32.MaxValue;
|
||||
LastTick = FirstTick;
|
||||
}
|
||||
|
||||
public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi)
|
||||
{
|
||||
Thread = previousTwi.Thread;
|
||||
FirstTick = previousTwi.FirstTick;
|
||||
LastTick = previousTwi.LastTick;
|
||||
Timeout = previousTwi.Timeout;
|
||||
IsTimedOut = previousTwi.IsTimedOut;
|
||||
AlarmIfTimeout = previousTwi.AlarmIfTimeout;
|
||||
AlarmMethod = previousTwi.AlarmMethod;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -97,6 +108,32 @@ namespace OpenSim.Framework.Monitoring
|
||||
/// /summary>
|
||||
public static event Action<ThreadWatchdogInfo> OnWatchdogTimeout;
|
||||
|
||||
/// <summary>
|
||||
/// Is this watchdog active?
|
||||
/// </summary>
|
||||
public static bool Enabled
|
||||
{
|
||||
get { return m_enabled; }
|
||||
set
|
||||
{
|
||||
// m_log.DebugFormat("[MEMORY WATCHDOG]: Setting MemoryWatchdog.Enabled to {0}", value);
|
||||
|
||||
if (value == m_enabled)
|
||||
return;
|
||||
|
||||
m_enabled = value;
|
||||
|
||||
if (m_enabled)
|
||||
{
|
||||
// Set now so we don't get alerted on the first run
|
||||
LastWatchdogThreadTick = Environment.TickCount & Int32.MaxValue;
|
||||
}
|
||||
|
||||
m_watchdogTimer.Enabled = m_enabled;
|
||||
}
|
||||
}
|
||||
private static bool m_enabled;
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static Dictionary<int, ThreadWatchdogInfo> m_threads;
|
||||
private static System.Timers.Timer m_watchdogTimer;
|
||||
@@ -115,11 +152,6 @@ namespace OpenSim.Framework.Monitoring
|
||||
m_watchdogTimer = new System.Timers.Timer(WATCHDOG_INTERVAL_MS);
|
||||
m_watchdogTimer.AutoReset = false;
|
||||
m_watchdogTimer.Elapsed += WatchdogTimerElapsed;
|
||||
|
||||
// Set now so we don't get alerted on the first run
|
||||
LastWatchdogThreadTick = Environment.TickCount & Int32.MaxValue;
|
||||
|
||||
m_watchdogTimer.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -314,7 +346,9 @@ namespace OpenSim.Framework.Monitoring
|
||||
if (callbackInfos == null)
|
||||
callbackInfos = new List<ThreadWatchdogInfo>();
|
||||
|
||||
callbackInfos.Add(threadInfo);
|
||||
// Send a copy of the watchdog info to prevent race conditions where the watchdog
|
||||
// thread updates the monitoring info after an alarm has been sent out.
|
||||
callbackInfos.Add(new ThreadWatchdogInfo(threadInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +65,14 @@ namespace OpenSim.Framework.Serialization
|
||||
|
||||
UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
|
||||
if (account != null)
|
||||
{
|
||||
return MakeOspa(account.FirstName, account.LastName);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId);
|
||||
// System.Console.WriteLine("[OSP RESOLVER]: No user account for {0}", userId);
|
||||
// }
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -79,10 +84,13 @@ namespace OpenSim.Framework.Serialization
|
||||
/// <returns></returns>
|
||||
public static string MakeOspa(string firstName, string lastName)
|
||||
{
|
||||
// m_log.DebugFormat("[OSP RESOLVER]: Making OSPA for {0} {1}", firstName, lastName);
|
||||
string ospa
|
||||
= OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
|
||||
|
||||
// m_log.DebugFormat("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
|
||||
// System.Console.WriteLine("[OSP RESOLVER]: Made OSPA {0} for {1} {2}", ospa, firstName, lastName);
|
||||
|
||||
return
|
||||
OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
|
||||
return ospa;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -54,8 +54,23 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the debug level.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// See MainServer.DebugLevel.
|
||||
/// </value>
|
||||
public int DebugLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Request number for diagnostic purposes.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is an internal number. In some debug situations an external number may also be supplied in the
|
||||
/// opensim-request-id header but we are not currently logging this.
|
||||
/// </remarks>
|
||||
public int RequestNumber { get; private set; }
|
||||
|
||||
private volatile int NotSocketErrors = 0;
|
||||
public volatile bool HTTPDRunning = false;
|
||||
|
||||
@@ -67,7 +82,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
protected Dictionary<string, LLSDMethod> m_llsdHandlers = new Dictionary<string, LLSDMethod>();
|
||||
protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
|
||||
protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
|
||||
protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
|
||||
// protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
|
||||
protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
|
||||
new Dictionary<string, PollServiceEventArgs>();
|
||||
|
||||
@@ -245,29 +260,29 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
return new List<string>(m_pollHandlers.Keys);
|
||||
}
|
||||
|
||||
// Note that the agent string is provided simply to differentiate
|
||||
// the handlers - it is NOT required to be an actual agent header
|
||||
// value.
|
||||
public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
|
||||
{
|
||||
lock (m_agentHandlers)
|
||||
{
|
||||
if (!m_agentHandlers.ContainsKey(agent))
|
||||
{
|
||||
m_agentHandlers.Add(agent, handler);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//must already have a handler for that path so return false
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<string> GetAgentHandlerKeys()
|
||||
{
|
||||
lock (m_agentHandlers)
|
||||
return new List<string>(m_agentHandlers.Keys);
|
||||
}
|
||||
// // Note that the agent string is provided simply to differentiate
|
||||
// // the handlers - it is NOT required to be an actual agent header
|
||||
// // value.
|
||||
// public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
|
||||
// {
|
||||
// lock (m_agentHandlers)
|
||||
// {
|
||||
// if (!m_agentHandlers.ContainsKey(agent))
|
||||
// {
|
||||
// m_agentHandlers.Add(agent, handler);
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //must already have a handler for that path so return false
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// public List<string> GetAgentHandlerKeys()
|
||||
// {
|
||||
// lock (m_agentHandlers)
|
||||
// return new List<string>(m_agentHandlers.Keys);
|
||||
// }
|
||||
|
||||
public bool AddLLSDHandler(string path, LLSDMethod handler)
|
||||
{
|
||||
@@ -296,6 +311,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
private void OnRequest(object source, RequestEventArgs args)
|
||||
{
|
||||
RequestNumber++;
|
||||
|
||||
try
|
||||
{
|
||||
IHttpClientContext context = (IHttpClientContext)source;
|
||||
@@ -405,7 +422,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
string requestMethod = request.HttpMethod;
|
||||
string uriString = request.RawUrl;
|
||||
|
||||
// string reqnum = "unknown";
|
||||
int requestStartTick = Environment.TickCount;
|
||||
|
||||
// Will be adjusted later on.
|
||||
@@ -422,22 +438,22 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
|
||||
|
||||
// This is the REST agent interface. We require an agent to properly identify
|
||||
// itself. If the REST handler recognizes the prefix it will attempt to
|
||||
// satisfy the request. If it is not recognizable, and no damage has occurred
|
||||
// the request can be passed through to the other handlers. This is a low
|
||||
// probability event; if a request is matched it is normally expected to be
|
||||
// handled
|
||||
IHttpAgentHandler agentHandler;
|
||||
|
||||
if (TryGetAgentHandler(request, response, out agentHandler))
|
||||
{
|
||||
if (HandleAgentRequest(agentHandler, request, response))
|
||||
{
|
||||
requestEndTick = Environment.TickCount;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// // This is the REST agent interface. We require an agent to properly identify
|
||||
// // itself. If the REST handler recognizes the prefix it will attempt to
|
||||
// // satisfy the request. If it is not recognizable, and no damage has occurred
|
||||
// // the request can be passed through to the other handlers. This is a low
|
||||
// // probability event; if a request is matched it is normally expected to be
|
||||
// // handled
|
||||
// IHttpAgentHandler agentHandler;
|
||||
//
|
||||
// if (TryGetAgentHandler(request, response, out agentHandler))
|
||||
// {
|
||||
// if (HandleAgentRequest(agentHandler, request, response))
|
||||
// {
|
||||
// requestEndTick = Environment.TickCount;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
//response.KeepAlive = true;
|
||||
response.SendChunked = false;
|
||||
@@ -449,9 +465,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
if (TryGetStreamHandler(handlerKey, out requestHandler))
|
||||
{
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found stream handler for {0} {1} {2} {3}",
|
||||
request.HttpMethod, request.Url.PathAndQuery, requestHandler.Name, requestHandler.Description);
|
||||
LogIncomingToStreamHandler(request, requestHandler);
|
||||
|
||||
response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
|
||||
|
||||
@@ -531,8 +545,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
"[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
|
||||
RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
|
||||
|
||||
buffer = HandleHTTPRequest(request, response);
|
||||
break;
|
||||
@@ -543,8 +557,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
"[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
|
||||
RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint);
|
||||
|
||||
buffer = HandleLLSDRequests(request, response);
|
||||
break;
|
||||
@@ -563,9 +577,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
if (DoWeHaveALLSDHandler(request.RawUrl))
|
||||
{
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
LogIncomingToContentTypeHandler(request);
|
||||
|
||||
buffer = HandleLLSDRequests(request, response);
|
||||
}
|
||||
@@ -573,18 +585,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
else if (DoWeHaveAHTTPHandler(request.RawUrl))
|
||||
{
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Found a {0} content type handler for {1} {2}",
|
||||
request.ContentType, request.HttpMethod, request.Url.PathAndQuery);
|
||||
LogIncomingToContentTypeHandler(request);
|
||||
|
||||
buffer = HandleHTTPRequest(request, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: Assuming a generic XMLRPC request for {0} {1}",
|
||||
request.HttpMethod, request.Url.PathAndQuery);
|
||||
LogIncomingToXmlRpcHandler(request);
|
||||
|
||||
// generic login request.
|
||||
buffer = HandleXmlRpcRequests(request, response);
|
||||
@@ -643,14 +651,90 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
if (tickdiff > 3000)
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms",
|
||||
"[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms",
|
||||
RequestNumber,
|
||||
requestMethod,
|
||||
uriString,
|
||||
requestHandler != null ? requestHandler.Name : "",
|
||||
requestHandler != null ? requestHandler.Description : "",
|
||||
request.RemoteIPEndPoint.ToString(),
|
||||
request.RemoteIPEndPoint,
|
||||
tickdiff);
|
||||
}
|
||||
else if (DebugLevel >= 4)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: HTTP IN {0} :{1} took {2}ms",
|
||||
RequestNumber,
|
||||
Port,
|
||||
tickdiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LogIncomingToStreamHandler(OSHttpRequest request, IRequestHandler requestHandler)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: HTTP IN {0} :{1} stream handler {2} {3} {4} {5} from {6}",
|
||||
RequestNumber,
|
||||
Port,
|
||||
request.HttpMethod,
|
||||
request.Url.PathAndQuery,
|
||||
requestHandler.Name,
|
||||
requestHandler.Description,
|
||||
request.RemoteIPEndPoint);
|
||||
|
||||
if (DebugLevel >= 5)
|
||||
LogIncomingInDetail(request);
|
||||
}
|
||||
|
||||
private void LogIncomingToContentTypeHandler(OSHttpRequest request)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}",
|
||||
RequestNumber,
|
||||
Port,
|
||||
request.ContentType,
|
||||
request.HttpMethod,
|
||||
request.Url.PathAndQuery,
|
||||
request.RemoteIPEndPoint);
|
||||
|
||||
if (DebugLevel >= 5)
|
||||
LogIncomingInDetail(request);
|
||||
}
|
||||
|
||||
private void LogIncomingToXmlRpcHandler(OSHttpRequest request)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[BASE HTTP SERVER]: HTTP IN {0} :{1} assumed generic XMLRPC request {2} {3} from {4}",
|
||||
RequestNumber,
|
||||
Port,
|
||||
request.HttpMethod,
|
||||
request.Url.PathAndQuery,
|
||||
request.RemoteIPEndPoint);
|
||||
|
||||
if (DebugLevel >= 5)
|
||||
LogIncomingInDetail(request);
|
||||
}
|
||||
|
||||
private void LogIncomingInDetail(OSHttpRequest request)
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(Util.Copy(request.InputStream), Encoding.UTF8))
|
||||
{
|
||||
string output;
|
||||
|
||||
if (DebugLevel == 5)
|
||||
{
|
||||
const int sampleLength = 80;
|
||||
char[] sampleChars = new char[sampleLength];
|
||||
reader.Read(sampleChars, 0, sampleLength);
|
||||
output = new string(sampleChars);
|
||||
}
|
||||
else
|
||||
{
|
||||
output = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[BASE HTTP SERVER]: {0}...", output.Replace("\n", @"\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -746,24 +830,24 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
|
||||
{
|
||||
agentHandler = null;
|
||||
|
||||
lock (m_agentHandlers)
|
||||
{
|
||||
foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
|
||||
{
|
||||
if (handler.Match(request, response))
|
||||
{
|
||||
agentHandler = handler;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
// private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
|
||||
// {
|
||||
// agentHandler = null;
|
||||
//
|
||||
// lock (m_agentHandlers)
|
||||
// {
|
||||
// foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
|
||||
// {
|
||||
// if (handler.Match(request, response))
|
||||
// {
|
||||
// agentHandler = handler;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Try all the registered xmlrpc handlers when an xmlrpc request is received.
|
||||
@@ -1688,21 +1772,21 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
m_pollHandlers.Remove(path);
|
||||
}
|
||||
|
||||
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
||||
{
|
||||
lock (m_agentHandlers)
|
||||
{
|
||||
IHttpAgentHandler foundHandler;
|
||||
|
||||
if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
|
||||
{
|
||||
m_agentHandlers.Remove(agent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
// public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
|
||||
// {
|
||||
// lock (m_agentHandlers)
|
||||
// {
|
||||
// IHttpAgentHandler foundHandler;
|
||||
//
|
||||
// if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
|
||||
// {
|
||||
// m_agentHandlers.Remove(agent);
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
|
||||
public void RemoveXmlRPCHandler(string method)
|
||||
{
|
||||
|
||||
@@ -41,10 +41,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
uint Port { get; }
|
||||
bool UseSSL { get; }
|
||||
|
||||
// Note that the agent string is provided simply to differentiate
|
||||
// the handlers - it is NOT required to be an actual agent header
|
||||
// value.
|
||||
bool AddAgentHandler(string agent, IHttpAgentHandler handler);
|
||||
// // Note that the agent string is provided simply to differentiate
|
||||
// // the handlers - it is NOT required to be an actual agent header
|
||||
// // value.
|
||||
// bool AddAgentHandler(string agent, IHttpAgentHandler handler);
|
||||
|
||||
/// <summary>
|
||||
/// Add a handler for an HTTP request.
|
||||
@@ -106,13 +106,13 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
bool SetDefaultLLSDHandler(DefaultLLSDMethod handler);
|
||||
|
||||
/// <summary>
|
||||
/// Remove the agent if it is registered.
|
||||
/// </summary>
|
||||
/// <param name="agent"></param>
|
||||
/// <param name="handler"></param>
|
||||
/// <returns></returns>
|
||||
bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
|
||||
// /// <summary>
|
||||
// /// Remove the agent if it is registered.
|
||||
// /// </summary>
|
||||
// /// <param name="agent"></param>
|
||||
// /// <param name="handler"></param>
|
||||
// /// <returns></returns>
|
||||
// bool RemoveAgentHandler(string agent, IHttpAgentHandler handler);
|
||||
|
||||
/// <summary>
|
||||
/// Remove an HTTP handler
|
||||
|
||||
@@ -29,6 +29,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
@@ -47,9 +48,12 @@ namespace OpenSim.Framework.Servers
|
||||
/// Control the printing of certain debug messages.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If DebugLevel >= 1, then short warnings are logged when receiving bad input data.
|
||||
/// If DebugLevel >= 2, then long warnings are logged when receiving bad input data.
|
||||
/// If DebugLevel >= 3, then short notices about all incoming non-poll HTTP requests are logged.
|
||||
/// If DebugLevel >= 1 then short warnings are logged when receiving bad input data.
|
||||
/// If DebugLevel >= 2 then long warnings are logged when receiving bad input data.
|
||||
/// If DebugLevel >= 3 then short notices about all incoming non-poll HTTP requests are logged.
|
||||
/// If DebugLevel >= 4 then the time taken to fulfill the request is logged.
|
||||
/// If DebugLevel >= 5 then the start of the body of incoming non-poll HTTP requests will be logged.
|
||||
/// If DebugLevel >= 6 then the entire body of incoming non-poll HTTP requests will be logged.
|
||||
/// </remarks>
|
||||
public static int DebugLevel
|
||||
{
|
||||
@@ -101,17 +105,28 @@ namespace OpenSim.Framework.Servers
|
||||
get { return new Dictionary<uint, BaseHttpServer>(m_Servers); }
|
||||
}
|
||||
|
||||
|
||||
public static void RegisterHttpConsoleCommands(ICommandConsole console)
|
||||
{
|
||||
console.Commands.AddCommand(
|
||||
"Debug", false, "debug http", "debug http [<level>]",
|
||||
"Turn on inbound non-poll http request debugging.",
|
||||
"If level <= 0, then no extra logging is done.\n"
|
||||
+ "If level >= 1, then short warnings are logged when receiving bad input data.\n"
|
||||
+ "If level >= 2, then long warnings are logged when receiving bad input data.\n"
|
||||
+ "If level >= 3, then short notices about all incoming non-poll HTTP requests are logged.\n"
|
||||
+ "If no level is specified then the current level is returned.",
|
||||
"Comms", false, "show http-handlers",
|
||||
"show http-handlers",
|
||||
"Show all registered http handlers", HandleShowHttpHandlersCommand);
|
||||
|
||||
console.Commands.AddCommand(
|
||||
"Debug", false, "debug http", "debug http <in|out|all> [<level>]",
|
||||
"Turn on http request logging.",
|
||||
"If in or all and\n"
|
||||
+ " level <= 0 then no extra logging is done.\n"
|
||||
+ " level >= 1 then short warnings are logged when receiving bad input data.\n"
|
||||
+ " level >= 2 then long warnings are logged when receiving bad input data.\n"
|
||||
+ " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n"
|
||||
+ " level >= 4 then the time taken to fulfill the request is logged.\n"
|
||||
+ " level >= 5 then a sample from the beginning of the incoming data is logged.\n"
|
||||
+ " level >= 6 then the entire incoming data is logged.\n"
|
||||
+ " no level is specified then the current level is returned.\n\n"
|
||||
+ "If out or all and\n"
|
||||
+ " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n"
|
||||
+ " level >= 4 then the time taken to fulfill the request is logged.\n",
|
||||
HandleDebugHttpCommand);
|
||||
}
|
||||
|
||||
@@ -119,25 +134,120 @@ namespace OpenSim.Framework.Servers
|
||||
/// Turn on some debugging values for OpenSim.
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
private static void HandleDebugHttpCommand(string module, string[] args)
|
||||
private static void HandleDebugHttpCommand(string module, string[] cmdparams)
|
||||
{
|
||||
if (args.Length == 3)
|
||||
if (cmdparams.Length < 3)
|
||||
{
|
||||
int newDebug;
|
||||
if (int.TryParse(args[2], out newDebug))
|
||||
{
|
||||
MainServer.DebugLevel = newDebug;
|
||||
MainConsole.Instance.OutputFormat("Debug http level set to {0}", newDebug);
|
||||
}
|
||||
MainConsole.Instance.Output("Usage: debug http <in|out|all> 0..6");
|
||||
return;
|
||||
}
|
||||
else if (args.Length == 2)
|
||||
|
||||
bool inReqs = false;
|
||||
bool outReqs = false;
|
||||
bool allReqs = false;
|
||||
|
||||
string subCommand = cmdparams[2];
|
||||
|
||||
if (subCommand.ToLower() == "in")
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("Current debug http level is {0}", MainServer.DebugLevel);
|
||||
inReqs = true;
|
||||
}
|
||||
else if (subCommand.ToLower() == "out")
|
||||
{
|
||||
outReqs = true;
|
||||
}
|
||||
else if (subCommand.ToLower() == "all")
|
||||
{
|
||||
allReqs = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug http 0..3");
|
||||
MainConsole.Instance.Output("You must specify in, out or all");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmdparams.Length >= 4)
|
||||
{
|
||||
string rawNewDebug = cmdparams[3];
|
||||
int newDebug;
|
||||
|
||||
if (!int.TryParse(rawNewDebug, out newDebug))
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("{0} is not a valid debug level", rawNewDebug);
|
||||
return;
|
||||
}
|
||||
|
||||
if (newDebug < 0 || newDebug > 6)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("{0} is outside the valid debug level range of 0..6", newDebug);
|
||||
return;
|
||||
}
|
||||
|
||||
if (allReqs || inReqs)
|
||||
{
|
||||
MainServer.DebugLevel = newDebug;
|
||||
MainConsole.Instance.OutputFormat("IN debug level set to {0}", newDebug);
|
||||
}
|
||||
|
||||
if (allReqs || outReqs)
|
||||
{
|
||||
WebUtil.DebugLevel = newDebug;
|
||||
MainConsole.Instance.OutputFormat("OUT debug level set to {0}", newDebug);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (allReqs || inReqs)
|
||||
MainConsole.Instance.OutputFormat("Current IN debug level is {0}", MainServer.DebugLevel);
|
||||
|
||||
if (allReqs || outReqs)
|
||||
MainConsole.Instance.OutputFormat("Current OUT debug level is {0}", WebUtil.DebugLevel);
|
||||
}
|
||||
}
|
||||
|
||||
private static void HandleShowHttpHandlersCommand(string module, string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: show http-handlers");
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder handlers = new StringBuilder();
|
||||
|
||||
lock (m_Servers)
|
||||
{
|
||||
foreach (BaseHttpServer httpServer in m_Servers.Values)
|
||||
{
|
||||
handlers.AppendFormat(
|
||||
"Registered HTTP Handlers for server at {0}:{1}\n", httpServer.ListenIPAddress, httpServer.Port);
|
||||
|
||||
handlers.AppendFormat("* XMLRPC:\n");
|
||||
foreach (String s in httpServer.GetXmlRpcHandlerKeys())
|
||||
handlers.AppendFormat("\t{0}\n", s);
|
||||
|
||||
handlers.AppendFormat("* HTTP:\n");
|
||||
List<String> poll = httpServer.GetPollServiceHandlerKeys();
|
||||
foreach (String s in httpServer.GetHTTPHandlerKeys())
|
||||
handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
|
||||
|
||||
// handlers.AppendFormat("* Agent:\n");
|
||||
// foreach (String s in httpServer.GetAgentHandlerKeys())
|
||||
// handlers.AppendFormat("\t{0}\n", s);
|
||||
|
||||
handlers.AppendFormat("* LLSD:\n");
|
||||
foreach (String s in httpServer.GetLLSDHandlerKeys())
|
||||
handlers.AppendFormat("\t{0}\n", s);
|
||||
|
||||
handlers.AppendFormat("* StreamHandlers ({0}):\n", httpServer.GetStreamHandlerKeys().Count);
|
||||
foreach (String s in httpServer.GetStreamHandlerKeys())
|
||||
handlers.AppendFormat("\t{0}\n", s);
|
||||
|
||||
handlers.Append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
MainConsole.Instance.Output(handlers.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenSim
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.7.4";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Extended;
|
||||
|
||||
public enum Flavour
|
||||
{
|
||||
|
||||
@@ -850,6 +850,12 @@ namespace OpenSim.Framework
|
||||
return Math.Min(Math.Max(x, min), max);
|
||||
}
|
||||
|
||||
public static Vector3 Clip(Vector3 vec, float min, float max)
|
||||
{
|
||||
return new Vector3(Clip(vec.X, min, max), Clip(vec.Y, min, max),
|
||||
Clip(vec.Z, min, max));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert an UUID to a raw uuid string. Right now this is a string without hyphens.
|
||||
/// </summary>
|
||||
@@ -1001,6 +1007,38 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy data from one stream to another, leaving the read position of both streams at the beginning.
|
||||
/// </summary>
|
||||
/// <param name='inputStream'>
|
||||
/// Input stream. Must be seekable.
|
||||
/// </param>
|
||||
/// <exception cref='ArgumentException'>
|
||||
/// Thrown if the input stream is not seekable.
|
||||
/// </exception>
|
||||
public static Stream Copy(Stream inputStream)
|
||||
{
|
||||
if (!inputStream.CanSeek)
|
||||
throw new ArgumentException("Util.Copy(Stream inputStream) must receive an inputStream that can seek");
|
||||
|
||||
const int readSize = 256;
|
||||
byte[] buffer = new byte[readSize];
|
||||
MemoryStream ms = new MemoryStream();
|
||||
|
||||
int count = inputStream.Read(buffer, 0, readSize);
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
ms.Write(buffer, 0, count);
|
||||
count = inputStream.Read(buffer, 0, readSize);
|
||||
}
|
||||
|
||||
ms.Position = 0;
|
||||
inputStream.Position = 0;
|
||||
|
||||
return ms;
|
||||
}
|
||||
|
||||
public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args)
|
||||
{
|
||||
return SendXmlRpcCommand(url, methodName, args);
|
||||
|
||||
@@ -53,10 +53,18 @@ namespace OpenSim.Framework
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Control the printing of certain debug messages.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If DebugLevel >= 3 then short notices about outgoing HTTP requests are logged.
|
||||
/// </remarks>
|
||||
public static int DebugLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Request number for diagnostic purposes.
|
||||
/// </summary>
|
||||
public static int RequestNumber = 0;
|
||||
public static int RequestNumber { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// this is the header field used to communicate the local request id
|
||||
@@ -146,7 +154,11 @@ namespace OpenSim.Framework
|
||||
private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed)
|
||||
{
|
||||
int reqnum = RequestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: HTTP OUT {0} ServiceOSD {1} {2} (timeout {3}, compressed {4})",
|
||||
reqnum, method, url, timeout, compressed);
|
||||
|
||||
string errorMessage = "unknown error";
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
@@ -229,7 +241,7 @@ namespace OpenSim.Framework
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > LongCallTime)
|
||||
m_log.InfoFormat(
|
||||
"[OSD REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
"[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
reqnum,
|
||||
method,
|
||||
url,
|
||||
@@ -238,10 +250,14 @@ namespace OpenSim.Framework
|
||||
strBuffer != null
|
||||
? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer)
|
||||
: "");
|
||||
else if (DebugLevel >= 4)
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
|
||||
reqnum, tickdiff, tickdata);
|
||||
}
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: <{0}> osd request for {1}, method {2} FAILED: {3}", reqnum, url, method, errorMessage);
|
||||
"[WEB UTIL]: ServiceOSD request {0} {1} {2} FAILED: {3}", reqnum, url, method, errorMessage);
|
||||
|
||||
return ErrorResponseMap(errorMessage);
|
||||
}
|
||||
@@ -317,7 +333,11 @@ namespace OpenSim.Framework
|
||||
{
|
||||
int reqnum = RequestNumber++;
|
||||
string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start form request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
if (DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: HTTP OUT {0} ServiceForm {1} {2} (timeout {3})",
|
||||
reqnum, method, url, timeout);
|
||||
|
||||
string errorMessage = "unknown error";
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
@@ -380,7 +400,7 @@ namespace OpenSim.Framework
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > LongCallTime)
|
||||
m_log.InfoFormat(
|
||||
"[SERVICE FORM]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
"[WEB UTIL]: Slow ServiceForm request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
reqnum,
|
||||
method,
|
||||
url,
|
||||
@@ -389,9 +409,13 @@ namespace OpenSim.Framework
|
||||
queryString != null
|
||||
? (queryString.Length > MaxRequestDiagLength) ? queryString.Remove(MaxRequestDiagLength) : queryString
|
||||
: "");
|
||||
else if (DebugLevel >= 4)
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
|
||||
reqnum, tickdiff, tickdata);
|
||||
}
|
||||
|
||||
m_log.WarnFormat("[SERVICE FORM]: <{0}> form request to {1} failed: {2}", reqnum, url, errorMessage);
|
||||
m_log.WarnFormat("[WEB UTIL]: ServiceForm request {0} {1} {2} failed: {2}", reqnum, method, url, errorMessage);
|
||||
|
||||
return ErrorResponseMap(errorMessage);
|
||||
}
|
||||
@@ -643,7 +667,6 @@ namespace OpenSim.Framework
|
||||
/// <returns></returns>
|
||||
public static string[] GetPreferredImageTypes(string accept)
|
||||
{
|
||||
|
||||
if (accept == null || accept == string.Empty)
|
||||
return new string[0];
|
||||
|
||||
@@ -695,13 +718,15 @@ namespace OpenSim.Framework
|
||||
string requestUrl, TRequest obj, Action<TResponse> action)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
if (WebUtil.DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: HTTP OUT {0} AsynchronousRequestObject {1} {2}",
|
||||
reqnum, verb, requestUrl);
|
||||
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
int tickdata = 0;
|
||||
|
||||
// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
|
||||
|
||||
Type type = typeof(TRequest);
|
||||
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
@@ -854,7 +879,7 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[ASYNC REQUEST]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
"[ASYNC REQUEST]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
reqnum,
|
||||
verb,
|
||||
requestUrl,
|
||||
@@ -862,6 +887,12 @@ namespace OpenSim.Framework
|
||||
tickdata,
|
||||
originalRequest);
|
||||
}
|
||||
else if (WebUtil.DebugLevel >= 4)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
|
||||
reqnum, tickdiff, tickdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -882,7 +913,11 @@ namespace OpenSim.Framework
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
if (WebUtil.DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: HTTP OUT {0} SynchronousRestForms {1} {2}",
|
||||
reqnum, verb, requestUrl);
|
||||
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
int tickdata = 0;
|
||||
@@ -967,13 +1002,17 @@ namespace OpenSim.Framework
|
||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||
if (tickdiff > WebUtil.LongCallTime)
|
||||
m_log.InfoFormat(
|
||||
"[FORMS]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
"[FORMS]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
reqnum,
|
||||
verb,
|
||||
requestUrl,
|
||||
tickdiff,
|
||||
tickdata,
|
||||
obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
|
||||
else if (WebUtil.DebugLevel >= 4)
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
|
||||
reqnum, tickdiff, tickdata);
|
||||
|
||||
return respstring;
|
||||
}
|
||||
@@ -998,7 +1037,11 @@ namespace OpenSim.Framework
|
||||
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
|
||||
{
|
||||
int reqnum = WebUtil.RequestNumber++;
|
||||
// m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
|
||||
|
||||
if (WebUtil.DebugLevel >= 3)
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: HTTP OUT {0} SynchronousRestObject {1} {2}",
|
||||
reqnum, verb, requestUrl);
|
||||
|
||||
int tickstart = Util.EnvironmentTickCount();
|
||||
int tickdata = 0;
|
||||
@@ -1111,7 +1154,7 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[SynchronousRestObjectRequester]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
"[SynchronousRestObjectRequester]: Slow request {0} {1} {2} took {3}ms, {4}ms writing, {5}",
|
||||
reqnum,
|
||||
verb,
|
||||
requestUrl,
|
||||
@@ -1119,6 +1162,12 @@ namespace OpenSim.Framework
|
||||
tickdata,
|
||||
originalRequest);
|
||||
}
|
||||
else if (WebUtil.DebugLevel >= 4)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing",
|
||||
reqnum, tickdiff, tickdata);
|
||||
}
|
||||
|
||||
return deserial;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Timers;
|
||||
using log4net;
|
||||
using NDesk.Options;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
@@ -310,8 +311,11 @@ namespace OpenSim
|
||||
"Change the scale of a named prim", HandleEditScale);
|
||||
|
||||
m_console.Commands.AddCommand("Users", false, "kick user",
|
||||
"kick user <first> <last> [message]",
|
||||
"Kick a user off the simulator", KickUserCommand);
|
||||
"kick user <first> <last> [--force] [message]",
|
||||
"Kick a user off the simulator",
|
||||
"The --force option will kick the user without any checks to see whether it's already in the process of closing\n"
|
||||
+ "Only use this option if you are sure the avatar is inactive and a normal kick user operation does not removed them",
|
||||
KickUserCommand);
|
||||
|
||||
m_console.Commands.AddCommand("Users", false, "show users",
|
||||
"show users [full]",
|
||||
@@ -328,10 +332,6 @@ namespace OpenSim
|
||||
"show circuits",
|
||||
"Show agent circuit data", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("Comms", false, "show http-handlers",
|
||||
"show http-handlers",
|
||||
"Show all registered http handlers", HandleShow);
|
||||
|
||||
m_console.Commands.AddCommand("Comms", false, "show pending-objects",
|
||||
"show pending-objects",
|
||||
"Show # of objects on the pending queues of all scene viewers", HandleShow);
|
||||
@@ -453,11 +453,17 @@ namespace OpenSim
|
||||
/// <param name="cmdparams">name of avatar to kick</param>
|
||||
private void KickUserCommand(string module, string[] cmdparams)
|
||||
{
|
||||
if (cmdparams.Length < 4)
|
||||
bool force = false;
|
||||
|
||||
OptionSet options = new OptionSet().Add("f|force", delegate (string v) { force = v != null; });
|
||||
|
||||
List<string> mainParams = options.Parse(cmdparams);
|
||||
|
||||
if (mainParams.Count < 4)
|
||||
return;
|
||||
|
||||
string alert = null;
|
||||
if (cmdparams.Length > 4)
|
||||
if (mainParams.Count > 4)
|
||||
alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4));
|
||||
|
||||
IList agents = SceneManager.GetCurrentSceneAvatars();
|
||||
@@ -466,8 +472,8 @@ namespace OpenSim
|
||||
{
|
||||
RegionInfo regionInfo = presence.Scene.RegionInfo;
|
||||
|
||||
if (presence.Firstname.ToLower().Contains(cmdparams[2].ToLower()) &&
|
||||
presence.Lastname.ToLower().Contains(cmdparams[3].ToLower()))
|
||||
if (presence.Firstname.ToLower().Contains(mainParams[2].ToLower()) &&
|
||||
presence.Lastname.ToLower().Contains(mainParams[3].ToLower()))
|
||||
{
|
||||
MainConsole.Instance.Output(
|
||||
String.Format(
|
||||
@@ -480,7 +486,7 @@ namespace OpenSim
|
||||
else
|
||||
presence.ControllingClient.Kick("\nThe OpenSim manager kicked you out.\n");
|
||||
|
||||
presence.Scene.IncomingCloseAgent(presence.UUID);
|
||||
presence.Scene.IncomingCloseAgent(presence.UUID, force);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1002,33 +1008,6 @@ namespace OpenSim
|
||||
HandleShowCircuits();
|
||||
break;
|
||||
|
||||
case "http-handlers":
|
||||
System.Text.StringBuilder handlers = new System.Text.StringBuilder("Registered HTTP Handlers:\n");
|
||||
|
||||
handlers.AppendFormat("* XMLRPC:\n");
|
||||
foreach (String s in HttpServer.GetXmlRpcHandlerKeys())
|
||||
handlers.AppendFormat("\t{0}\n", s);
|
||||
|
||||
handlers.AppendFormat("* HTTP:\n");
|
||||
List<String> poll = HttpServer.GetPollServiceHandlerKeys();
|
||||
foreach (String s in HttpServer.GetHTTPHandlerKeys())
|
||||
handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty));
|
||||
|
||||
handlers.AppendFormat("* Agent:\n");
|
||||
foreach (String s in HttpServer.GetAgentHandlerKeys())
|
||||
handlers.AppendFormat("\t{0}\n", s);
|
||||
|
||||
handlers.AppendFormat("* LLSD:\n");
|
||||
foreach (String s in HttpServer.GetLLSDHandlerKeys())
|
||||
handlers.AppendFormat("\t{0}\n", s);
|
||||
|
||||
handlers.AppendFormat("* StreamHandlers ({0}):\n", HttpServer.GetStreamHandlerKeys().Count);
|
||||
foreach (String s in HttpServer.GetStreamHandlerKeys())
|
||||
handlers.AppendFormat("\t{0}\n", s);
|
||||
|
||||
MainConsole.Instance.Output(handlers.ToString());
|
||||
break;
|
||||
|
||||
case "modules":
|
||||
MainConsole.Instance.Output("The currently loaded shared modules are:");
|
||||
foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
|
||||
|
||||
@@ -305,8 +305,13 @@ namespace OpenSim
|
||||
m_httpServerPort = m_networkServersInfo.HttpListenerPort;
|
||||
SceneManager.OnRestartSim += handleRestartRegion;
|
||||
|
||||
// Only start the memory watchdog once all regions are ready
|
||||
SceneManager.OnRegionsReadyStatusChange += sm => MemoryWatchdog.Enabled = sm.AllRegionsReady;
|
||||
// Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is
|
||||
// heavily used during initial startup.
|
||||
//
|
||||
// FIXME: It's also possible that region ready status should be flipped during an OAR load since this
|
||||
// also makes heavy use of the CPU.
|
||||
SceneManager.OnRegionsReadyStatusChange
|
||||
+= sm => { MemoryWatchdog.Enabled = sm.AllRegionsReady; Watchdog.Enabled = sm.AllRegionsReady; };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
|
||||
UUID spId = TestHelpers.ParseTail(0x1);
|
||||
|
||||
SceneHelpers.AddScenePresence(m_scene, spId);
|
||||
m_scene.IncomingCloseAgent(spId);
|
||||
m_scene.IncomingCloseAgent(spId, false);
|
||||
|
||||
// TODO: Add more assertions for the other aspects of event queues
|
||||
Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0));
|
||||
|
||||
@@ -487,16 +487,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
#region Client Methods
|
||||
|
||||
/// <summary>
|
||||
/// Close down the client view
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
Close(false);
|
||||
}
|
||||
|
||||
public void Close(bool force)
|
||||
{
|
||||
// We lock here to prevent race conditions between two threads calling close simultaneously (e.g.
|
||||
// a simultaneous relog just as a client is being closed out due to no packet ack from the old connection.
|
||||
lock (CloseSyncLock)
|
||||
{
|
||||
if (!IsActive)
|
||||
// We still perform a force close inside the sync lock since this is intended to attempt close where
|
||||
// there is some unidentified connection problem, not where we have issues due to deadlock
|
||||
if (!IsActive && !force)
|
||||
return;
|
||||
|
||||
IsActive = false;
|
||||
@@ -4447,37 +4451,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (bl[i].BannedUserID == UUID.Zero)
|
||||
continue;
|
||||
BannedUsers.Add(bl[i].BannedUserID);
|
||||
|
||||
if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0))
|
||||
{
|
||||
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
|
||||
packet.AgentData.TransactionID = UUID.Random();
|
||||
packet.AgentData.AgentID = AgentId;
|
||||
packet.AgentData.SessionID = SessionId;
|
||||
packet.MethodData.Invoice = invoice;
|
||||
packet.MethodData.Method = Utils.StringToBytes("setaccess");
|
||||
|
||||
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count];
|
||||
|
||||
int j;
|
||||
for (j = 0; j < (6 + BannedUsers.Count); j++)
|
||||
{
|
||||
returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock();
|
||||
}
|
||||
j = 0;
|
||||
|
||||
returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
|
||||
returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
|
||||
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
||||
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
||||
returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++;
|
||||
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
||||
|
||||
foreach (UUID banned in BannedUsers)
|
||||
{
|
||||
returnblock[j].Parameter = banned.GetBytes(); j++;
|
||||
}
|
||||
packet.ParamList = returnblock;
|
||||
packet.Header.Reliable = true;
|
||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||
|
||||
BannedUsers.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
|
||||
packet.AgentData.TransactionID = UUID.Random();
|
||||
packet.AgentData.AgentID = AgentId;
|
||||
packet.AgentData.SessionID = SessionId;
|
||||
packet.MethodData.Invoice = invoice;
|
||||
packet.MethodData.Method = Utils.StringToBytes("setaccess");
|
||||
|
||||
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count];
|
||||
|
||||
for (int i = 0; i < (6 + BannedUsers.Count); i++)
|
||||
{
|
||||
returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
|
||||
}
|
||||
int j = 0;
|
||||
|
||||
returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
|
||||
returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
|
||||
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
||||
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
||||
returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++;
|
||||
returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
|
||||
|
||||
foreach (UUID banned in BannedUsers)
|
||||
{
|
||||
returnblock[j].Parameter = banned.GetBytes(); j++;
|
||||
}
|
||||
packet.ParamList = returnblock;
|
||||
packet.Header.Reliable = false;
|
||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||
}
|
||||
|
||||
public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
|
||||
@@ -5810,7 +5821,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
args.Channel = ch;
|
||||
args.From = String.Empty;
|
||||
args.Message = Utils.BytesToString(msg);
|
||||
args.Type = ChatTypeEnum.Shout;
|
||||
args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance
|
||||
args.Position = new Vector3();
|
||||
args.Scene = Scene;
|
||||
args.Sender = this;
|
||||
@@ -11989,7 +12000,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
Kick(reason);
|
||||
Thread.Sleep(1000);
|
||||
Close();
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
|
||||
@@ -57,39 +57,36 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a xfer uploader if one does not already exist.
|
||||
/// Return the xfer uploader for the given transaction.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If an uploader does not already exist for this transaction then it is created, otherwise the existing
|
||||
/// uploader is returned.
|
||||
/// </remarks>
|
||||
/// <param name="transactionID"></param>
|
||||
/// <param name="assetID">
|
||||
/// We must transfer the new asset ID into the uploader on creation, otherwise
|
||||
/// we can see race conditions with other threads which can retrieve an item before it is updated with the new
|
||||
/// asset id.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The xfer uploader requested. Null if one is already in existence.
|
||||
/// FIXME: This is a bizarre thing to do, and is probably meant to signal an error condition if multiple
|
||||
/// transfers are made. Needs to be corrected.
|
||||
/// </returns>
|
||||
public AssetXferUploader RequestXferUploader(UUID transactionID, UUID assetID)
|
||||
/// <returns>The asset xfer uploader</returns>
|
||||
public AssetXferUploader RequestXferUploader(UUID transactionID)
|
||||
{
|
||||
AssetXferUploader uploader;
|
||||
|
||||
lock (XferUploaders)
|
||||
{
|
||||
if (!XferUploaders.ContainsKey(transactionID))
|
||||
{
|
||||
AssetXferUploader uploader = new AssetXferUploader(this, m_Scene, assetID, m_dumpAssetsToFile);
|
||||
uploader = new AssetXferUploader(this, m_Scene, transactionID, m_dumpAssetsToFile);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[AGENT ASSETS TRANSACTIONS]: Adding asset xfer uploader {0} since it didn't previously exist", transactionID);
|
||||
|
||||
XferUploaders.Add(transactionID, uploader);
|
||||
|
||||
return uploader;
|
||||
}
|
||||
else
|
||||
{
|
||||
uploader = XferUploaders[transactionID];
|
||||
}
|
||||
}
|
||||
|
||||
m_log.WarnFormat("[AGENT ASSETS TRANSACTIONS]: Ignoring request for asset xfer uploader {0} since it already exists", transactionID);
|
||||
|
||||
return null;
|
||||
return uploader;
|
||||
}
|
||||
|
||||
public void HandleXfer(ulong xferID, uint packetID, byte[] data)
|
||||
@@ -151,115 +148,28 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
string description, string name, sbyte invType,
|
||||
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||
{
|
||||
AssetXferUploader uploader = null;
|
||||
AssetXferUploader uploader = RequestXferUploader(transactionID);
|
||||
|
||||
lock (XferUploaders)
|
||||
{
|
||||
if (XferUploaders.ContainsKey(transactionID))
|
||||
uploader = XferUploaders[transactionID];
|
||||
}
|
||||
|
||||
if (uploader != null)
|
||||
uploader.RequestCreateInventoryItem(
|
||||
remoteClient, transactionID, folderID,
|
||||
callbackID, description, name, invType, type,
|
||||
wearableType, nextOwnerMask);
|
||||
else
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to create inventory item {1} from {2}",
|
||||
transactionID, name, remoteClient.Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get an uploaded asset. If the data is successfully retrieved,
|
||||
/// the transaction will be removed.
|
||||
/// </summary>
|
||||
/// <param name="transactionID"></param>
|
||||
/// <returns>The asset if the upload has completed, null if it has not.</returns>
|
||||
private AssetBase GetTransactionAsset(UUID transactionID)
|
||||
{
|
||||
lock (XferUploaders)
|
||||
{
|
||||
if (XferUploaders.ContainsKey(transactionID))
|
||||
{
|
||||
AssetXferUploader uploader = XferUploaders[transactionID];
|
||||
AssetBase asset = uploader.GetAssetData();
|
||||
RemoveXferUploader(transactionID);
|
||||
|
||||
return asset;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
uploader.RequestCreateInventoryItem(
|
||||
remoteClient, folderID, callbackID,
|
||||
description, name, invType, type, wearableType, nextOwnerMask);
|
||||
}
|
||||
|
||||
public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient,
|
||||
SceneObjectPart part, UUID transactionID,
|
||||
TaskInventoryItem item)
|
||||
{
|
||||
AssetXferUploader uploader = null;
|
||||
AssetXferUploader uploader = RequestXferUploader(transactionID);
|
||||
|
||||
lock (XferUploaders)
|
||||
{
|
||||
if (XferUploaders.ContainsKey(transactionID))
|
||||
uploader = XferUploaders[transactionID];
|
||||
}
|
||||
|
||||
if (uploader != null)
|
||||
{
|
||||
AssetBase asset = GetTransactionAsset(transactionID);
|
||||
|
||||
// Only legacy viewers use this, and they prefer CAPS, which
|
||||
// we have, so this really never runs.
|
||||
// Allow it, but only for "safe" types.
|
||||
if ((InventoryType)item.InvType != InventoryType.Notecard &&
|
||||
(InventoryType)item.InvType != InventoryType.LSL)
|
||||
return;
|
||||
|
||||
if (asset != null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[AGENT ASSETS TRANSACTIONS]: Updating item {0} in {1} for transaction {2}",
|
||||
// item.Name, part.Name, transactionID);
|
||||
|
||||
asset.FullID = UUID.Random();
|
||||
asset.Name = item.Name;
|
||||
asset.Description = item.Description;
|
||||
asset.Type = (sbyte)item.Type;
|
||||
item.AssetID = asset.FullID;
|
||||
|
||||
m_Scene.AssetService.Store(asset);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to update task inventory item {1} in {2}",
|
||||
transactionID, item.Name, part.Name);
|
||||
}
|
||||
uploader.RequestUpdateTaskInventoryItem(remoteClient, item);
|
||||
}
|
||||
|
||||
public void RequestUpdateInventoryItem(IClientAPI remoteClient,
|
||||
UUID transactionID, InventoryItemBase item)
|
||||
{
|
||||
AssetXferUploader uploader = null;
|
||||
AssetXferUploader uploader = RequestXferUploader(transactionID);
|
||||
|
||||
lock (XferUploaders)
|
||||
{
|
||||
if (XferUploaders.ContainsKey(transactionID))
|
||||
uploader = XferUploaders[transactionID];
|
||||
}
|
||||
|
||||
if (uploader != null)
|
||||
{
|
||||
uploader.RequestUpdateInventoryItem(remoteClient, transactionID, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT ASSET TRANSACTIONS]: Could not find uploader with transaction ID {0} when handling request to update inventory item {1} for {2}",
|
||||
transactionID, item.Name, remoteClient.Name);
|
||||
}
|
||||
uploader.RequestUpdateInventoryItem(remoteClient, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
IClientAPI remoteClient, SceneObjectPart part, UUID transactionID, TaskInventoryItem item)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[TRANSACTIONS MANAGER] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}",
|
||||
"[ASSET TRANSACTION MODULE] Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}",
|
||||
item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName);
|
||||
|
||||
AgentAssetTransactions transactions =
|
||||
@@ -274,13 +274,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
}
|
||||
|
||||
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
||||
AssetXferUploader uploader = transactions.RequestXferUploader(transaction, assetID);
|
||||
|
||||
if (uploader != null)
|
||||
{
|
||||
uploader.Initialise(remoteClient, assetID, transaction, type,
|
||||
data, storeLocal, tempFile);
|
||||
}
|
||||
AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
|
||||
uploader.StartUpload(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -40,39 +40,75 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Upload state.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// New -> Uploading -> Complete
|
||||
/// </remarks>
|
||||
private enum UploadState
|
||||
{
|
||||
New,
|
||||
Uploading,
|
||||
Complete
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the object that holds this uploader. Used to remove ourselves from it's list if we
|
||||
/// are performing a delayed update.
|
||||
/// </summary>
|
||||
AgentAssetTransactions m_transactions;
|
||||
|
||||
private UploadState m_uploadState = UploadState.New;
|
||||
|
||||
private AssetBase m_asset;
|
||||
private UUID InventFolder = UUID.Zero;
|
||||
private sbyte invType = 0;
|
||||
|
||||
private bool m_createItem = false;
|
||||
private uint m_createItemCallback = 0;
|
||||
private bool m_updateItem = false;
|
||||
private bool m_createItem;
|
||||
private uint m_createItemCallback;
|
||||
|
||||
private bool m_updateItem;
|
||||
private InventoryItemBase m_updateItemData;
|
||||
|
||||
private bool m_updateTaskItem;
|
||||
private TaskInventoryItem m_updateTaskItemData;
|
||||
|
||||
private string m_description = String.Empty;
|
||||
private bool m_dumpAssetToFile;
|
||||
private bool m_finished = false;
|
||||
private string m_name = String.Empty;
|
||||
private bool m_storeLocal;
|
||||
// private bool m_storeLocal;
|
||||
private uint nextPerm = 0;
|
||||
private IClientAPI ourClient;
|
||||
private UUID TransactionID = UUID.Zero;
|
||||
|
||||
private UUID m_transactionID;
|
||||
|
||||
private sbyte type = 0;
|
||||
private byte wearableType = 0;
|
||||
public ulong XferID;
|
||||
private Scene m_Scene;
|
||||
|
||||
public AssetXferUploader(AgentAssetTransactions transactions, Scene scene, UUID assetID, bool dumpAssetToFile)
|
||||
/// <summary>
|
||||
/// AssetXferUploader constructor
|
||||
/// </summary>
|
||||
/// <param name='transactions'>/param>
|
||||
/// <param name='scene'></param>
|
||||
/// <param name='transactionID'></param>
|
||||
/// <param name='dumpAssetToFile'>
|
||||
/// If true then when the asset is uploaded it is dumped to a file with the format
|
||||
/// String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat",
|
||||
/// now.Year, now.Month, now.Day, now.Hour, now.Minute,
|
||||
/// now.Second, m_asset.Name, m_asset.Type);
|
||||
/// for debugging purposes.
|
||||
/// </param>
|
||||
public AssetXferUploader(
|
||||
AgentAssetTransactions transactions, Scene scene, UUID transactionID, bool dumpAssetToFile)
|
||||
{
|
||||
m_asset = new AssetBase();
|
||||
|
||||
m_transactions = transactions;
|
||||
m_transactionID = transactionID;
|
||||
m_Scene = scene;
|
||||
m_asset = new AssetBase() { FullID = assetID };
|
||||
m_dumpAssetToFile = dumpAssetToFile;
|
||||
}
|
||||
|
||||
@@ -118,30 +154,50 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialise asset transfer from the client
|
||||
/// Start asset transfer from the client
|
||||
/// </summary>
|
||||
/// <param name="xferID"></param>
|
||||
/// <param name="packetID"></param>
|
||||
/// <param name="data"></param>
|
||||
public void Initialise(IClientAPI remoteClient, UUID assetID,
|
||||
UUID transaction, sbyte type, byte[] data, bool storeLocal,
|
||||
bool tempFile)
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="assetID"></param>
|
||||
/// <param name="transaction"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="data">
|
||||
/// Optional data. If present then the asset is created immediately with this data
|
||||
/// rather than requesting an upload from the client. The data must be longer than 2 bytes.
|
||||
/// </param>
|
||||
/// <param name="storeLocal"></param>
|
||||
/// <param name="tempFile"></param>
|
||||
public void StartUpload(
|
||||
IClientAPI remoteClient, UUID assetID, UUID transaction, sbyte type, byte[] data, bool storeLocal,
|
||||
bool tempFile)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ASSET XFER UPLOADER]: Initialised xfer from {0}, asset {1}, transaction {2}, type {3}, storeLocal {4}, tempFile {5}, already received data length {6}",
|
||||
// remoteClient.Name, assetID, transaction, type, storeLocal, tempFile, data.Length);
|
||||
|
||||
lock (this)
|
||||
{
|
||||
if (m_uploadState != UploadState.New)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[ASSET XFER UPLOADER]: Tried to start upload of asset {0}, transaction {1} for {2} but this is already in state {3}. Aborting.",
|
||||
assetID, transaction, remoteClient.Name, m_uploadState);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_uploadState = UploadState.Uploading;
|
||||
}
|
||||
|
||||
ourClient = remoteClient;
|
||||
m_asset.Name = "blank";
|
||||
m_asset.Description = "empty";
|
||||
|
||||
m_asset.FullID = assetID;
|
||||
m_asset.Type = type;
|
||||
m_asset.CreatorID = remoteClient.AgentId.ToString();
|
||||
m_asset.Data = data;
|
||||
m_asset.Local = storeLocal;
|
||||
m_asset.Temporary = tempFile;
|
||||
|
||||
TransactionID = transaction;
|
||||
m_storeLocal = storeLocal;
|
||||
// m_storeLocal = storeLocal;
|
||||
|
||||
if (m_asset.Data.Length > 2)
|
||||
{
|
||||
@@ -166,36 +222,35 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
|
||||
protected void SendCompleteMessage()
|
||||
{
|
||||
ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true,
|
||||
m_asset.FullID);
|
||||
|
||||
// We must lock in order to avoid a race with a separate thread dealing with an inventory item or create
|
||||
// message from other client UDP.
|
||||
lock (this)
|
||||
{
|
||||
m_finished = true;
|
||||
m_uploadState = UploadState.Complete;
|
||||
|
||||
ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID);
|
||||
|
||||
if (m_createItem)
|
||||
{
|
||||
DoCreateItem(m_createItemCallback);
|
||||
CompleteCreateItem(m_createItemCallback);
|
||||
}
|
||||
else if (m_updateItem)
|
||||
{
|
||||
StoreAssetForItemUpdate(m_updateItemData);
|
||||
|
||||
// Remove ourselves from the list of transactions if completion was delayed until the transaction
|
||||
// was complete.
|
||||
// TODO: Should probably do the same for create item.
|
||||
m_transactions.RemoveXferUploader(TransactionID);
|
||||
CompleteItemUpdate(m_updateItemData);
|
||||
}
|
||||
else if (m_storeLocal)
|
||||
else if (m_updateTaskItem)
|
||||
{
|
||||
m_Scene.AssetService.Store(m_asset);
|
||||
CompleteTaskItemUpdate(m_updateTaskItemData);
|
||||
}
|
||||
// else if (m_storeLocal)
|
||||
// {
|
||||
// m_Scene.AssetService.Store(m_asset);
|
||||
// }
|
||||
}
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ASSET XFER UPLOADER]: Uploaded asset {0} for transaction {1}",
|
||||
m_asset.FullID, TransactionID);
|
||||
m_asset.FullID, m_transactionID);
|
||||
|
||||
if (m_dumpAssetToFile)
|
||||
{
|
||||
@@ -223,40 +278,37 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
}
|
||||
|
||||
public void RequestCreateInventoryItem(IClientAPI remoteClient,
|
||||
UUID transactionID, UUID folderID, uint callbackID,
|
||||
UUID folderID, uint callbackID,
|
||||
string description, string name, sbyte invType,
|
||||
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||
{
|
||||
if (TransactionID == transactionID)
|
||||
{
|
||||
InventFolder = folderID;
|
||||
m_name = name;
|
||||
m_description = description;
|
||||
this.type = type;
|
||||
this.invType = invType;
|
||||
this.wearableType = wearableType;
|
||||
nextPerm = nextOwnerMask;
|
||||
m_asset.Name = name;
|
||||
m_asset.Description = description;
|
||||
m_asset.Type = type;
|
||||
InventFolder = folderID;
|
||||
m_name = name;
|
||||
m_description = description;
|
||||
this.type = type;
|
||||
this.invType = invType;
|
||||
this.wearableType = wearableType;
|
||||
nextPerm = nextOwnerMask;
|
||||
m_asset.Name = name;
|
||||
m_asset.Description = description;
|
||||
m_asset.Type = type;
|
||||
|
||||
// We must lock to avoid a race with a separate thread uploading the asset.
|
||||
lock (this)
|
||||
// We must lock to avoid a race with a separate thread uploading the asset.
|
||||
lock (this)
|
||||
{
|
||||
if (m_uploadState == UploadState.Complete)
|
||||
{
|
||||
if (m_finished)
|
||||
{
|
||||
DoCreateItem(callbackID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_createItem = true; //set flag so the inventory item is created when upload is complete
|
||||
m_createItemCallback = callbackID;
|
||||
}
|
||||
CompleteCreateItem(callbackID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_createItem = true; //set flag so the inventory item is created when upload is complete
|
||||
m_createItemCallback = callbackID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, InventoryItemBase item)
|
||||
public void RequestUpdateInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
|
||||
{
|
||||
// We must lock to avoid a race with a separate thread uploading the asset.
|
||||
lock (this)
|
||||
@@ -271,9 +323,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
item.AssetID = m_asset.FullID;
|
||||
m_Scene.InventoryService.UpdateItem(item);
|
||||
|
||||
if (m_finished)
|
||||
if (m_uploadState == UploadState.Complete)
|
||||
{
|
||||
StoreAssetForItemUpdate(item);
|
||||
CompleteItemUpdate(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -287,20 +339,59 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
}
|
||||
}
|
||||
|
||||
public void RequestUpdateTaskInventoryItem(IClientAPI remoteClient, TaskInventoryItem taskItem)
|
||||
{
|
||||
// We must lock to avoid a race with a separate thread uploading the asset.
|
||||
lock (this)
|
||||
{
|
||||
m_asset.Name = taskItem.Name;
|
||||
m_asset.Description = taskItem.Description;
|
||||
m_asset.Type = (sbyte)taskItem.Type;
|
||||
taskItem.AssetID = m_asset.FullID;
|
||||
|
||||
if (m_uploadState == UploadState.Complete)
|
||||
{
|
||||
CompleteTaskItemUpdate(taskItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_updateTaskItem = true;
|
||||
m_updateTaskItemData = taskItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Store the asset for the given item.
|
||||
/// Store the asset for the given item when it has been uploaded.
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
private void StoreAssetForItemUpdate(InventoryItemBase item)
|
||||
private void CompleteItemUpdate(InventoryItemBase item)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier item update for {1} for {2}",
|
||||
// m_asset.FullID, item.Name, ourClient.Name);
|
||||
|
||||
m_Scene.AssetService.Store(m_asset);
|
||||
|
||||
m_transactions.RemoveXferUploader(m_transactionID);
|
||||
}
|
||||
|
||||
private void DoCreateItem(uint callbackID)
|
||||
/// <summary>
|
||||
/// Store the asset for the given task item when it has been uploaded.
|
||||
/// </summary>
|
||||
/// <param name="taskItem"></param>
|
||||
private void CompleteTaskItemUpdate(TaskInventoryItem taskItem)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ASSET XFER UPLOADER]: Storing asset {0} for earlier task item update for {1} for {2}",
|
||||
// m_asset.FullID, taskItem.Name, ourClient.Name);
|
||||
|
||||
m_Scene.AssetService.Store(m_asset);
|
||||
|
||||
m_transactions.RemoveXferUploader(m_transactionID);
|
||||
}
|
||||
|
||||
private void CompleteCreateItem(uint callbackID)
|
||||
{
|
||||
m_Scene.AssetService.Store(m_asset);
|
||||
|
||||
@@ -326,20 +417,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
ourClient.SendInventoryItemCreateUpdate(item, callbackID);
|
||||
else
|
||||
ourClient.SendAlertMessage("Unable to create inventory item");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the asset data uploaded in this transfer.
|
||||
/// </summary>
|
||||
/// <returns>null if the asset has not finished uploading</returns>
|
||||
public AssetBase GetAssetData()
|
||||
{
|
||||
if (m_finished)
|
||||
{
|
||||
return m_asset;
|
||||
}
|
||||
|
||||
return null;
|
||||
m_transactions.RemoveXferUploader(m_transactionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,8 +107,6 @@ namespace Flotsam.RegionModules.AssetCache
|
||||
private IAssetService m_AssetService;
|
||||
private List<Scene> m_Scenes = new List<Scene>();
|
||||
|
||||
private bool m_DeepScanBeforePurge;
|
||||
|
||||
public FlotsamAssetCache()
|
||||
{
|
||||
m_InvalidChars.AddRange(Path.GetInvalidPathChars());
|
||||
@@ -170,8 +168,6 @@ namespace Flotsam.RegionModules.AssetCache
|
||||
m_CacheDirectoryTierLen = assetConfig.GetInt("CacheDirectoryTierLength", m_CacheDirectoryTierLen);
|
||||
|
||||
m_CacheWarnAt = assetConfig.GetInt("CacheWarnAt", m_CacheWarnAt);
|
||||
|
||||
m_DeepScanBeforePurge = assetConfig.GetBoolean("DeepScanBeforePurge", m_DeepScanBeforePurge);
|
||||
}
|
||||
|
||||
m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory {0}", m_CacheDirectory);
|
||||
@@ -506,13 +502,10 @@ namespace Flotsam.RegionModules.AssetCache
|
||||
// Purge all files last accessed prior to this point
|
||||
DateTime purgeLine = DateTime.Now - m_FileExpiration;
|
||||
|
||||
// An optional deep scan at this point will ensure assets present in scenes,
|
||||
// or referenced by objects in the scene, but not recently accessed
|
||||
// are not purged.
|
||||
if (m_DeepScanBeforePurge)
|
||||
{
|
||||
CacheScenes();
|
||||
}
|
||||
// An asset cache may contain local non-temporary assets that are not in the asset service. Therefore,
|
||||
// before cleaning up expired files we must scan the objects in the scene to make sure that we retain
|
||||
// such local assets if they have not been recently accessed.
|
||||
TouchAllSceneAssets(false);
|
||||
|
||||
foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
|
||||
{
|
||||
@@ -705,11 +698,14 @@ namespace Flotsam.RegionModules.AssetCache
|
||||
|
||||
/// <summary>
|
||||
/// Iterates through all Scenes, doing a deep scan through assets
|
||||
/// to cache all assets present in the scene or referenced by assets
|
||||
/// in the scene
|
||||
/// to update the access time of all assets present in the scene or referenced by assets
|
||||
/// in the scene.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private int CacheScenes()
|
||||
/// <param name="storeUncached">
|
||||
/// If true, then assets scanned which are not found in cache are added to the cache.
|
||||
/// </param>
|
||||
/// <returns>Number of distinct asset references found in the scene.</returns>
|
||||
private int TouchAllSceneAssets(bool storeUncached)
|
||||
{
|
||||
UuidGatherer gatherer = new UuidGatherer(m_AssetService);
|
||||
|
||||
@@ -732,7 +728,7 @@ namespace Flotsam.RegionModules.AssetCache
|
||||
{
|
||||
File.SetLastAccessTime(filename, DateTime.Now);
|
||||
}
|
||||
else
|
||||
else if (storeUncached)
|
||||
{
|
||||
m_AssetService.Get(assetID.ToString());
|
||||
}
|
||||
@@ -860,13 +856,14 @@ namespace Flotsam.RegionModules.AssetCache
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "assets":
|
||||
m_log.Info("[FLOTSAM ASSET CACHE]: Caching all assets, in all scenes.");
|
||||
m_log.Info("[FLOTSAM ASSET CACHE]: Ensuring assets are cached for all scenes.");
|
||||
|
||||
Util.FireAndForget(delegate {
|
||||
int assetsCached = CacheScenes();
|
||||
m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Completed Scene Caching, {0} assets found.", assetsCached);
|
||||
int assetReferenceTotal = TouchAllSceneAssets(true);
|
||||
m_log.InfoFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Completed check with {0} assets.",
|
||||
assetReferenceTotal);
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
@@ -461,7 +461,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||
|
||||
SceneObjectGroup rezzedAtt = presence.GetAttachments()[0];
|
||||
|
||||
scene.IncomingCloseAgent(presence.UUID);
|
||||
scene.IncomingCloseAgent(presence.UUID, false);
|
||||
|
||||
// Check that we can't retrieve this attachment from the scene.
|
||||
Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null);
|
||||
@@ -641,4 +641,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||
// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,9 +482,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
Util.FireAndForget(
|
||||
delegate
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[FRIENDS MODULE]: Notifying {0} friends of {1} of online status {2}",
|
||||
friendList.Count, agentID, online);
|
||||
// m_log.DebugFormat(
|
||||
// "[FRIENDS MODULE]: Notifying {0} friends of {1} of online status {2}",
|
||||
// friendList.Count, agentID, online);
|
||||
|
||||
// Notify about this user status
|
||||
StatusNotify(friendList, agentID, online);
|
||||
|
||||
@@ -350,38 +350,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||
Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
||||
/// an account exists with the same name as the creator, though not the same id.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLoadIarV0_1SameNameCreator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
|
||||
UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire");
|
||||
|
||||
m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
|
||||
InventoryItemBase foundItem1
|
||||
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
|
||||
|
||||
Assert.That(
|
||||
foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()),
|
||||
"Loaded item non-uuid creator doesn't match original");
|
||||
Assert.That(
|
||||
foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID),
|
||||
"Loaded item uuid creator doesn't match original");
|
||||
Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID),
|
||||
"Loaded item owner doesn't match inventory reciever");
|
||||
|
||||
AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
|
||||
string xmlData = Utils.BytesToString(asset1.Data);
|
||||
SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
|
||||
|
||||
Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID));
|
||||
}
|
||||
// /// <summary>
|
||||
// /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
||||
// /// an account exists with the same name as the creator, though not the same id.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void TestLoadIarV0_1SameNameCreator()
|
||||
// {
|
||||
// TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
//
|
||||
// UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
|
||||
// UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire");
|
||||
//
|
||||
// m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
|
||||
// InventoryItemBase foundItem1
|
||||
// = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
|
||||
//
|
||||
// Assert.That(
|
||||
// foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()),
|
||||
// "Loaded item non-uuid creator doesn't match original");
|
||||
// Assert.That(
|
||||
// foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID),
|
||||
// "Loaded item uuid creator doesn't match original");
|
||||
// Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID),
|
||||
// "Loaded item owner doesn't match inventory reciever");
|
||||
//
|
||||
// AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
|
||||
// string xmlData = Utils.BytesToString(asset1.Data);
|
||||
// SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
|
||||
//
|
||||
// Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID));
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
|
||||
|
||||
@@ -644,7 +644,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// an agent cannot teleport back to this region if it has teleported away.
|
||||
Thread.Sleep(2000);
|
||||
|
||||
sp.Scene.IncomingCloseAgent(sp.UUID);
|
||||
sp.Scene.IncomingCloseAgent(sp.UUID, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
protected string m_assetServerURL;
|
||||
protected HGAssetMapper m_assetMapper;
|
||||
|
||||
public HGUuidGatherer(HGAssetMapper assMap, IAssetService assetCache, string assetServerURL) : base(assetCache)
|
||||
public HGUuidGatherer(HGAssetMapper assMap, IAssetService assetService, string assetServerURL) : base(assetService)
|
||||
{
|
||||
m_assetMapper = assMap;
|
||||
m_assetServerURL = assetServerURL;
|
||||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
protected override AssetBase GetAsset(UUID uuid)
|
||||
{
|
||||
if (string.Empty == m_assetServerURL)
|
||||
return m_assetCache.Get(uuid.ToString());
|
||||
return base.GetAsset(uuid);
|
||||
else
|
||||
return m_assetMapper.FetchAsset(m_assetServerURL, uuid);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
{
|
||||
public class DynamicTexture : IDynamicTexture
|
||||
{
|
||||
public string InputCommands { get; private set; }
|
||||
public Uri InputUri { get; private set; }
|
||||
public string InputParams { get; private set; }
|
||||
public byte[] Data { get; private set; }
|
||||
public Size Size { get; private set; }
|
||||
public bool IsReuseable { get; private set; }
|
||||
|
||||
public DynamicTexture(string inputCommands, string inputParams, byte[] data, Size size, bool isReuseable)
|
||||
{
|
||||
InputCommands = inputCommands;
|
||||
InputParams = inputParams;
|
||||
Data = data;
|
||||
Size = size;
|
||||
IsReuseable = isReuseable;
|
||||
}
|
||||
|
||||
public DynamicTexture(Uri inputUri, string inputParams, byte[] data, Size size, bool isReuseable)
|
||||
{
|
||||
InputUri = inputUri;
|
||||
InputParams = inputParams;
|
||||
Data = data;
|
||||
Size = size;
|
||||
IsReuseable = isReuseable;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,13 +42,29 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
{
|
||||
public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
|
||||
{
|
||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private const int ALL_SIDES = -1;
|
||||
|
||||
public const int DISP_EXPIRE = 1;
|
||||
public const int DISP_TEMP = 2;
|
||||
|
||||
/// <summary>
|
||||
/// If true then where possible dynamic textures are reused.
|
||||
/// </summary>
|
||||
public bool ReuseTextures { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If false, then textures which have a low data size are not reused when ReuseTextures = true.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// LL viewers 3.3.4 and before appear to not fully render textures pulled from the viewer cache if those
|
||||
/// textures have a relatively high pixel surface but a small data size. Typically, this appears to happen
|
||||
/// if the data size is smaller than the viewer's discard level 2 size estimate. So if this is setting is
|
||||
/// false, textures smaller than the calculation in IsSizeReuseable are always regenerated rather than reused
|
||||
/// to work around this problem.</remarks>
|
||||
public bool ReuseLowDataTextures { get; set; }
|
||||
|
||||
private Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>();
|
||||
|
||||
private Dictionary<string, IDynamicTextureRender> RenderPlugins =
|
||||
@@ -56,6 +72,15 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
|
||||
private Dictionary<UUID, DynamicTextureUpdater> Updaters = new Dictionary<UUID, DynamicTextureUpdater>();
|
||||
|
||||
/// <summary>
|
||||
/// Record dynamic textures that we can reuse for a given data and parameter combination rather than
|
||||
/// regenerate.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Key is string.Format("{0}{1}", data
|
||||
/// </remarks>
|
||||
private Cache m_reuseableDynamicTextures;
|
||||
|
||||
#region IDynamicTextureManager Members
|
||||
|
||||
public void RegisterRender(string handleType, IDynamicTextureRender render)
|
||||
@@ -69,17 +94,17 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
/// <summary>
|
||||
/// Called by code which actually renders the dynamic texture to supply texture data.
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="data"></param>
|
||||
public void ReturnData(UUID id, byte[] data)
|
||||
/// <param name="updaterId"></param>
|
||||
/// <param name="texture"></param>
|
||||
public void ReturnData(UUID updaterId, IDynamicTexture texture)
|
||||
{
|
||||
DynamicTextureUpdater updater = null;
|
||||
|
||||
lock (Updaters)
|
||||
{
|
||||
if (Updaters.ContainsKey(id))
|
||||
if (Updaters.ContainsKey(updaterId))
|
||||
{
|
||||
updater = Updaters[id];
|
||||
updater = Updaters[updaterId];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +113,16 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
if (RegisteredScenes.ContainsKey(updater.SimUUID))
|
||||
{
|
||||
Scene scene = RegisteredScenes[updater.SimUUID];
|
||||
updater.DataReceived(data, scene);
|
||||
UUID newTextureID = updater.DataReceived(texture.Data, scene);
|
||||
|
||||
if (ReuseTextures
|
||||
&& !updater.BlendWithOldTexture
|
||||
&& texture.IsReuseable
|
||||
&& (ReuseLowDataTextures || IsDataSizeReuseable(texture)))
|
||||
{
|
||||
m_reuseableDynamicTextures.Store(
|
||||
GenerateReusableTextureKey(texture.InputCommands, texture.InputParams), newTextureID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +138,27 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the texture is reuseable based on its data size.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is a workaround for a viewer bug where very small data size textures relative to their pixel size
|
||||
/// are not redisplayed properly when pulled from cache. The calculation here is based on the typical discard
|
||||
/// level of 2, a 'rate' of 0.125 and 4 components (which makes for a factor of 0.5).
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
private bool IsDataSizeReuseable(IDynamicTexture texture)
|
||||
{
|
||||
// Console.WriteLine("{0} {1}", texture.Size.Width, texture.Size.Height);
|
||||
int discardLevel2DataThreshold = (int)Math.Ceiling((texture.Size.Width >> 2) * (texture.Size.Height >> 2) * 0.5);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[DYNAMIC TEXTURE MODULE]: Discard level 2 threshold {0}, texture data length {1}",
|
||||
// discardLevel2DataThreshold, texture.Data.Length);
|
||||
|
||||
return discardLevel2DataThreshold < texture.Data.Length;
|
||||
}
|
||||
|
||||
public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
|
||||
string extraParams, int updateTimer)
|
||||
{
|
||||
@@ -167,22 +222,61 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
|
||||
string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face)
|
||||
{
|
||||
if (RenderPlugins.ContainsKey(contentType))
|
||||
{
|
||||
DynamicTextureUpdater updater = new DynamicTextureUpdater();
|
||||
updater.SimUUID = simID;
|
||||
updater.PrimID = primID;
|
||||
updater.ContentType = contentType;
|
||||
updater.BodyData = data;
|
||||
updater.UpdateTimer = updateTimer;
|
||||
updater.UpdaterID = UUID.Random();
|
||||
updater.Params = extraParams;
|
||||
updater.BlendWithOldTexture = SetBlending;
|
||||
updater.FrontAlpha = AlphaValue;
|
||||
updater.Face = face;
|
||||
updater.Url = "Local image";
|
||||
updater.Disp = disp;
|
||||
if (!RenderPlugins.ContainsKey(contentType))
|
||||
return UUID.Zero;
|
||||
|
||||
Scene scene;
|
||||
RegisteredScenes.TryGetValue(simID, out scene);
|
||||
|
||||
if (scene == null)
|
||||
return UUID.Zero;
|
||||
|
||||
SceneObjectPart part = scene.GetSceneObjectPart(primID);
|
||||
|
||||
if (part == null)
|
||||
return UUID.Zero;
|
||||
|
||||
// If we want to reuse dynamic textures then we have to ignore any request from the caller to expire
|
||||
// them.
|
||||
if (ReuseTextures)
|
||||
disp = disp & ~DISP_EXPIRE;
|
||||
|
||||
DynamicTextureUpdater updater = new DynamicTextureUpdater();
|
||||
updater.SimUUID = simID;
|
||||
updater.PrimID = primID;
|
||||
updater.ContentType = contentType;
|
||||
updater.BodyData = data;
|
||||
updater.UpdateTimer = updateTimer;
|
||||
updater.UpdaterID = UUID.Random();
|
||||
updater.Params = extraParams;
|
||||
updater.BlendWithOldTexture = SetBlending;
|
||||
updater.FrontAlpha = AlphaValue;
|
||||
updater.Face = face;
|
||||
updater.Url = "Local image";
|
||||
updater.Disp = disp;
|
||||
|
||||
object objReusableTextureUUID = null;
|
||||
|
||||
if (ReuseTextures && !updater.BlendWithOldTexture)
|
||||
{
|
||||
string reuseableTextureKey = GenerateReusableTextureKey(data, extraParams);
|
||||
objReusableTextureUUID = m_reuseableDynamicTextures.Get(reuseableTextureKey);
|
||||
|
||||
if (objReusableTextureUUID != null)
|
||||
{
|
||||
// If something else has removed this temporary asset from the cache, detect and invalidate
|
||||
// our cached uuid.
|
||||
if (scene.AssetService.GetMetadata(objReusableTextureUUID.ToString()) == null)
|
||||
{
|
||||
m_reuseableDynamicTextures.Invalidate(reuseableTextureKey);
|
||||
objReusableTextureUUID = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We cannot reuse a dynamic texture if the data is going to be blended with something already there.
|
||||
if (objReusableTextureUUID == null)
|
||||
{
|
||||
lock (Updaters)
|
||||
{
|
||||
if (!Updaters.ContainsKey(updater.UpdaterID))
|
||||
@@ -191,11 +285,29 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
}
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[DYNAMIC TEXTURE MODULE]: Requesting generation of new dynamic texture for {0} in {1}",
|
||||
// part.Name, part.ParentGroup.Scene.Name);
|
||||
|
||||
RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
|
||||
return updater.UpdaterID;
|
||||
}
|
||||
|
||||
return UUID.Zero;
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[DYNAMIC TEXTURE MODULE]: Reusing cached texture {0} for {1} in {2}",
|
||||
// objReusableTextureUUID, part.Name, part.ParentGroup.Scene.Name);
|
||||
|
||||
// No need to add to updaters as the texture is always the same. Not that this functionality
|
||||
// apppears to be implemented anyway.
|
||||
updater.UpdatePart(part, (UUID)objReusableTextureUUID);
|
||||
}
|
||||
|
||||
return updater.UpdaterID;
|
||||
}
|
||||
|
||||
private string GenerateReusableTextureKey(string data, string extraParams)
|
||||
{
|
||||
return string.Format("{0}{1}", data, extraParams);
|
||||
}
|
||||
|
||||
public void GetDrawStringSize(string contentType, string text, string fontName, int fontSize,
|
||||
@@ -215,6 +327,13 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
IConfig texturesConfig = config.Configs["Textures"];
|
||||
if (texturesConfig != null)
|
||||
{
|
||||
ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false);
|
||||
ReuseLowDataTextures = texturesConfig.GetBoolean("ReuseDynamicLowDataTextures", false);
|
||||
}
|
||||
|
||||
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||
{
|
||||
RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
|
||||
@@ -224,6 +343,11 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (ReuseTextures)
|
||||
{
|
||||
m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);
|
||||
m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
@@ -268,10 +392,61 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
BodyData = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the given part with the new texture.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The old texture UUID.
|
||||
/// </returns>
|
||||
public UUID UpdatePart(SceneObjectPart part, UUID textureID)
|
||||
{
|
||||
UUID oldID;
|
||||
|
||||
lock (part)
|
||||
{
|
||||
// mostly keep the values from before
|
||||
Primitive.TextureEntry tmptex = part.Shape.Textures;
|
||||
|
||||
// FIXME: Need to return the appropriate ID if only a single face is replaced.
|
||||
oldID = tmptex.DefaultTexture.TextureID;
|
||||
|
||||
if (Face == ALL_SIDES)
|
||||
{
|
||||
oldID = tmptex.DefaultTexture.TextureID;
|
||||
tmptex.DefaultTexture.TextureID = textureID;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face);
|
||||
texface.TextureID = textureID;
|
||||
tmptex.FaceTextures[Face] = texface;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
tmptex.DefaultTexture.TextureID = textureID;
|
||||
}
|
||||
}
|
||||
|
||||
// I'm pretty sure we always want to force this to true
|
||||
// I'm pretty sure noone whats to set fullbright true if it wasn't true before.
|
||||
// tmptex.DefaultTexture.Fullbright = true;
|
||||
|
||||
part.UpdateTextureEntry(tmptex.GetBytes());
|
||||
}
|
||||
|
||||
return oldID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called once new texture data has been received for this updater.
|
||||
/// </summary>
|
||||
public void DataReceived(byte[] data, Scene scene)
|
||||
/// <param name="data"></param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="isReuseable">True if the data given is reuseable.</param>
|
||||
/// <returns>The asset UUID given to the incoming data.</returns>
|
||||
public UUID DataReceived(byte[] data, Scene scene)
|
||||
{
|
||||
SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
|
||||
|
||||
@@ -281,7 +456,8 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
String.Format("DynamicTextureModule: Error preparing image using URL {0}", Url);
|
||||
scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Say,
|
||||
0, part.ParentGroup.RootPart.AbsolutePosition, part.Name, part.UUID, false);
|
||||
return;
|
||||
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
byte[] assetData = null;
|
||||
@@ -319,56 +495,29 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
|
||||
if (cacheLayerDecode != null)
|
||||
{
|
||||
cacheLayerDecode.Decode(asset.FullID, asset.Data);
|
||||
cacheLayerDecode = null;
|
||||
if (!cacheLayerDecode.Decode(asset.FullID, asset.Data))
|
||||
m_log.WarnFormat(
|
||||
"[DYNAMIC TEXTURE MODULE]: Decoding of dynamically generated asset {0} for {1} in {2} failed",
|
||||
asset.ID, part.Name, part.ParentGroup.Scene.Name);
|
||||
}
|
||||
|
||||
UUID oldID = UUID.Zero;
|
||||
|
||||
lock (part)
|
||||
{
|
||||
// mostly keep the values from before
|
||||
Primitive.TextureEntry tmptex = part.Shape.Textures;
|
||||
|
||||
// remove the old asset from the cache
|
||||
oldID = tmptex.DefaultTexture.TextureID;
|
||||
|
||||
if (Face == ALL_SIDES)
|
||||
{
|
||||
tmptex.DefaultTexture.TextureID = asset.FullID;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face);
|
||||
texface.TextureID = asset.FullID;
|
||||
tmptex.FaceTextures[Face] = texface;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
tmptex.DefaultTexture.TextureID = asset.FullID;
|
||||
}
|
||||
}
|
||||
|
||||
// I'm pretty sure we always want to force this to true
|
||||
// I'm pretty sure noone whats to set fullbright true if it wasn't true before.
|
||||
// tmptex.DefaultTexture.Fullbright = true;
|
||||
|
||||
part.UpdateTextureEntry(tmptex.GetBytes());
|
||||
}
|
||||
UUID oldID = UpdatePart(part, asset.FullID);
|
||||
|
||||
if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0))
|
||||
{
|
||||
if (oldAsset == null) oldAsset = scene.AssetService.Get(oldID.ToString());
|
||||
if (oldAsset == null)
|
||||
oldAsset = scene.AssetService.Get(oldID.ToString());
|
||||
|
||||
if (oldAsset != null)
|
||||
{
|
||||
if (oldAsset.Temporary == true)
|
||||
if (oldAsset.Temporary)
|
||||
{
|
||||
scene.AssetService.Delete(oldID.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return asset.FullID;
|
||||
}
|
||||
|
||||
private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha)
|
||||
|
||||
@@ -32,6 +32,7 @@ using System.Net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Imaging;
|
||||
using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using log4net;
|
||||
@@ -67,12 +68,18 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte[] ConvertUrl(string url, string extraParams)
|
||||
// public bool AlwaysIdenticalConversion(string bodyData, string extraParams)
|
||||
// {
|
||||
// // We don't support conversion of body data.
|
||||
// return false;
|
||||
// }
|
||||
|
||||
public IDynamicTexture ConvertUrl(string url, string extraParams)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] ConvertStream(Stream data, string extraParams)
|
||||
public IDynamicTexture ConvertData(string bodyData, string extraParams)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -165,11 +172,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
||||
|
||||
private void HttpRequestReturn(IAsyncResult result)
|
||||
{
|
||||
|
||||
RequestState state = (RequestState) result.AsyncState;
|
||||
WebRequest request = (WebRequest) state.Request;
|
||||
Stream stream = null;
|
||||
byte[] imageJ2000 = new byte[0];
|
||||
Size newSize = new Size(0, 0);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -182,37 +189,43 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
||||
try
|
||||
{
|
||||
Bitmap image = new Bitmap(stream);
|
||||
Size newsize;
|
||||
|
||||
// TODO: make this a bit less hard coded
|
||||
if ((image.Height < 64) && (image.Width < 64))
|
||||
{
|
||||
newsize = new Size(32, 32);
|
||||
newSize.Width = 32;
|
||||
newSize.Height = 32;
|
||||
}
|
||||
else if ((image.Height < 128) && (image.Width < 128))
|
||||
{
|
||||
newsize = new Size(64, 64);
|
||||
newSize.Width = 64;
|
||||
newSize.Height = 64;
|
||||
}
|
||||
else if ((image.Height < 256) && (image.Width < 256))
|
||||
{
|
||||
newsize = new Size(128, 128);
|
||||
newSize.Width = 128;
|
||||
newSize.Height = 128;
|
||||
}
|
||||
else if ((image.Height < 512 && image.Width < 512))
|
||||
{
|
||||
newsize = new Size(256, 256);
|
||||
newSize.Width = 256;
|
||||
newSize.Height = 256;
|
||||
}
|
||||
else if ((image.Height < 1024 && image.Width < 1024))
|
||||
{
|
||||
newsize = new Size(512, 512);
|
||||
newSize.Width = 512;
|
||||
newSize.Height = 512;
|
||||
}
|
||||
else
|
||||
{
|
||||
newsize = new Size(1024, 1024);
|
||||
newSize.Width = 1024;
|
||||
newSize.Height = 1024;
|
||||
}
|
||||
|
||||
Bitmap resize = new Bitmap(image, newsize);
|
||||
|
||||
imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
|
||||
using (Bitmap resize = new Bitmap(image, newSize))
|
||||
{
|
||||
imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -227,7 +240,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -236,9 +248,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
||||
stream.Close();
|
||||
}
|
||||
}
|
||||
m_log.DebugFormat("[LOADIMAGEURLMODULE] Returning {0} bytes of image data for request {1}",
|
||||
|
||||
m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}",
|
||||
imageJ2000.Length, state.RequestID);
|
||||
m_textureManager.ReturnData(state.RequestID, imageJ2000);
|
||||
|
||||
m_textureManager.ReturnData(
|
||||
state.RequestID,
|
||||
new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture(
|
||||
request.RequestUri, null, imageJ2000, newSize, false));
|
||||
}
|
||||
|
||||
#region Nested type: RequestState
|
||||
|
||||
@@ -45,31 +45,292 @@ using OpenSim.Tests.Common.Mock;
|
||||
namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class VectorRenderModuleTests
|
||||
public class VectorRenderModuleTests : OpenSimTestCase
|
||||
{
|
||||
Scene m_scene;
|
||||
DynamicTextureModule m_dtm;
|
||||
VectorRenderModule m_vrm;
|
||||
|
||||
private void SetupScene(bool reuseTextures)
|
||||
{
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
|
||||
m_dtm = new DynamicTextureModule();
|
||||
m_dtm.ReuseTextures = reuseTextures;
|
||||
// m_dtm.ReuseLowDataTextures = reuseTextures;
|
||||
|
||||
m_vrm = new VectorRenderModule();
|
||||
|
||||
SceneHelpers.SetupSceneModules(m_scene, m_dtm, m_vrm);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDraw()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
DynamicTextureModule dtm = new DynamicTextureModule();
|
||||
VectorRenderModule vrm = new VectorRenderModule();
|
||||
SceneHelpers.SetupSceneModules(scene, dtm, vrm);
|
||||
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene);
|
||||
SetupScene(false);
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||
UUID originalTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
|
||||
|
||||
dtm.AddDynamicTextureData(
|
||||
scene.RegionInfo.RegionID,
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
vrm.GetContentType(),
|
||||
m_vrm.GetContentType(),
|
||||
"PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;",
|
||||
"",
|
||||
0);
|
||||
|
||||
Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRepeatSameDraw()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;";
|
||||
|
||||
SetupScene(false);
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"",
|
||||
0);
|
||||
|
||||
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"",
|
||||
0);
|
||||
|
||||
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRepeatSameDrawDifferentExtraParams()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;";
|
||||
|
||||
SetupScene(false);
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"",
|
||||
0);
|
||||
|
||||
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"alpha:250",
|
||||
0);
|
||||
|
||||
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRepeatSameDrawContainingImage()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string dtText
|
||||
= "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://localhost/shouldnotexist.png";
|
||||
|
||||
SetupScene(false);
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"",
|
||||
0);
|
||||
|
||||
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"",
|
||||
0);
|
||||
|
||||
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDrawReusingTexture()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
SetupScene(true);
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||
UUID originalTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
"PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;",
|
||||
"",
|
||||
0);
|
||||
|
||||
Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRepeatSameDrawReusingTexture()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;";
|
||||
|
||||
SetupScene(true);
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"",
|
||||
0);
|
||||
|
||||
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"",
|
||||
0);
|
||||
|
||||
Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test a low data dynamically generated texture such that it is treated as a low data texture that causes
|
||||
/// problems for current viewers.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// As we do not set DynamicTextureModule.ReuseLowDataTextures = true in this test, it should not reuse the
|
||||
/// texture
|
||||
/// </remarks>
|
||||
[Test]
|
||||
public void TestRepeatSameDrawLowDataTexture()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;";
|
||||
|
||||
SetupScene(true);
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"1024",
|
||||
0);
|
||||
|
||||
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"1024",
|
||||
0);
|
||||
|
||||
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRepeatSameDrawDifferentExtraParamsReusingTexture()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;";
|
||||
|
||||
SetupScene(true);
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"",
|
||||
0);
|
||||
|
||||
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"alpha:250",
|
||||
0);
|
||||
|
||||
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRepeatSameDrawContainingImageReusingTexture()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string dtText
|
||||
= "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World; Image http://localhost/shouldnotexist.png";
|
||||
|
||||
SetupScene(true);
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"",
|
||||
0);
|
||||
|
||||
UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
|
||||
|
||||
m_dtm.AddDynamicTextureData(
|
||||
m_scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_vrm.GetContentType(),
|
||||
dtText,
|
||||
"",
|
||||
0);
|
||||
|
||||
Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,10 +30,12 @@ using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Imaging;
|
||||
using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using log4net;
|
||||
@@ -45,9 +47,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
{
|
||||
public class VectorRenderModule : IRegionModule, IDynamicTextureRender
|
||||
{
|
||||
// These fields exist for testing purposes, please do not remove.
|
||||
// private static bool s_flipper;
|
||||
// private static byte[] s_asset1Data;
|
||||
// private static byte[] s_asset2Data;
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private string m_name = "VectorRenderModule";
|
||||
private Scene m_scene;
|
||||
private IDynamicTextureManager m_textureManager;
|
||||
private Graphics m_graph;
|
||||
@@ -61,12 +67,12 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
|
||||
public string GetContentType()
|
||||
{
|
||||
return ("vector");
|
||||
return "vector";
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return m_name;
|
||||
return Name;
|
||||
}
|
||||
|
||||
public bool SupportsAsynchronous()
|
||||
@@ -74,14 +80,20 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte[] ConvertUrl(string url, string extraParams)
|
||||
// public bool AlwaysIdenticalConversion(string bodyData, string extraParams)
|
||||
// {
|
||||
// string[] lines = GetLines(bodyData);
|
||||
// return lines.Any((str, r) => str.StartsWith("Image"));
|
||||
// }
|
||||
|
||||
public IDynamicTexture ConvertUrl(string url, string extraParams)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] ConvertStream(Stream data, string extraParams)
|
||||
public IDynamicTexture ConvertData(string bodyData, string extraParams)
|
||||
{
|
||||
return null;
|
||||
return Draw(bodyData, extraParams);
|
||||
}
|
||||
|
||||
public bool AsyncConvertUrl(UUID id, string url, string extraParams)
|
||||
@@ -91,21 +103,28 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
|
||||
public bool AsyncConvertData(UUID id, string bodyData, string extraParams)
|
||||
{
|
||||
Draw(bodyData, id, extraParams);
|
||||
// XXX: This isn't actually being done asynchronously!
|
||||
m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void GetDrawStringSize(string text, string fontName, int fontSize,
|
||||
out double xSize, out double ySize)
|
||||
{
|
||||
using (Font myFont = new Font(fontName, fontSize))
|
||||
lock (this)
|
||||
{
|
||||
SizeF stringSize = new SizeF();
|
||||
lock (m_graph)
|
||||
using (Font myFont = new Font(fontName, fontSize))
|
||||
{
|
||||
stringSize = m_graph.MeasureString(text, myFont);
|
||||
xSize = stringSize.Width;
|
||||
ySize = stringSize.Height;
|
||||
SizeF stringSize = new SizeF();
|
||||
|
||||
// XXX: This lock may be unnecessary.
|
||||
lock (m_graph)
|
||||
{
|
||||
stringSize = m_graph.MeasureString(text, myFont);
|
||||
xSize = stringSize.Width;
|
||||
ySize = stringSize.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,6 +163,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
{
|
||||
m_textureManager.RegisterRender(GetContentType(), this);
|
||||
}
|
||||
|
||||
// This code exists for testing purposes, please do not remove.
|
||||
// s_asset1Data = m_scene.AssetService.Get("00000000-0000-1111-9999-000000000001").Data;
|
||||
// s_asset1Data = m_scene.AssetService.Get("9f4acf0d-1841-4e15-bdb8-3a12efc9dd8f").Data;
|
||||
|
||||
// Terrain dirt - smallest bin/assets file (6004 bytes)
|
||||
// s_asset2Data = m_scene.AssetService.Get("b8d3965a-ad78-bf43-699b-bff8eca6c975").Data;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
@@ -152,7 +178,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return m_name; }
|
||||
get { return "VectorRenderModule"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
@@ -162,7 +188,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
|
||||
#endregion
|
||||
|
||||
private void Draw(string data, UUID id, string extraParams)
|
||||
private IDynamicTexture Draw(string data, string extraParams)
|
||||
{
|
||||
// We need to cater for old scripts that didnt use extraParams neatly, they use either an integer size which represents both width and height, or setalpha
|
||||
// we will now support multiple comma seperated params in the form width:256,height:512,alpha:255
|
||||
@@ -305,40 +331,57 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
|
||||
Bitmap bitmap = null;
|
||||
Graphics graph = null;
|
||||
bool reuseable = false;
|
||||
|
||||
try
|
||||
{
|
||||
if (alpha == 256)
|
||||
bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
|
||||
else
|
||||
bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
|
||||
graph = Graphics.FromImage(bitmap);
|
||||
|
||||
// this is really just to save people filling the
|
||||
// background color in their scripts, only do when fully opaque
|
||||
if (alpha >= 255)
|
||||
// XXX: In testing, it appears that if multiple threads dispose of separate GDI+ objects simultaneously,
|
||||
// the native malloc heap can become corrupted, possibly due to a double free(). This may be due to
|
||||
// bugs in the underlying libcairo used by mono's libgdiplus.dll on Linux/OSX. These problems were
|
||||
// seen with both libcario 1.10.2-6.1ubuntu3 and 1.8.10-2ubuntu1. They go away if disposal is perfomed
|
||||
// under lock.
|
||||
lock (this)
|
||||
{
|
||||
using (SolidBrush bgFillBrush = new SolidBrush(bgColor))
|
||||
{
|
||||
graph.FillRectangle(bgFillBrush, 0, 0, width, height);
|
||||
}
|
||||
}
|
||||
if (alpha == 256)
|
||||
bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
|
||||
else
|
||||
bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
|
||||
for (int w = 0; w < bitmap.Width; w++)
|
||||
{
|
||||
if (alpha <= 255)
|
||||
graph = Graphics.FromImage(bitmap);
|
||||
|
||||
// this is really just to save people filling the
|
||||
// background color in their scripts, only do when fully opaque
|
||||
if (alpha >= 255)
|
||||
{
|
||||
for (int h = 0; h < bitmap.Height; h++)
|
||||
using (SolidBrush bgFillBrush = new SolidBrush(bgColor))
|
||||
{
|
||||
bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h)));
|
||||
graph.FillRectangle(bgFillBrush, 0, 0, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
for (int w = 0; w < bitmap.Width; w++)
|
||||
{
|
||||
if (alpha <= 255)
|
||||
{
|
||||
for (int h = 0; h < bitmap.Height; h++)
|
||||
{
|
||||
bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GDIDraw(data, graph, altDataDelim, out reuseable);
|
||||
}
|
||||
|
||||
GDIDraw(data, graph, altDataDelim);
|
||||
|
||||
byte[] imageJ2000 = new byte[0];
|
||||
|
||||
// This code exists for testing purposes, please do not remove.
|
||||
// if (s_flipper)
|
||||
// imageJ2000 = s_asset1Data;
|
||||
// else
|
||||
// imageJ2000 = s_asset2Data;
|
||||
//
|
||||
// s_flipper = !s_flipper;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -351,15 +394,24 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
m_textureManager.ReturnData(id, imageJ2000);
|
||||
return new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture(
|
||||
data, extraParams, imageJ2000, new Size(width, height), reuseable);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (graph != null)
|
||||
graph.Dispose();
|
||||
|
||||
if (bitmap != null)
|
||||
bitmap.Dispose();
|
||||
// XXX: In testing, it appears that if multiple threads dispose of separate GDI+ objects simultaneously,
|
||||
// the native malloc heap can become corrupted, possibly due to a double free(). This may be due to
|
||||
// bugs in the underlying libcairo used by mono's libgdiplus.dll on Linux/OSX. These problems were
|
||||
// seen with both libcario 1.10.2-6.1ubuntu3 and 1.8.10-2ubuntu1. They go away if disposal is perfomed
|
||||
// under lock.
|
||||
lock (this)
|
||||
{
|
||||
if (graph != null)
|
||||
graph.Dispose();
|
||||
|
||||
if (bitmap != null)
|
||||
bitmap.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,8 +470,21 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
}
|
||||
*/
|
||||
|
||||
private void GDIDraw(string data, Graphics graph, char dataDelim)
|
||||
/// <summary>
|
||||
/// Split input data into discrete command lines.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <param name='data'></param>
|
||||
/// <param name='dataDelim'></param>
|
||||
private string[] GetLines(string data, char dataDelim)
|
||||
{
|
||||
char[] lineDelimiter = { dataDelim };
|
||||
return data.Split(lineDelimiter);
|
||||
}
|
||||
|
||||
private void GDIDraw(string data, Graphics graph, char dataDelim, out bool reuseable)
|
||||
{
|
||||
reuseable = true;
|
||||
Point startPoint = new Point(0, 0);
|
||||
Point endPoint = new Point(0, 0);
|
||||
Pen drawPen = null;
|
||||
@@ -434,11 +499,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
myFont = new Font(fontName, fontSize);
|
||||
myBrush = new SolidBrush(Color.Black);
|
||||
|
||||
char[] lineDelimiter = {dataDelim};
|
||||
char[] partsDelimiter = {','};
|
||||
string[] lines = data.Split(lineDelimiter);
|
||||
|
||||
foreach (string line in lines)
|
||||
foreach (string line in GetLines(data, dataDelim))
|
||||
{
|
||||
string nextLine = line.Trim();
|
||||
//replace with switch, or even better, do some proper parsing
|
||||
@@ -469,6 +532,10 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
|
||||
}
|
||||
else if (nextLine.StartsWith("Image"))
|
||||
{
|
||||
// We cannot reuse any generated texture involving fetching an image via HTTP since that image
|
||||
// can change.
|
||||
reuseable = false;
|
||||
|
||||
float x = 0;
|
||||
float y = 0;
|
||||
GetParams(partsDelimiter, ref nextLine, 5, ref x, ref y);
|
||||
|
||||
@@ -204,8 +204,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||
public byte[] GetData(string id)
|
||||
{
|
||||
// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Requesting data for asset {0}", id);
|
||||
|
||||
AssetBase asset = m_Cache.Get(id);
|
||||
|
||||
AssetBase asset = null;
|
||||
|
||||
if (m_Cache != null)
|
||||
asset = m_Cache.Get(id);
|
||||
|
||||
if (asset != null)
|
||||
return asset.Data;
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using log4net.Config;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class AssetConnectorsTests : OpenSimTestCase
|
||||
{
|
||||
[Test]
|
||||
public void TestAddAsset()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
IConfigSource config = new IniConfigSource();
|
||||
config.AddConfig("Modules");
|
||||
config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
|
||||
config.AddConfig("AssetService");
|
||||
config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
|
||||
config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
|
||||
|
||||
LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
|
||||
lasc.Initialise(config);
|
||||
|
||||
AssetBase a1 = AssetHelpers.CreateNotecardAsset();
|
||||
lasc.Store(a1);
|
||||
|
||||
AssetBase retreivedA1 = lasc.Get(a1.ID);
|
||||
Assert.That(retreivedA1.ID, Is.EqualTo(a1.ID));
|
||||
Assert.That(retreivedA1.Metadata.ID, Is.EqualTo(a1.Metadata.ID));
|
||||
Assert.That(retreivedA1.Data.Length, Is.EqualTo(a1.Data.Length));
|
||||
|
||||
AssetMetadata retrievedA1Metadata = lasc.GetMetadata(a1.ID);
|
||||
Assert.That(retrievedA1Metadata.ID, Is.EqualTo(a1.ID));
|
||||
|
||||
byte[] retrievedA1Data = lasc.GetData(a1.ID);
|
||||
Assert.That(retrievedA1Data.Length, Is.EqualTo(a1.Data.Length));
|
||||
|
||||
// TODO: Add cache and check that this does receive a copy of the asset
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddTemporaryAsset()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
IConfigSource config = new IniConfigSource();
|
||||
config.AddConfig("Modules");
|
||||
config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
|
||||
config.AddConfig("AssetService");
|
||||
config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
|
||||
config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
|
||||
|
||||
LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
|
||||
lasc.Initialise(config);
|
||||
|
||||
AssetBase a1 = AssetHelpers.CreateNotecardAsset();
|
||||
a1.Temporary = true;
|
||||
|
||||
lasc.Store(a1);
|
||||
|
||||
Assert.That(lasc.Get(a1.ID), Is.Null);
|
||||
Assert.That(lasc.GetData(a1.ID), Is.Null);
|
||||
Assert.That(lasc.GetMetadata(a1.ID), Is.Null);
|
||||
|
||||
// TODO: Add cache and check that this does receive a copy of the asset
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddLocalAsset()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
IConfigSource config = new IniConfigSource();
|
||||
config.AddConfig("Modules");
|
||||
config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
|
||||
config.AddConfig("AssetService");
|
||||
config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
|
||||
config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
|
||||
|
||||
LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
|
||||
lasc.Initialise(config);
|
||||
|
||||
AssetBase a1 = AssetHelpers.CreateNotecardAsset();
|
||||
a1.Local = true;
|
||||
|
||||
lasc.Store(a1);
|
||||
|
||||
Assert.That(lasc.Get(a1.ID), Is.Null);
|
||||
Assert.That(lasc.GetData(a1.ID), Is.Null);
|
||||
Assert.That(lasc.GetMetadata(a1.ID), Is.Null);
|
||||
|
||||
// TODO: Add cache and check that this does receive a copy of the asset
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ using OpenSim.Tests.Common;
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class GridConnectorsTests
|
||||
public class GridConnectorsTests : OpenSimTestCase
|
||||
{
|
||||
LocalGridServicesConnector m_LocalConnector;
|
||||
private void SetUp()
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||
|
||||
Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id); });
|
||||
Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id, false); });
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ using RegionSettings = OpenSim.Framework.RegionSettings;
|
||||
namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class ArchiverTests
|
||||
public class ArchiverTests : OpenSimTestCase
|
||||
{
|
||||
private Guid m_lastRequestId;
|
||||
private string m_lastErrorMessage;
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
/// without recounting the whole sim.
|
||||
///
|
||||
/// We start out tainted so that the first get call resets the various prim counts.
|
||||
/// <value>
|
||||
/// </value>
|
||||
private bool m_Tainted = true;
|
||||
|
||||
private Object m_TaintLock = new Object();
|
||||
|
||||
@@ -85,13 +85,15 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
||||
dis = 0;
|
||||
}
|
||||
|
||||
float thisSpGain;
|
||||
|
||||
// Scale by distance
|
||||
if (radius == 0)
|
||||
gain = (float)((double)gain * ((100.0 - dis) / 100.0));
|
||||
thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0));
|
||||
else
|
||||
gain = (float)((double)gain * ((radius - dis) / radius));
|
||||
thisSpGain = (float)((double)gain * ((radius - dis) / radius));
|
||||
|
||||
sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
|
||||
sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using OpenMetaverse;
|
||||
|
||||
@@ -33,7 +35,14 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
public interface IDynamicTextureManager
|
||||
{
|
||||
void RegisterRender(string handleType, IDynamicTextureRender render);
|
||||
void ReturnData(UUID id, byte[] data);
|
||||
|
||||
/// <summary>
|
||||
/// Used by IDynamicTextureRender implementations to return renders
|
||||
/// </summary>
|
||||
/// <param name='id'></param>
|
||||
/// <param name='data'></param>
|
||||
/// <param name='isReuseable'></param>
|
||||
void ReturnData(UUID id, IDynamicTexture texture);
|
||||
|
||||
UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams,
|
||||
int updateTimer);
|
||||
@@ -113,11 +122,65 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
string GetName();
|
||||
string GetContentType();
|
||||
bool SupportsAsynchronous();
|
||||
byte[] ConvertUrl(string url, string extraParams);
|
||||
byte[] ConvertStream(Stream data, string extraParams);
|
||||
|
||||
// /// <summary>
|
||||
// /// Return true if converting the input body and extra params data will always result in the same byte[] array
|
||||
// /// </summary>
|
||||
// /// <remarks>
|
||||
// /// This method allows the caller to use a previously generated asset if it has one.
|
||||
// /// </remarks>
|
||||
// /// <returns></returns>
|
||||
// /// <param name='bodyData'></param>
|
||||
// /// <param name='extraParams'></param>
|
||||
// bool AlwaysIdenticalConversion(string bodyData, string extraParams);
|
||||
|
||||
IDynamicTexture ConvertUrl(string url, string extraParams);
|
||||
IDynamicTexture ConvertData(string bodyData, string extraParams);
|
||||
|
||||
bool AsyncConvertUrl(UUID id, string url, string extraParams);
|
||||
bool AsyncConvertData(UUID id, string bodyData, string extraParams);
|
||||
|
||||
void GetDrawStringSize(string text, string fontName, int fontSize,
|
||||
out double xSize, out double ySize);
|
||||
}
|
||||
|
||||
public interface IDynamicTexture
|
||||
{
|
||||
/// <summary>
|
||||
/// Input commands used to generate this data.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Null if input commands were not used.
|
||||
/// </remarks>
|
||||
string InputCommands { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Uri used to generate this data.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Null if a uri was not used.
|
||||
/// </remarks>
|
||||
Uri InputUri { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Extra input params used to generate this data.
|
||||
/// </summary>
|
||||
string InputParams { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Texture data.
|
||||
/// </summary>
|
||||
byte[] Data { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Size of texture.
|
||||
/// </summary>
|
||||
Size Size { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Signal whether the texture is reuseable (i.e. whether the same input data will always generate the same
|
||||
/// texture).
|
||||
/// </summary>
|
||||
bool IsReuseable { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
|
||||
public interface IJsonStoreModule
|
||||
{
|
||||
bool CreateStore(string value, out UUID result);
|
||||
bool CreateStore(string value, ref UUID result);
|
||||
bool DestroyStore(UUID storeID);
|
||||
bool TestPath(UUID storeID, string path, bool useJson);
|
||||
bool SetValue(UUID storeID, string path, string value, bool useJson);
|
||||
|
||||
@@ -46,9 +46,31 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// </summary>
|
||||
event ScriptCommand OnScriptCommand;
|
||||
|
||||
/// <summary>
|
||||
/// Register an instance method as a script call by method name
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="method"></param>
|
||||
void RegisterScriptInvocation(object target, string method);
|
||||
|
||||
/// <summary>
|
||||
/// Register an instance method as a script call by method info
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="method"></param>
|
||||
void RegisterScriptInvocation(object target, MethodInfo method);
|
||||
|
||||
/// <summary>
|
||||
/// Register one or more instance methods as script calls by method name
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="methods"></param>
|
||||
void RegisterScriptInvocation(object target, string[] methods);
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array of all registered script calls
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Delegate[] GetScriptInvocationList();
|
||||
|
||||
Delegate LookupScriptInvocation(string fname);
|
||||
|
||||
@@ -47,26 +47,71 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public delegate void OnFrameDelegate();
|
||||
|
||||
/// <summary>
|
||||
/// Triggered on each sim frame.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.Update"/>
|
||||
/// Core uses it for things like Sun, Wind & Clouds
|
||||
/// The MRM module also uses it.
|
||||
/// </remarks>
|
||||
public event OnFrameDelegate OnFrame;
|
||||
|
||||
public delegate void ClientMovement(ScenePresence client);
|
||||
|
||||
/// <summary>
|
||||
/// Trigerred when an agent moves.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.ScenePresence.HandleAgentUpdate"/>
|
||||
/// prior to <see cref="OpenSim.Region.Framework.Scenes.ScenePresence.TriggerScenePresenceUpdated"/>
|
||||
/// </remarks>
|
||||
public event ClientMovement OnClientMovement;
|
||||
|
||||
public delegate void OnTerrainTaintedDelegate();
|
||||
|
||||
/// <summary>
|
||||
/// Triggered if the terrain has been edited
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This gets triggered in <see cref="OpenSim.Region.CoreModules.World.Terrain.CheckForTerrainUpdates"/>
|
||||
/// after it determines that an update has been made.
|
||||
/// </remarks>
|
||||
public event OnTerrainTaintedDelegate OnTerrainTainted;
|
||||
|
||||
public delegate void OnTerrainTickDelegate();
|
||||
|
||||
/// <summary>
|
||||
/// Triggered if the terrain has been edited
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.UpdateTerrain"/>
|
||||
/// but is used by core solely to update the physics engine.
|
||||
/// </remarks>
|
||||
public event OnTerrainTickDelegate OnTerrainTick;
|
||||
|
||||
public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a region is backed up/persisted to storage
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This gets triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.Backup"/>
|
||||
/// and is fired before the persistence occurs.
|
||||
/// </remarks>
|
||||
public event OnBackupDelegate OnBackup;
|
||||
|
||||
public delegate void OnClientConnectCoreDelegate(IClientCore client);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a new client connects to the scene.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This gets triggered in <see cref="TriggerOnNewClient"/>,
|
||||
/// which checks if an instance of <see cref="OpenSim.Framework.IClientAPI"/>
|
||||
/// also implements <see cref="OpenSim.Framework.Client.IClientCore"/> and as such,
|
||||
/// is not triggered by <see cref="OpenSim.Region.OptionalModules.World.NPC">NPCs</see>.
|
||||
/// </remarks>
|
||||
public event OnClientConnectCoreDelegate OnClientConnect;
|
||||
|
||||
public delegate void OnNewClientDelegate(IClientAPI client);
|
||||
@@ -87,22 +132,74 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public delegate void OnNewPresenceDelegate(ScenePresence presence);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a new presence is added to the scene
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both
|
||||
/// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
|
||||
/// </remarks>
|
||||
public event OnNewPresenceDelegate OnNewPresence;
|
||||
|
||||
public delegate void OnRemovePresenceDelegate(UUID agentId);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a presence is removed from the scene
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/> which is used by both
|
||||
/// <see cref="OpenSim.Framework.PresenceType.User">users</see> and <see cref="OpenSim.Framework.PresenceType.Npc">NPCs</see>
|
||||
/// </remarks>
|
||||
public event OnRemovePresenceDelegate OnRemovePresence;
|
||||
|
||||
public delegate void OnParcelPrimCountUpdateDelegate();
|
||||
|
||||
/// <summary>
|
||||
/// Triggered whenever the prim count may have been altered, or prior
|
||||
/// to an action that requires the current prim count to be accurate.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerParcelPrimCountUpdate"/> in
|
||||
/// <see cref="OpenSim.OpenSimBase.CreateRegion"/>,
|
||||
/// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.EventManagerOnRequestParcelPrimCountUpdate"/>,
|
||||
/// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ClientOnParcelObjectOwnerRequest"/>,
|
||||
/// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.GetPrimsFree"/>,
|
||||
/// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.UpdateLandSold"/>,
|
||||
/// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.DeedToGroup"/>,
|
||||
/// <see cref="OpenSim.Region.CoreModules.World.Land.LandObject.SendLandUpdateToClient"/>
|
||||
/// </remarks>
|
||||
public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
|
||||
|
||||
public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered in response to <see cref="OnParcelPrimCountUpdate"/> for
|
||||
/// objects that actually contribute to parcel prim count.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerParcelPrimCountAdd"/> in
|
||||
/// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.EventManagerOnParcelPrimCountUpdate"/>
|
||||
/// </remarks>
|
||||
public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
|
||||
|
||||
public delegate void OnPluginConsoleDelegate(string[] args);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered after <see cref="OpenSim.IApplicationPlugin.PostInitialise"/>
|
||||
/// has been called for all <see cref="OpenSim.IApplicationPlugin"/>
|
||||
/// loaded via <see cref="OpenSim.OpenSimBase.LoadPlugins"/>.
|
||||
/// Handlers for this event are typically used to parse the arguments
|
||||
/// from <see cref="OnPluginConsoleDelegate"/> in order to process or
|
||||
/// filter the arguments and pass them onto <see cref="OpenSim.Region.CoreModules.Framework.InterfaceCommander.Commander.ProcessConsoleCommand"/>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerOnPluginConsole"/> in
|
||||
/// <see cref="Scene.SendCommandToPlugins"/> via
|
||||
/// <see cref="SceneManager.SendCommandToPluginModules"/> via
|
||||
/// <see cref="OpenSim.OpenSimBase.HandleCommanderCommand"/> via
|
||||
/// <see cref="OpenSim.OpenSimBase.AddPluginCommands"/> via
|
||||
/// <see cref="OpenSim.OpenSimBase.StartupSpecific"/>
|
||||
/// </remarks>
|
||||
public event OnPluginConsoleDelegate OnPluginConsole;
|
||||
|
||||
/// <summary>
|
||||
@@ -117,8 +214,28 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered before the grunt work for adding a root agent to a
|
||||
/// scene has been performed (resuming attachment scripts, physics,
|
||||
/// animations etc.)
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered before <see cref="OnMakeRootAgent"/>
|
||||
/// by <see cref="TriggerSetRootAgentScene"/>
|
||||
/// in <see cref="ScenePresence.MakeRootAgent"/>
|
||||
/// via <see cref="Scene.AgentCrossing"/>
|
||||
/// and <see cref="ScenePresence.CompleteMovement"/>
|
||||
/// </remarks>
|
||||
public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered after parcel properties have been updated.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerOnParcelPropertiesUpdateRequest"/> in
|
||||
/// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ClientOnParcelPropertiesUpdateRequest"/>,
|
||||
/// <see cref="OpenSim.Region.CoreModules.World.Land.LandManagementModule.ProcessPropertiesUpdate"/>
|
||||
/// </remarks>
|
||||
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
|
||||
|
||||
/// <summary>
|
||||
@@ -133,13 +250,45 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Fired when an object is touched/grabbed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The originalID is the local ID of the part that was actually touched. The localID itself is always that of
|
||||
/// the root part.
|
||||
/// Triggerd in response to <see cref="OpenSim.Framework.IClientAPI.OnGrabObject"/>
|
||||
/// via <see cref="TriggerObjectGrab"/>
|
||||
/// in <see cref="Scene.ProcessObjectGrab"/>
|
||||
/// </remarks>
|
||||
public event ObjectGrabDelegate OnObjectGrab;
|
||||
public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object is being touched/grabbed continuously.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered in response to <see cref="OpenSim.Framework.IClientAPI.OnGrabUpdate"/>
|
||||
/// via <see cref="TriggerObjectGrabbing"/>
|
||||
/// in <see cref="Scene.ProcessObjectGrabUpdate"/>
|
||||
/// </remarks>
|
||||
public event ObjectGrabDelegate OnObjectGrabbing;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object stops being touched/grabbed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered in response to <see cref="OpenSim.Framework.IClientAPI.OnDeGrabObject"/>
|
||||
/// via <see cref="TriggerObjectDeGrab"/>
|
||||
/// in <see cref="Scene.ProcessObjectDeGrab"/>
|
||||
/// </remarks>
|
||||
public event ObjectDeGrabDelegate OnObjectDeGrab;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a script resets.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerScriptReset"/>
|
||||
/// in <see cref="Scene.ProcessScriptReset"/>
|
||||
/// via <see cref="OpenSim.Framework.IClientAPI.OnScriptReset"/>
|
||||
/// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleScriptReset"/>
|
||||
/// </remarks>
|
||||
public event ScriptResetDelegate OnScriptReset;
|
||||
|
||||
public event OnPermissionErrorDelegate OnPermissionError;
|
||||
@@ -149,29 +298,105 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Occurs after OnNewScript.
|
||||
/// Triggered by <see cref="TriggerRezScript"/>
|
||||
/// in <see cref="SceneObjectPartInventory.CreateScriptInstance"/>
|
||||
/// </remarks>
|
||||
public event NewRezScript OnRezScript;
|
||||
public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
|
||||
|
||||
public delegate void RemoveScript(uint localID, UUID itemID);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a script is removed from an object.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerRemoveScript"/>
|
||||
/// in <see cref="Scene.RemoveTaskInventory"/>,
|
||||
/// <see cref="Scene.CreateAgentInventoryItemFromTask"/>,
|
||||
/// <see cref="SceneObjectPartInventory.RemoveScriptInstance"/>,
|
||||
/// <see cref="SceneObjectPartInventory.RemoveInventoryItem"/>
|
||||
/// </remarks>
|
||||
public event RemoveScript OnRemoveScript;
|
||||
|
||||
public delegate void StartScript(uint localID, UUID itemID);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a script starts.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerStartScript"/>
|
||||
/// in <see cref="Scene.SetScriptRunning"/>
|
||||
/// via <see cref="OpenSim.Framework.IClientAPI.OnSetScriptRunning"/>,
|
||||
/// via <see cref="OpenSim.Region.ClientStack.LindenUDP.HandleSetScriptRunning"/>
|
||||
/// </remarks>
|
||||
public event StartScript OnStartScript;
|
||||
|
||||
public delegate void StopScript(uint localID, UUID itemID);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a script stops.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerStopScript"/>,
|
||||
/// in <see cref="SceneObjectPartInventory.CreateScriptInstance"/>,
|
||||
/// <see cref="SceneObjectPartInventory.StopScriptInstance"/>,
|
||||
/// <see cref="Scene.SetScriptRunning"/>
|
||||
/// </remarks>
|
||||
public event StopScript OnStopScript;
|
||||
|
||||
public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object is moved.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerGroupMove"/>
|
||||
/// in <see cref="SceneObjectGroup.UpdateGroupPosition"/>,
|
||||
/// <see cref="SceneObjectGroup.GrabMovement"/>
|
||||
/// </remarks>
|
||||
public event SceneGroupMoved OnSceneGroupMove;
|
||||
|
||||
public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object is grabbed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerGroupGrab"/>
|
||||
/// in <see cref="SceneObjectGroup.OnGrabGroup"/>
|
||||
/// via <see cref="SceneObjectGroup.ObjectGrabHandler"/>
|
||||
/// via <see cref="Scene.ProcessObjectGrab"/>
|
||||
/// via <see cref="OpenSim.Framework.IClientAPI.OnGrabObject"/>
|
||||
/// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectGrab"/>
|
||||
/// </remarks>
|
||||
public event SceneGroupGrabed OnSceneGroupGrab;
|
||||
|
||||
public delegate bool SceneGroupSpinStarted(UUID groupID);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object starts to spin.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerGroupSpinStart"/>
|
||||
/// in <see cref="SceneObjectGroup.SpinStart"/>
|
||||
/// via <see cref="SceneGraph.SpinStart"/>
|
||||
/// via <see cref="OpenSim.Framework.IClientAPI.OnSpinStart"/>
|
||||
/// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectSpinStart"/>
|
||||
/// </remarks>
|
||||
public event SceneGroupSpinStarted OnSceneGroupSpinStart;
|
||||
|
||||
public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object is being spun.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerGroupSpin"/>
|
||||
/// in <see cref="SceneObjectGroup.SpinMovement"/>
|
||||
/// via <see cref="SceneGraph.SpinObject"/>
|
||||
/// via <see cref="OpenSim.Framework.IClientAPI.OnSpinUpdate"/>
|
||||
/// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleObjectSpinUpdate"/>
|
||||
/// </remarks>
|
||||
public event SceneGroupSpun OnSceneGroupSpin;
|
||||
|
||||
public delegate void LandObjectAdded(ILandObject newParcel);
|
||||
@@ -210,6 +435,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Occurs before OnRezScript
|
||||
/// Triggered by <see cref="TriggerNewScript"/>
|
||||
/// in <see cref="Scene.RezScriptFromAgentInventory"/>,
|
||||
/// <see cref="Scene.RezNewScript"/>
|
||||
/// </remarks>
|
||||
public event NewScript OnNewScript;
|
||||
|
||||
@@ -241,6 +469,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset.
|
||||
/// Triggered by <see cref="TriggerUpdateScript"/>
|
||||
/// in <see cref="Scene.CapsUpdateTaskInventoryScriptAsset"/>
|
||||
/// via <see cref="Scene.CapsUpdateTaskInventoryScriptAsset"/>
|
||||
/// via <see cref="OpenSim.Region.ClientStack.Linden.BunchOfCaps.TaskScriptUpdated"/>
|
||||
/// via <see cref="OpenSim.Region.ClientStack.Linden.TaskInventoryScriptUpdater.OnUpLoad"/>
|
||||
/// via <see cref="OpenSim.Region.ClientStack.Linden.TaskInventoryScriptUpdater.uploaderCaps"/>
|
||||
/// </remarks>
|
||||
public event UpdateScript OnUpdateScript;
|
||||
|
||||
@@ -266,48 +500,203 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when some scene object properties change.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// ScriptChangedEvent is fired when a scene object property that a script might be interested
|
||||
/// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event.
|
||||
/// This is not an indication that the script has changed (see OnUpdateScript for that).
|
||||
/// This event is sent to a script to tell it that some property changed on
|
||||
/// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed .
|
||||
/// </summary>
|
||||
/// Triggered by <see cref="TriggerOnScriptChangedEvent"/>
|
||||
/// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.TeleportAgentWithinRegion"/>,
|
||||
/// <see cref="SceneObjectPart.TriggerScriptChangedEvent"/>
|
||||
/// </remarks>
|
||||
public event ScriptChangedEvent OnScriptChangedEvent;
|
||||
public delegate void ScriptChangedEvent(uint localID, uint change);
|
||||
|
||||
public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a script receives control input from an agent.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerControlEvent"/>
|
||||
/// in <see cref="ScenePresence.SendControlsToScripts"/>
|
||||
/// via <see cref="ScenePresence.HandleAgentUpdate"/>
|
||||
/// via <see cref="OpenSim.Framework.IClientAPI.OnAgentUpdate"/>
|
||||
/// via <see cref="OpenSim.Region.ClientStack.LindenUDP.LLClientView.HandleAgentUpdate"/>
|
||||
/// </remarks>
|
||||
public event ScriptControlEvent OnScriptControlEvent;
|
||||
|
||||
public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object has arrived within a tolerance distance
|
||||
/// of a motion target.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerAtTargetEvent"/>
|
||||
/// in <see cref="SceneObjectGroup.checkAtTargets"/>
|
||||
/// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
|
||||
/// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
|
||||
/// </remarks>
|
||||
public event ScriptAtTargetEvent OnScriptAtTargetEvent;
|
||||
|
||||
public delegate void ScriptNotAtTargetEvent(uint localID);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object has a motion target but has not arrived
|
||||
/// within a tolerance distance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerNotAtTargetEvent"/>
|
||||
/// in <see cref="SceneObjectGroup.checkAtTargets"/>
|
||||
/// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
|
||||
/// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
|
||||
/// </remarks>
|
||||
public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
|
||||
|
||||
public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object has arrived within a tolerance rotation
|
||||
/// of a rotation target.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerAtRotTargetEvent"/>
|
||||
/// in <see cref="SceneObjectGroup.checkAtTargets"/>
|
||||
/// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
|
||||
/// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
|
||||
/// </remarks>
|
||||
public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
|
||||
|
||||
public delegate void ScriptNotAtRotTargetEvent(uint localID);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object has a rotation target but has not arrived
|
||||
/// within a tolerance rotation.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerNotAtRotTargetEvent"/>
|
||||
/// in <see cref="SceneObjectGroup.checkAtTargets"/>
|
||||
/// via <see cref="SceneObjectGroup.ScheduleGroupForFullUpdate"/>,
|
||||
/// <see cref="Scene.CheckAtTargets"/> via <see cref="Scene.Update"/>
|
||||
/// </remarks>
|
||||
public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
|
||||
|
||||
public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a physical collision has started between a prim
|
||||
/// and something other than the region terrain.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerScriptCollidingStart"/>
|
||||
/// in <see cref="SceneObjectPart.SendCollisionEvent"/>
|
||||
/// via <see cref="SceneObjectPart.PhysicsCollision"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
|
||||
/// </remarks>
|
||||
public event ScriptColliding OnScriptColliderStart;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when something that previously collided with a prim has
|
||||
/// not stopped colliding with it.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <seealso cref="OnScriptColliderStart"/>
|
||||
/// Triggered by <see cref="TriggerScriptColliding"/>
|
||||
/// in <see cref="SceneObjectPart.SendCollisionEvent"/>
|
||||
/// via <see cref="SceneObjectPart.PhysicsCollision"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
|
||||
/// </remarks>
|
||||
public event ScriptColliding OnScriptColliding;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when something that previously collided with a prim has
|
||||
/// stopped colliding with it.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerScriptCollidingEnd"/>
|
||||
/// in <see cref="SceneObjectPart.SendCollisionEvent"/>
|
||||
/// via <see cref="SceneObjectPart.PhysicsCollision"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
|
||||
/// </remarks>
|
||||
public event ScriptColliding OnScriptCollidingEnd;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a physical collision has started between an object
|
||||
/// and the region terrain.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerScriptLandCollidingStart"/>
|
||||
/// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
|
||||
/// via <see cref="SceneObjectPart.PhysicsCollision"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
|
||||
/// </remarks>
|
||||
public event ScriptColliding OnScriptLandColliderStart;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object that previously collided with the region
|
||||
/// terrain has not yet stopped colliding with it.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerScriptLandColliding"/>
|
||||
/// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
|
||||
/// via <see cref="SceneObjectPart.PhysicsCollision"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
|
||||
/// </remarks>
|
||||
public event ScriptColliding OnScriptLandColliding;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object that previously collided with the region
|
||||
/// terrain has stopped colliding with it.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerScriptLandCollidingEnd"/>
|
||||
/// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
|
||||
/// via <see cref="SceneObjectPart.PhysicsCollision"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/>
|
||||
/// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/>
|
||||
/// </remarks>
|
||||
public event ScriptColliding OnScriptLandColliderEnd;
|
||||
|
||||
public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an agent has been made a child agent of a scene.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerOnMakeChildAgent"/>
|
||||
/// in <see cref="ScenePresence.MakeChildAgent"/>
|
||||
/// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.CrossAgentToNewRegionAsync"/>,
|
||||
/// <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>,
|
||||
/// <see cref="OpenSim.Region.CoreModules.InterGrid.KillAUser.ShutdownNoLogout"/>
|
||||
/// </remarks>
|
||||
public event OnMakeChildAgentDelegate OnMakeChildAgent;
|
||||
|
||||
public delegate void OnSaveNewWindlightProfileDelegate();
|
||||
public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered after the grunt work for adding a root agent to a
|
||||
/// scene has been performed (resuming attachment scripts, physics,
|
||||
/// animations etc.)
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This event is on the critical path for transferring an avatar from one region to another. Try and do
|
||||
/// as little work on this event as possible, or do work asynchronously.
|
||||
/// </summary>
|
||||
/// Triggered after <see cref="OnSetRootAgentScene"/>
|
||||
/// by <see cref="TriggerOnMakeRootAgent"/>
|
||||
/// in <see cref="ScenePresence.MakeRootAgent"/>
|
||||
/// via <see cref="Scene.AgentCrossing"/>
|
||||
/// and <see cref="ScenePresence.CompleteMovement"/>
|
||||
/// </remarks>
|
||||
public event Action<ScenePresence> OnMakeRootAgent;
|
||||
|
||||
public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted;
|
||||
@@ -333,9 +722,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public event AvatarKillData OnAvatarKilled;
|
||||
public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar);
|
||||
|
||||
// public delegate void ScriptTimerEvent(uint localID, double timerinterval);
|
||||
|
||||
// public event ScriptTimerEvent OnScriptTimerEvent;
|
||||
/*
|
||||
public delegate void ScriptTimerEvent(uint localID, double timerinterval);
|
||||
/// <summary>
|
||||
/// Used to be triggered when the LSL timer event fires.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerTimerEvent"/>
|
||||
/// via <see cref="SceneObjectPart.handleTimerAccounting"/>
|
||||
/// </remarks>
|
||||
public event ScriptTimerEvent OnScriptTimerEvent;
|
||||
*/
|
||||
|
||||
public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour);
|
||||
public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
|
||||
@@ -345,12 +742,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Triggered when an object is added to the scene.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerObjectAddedToScene"/>
|
||||
/// in <see cref="Scene.AddNewSceneObject"/>,
|
||||
/// <see cref="Scene.DuplicateObject"/>,
|
||||
/// <see cref="Scene.doObjectDuplicateOnRay"/>
|
||||
/// </remarks>
|
||||
public event Action<SceneObjectGroup> OnObjectAddedToScene;
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for <see cref="OnObjectBeingRemovedFromScene"/>
|
||||
/// </summary>
|
||||
/// <param name="obj">The object being removed from the scene</param>
|
||||
public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an object is removed from the scene.
|
||||
/// </summary>
|
||||
public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/>
|
||||
/// in <see cref="Scene.DeleteSceneObject"/>
|
||||
/// </remarks>
|
||||
public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
|
||||
|
||||
public delegate void NoticeNoLandDataFromStorage();
|
||||
@@ -366,6 +778,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate;
|
||||
|
||||
public delegate void ParcelPrimCountTainted();
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when the parcel prim count has been altered.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerParcelPrimCountTainted"/> in
|
||||
/// <see cref="OpenSim.Region.CoreModules.Avatar.Attachments.AttachmentsModule.DetachSingleAttachmentToGround"/>,
|
||||
/// <see cref="OpenSim.Region.CoreModules.Avatar.Attachments.AttachmentsModule.AttachToAgent"/>,
|
||||
/// <see cref="Scene.DeleteSceneObject"/>,
|
||||
/// <see cref="Scene.SelectPrim"/>,
|
||||
/// <see cref="Scene.DeselectPrim"/>,
|
||||
/// <see cref="SceneObjectGroup.UpdatePrimFlags"/>,
|
||||
/// <see cref="SceneObjectGroup.AbsolutePosition"/>
|
||||
/// </remarks>
|
||||
public event ParcelPrimCountTainted OnParcelPrimCountTainted;
|
||||
public event GetScriptRunning OnGetScriptRunning;
|
||||
|
||||
@@ -478,6 +904,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="copy"></param>
|
||||
/// <param name="original"></param>
|
||||
/// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
|
||||
/// <remarks>
|
||||
/// Triggered in <see cref="OpenSim.Region.Framework.Scenes.SceneObjectPart.Copy"/>
|
||||
/// </remarks>
|
||||
public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
|
||||
public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
|
||||
|
||||
@@ -519,9 +948,28 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public event PrimsLoaded OnPrimsLoaded;
|
||||
|
||||
public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a teleport starts
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerTeleportStart"/>
|
||||
/// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.CreateAgent"/>
|
||||
/// and <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule.CreateAgent"/>
|
||||
/// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>
|
||||
/// </remarks>
|
||||
public event TeleportStart OnTeleportStart;
|
||||
|
||||
public delegate void TeleportFail(IClientAPI client, bool gridLogout);
|
||||
|
||||
/// <summary>
|
||||
/// Trigered when a teleport fails.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered by <see cref="TriggerTeleportFail"/>
|
||||
/// in <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.Fail"/>
|
||||
/// via <see cref="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule.DoTeleport"/>
|
||||
/// </remarks>
|
||||
public event TeleportFail OnTeleportFail;
|
||||
|
||||
public class MoneyTransferArgs : EventArgs
|
||||
@@ -529,7 +977,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public UUID sender;
|
||||
public UUID receiver;
|
||||
|
||||
// Always false. The SL protocol sucks.
|
||||
/// <summary>
|
||||
/// Always false. The SL protocol sucks.
|
||||
/// </summary>
|
||||
public bool authenticated = false;
|
||||
|
||||
public int amount;
|
||||
@@ -586,8 +1036,29 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public delegate void LandBuy(Object sender, LandBuyArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when an attempt to transfer grid currency occurs
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessMoneyTransferRequest"/>
|
||||
/// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientGridEvents"/>
|
||||
/// via <see cref="OpenSim.Region.Framework.Scenes.Scene.SubscribeToClientEvents"/>
|
||||
/// via <see cref="OpenSim.Region.Framework.Scenes.Scene.AddNewClient"/>
|
||||
/// </remarks>
|
||||
public event MoneyTransferEvent OnMoneyTransfer;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered after after <see cref="OnValidateLandBuy"/>
|
||||
/// </summary>
|
||||
public event LandBuy OnLandBuy;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered to allow or prevent a real estate transaction
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Triggered in <see cref="OpenSim.Region.Framework.Scenes.Scene.ProcessParcelBuy"/>
|
||||
/// <seealso cref="OpenSim.Region.OptionalModules.World.MoneyModule.SampleMoneyModule.ValidateLandBuy"/>
|
||||
/// </remarks>
|
||||
public event LandBuy OnValidateLandBuy;
|
||||
|
||||
public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
|
||||
@@ -2003,7 +2474,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
// this lets us keep track of nasty script events like timer, etc.
|
||||
/// <summary>
|
||||
/// this lets us keep track of nasty script events like timer, etc.
|
||||
/// </summary>
|
||||
/// <param name="objLocalID"></param>
|
||||
/// <param name="Interval"></param>
|
||||
public void TriggerTimerEvent(uint objLocalID, double Interval)
|
||||
{
|
||||
throw new NotImplementedException("TriggerTimerEvent was thought to be not used anymore and the registration for the event from scene object part has been commented out due to a memory leak");
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public void StartScripts()
|
||||
{
|
||||
m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName);
|
||||
// m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName);
|
||||
|
||||
IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
|
||||
|
||||
|
||||
@@ -468,7 +468,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (!InventoryService.AddFolder(folder))
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Failed to move create folder for user {0} {1}",
|
||||
"[AGENT INVENTORY]: Failed to create folder for user {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// TODO: need to figure out how allow client agents but deny
|
||||
// root agents when ACL denies access to root agent
|
||||
public bool m_strictAccessControl = true;
|
||||
public int MaxUndoCount = 5;
|
||||
|
||||
public int MaxUndoCount { get; set; }
|
||||
|
||||
// Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
|
||||
public bool LoginLock = false;
|
||||
@@ -714,6 +715,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
//Animation states
|
||||
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
|
||||
|
||||
MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20);
|
||||
|
||||
PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims);
|
||||
CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims);
|
||||
|
||||
@@ -817,6 +820,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
// FIXME: Ultimately this should be in a module.
|
||||
SendPeriodicAppearanceUpdates = true;
|
||||
|
||||
IConfig appearanceConfig = m_config.Configs["Appearance"];
|
||||
if (appearanceConfig != null)
|
||||
{
|
||||
@@ -3529,7 +3534,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
"[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.",
|
||||
sp.Name, sp.UUID, RegionInfo.RegionName);
|
||||
|
||||
sp.ControllingClient.Close();
|
||||
sp.ControllingClient.Close(true);
|
||||
sp = null;
|
||||
}
|
||||
|
||||
@@ -4083,16 +4088,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Tell a single agent to disconnect from the region.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="agentID"></param>
|
||||
public bool IncomingCloseAgent(UUID agentID)
|
||||
/// <param name="force">
|
||||
/// Force the agent to close even if it might be in the middle of some other operation. You do not want to
|
||||
/// force unless you are absolutely sure that the agent is dead and a normal close is not working.
|
||||
/// </param>
|
||||
public bool IncomingCloseAgent(UUID agentID, bool force)
|
||||
{
|
||||
//m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
|
||||
|
||||
ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
|
||||
if (presence != null)
|
||||
{
|
||||
presence.ControllingClient.Close();
|
||||
presence.ControllingClient.Close(force);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4545,6 +4553,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return m_sceneGraph.GetSceneObjectGroup(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to get the SOG via its UUID
|
||||
/// </summary>
|
||||
/// <param name="fullID"></param>
|
||||
/// <param name="sog"></param>
|
||||
/// <returns></returns>
|
||||
public bool TryGetSceneObjectGroup(UUID fullID, out SceneObjectGroup sog)
|
||||
{
|
||||
sog = GetSceneObjectGroup(fullID);
|
||||
return sog != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a prim by name from the scene (will return the first
|
||||
/// found, if there are more than one prim with the same name)
|
||||
@@ -4576,6 +4596,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return m_sceneGraph.GetSceneObjectPart(fullID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to get a prim via its UUID
|
||||
/// </summary>
|
||||
/// <param name="fullID"></param>
|
||||
/// <param name="sop"></param>
|
||||
/// <returns></returns>
|
||||
public bool TryGetSceneObjectPart(UUID fullID, out SceneObjectPart sop)
|
||||
{
|
||||
sop = GetSceneObjectPart(fullID);
|
||||
return sop != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a scene object group that contains the prim with the given local id
|
||||
/// </summary>
|
||||
|
||||
@@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public bool AddNewSceneObject(
|
||||
SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel)
|
||||
{
|
||||
AddNewSceneObject(sceneObject, true, false);
|
||||
AddNewSceneObject(sceneObject, attachToBackup, false);
|
||||
|
||||
if (pos != null)
|
||||
sceneObject.AbsolutePosition = (Vector3)pos;
|
||||
|
||||
@@ -1119,14 +1119,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
parts[i].UUID = UUID.Random();
|
||||
}
|
||||
|
||||
// helper provided for parts.
|
||||
public int GetSceneMaxUndo()
|
||||
{
|
||||
if (m_scene != null)
|
||||
return m_scene.MaxUndoCount;
|
||||
return 5;
|
||||
}
|
||||
|
||||
// justincc: I don't believe this hack is needed any longer, especially since the physics
|
||||
// parts of set AbsolutePosition were already commented out. By changing HasGroupChanged to false
|
||||
// this method was preventing proper reload of scene objects.
|
||||
@@ -2674,27 +2666,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
RootPart.StoreUndoState(true);
|
||||
|
||||
scale.X = Math.Min(scale.X, Scene.m_maxNonphys);
|
||||
scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys);
|
||||
scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys);
|
||||
|
||||
PhysicsActor pa = m_rootPart.PhysActor;
|
||||
|
||||
if (pa != null && pa.IsPhysical)
|
||||
if (Scene != null)
|
||||
{
|
||||
scale.X = Math.Min(scale.X, Scene.m_maxPhys);
|
||||
scale.Y = Math.Min(scale.Y, Scene.m_maxPhys);
|
||||
scale.Z = Math.Min(scale.Z, Scene.m_maxPhys);
|
||||
}
|
||||
|
||||
PhysicsActor pa = m_rootPart.PhysActor;
|
||||
|
||||
float x = (scale.X / RootPart.Scale.X);
|
||||
float y = (scale.Y / RootPart.Scale.Y);
|
||||
float z = (scale.Z / RootPart.Scale.Z);
|
||||
|
||||
SceneObjectPart[] parts;
|
||||
if (x > 1.0f || y > 1.0f || z > 1.0f)
|
||||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
|
||||
if (Scene != null & (x > 1.0f || y > 1.0f || z > 1.0f))
|
||||
{
|
||||
parts = m_parts.GetArray();
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
SceneObjectPart obPart = parts[i];
|
||||
@@ -2708,7 +2696,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (pa != null && pa.IsPhysical)
|
||||
{
|
||||
if (oldSize.X * x > m_scene.m_maxPhys)
|
||||
if (oldSize.X * x > Scene.m_maxPhys)
|
||||
{
|
||||
f = m_scene.m_maxPhys / oldSize.X;
|
||||
a = f / x;
|
||||
@@ -2717,7 +2705,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
z *= a;
|
||||
}
|
||||
|
||||
if (oldSize.Y * y > m_scene.m_maxPhys)
|
||||
if (oldSize.Y * y > Scene.m_maxPhys)
|
||||
{
|
||||
f = m_scene.m_maxPhys / oldSize.Y;
|
||||
a = f / y;
|
||||
@@ -2726,7 +2714,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
z *= a;
|
||||
}
|
||||
|
||||
if (oldSize.Z * z > m_scene.m_maxPhys)
|
||||
if (oldSize.Z * z > Scene.m_maxPhys)
|
||||
{
|
||||
f = m_scene.m_maxPhys / oldSize.Z;
|
||||
a = f / z;
|
||||
@@ -2737,7 +2725,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldSize.X * x > m_scene.m_maxNonphys)
|
||||
if (oldSize.X * x > Scene.m_maxNonphys)
|
||||
{
|
||||
f = m_scene.m_maxNonphys / oldSize.X;
|
||||
a = f / x;
|
||||
@@ -2746,7 +2734,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
z *= a;
|
||||
}
|
||||
|
||||
if (oldSize.Y * y > m_scene.m_maxNonphys)
|
||||
if (oldSize.Y * y > Scene.m_maxNonphys)
|
||||
{
|
||||
f = m_scene.m_maxNonphys / oldSize.Y;
|
||||
a = f / y;
|
||||
@@ -2755,7 +2743,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
z *= a;
|
||||
}
|
||||
|
||||
if (oldSize.Z * z > m_scene.m_maxNonphys)
|
||||
if (oldSize.Z * z > Scene.m_maxNonphys)
|
||||
{
|
||||
f = m_scene.m_maxNonphys / oldSize.Z;
|
||||
a = f / z;
|
||||
@@ -2779,7 +2767,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
RootPart.Resize(prevScale);
|
||||
// RootPart.IgnoreUndoUpdate = false;
|
||||
|
||||
parts = m_parts.GetArray();
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
SceneObjectPart obPart = parts[i];
|
||||
|
||||
@@ -266,8 +266,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private string m_sitAnimation = "SIT";
|
||||
private string m_text = String.Empty;
|
||||
private string m_touchName = String.Empty;
|
||||
private readonly Stack<UndoState> m_undo = new Stack<UndoState>(5);
|
||||
private readonly Stack<UndoState> m_redo = new Stack<UndoState>(5);
|
||||
private readonly List<UndoState> m_undo = new List<UndoState>(5);
|
||||
private readonly List<UndoState> m_redo = new List<UndoState>(5);
|
||||
|
||||
private bool m_passTouches = false;
|
||||
private bool m_passCollisions = false;
|
||||
@@ -733,7 +733,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message);
|
||||
m_log.ErrorFormat("[SCENEOBJECTPART]: GROUP POSITION. {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3150,61 +3150,62 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void StoreUndoState(bool forGroup)
|
||||
{
|
||||
if (!Undoing)
|
||||
if (ParentGroup == null || ParentGroup.Scene == null)
|
||||
return;
|
||||
|
||||
if (Undoing)
|
||||
{
|
||||
if (!IgnoreUndoUpdate)
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IgnoreUndoUpdate)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId);
|
||||
return;
|
||||
}
|
||||
|
||||
lock (m_undo)
|
||||
{
|
||||
if (m_undo.Count > 0)
|
||||
{
|
||||
if (ParentGroup != null)
|
||||
UndoState last = m_undo[m_undo.Count - 1];
|
||||
if (last != null)
|
||||
{
|
||||
lock (m_undo)
|
||||
// TODO: May need to fix for group comparison
|
||||
if (last.Compare(this))
|
||||
{
|
||||
if (m_undo.Count > 0)
|
||||
{
|
||||
UndoState last = m_undo.Peek();
|
||||
if (last != null)
|
||||
{
|
||||
// TODO: May need to fix for group comparison
|
||||
if (last.Compare(this))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
|
||||
// Name, LocalId, m_undo.Count);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}",
|
||||
// Name, LocalId, forGroup, m_undo.Count);
|
||||
|
||||
if (ParentGroup.GetSceneMaxUndo() > 0)
|
||||
{
|
||||
UndoState nUndo = new UndoState(this, forGroup);
|
||||
|
||||
m_undo.Push(nUndo);
|
||||
|
||||
if (m_redo.Count > 0)
|
||||
m_redo.Clear();
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
|
||||
// Name, LocalId, forGroup, m_undo.Count);
|
||||
}
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
|
||||
// Name, LocalId, m_undo.Count);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId);
|
||||
// }
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}",
|
||||
// Name, LocalId, forGroup, m_undo.Count);
|
||||
|
||||
if (ParentGroup.Scene.MaxUndoCount > 0)
|
||||
{
|
||||
UndoState nUndo = new UndoState(this, forGroup);
|
||||
|
||||
m_undo.Add(nUndo);
|
||||
|
||||
if (m_undo.Count > ParentGroup.Scene.MaxUndoCount)
|
||||
m_undo.RemoveAt(0);
|
||||
|
||||
if (m_redo.Count > 0)
|
||||
m_redo.Clear();
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
|
||||
// Name, LocalId, forGroup, m_undo.Count);
|
||||
}
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3229,21 +3230,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (m_undo.Count > 0)
|
||||
{
|
||||
UndoState goback = m_undo.Pop();
|
||||
UndoState goback = m_undo[m_undo.Count - 1];
|
||||
m_undo.RemoveAt(m_undo.Count - 1);
|
||||
|
||||
if (goback != null)
|
||||
UndoState nUndo = null;
|
||||
|
||||
if (ParentGroup.Scene.MaxUndoCount > 0)
|
||||
{
|
||||
UndoState nUndo = null;
|
||||
|
||||
if (ParentGroup.GetSceneMaxUndo() > 0)
|
||||
{
|
||||
nUndo = new UndoState(this, goback.ForGroup);
|
||||
}
|
||||
nUndo = new UndoState(this, goback.ForGroup);
|
||||
}
|
||||
|
||||
goback.PlaybackState(this);
|
||||
goback.PlaybackState(this);
|
||||
|
||||
if (nUndo != null)
|
||||
m_redo.Push(nUndo);
|
||||
if (nUndo != null)
|
||||
{
|
||||
m_redo.Add(nUndo);
|
||||
|
||||
if (m_redo.Count > ParentGroup.Scene.MaxUndoCount)
|
||||
m_redo.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3263,20 +3267,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (m_redo.Count > 0)
|
||||
{
|
||||
UndoState gofwd = m_redo.Pop();
|
||||
|
||||
if (gofwd != null)
|
||||
UndoState gofwd = m_redo[m_redo.Count - 1];
|
||||
m_redo.RemoveAt(m_redo.Count - 1);
|
||||
|
||||
if (ParentGroup.Scene.MaxUndoCount > 0)
|
||||
{
|
||||
if (ParentGroup.GetSceneMaxUndo() > 0)
|
||||
{
|
||||
UndoState nUndo = new UndoState(this, gofwd.ForGroup);
|
||||
|
||||
m_undo.Push(nUndo);
|
||||
}
|
||||
|
||||
gofwd.PlayfwdState(this);
|
||||
UndoState nUndo = new UndoState(this, gofwd.ForGroup);
|
||||
|
||||
m_undo.Add(nUndo);
|
||||
|
||||
if (m_undo.Count > ParentGroup.Scene.MaxUndoCount)
|
||||
m_undo.RemoveAt(0);
|
||||
}
|
||||
|
||||
gofwd.PlayfwdState(this);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}",
|
||||
// Name, LocalId, m_redo.Count);
|
||||
|
||||
@@ -891,7 +891,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (wasChild && HasAttachments())
|
||||
{
|
||||
m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments...");
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name);
|
||||
|
||||
// Resume scripts
|
||||
foreach (SceneObjectGroup sog in m_attachments)
|
||||
{
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public const string LastReportedObjectUpdateStatName = "LastReportedObjectUpdates";
|
||||
public const string SlowFramesStatName = "SlowFrames";
|
||||
|
||||
public delegate void SendStatResult(SimStats stats);
|
||||
|
||||
@@ -128,6 +129,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
get { return lastReportedSimStats; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Number of frames that have taken longer to process than Scene.MIN_FRAME_TIME
|
||||
/// </summary>
|
||||
public Stat SlowFramesStat { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The threshold at which we log a slow frame.
|
||||
/// </summary>
|
||||
public int SlowFramesStatReportThreshold { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Extra sim statistics that are used by monitors but not sent to the client.
|
||||
/// </summary>
|
||||
@@ -225,6 +236,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (StatsManager.SimExtraStats != null)
|
||||
OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket;
|
||||
|
||||
/// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit
|
||||
/// longer than ideal (which in itself is a concern).
|
||||
SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2);
|
||||
|
||||
SlowFramesStat
|
||||
= new Stat(
|
||||
"SlowFrames",
|
||||
"Slow Frames",
|
||||
" frames",
|
||||
"scene",
|
||||
m_scene.Name,
|
||||
StatVerbosity.Info,
|
||||
"Number of frames where frame time has been significantly longer than the desired frame time.");
|
||||
|
||||
StatsManager.RegisterStat(SlowFramesStat);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
@@ -418,6 +445,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
lock (m_lastReportedExtraSimStats)
|
||||
{
|
||||
m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor;
|
||||
m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value;
|
||||
|
||||
Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
|
||||
|
||||
@@ -535,6 +563,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void addFrameMS(int ms)
|
||||
{
|
||||
m_frameMS += ms;
|
||||
|
||||
// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit
|
||||
// longer than ideal due to the inaccuracy of the Sleep in Scene.Update() (which in itself is a concern).
|
||||
if (ms > SlowFramesStatReportThreshold)
|
||||
SlowFramesStat.Value++;
|
||||
}
|
||||
|
||||
public void AddSpareMS(int ms)
|
||||
|
||||
@@ -62,8 +62,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2));
|
||||
Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3));
|
||||
Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4));
|
||||
|
||||
Assert.That(g1Post.RootPart.UndoCount, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests for undo/redo
|
||||
/// </summary>
|
||||
public class SceneObjectUndoRedoTests : OpenSimTestCase
|
||||
{
|
||||
[Test]
|
||||
public void TestUndoRedoResizeSceneObject()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
Vector3 firstSize = new Vector3(2, 3, 4);
|
||||
Vector3 secondSize = new Vector3(5, 6, 7);
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
scene.MaxUndoCount = 20;
|
||||
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
|
||||
|
||||
// TODO: It happens to be the case that we are not storing undo states for SOPs which are not yet in a SOG,
|
||||
// which is the way that AddSceneObject() sets up the object (i.e. it creates the SOP first). However,
|
||||
// this is somewhat by chance. Really, we shouldn't be storing undo states at all if the object is not
|
||||
// in a scene.
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||
|
||||
g1.GroupResize(firstSize);
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
|
||||
|
||||
g1.GroupResize(secondSize);
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));
|
||||
|
||||
g1.RootPart.Undo();
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
|
||||
Assert.That(g1.GroupScale, Is.EqualTo(firstSize));
|
||||
|
||||
g1.RootPart.Redo();
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));
|
||||
Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUndoLimit()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Vector3 firstSize = new Vector3(2, 3, 4);
|
||||
Vector3 secondSize = new Vector3(5, 6, 7);
|
||||
Vector3 thirdSize = new Vector3(8, 9, 10);
|
||||
Vector3 fourthSize = new Vector3(11, 12, 13);
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
scene.MaxUndoCount = 2;
|
||||
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
|
||||
|
||||
g1.GroupResize(firstSize);
|
||||
g1.GroupResize(secondSize);
|
||||
g1.GroupResize(thirdSize);
|
||||
g1.GroupResize(fourthSize);
|
||||
|
||||
g1.RootPart.Undo();
|
||||
g1.RootPart.Undo();
|
||||
g1.RootPart.Undo();
|
||||
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||
Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNoUndoOnObjectsNotInScene()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Vector3 firstSize = new Vector3(2, 3, 4);
|
||||
Vector3 secondSize = new Vector3(5, 6, 7);
|
||||
Vector3 thirdSize = new Vector3(8, 9, 10);
|
||||
Vector3 fourthSize = new Vector3(11, 12, 13);
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
scene.MaxUndoCount = 20;
|
||||
SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
|
||||
|
||||
g1.GroupResize(firstSize);
|
||||
g1.GroupResize(secondSize);
|
||||
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||
|
||||
g1.RootPart.Undo();
|
||||
|
||||
Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUndoBeyondAvailable()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Vector3 newSize = new Vector3(2, 3, 4);
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
scene.MaxUndoCount = 20;
|
||||
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
|
||||
Vector3 originalSize = g1.GroupScale;
|
||||
|
||||
g1.RootPart.Undo();
|
||||
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||
Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
|
||||
|
||||
g1.GroupResize(newSize);
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
|
||||
Assert.That(g1.GroupScale, Is.EqualTo(newSize));
|
||||
|
||||
g1.RootPart.Undo();
|
||||
g1.RootPart.Undo();
|
||||
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||
Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRedoBeyondAvailable()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
Vector3 newSize = new Vector3(2, 3, 4);
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
scene.MaxUndoCount = 20;
|
||||
SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
|
||||
Vector3 originalSize = g1.GroupScale;
|
||||
|
||||
g1.RootPart.Redo();
|
||||
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
|
||||
Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
|
||||
|
||||
g1.GroupResize(newSize);
|
||||
g1.RootPart.Undo();
|
||||
g1.RootPart.Redo();
|
||||
g1.RootPart.Redo();
|
||||
|
||||
Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
|
||||
Assert.That(g1.GroupScale, Is.EqualTo(newSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ using OpenSim.Tests.Common.Mock;
|
||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SceneObjectUserGroupTests
|
||||
public class SceneObjectUserGroupTests : OpenSimTestCase
|
||||
{
|
||||
/// <summary>
|
||||
/// Test share with group object functionality
|
||||
@@ -54,7 +54,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
public void TestShareWithGroup()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
TestScene scene = new SceneHelpers().SetupScene();
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
|
||||
|
||||
scene.IncomingCloseAgent(sp.UUID);
|
||||
scene.IncomingCloseAgent(sp.UUID, false);
|
||||
|
||||
Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
|
||||
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null);
|
||||
|
||||
@@ -50,8 +50,40 @@ using OpenSim.Tests.Common.Mock;
|
||||
namespace OpenSim.Region.Framework.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class UserInventoryTests
|
||||
public class UserInventoryTests : OpenSimTestCase
|
||||
{
|
||||
[Test]
|
||||
public void TestCreateInventoryFolders()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
// For this test both folders will have the same name which is legal in SL user inventories.
|
||||
string foldersName = "f1";
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
|
||||
|
||||
UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName);
|
||||
|
||||
List<InventoryFolderBase> oneFolder
|
||||
= UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName);
|
||||
|
||||
Assert.That(oneFolder.Count, Is.EqualTo(1));
|
||||
InventoryFolderBase firstRetrievedFolder = oneFolder[0];
|
||||
Assert.That(firstRetrievedFolder.Name, Is.EqualTo(foldersName));
|
||||
|
||||
UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName);
|
||||
|
||||
List<InventoryFolderBase> twoFolders
|
||||
= UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName);
|
||||
|
||||
Assert.That(twoFolders.Count, Is.EqualTo(2));
|
||||
Assert.That(twoFolders[0].Name, Is.EqualTo(foldersName));
|
||||
Assert.That(twoFolders[1].Name, Is.EqualTo(foldersName));
|
||||
Assert.That(twoFolders[0].ID, Is.Not.EqualTo(twoFolders[1].ID));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGiveInventoryItem()
|
||||
{
|
||||
@@ -83,7 +115,7 @@ namespace OpenSim.Region.Framework.Tests
|
||||
public void TestGiveInventoryFolder()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
|
||||
|
||||
@@ -52,26 +52,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public class UuidGatherer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Asset cache used for gathering assets
|
||||
/// </summary>
|
||||
protected IAssetService m_assetCache;
|
||||
|
||||
/// <summary>
|
||||
/// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
|
||||
/// asset was found by the asset service.
|
||||
/// </summary>
|
||||
private AssetBase m_requestedObjectAsset;
|
||||
|
||||
/// <summary>
|
||||
/// Signal whether we are currently waiting for the asset service to deliver an asset.
|
||||
/// </summary>
|
||||
private bool m_waitingForObjectAsset;
|
||||
protected IAssetService m_assetService;
|
||||
|
||||
// /// <summary>
|
||||
// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
|
||||
// /// asset was found by the asset service.
|
||||
// /// </summary>
|
||||
// private AssetBase m_requestedObjectAsset;
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Signal whether we are currently waiting for the asset service to deliver an asset.
|
||||
// /// </summary>
|
||||
// private bool m_waitingForObjectAsset;
|
||||
|
||||
public UuidGatherer(IAssetService assetCache)
|
||||
{
|
||||
m_assetCache = assetCache;
|
||||
m_assetService = assetCache;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -195,18 +192,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The callback made when we request the asset for an object from the asset service.
|
||||
/// </summary>
|
||||
private void AssetReceived(string id, Object sender, AssetBase asset)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
m_requestedObjectAsset = asset;
|
||||
m_waitingForObjectAsset = false;
|
||||
Monitor.Pulse(this);
|
||||
}
|
||||
}
|
||||
// /// <summary>
|
||||
// /// The callback made when we request the asset for an object from the asset service.
|
||||
// /// </summary>
|
||||
// private void AssetReceived(string id, Object sender, AssetBase asset)
|
||||
// {
|
||||
// lock (this)
|
||||
// {
|
||||
// m_requestedObjectAsset = asset;
|
||||
// m_waitingForObjectAsset = false;
|
||||
// Monitor.Pulse(this);
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Get an asset synchronously, potentially using an asynchronous callback. If the
|
||||
@@ -216,25 +213,29 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <returns></returns>
|
||||
protected virtual AssetBase GetAsset(UUID uuid)
|
||||
{
|
||||
m_waitingForObjectAsset = true;
|
||||
m_assetCache.Get(uuid.ToString(), this, AssetReceived);
|
||||
return m_assetService.Get(uuid.ToString());
|
||||
|
||||
// The asset cache callback can either
|
||||
//
|
||||
// 1. Complete on the same thread (if the asset is already in the cache) or
|
||||
// 2. Come in via a different thread (if we need to go fetch it).
|
||||
//
|
||||
// The code below handles both these alternatives.
|
||||
lock (this)
|
||||
{
|
||||
if (m_waitingForObjectAsset)
|
||||
{
|
||||
Monitor.Wait(this);
|
||||
m_waitingForObjectAsset = false;
|
||||
}
|
||||
}
|
||||
|
||||
return m_requestedObjectAsset;
|
||||
// XXX: Switching to do this synchronously where the call was async before but we always waited for it
|
||||
// to complete anyway!
|
||||
// m_waitingForObjectAsset = true;
|
||||
// m_assetCache.Get(uuid.ToString(), this, AssetReceived);
|
||||
//
|
||||
// // The asset cache callback can either
|
||||
// //
|
||||
// // 1. Complete on the same thread (if the asset is already in the cache) or
|
||||
// // 2. Come in via a different thread (if we need to go fetch it).
|
||||
// //
|
||||
// // The code below handles both these alternatives.
|
||||
// lock (this)
|
||||
// {
|
||||
// if (m_waitingForObjectAsset)
|
||||
// {
|
||||
// Monitor.Wait(this);
|
||||
// m_waitingForObjectAsset = false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return m_requestedObjectAsset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -885,6 +885,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Close(false);
|
||||
}
|
||||
|
||||
public void Close(bool force)
|
||||
{
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
@@ -231,12 +231,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
|
||||
if (m_server == null || m_baseNick == null || m_ircChannel == null || m_user == null)
|
||||
throw new Exception("Invalid connector configuration");
|
||||
|
||||
// Generate an initial nickname if randomizing is enabled
|
||||
// Generate an initial nickname
|
||||
|
||||
if (m_randomizeNick)
|
||||
{
|
||||
m_nick = m_baseNick + Util.RandomClass.Next(1, 99);
|
||||
}
|
||||
else
|
||||
m_nick = m_baseNick;
|
||||
|
||||
m_log.InfoFormat("[IRC-Connector-{0}]: Initialization complete", idn);
|
||||
|
||||
|
||||
@@ -175,14 +175,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool CreateStore(string value, out UUID result)
|
||||
public bool CreateStore(string value, ref UUID result)
|
||||
{
|
||||
result = UUID.Zero;
|
||||
if (result == UUID.Zero)
|
||||
result = UUID.Random();
|
||||
|
||||
JsonStore map = null;
|
||||
|
||||
if (! m_enabled) return false;
|
||||
|
||||
UUID uuid = UUID.Random();
|
||||
JsonStore map = null;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -195,9 +196,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
}
|
||||
|
||||
lock (m_JsonValueStore)
|
||||
m_JsonValueStore.Add(uuid,map);
|
||||
m_JsonValueStore.Add(result,map);
|
||||
|
||||
result = uuid;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
if (! m_JsonValueStore.TryGetValue(storeID,out map))
|
||||
{
|
||||
m_log.InfoFormat("[JsonStore] Missing store {0}",storeID);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
protected UUID JsonCreateStore(UUID hostID, UUID scriptID, string value)
|
||||
{
|
||||
UUID uuid = UUID.Zero;
|
||||
if (! m_store.CreateStore(value, out uuid))
|
||||
if (! m_store.CreateStore(value, ref uuid))
|
||||
GenerateRuntimeError("Failed to create Json store");
|
||||
|
||||
return uuid;
|
||||
|
||||
@@ -900,6 +900,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Close(false);
|
||||
}
|
||||
|
||||
public void Close(bool force)
|
||||
{
|
||||
// Remove ourselves from the scene
|
||||
m_scene.RemoveClient(AgentId, false);
|
||||
|
||||
@@ -176,16 +176,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
if (m_avatars.ContainsKey(agentID))
|
||||
{
|
||||
ScenePresence sp;
|
||||
scene.TryGetScenePresence(agentID, out sp);
|
||||
if (scene.TryGetScenePresence(agentID, out sp))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}",
|
||||
sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}",
|
||||
sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget);
|
||||
|
||||
sp.MoveToTarget(pos, noFly, landAtTarget);
|
||||
sp.SetAlwaysRun = running;
|
||||
|
||||
return true;
|
||||
sp.MoveToTarget(pos, noFly, landAtTarget);
|
||||
sp.SetAlwaysRun = running;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,12 +200,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
if (m_avatars.ContainsKey(agentID))
|
||||
{
|
||||
ScenePresence sp;
|
||||
scene.TryGetScenePresence(agentID, out sp);
|
||||
if (scene.TryGetScenePresence(agentID, out sp))
|
||||
{
|
||||
sp.Velocity = Vector3.Zero;
|
||||
sp.ResetMoveToTarget();
|
||||
|
||||
sp.Velocity = Vector3.Zero;
|
||||
sp.ResetMoveToTarget();
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,9 +224,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
{
|
||||
if (m_avatars.ContainsKey(agentID))
|
||||
{
|
||||
ScenePresence sp;
|
||||
scene.TryGetScenePresence(agentID, out sp);
|
||||
|
||||
m_avatars[agentID].Say(channel, text);
|
||||
|
||||
return true;
|
||||
@@ -240,9 +239,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
{
|
||||
if (m_avatars.ContainsKey(agentID))
|
||||
{
|
||||
ScenePresence sp;
|
||||
scene.TryGetScenePresence(agentID, out sp);
|
||||
|
||||
m_avatars[agentID].Shout(channel, text);
|
||||
|
||||
return true;
|
||||
@@ -259,11 +255,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
if (m_avatars.ContainsKey(agentID))
|
||||
{
|
||||
ScenePresence sp;
|
||||
scene.TryGetScenePresence(agentID, out sp);
|
||||
sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero);
|
||||
// sp.HandleAgentSit(m_avatars[agentID], agentID);
|
||||
|
||||
return true;
|
||||
if (scene.TryGetScenePresence(agentID, out sp))
|
||||
{
|
||||
sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero);
|
||||
// sp.HandleAgentSit(m_avatars[agentID], agentID);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,9 +274,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
{
|
||||
if (m_avatars.ContainsKey(agentID))
|
||||
{
|
||||
ScenePresence sp;
|
||||
scene.TryGetScenePresence(agentID, out sp);
|
||||
|
||||
m_avatars[agentID].Whisper(channel, text);
|
||||
|
||||
return true;
|
||||
@@ -295,10 +290,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
if (m_avatars.ContainsKey(agentID))
|
||||
{
|
||||
ScenePresence sp;
|
||||
scene.TryGetScenePresence(agentID, out sp);
|
||||
sp.StandUp();
|
||||
if (scene.TryGetScenePresence(agentID, out sp))
|
||||
{
|
||||
sp.StandUp();
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,6 +308,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
{
|
||||
if (m_avatars.ContainsKey(agentID))
|
||||
return m_avatars[agentID].Touch(objectID);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -321,9 +319,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
{
|
||||
NPCAvatar av;
|
||||
if (m_avatars.TryGetValue(agentID, out av))
|
||||
{
|
||||
return av.OwnerID;
|
||||
}
|
||||
}
|
||||
|
||||
return UUID.Zero;
|
||||
|
||||
@@ -183,6 +183,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public void llResetScript()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
// We need to tell the URL module, if we hav one, to release
|
||||
// the allocated URLs
|
||||
if (m_UrlModule != null)
|
||||
m_UrlModule.ScriptRemoved(m_item.ItemID);
|
||||
|
||||
m_ScriptEngine.ApiResetScript(m_item.ItemID);
|
||||
}
|
||||
|
||||
@@ -237,33 +243,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
|
||||
public List<SceneObjectPart> GetLinkParts(int linkType)
|
||||
{
|
||||
return GetLinkParts(m_host, linkType);
|
||||
}
|
||||
|
||||
private List<SceneObjectPart> GetLinkParts(SceneObjectPart part, int linkType)
|
||||
{
|
||||
List<SceneObjectPart> ret = new List<SceneObjectPart>();
|
||||
ret.Add(m_host);
|
||||
ret.Add(part);
|
||||
|
||||
switch (linkType)
|
||||
{
|
||||
case ScriptBaseClass.LINK_SET:
|
||||
return new List<SceneObjectPart>(m_host.ParentGroup.Parts);
|
||||
return new List<SceneObjectPart>(part.ParentGroup.Parts);
|
||||
|
||||
case ScriptBaseClass.LINK_ROOT:
|
||||
ret = new List<SceneObjectPart>();
|
||||
ret.Add(m_host.ParentGroup.RootPart);
|
||||
ret.Add(part.ParentGroup.RootPart);
|
||||
return ret;
|
||||
|
||||
case ScriptBaseClass.LINK_ALL_OTHERS:
|
||||
ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
|
||||
ret = new List<SceneObjectPart>(part.ParentGroup.Parts);
|
||||
|
||||
if (ret.Contains(m_host))
|
||||
ret.Remove(m_host);
|
||||
if (ret.Contains(part))
|
||||
ret.Remove(part);
|
||||
|
||||
return ret;
|
||||
|
||||
case ScriptBaseClass.LINK_ALL_CHILDREN:
|
||||
ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
|
||||
ret = new List<SceneObjectPart>(part.ParentGroup.Parts);
|
||||
|
||||
if (ret.Contains(m_host.ParentGroup.RootPart))
|
||||
ret.Remove(m_host.ParentGroup.RootPart);
|
||||
if (ret.Contains(part.ParentGroup.RootPart))
|
||||
ret.Remove(part.ParentGroup.RootPart);
|
||||
return ret;
|
||||
|
||||
case ScriptBaseClass.LINK_THIS:
|
||||
@@ -273,7 +284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (linkType < 0)
|
||||
return new List<SceneObjectPart>();
|
||||
|
||||
SceneObjectPart target = m_host.ParentGroup.GetLinkNumPart(linkType);
|
||||
SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType);
|
||||
if (target == null)
|
||||
return new List<SceneObjectPart>();
|
||||
ret = new List<SceneObjectPart>();
|
||||
@@ -1957,7 +1968,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
pos.x > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a east-adjacent region.
|
||||
pos.y < -10.0 || // return FALSE if more than 10 meters into a south-adjacent region.
|
||||
pos.y > (Constants.RegionSize + 10) || // return FALSE if more than 10 meters into a north-adjacent region.
|
||||
pos.z > 4096 // return FALSE if altitude than 4096m
|
||||
pos.z > Constants.RegionHeight // return FALSE if altitude than 4096m
|
||||
)
|
||||
)
|
||||
{
|
||||
@@ -4012,9 +4023,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public void llSetText(string text, LSL_Vector color, double alpha)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
Vector3 av3 = new Vector3(Util.Clip((float)color.x, 0.0f, 1.0f),
|
||||
Util.Clip((float)color.y, 0.0f, 1.0f),
|
||||
Util.Clip((float)color.z, 0.0f, 1.0f));
|
||||
Vector3 av3 = Util.Clip(new Vector3((float)color.x, (float)color.y,
|
||||
(float)color.z), 0.0f, 1.0f);
|
||||
m_host.SetText(text.Length > 254 ? text.Remove(254) : text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
|
||||
//m_host.ParentGroup.HasGroupChanged = true;
|
||||
//m_host.ParentGroup.ScheduleGroupForFullUpdate();
|
||||
@@ -5122,17 +5132,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
|
||||
string ret = String.Empty;
|
||||
int x = 0;
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
if (src.Data.Length > 0)
|
||||
{
|
||||
ret = src.Data[x++].ToString();
|
||||
for (; x < src.Data.Length; x++)
|
||||
{
|
||||
ret += ", "+src.Data[x].ToString();
|
||||
}
|
||||
ret = string.Join(", ",
|
||||
(new List<object>(src.Data)).ConvertAll<string>(o =>
|
||||
{
|
||||
return o.ToString();
|
||||
}).ToArray());
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -5427,27 +5436,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// Returns the index of the first occurrence of test
|
||||
/// in src.
|
||||
/// </summary>
|
||||
|
||||
/// <param name="src">Source list</param>
|
||||
/// <param name="test">List to search for</param>
|
||||
/// <returns>
|
||||
/// The index number of the point in src where test was found if it was found.
|
||||
/// Otherwise returns -1
|
||||
/// </returns>
|
||||
public LSL_Integer llListFindList(LSL_List src, LSL_List test)
|
||||
{
|
||||
|
||||
int index = -1;
|
||||
int length = src.Length - test.Length + 1;
|
||||
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
// If either list is empty, do not match
|
||||
|
||||
if (src.Length != 0 && test.Length != 0)
|
||||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
if (src.Data[i].Equals(test.Data[0]))
|
||||
// Why this piece of insanity? This is because most script constants are C# value types (e.g. int)
|
||||
// rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code
|
||||
// and so the comparison fails even if the LSL_Integer conceptually has the same value.
|
||||
// Therefore, here we test Equals on both the source and destination objects.
|
||||
// However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)).
|
||||
if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i]))
|
||||
{
|
||||
int j;
|
||||
for (j = 1; j < test.Length; j++)
|
||||
if (!src.Data[i+j].Equals(test.Data[j]))
|
||||
if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j])))
|
||||
break;
|
||||
|
||||
if (j == test.Length)
|
||||
{
|
||||
index = i;
|
||||
@@ -5458,19 +5476,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
|
||||
return index;
|
||||
|
||||
}
|
||||
|
||||
public LSL_String llGetObjectName()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return m_host.Name!=null?m_host.Name:String.Empty;
|
||||
return m_host.Name !=null ? m_host.Name : String.Empty;
|
||||
}
|
||||
|
||||
public void llSetObjectName(string name)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
m_host.Name = name!=null?name:String.Empty;
|
||||
m_host.Name = name != null ? name : String.Empty;
|
||||
}
|
||||
|
||||
public LSL_String llGetDate()
|
||||
@@ -7178,7 +7195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
public void llSetPrimitiveParams(LSL_List rules)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
SetPrimParams(m_host, rules);
|
||||
|
||||
setLinkPrimParams(ScriptBaseClass.LINK_THIS, rules);
|
||||
|
||||
ScriptSleep(200);
|
||||
}
|
||||
@@ -7203,11 +7221,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
List<SceneObjectPart> parts = GetLinkParts(linknumber);
|
||||
|
||||
LSL_List remaining = null;
|
||||
|
||||
foreach (SceneObjectPart part in parts)
|
||||
SetPrimParams(part, rules);
|
||||
remaining = SetPrimParams(part, rules);
|
||||
|
||||
while(remaining != null && remaining.Length > 2)
|
||||
{
|
||||
linknumber = remaining.GetLSLIntegerItem(0);
|
||||
rules = remaining.GetSublist(1,-1);
|
||||
parts = GetLinkParts(linknumber);
|
||||
|
||||
foreach (SceneObjectPart part in parts)
|
||||
remaining = SetPrimParams(part, rules);
|
||||
}
|
||||
}
|
||||
|
||||
protected void SetPrimParams(SceneObjectPart part, LSL_List rules)
|
||||
protected LSL_List SetPrimParams(SceneObjectPart part, LSL_List rules)
|
||||
{
|
||||
int idx = 0;
|
||||
|
||||
@@ -7230,7 +7260,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
case (int)ScriptBaseClass.PRIM_POSITION:
|
||||
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
|
||||
if (remain < 1)
|
||||
return;
|
||||
return null;
|
||||
|
||||
v=rules.GetVector3Item(idx++);
|
||||
positionChanged = true;
|
||||
@@ -7239,7 +7269,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
case (int)ScriptBaseClass.PRIM_SIZE:
|
||||
if (remain < 1)
|
||||
return;
|
||||
return null;
|
||||
|
||||
v=rules.GetVector3Item(idx++);
|
||||
SetScale(part, v);
|
||||
@@ -7247,7 +7277,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
case (int)ScriptBaseClass.PRIM_ROTATION:
|
||||
if (remain < 1)
|
||||
return;
|
||||
return null;
|
||||
|
||||
LSL_Rotation q = rules.GetQuaternionItem(idx++);
|
||||
// try to let this work as in SL...
|
||||
@@ -7267,7 +7297,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_TYPE:
|
||||
if (remain < 3)
|
||||
return;
|
||||
return null;
|
||||
|
||||
code = (int)rules.GetLSLIntegerItem(idx++);
|
||||
|
||||
@@ -7286,7 +7316,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
case (int)ScriptBaseClass.PRIM_TYPE_BOX:
|
||||
if (remain < 6)
|
||||
return;
|
||||
return null;
|
||||
|
||||
face = (int)rules.GetLSLIntegerItem(idx++);
|
||||
v = rules.GetVector3Item(idx++); // cut
|
||||
@@ -7301,7 +7331,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER:
|
||||
if (remain < 6)
|
||||
return;
|
||||
return null;
|
||||
|
||||
face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
|
||||
v = rules.GetVector3Item(idx++); // cut
|
||||
@@ -7315,7 +7345,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_TYPE_PRISM:
|
||||
if (remain < 6)
|
||||
return;
|
||||
return null;
|
||||
|
||||
face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
|
||||
v = rules.GetVector3Item(idx++); //cut
|
||||
@@ -7329,7 +7359,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_TYPE_SPHERE:
|
||||
if (remain < 5)
|
||||
return;
|
||||
return null;
|
||||
|
||||
face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
|
||||
v = rules.GetVector3Item(idx++); // cut
|
||||
@@ -7342,7 +7372,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_TYPE_TORUS:
|
||||
if (remain < 11)
|
||||
return;
|
||||
return null;
|
||||
|
||||
face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
|
||||
v = rules.GetVector3Item(idx++); //cut
|
||||
@@ -7361,7 +7391,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
|
||||
if (remain < 11)
|
||||
return;
|
||||
return null;
|
||||
|
||||
face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
|
||||
v = rules.GetVector3Item(idx++); //cut
|
||||
@@ -7380,7 +7410,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_TYPE_RING:
|
||||
if (remain < 11)
|
||||
return;
|
||||
return null;
|
||||
|
||||
face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
|
||||
v = rules.GetVector3Item(idx++); //cut
|
||||
@@ -7399,7 +7429,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
|
||||
if (remain < 2)
|
||||
return;
|
||||
return null;
|
||||
|
||||
string map = rules.Data[idx++].ToString();
|
||||
face = (int)rules.GetLSLIntegerItem(idx++); // type
|
||||
@@ -7411,7 +7441,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_TEXTURE:
|
||||
if (remain < 5)
|
||||
return;
|
||||
return null;
|
||||
|
||||
face=(int)rules.GetLSLIntegerItem(idx++);
|
||||
string tex=rules.Data[idx++].ToString();
|
||||
@@ -7428,7 +7458,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_COLOR:
|
||||
if (remain < 3)
|
||||
return;
|
||||
return null;
|
||||
|
||||
face=(int)rules.GetLSLIntegerItem(idx++);
|
||||
LSL_Vector color=rules.GetVector3Item(idx++);
|
||||
@@ -7441,7 +7471,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_FLEXIBLE:
|
||||
if (remain < 7)
|
||||
return;
|
||||
return null;
|
||||
|
||||
bool flexi = rules.GetLSLIntegerItem(idx++);
|
||||
int softness = rules.GetLSLIntegerItem(idx++);
|
||||
@@ -7457,7 +7487,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
|
||||
if (remain < 5)
|
||||
return;
|
||||
return null;
|
||||
bool light = rules.GetLSLIntegerItem(idx++);
|
||||
LSL_Vector lightcolor = rules.GetVector3Item(idx++);
|
||||
float intensity = (float)rules.GetLSLFloatItem(idx++);
|
||||
@@ -7470,7 +7500,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_GLOW:
|
||||
if (remain < 2)
|
||||
return;
|
||||
return null;
|
||||
face = rules.GetLSLIntegerItem(idx++);
|
||||
float glow = (float)rules.GetLSLFloatItem(idx++);
|
||||
|
||||
@@ -7480,7 +7510,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
|
||||
if (remain < 3)
|
||||
return;
|
||||
return null;
|
||||
face = (int)rules.GetLSLIntegerItem(idx++);
|
||||
int shiny = (int)rules.GetLSLIntegerItem(idx++);
|
||||
Bumpiness bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++);
|
||||
@@ -7491,7 +7521,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
|
||||
if (remain < 2)
|
||||
return;
|
||||
return null;
|
||||
face = rules.GetLSLIntegerItem(idx++);
|
||||
bool st = rules.GetLSLIntegerItem(idx++);
|
||||
SetFullBright(part, face , st);
|
||||
@@ -7499,17 +7529,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_MATERIAL:
|
||||
if (remain < 1)
|
||||
return;
|
||||
return null;
|
||||
int mat = rules.GetLSLIntegerItem(idx++);
|
||||
if (mat < 0 || mat > 7)
|
||||
return;
|
||||
return null;
|
||||
|
||||
part.Material = Convert.ToByte(mat);
|
||||
break;
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_PHANTOM:
|
||||
if (remain < 1)
|
||||
return;
|
||||
return null;
|
||||
|
||||
string ph = rules.Data[idx++].ToString();
|
||||
m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1"));
|
||||
@@ -7518,7 +7548,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_PHYSICS:
|
||||
if (remain < 1)
|
||||
return;
|
||||
return null;
|
||||
string phy = rules.Data[idx++].ToString();
|
||||
bool physics;
|
||||
|
||||
@@ -7532,7 +7562,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
|
||||
if (remain < 1)
|
||||
return;
|
||||
return null;
|
||||
string temp = rules.Data[idx++].ToString();
|
||||
|
||||
m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
|
||||
@@ -7541,7 +7571,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
case (int)ScriptBaseClass.PRIM_TEXGEN:
|
||||
if (remain < 2)
|
||||
return;
|
||||
return null;
|
||||
//face,type
|
||||
face = rules.GetLSLIntegerItem(idx++);
|
||||
int style = rules.GetLSLIntegerItem(idx++);
|
||||
@@ -7549,37 +7579,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
case (int)ScriptBaseClass.PRIM_TEXT:
|
||||
if (remain < 3)
|
||||
return;
|
||||
return null;
|
||||
string primText = rules.GetLSLStringItem(idx++);
|
||||
LSL_Vector primTextColor = rules.GetVector3Item(idx++);
|
||||
LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++);
|
||||
Vector3 av3 = new Vector3(Util.Clip((float)primTextColor.x, 0.0f, 1.0f),
|
||||
Util.Clip((float)primTextColor.y, 0.0f, 1.0f),
|
||||
Util.Clip((float)primTextColor.z, 0.0f, 1.0f));
|
||||
Vector3 av3 = Util.Clip(new Vector3((float)primTextColor.x,
|
||||
(float)primTextColor.y,
|
||||
(float)primTextColor.z), 0.0f, 1.0f);
|
||||
part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
|
||||
|
||||
break;
|
||||
case (int)ScriptBaseClass.PRIM_NAME:
|
||||
if (remain < 1)
|
||||
return;
|
||||
return null;
|
||||
string primName = rules.GetLSLStringItem(idx++);
|
||||
part.Name = primName;
|
||||
break;
|
||||
case (int)ScriptBaseClass.PRIM_DESC:
|
||||
if (remain < 1)
|
||||
return;
|
||||
return null;
|
||||
string primDesc = rules.GetLSLStringItem(idx++);
|
||||
part.Description = primDesc;
|
||||
break;
|
||||
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
|
||||
if (remain < 1)
|
||||
return;
|
||||
return null;
|
||||
LSL_Rotation lr = rules.GetQuaternionItem(idx++);
|
||||
SetRot(part, Rot2Quaternion(lr));
|
||||
break;
|
||||
case (int)ScriptBaseClass.PRIM_OMEGA:
|
||||
if (remain < 3)
|
||||
return;
|
||||
return null;
|
||||
LSL_Vector axis = rules.GetVector3Item(idx++);
|
||||
LSL_Float spinrate = rules.GetLSLFloatItem(idx++);
|
||||
LSL_Float gain = rules.GetLSLFloatItem(idx++);
|
||||
@@ -7587,12 +7617,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
|
||||
if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
|
||||
return;
|
||||
LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++);
|
||||
LSL_List new_rules = rules.GetSublist(idx, -1);
|
||||
setLinkPrimParams((int)new_linknumber, new_rules);
|
||||
return null;
|
||||
|
||||
return;
|
||||
return rules.GetSublist(idx, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7614,6 +7641,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public LSL_String llStringToBase64(string str)
|
||||
@@ -10686,7 +10714,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (obj.OwnerID != m_host.OwnerID)
|
||||
return;
|
||||
|
||||
SetPrimParams(obj, rules);
|
||||
LSL_List remaining = SetPrimParams(obj, rules);
|
||||
|
||||
while (remaining != null && remaining.Length > 2)
|
||||
{
|
||||
LSL_Integer newLink = remaining.GetLSLIntegerItem(0);
|
||||
LSL_List newrules = remaining.GetSublist(1, -1);
|
||||
foreach(SceneObjectPart part in GetLinkParts(obj, newLink)){
|
||||
remaining = SetPrimParams(part, newrules);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules)
|
||||
|
||||
@@ -2434,8 +2434,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
|
||||
return new LSL_Vector(0, 0, 0);
|
||||
|
||||
Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition;
|
||||
return new LSL_Vector(pos.X, pos.Y, pos.Z);
|
||||
ScenePresence sp = World.GetScenePresence(npcId);
|
||||
|
||||
if (sp != null)
|
||||
{
|
||||
Vector3 pos = sp.AbsolutePosition;
|
||||
return new LSL_Vector(pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
}
|
||||
|
||||
return new LSL_Vector(0, 0, 0);
|
||||
@@ -2503,9 +2508,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
|
||||
|
||||
ScenePresence sp = World.GetScenePresence(npcId);
|
||||
Quaternion rot = sp.Rotation;
|
||||
|
||||
return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
|
||||
if (sp != null)
|
||||
{
|
||||
Quaternion rot = sp.Rotation;
|
||||
return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
|
||||
}
|
||||
}
|
||||
|
||||
return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
|
||||
@@ -2527,7 +2535,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return;
|
||||
|
||||
ScenePresence sp = World.GetScenePresence(npcId);
|
||||
sp.Rotation = LSL_Api.Rot2Quaternion(rotation);
|
||||
|
||||
if (sp != null)
|
||||
sp.Rotation = LSL_Api.Rot2Quaternion(rotation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2689,6 +2699,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osNpcTouch");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||
int linkNum = link_num.value;
|
||||
if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS))
|
||||
@@ -2696,12 +2707,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
UUID npcId;
|
||||
if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID))
|
||||
return;
|
||||
|
||||
SceneObjectPart part = null;
|
||||
UUID objectId;
|
||||
if (UUID.TryParse(LSL_String.ToString(object_key), out objectId))
|
||||
part = World.GetSceneObjectPart(objectId);
|
||||
|
||||
if (part == null)
|
||||
return;
|
||||
|
||||
if (linkNum != ScriptBaseClass.LINK_THIS)
|
||||
{
|
||||
if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT)
|
||||
@@ -2716,6 +2730,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
module.Touch(npcId, part.UUID);
|
||||
}
|
||||
}
|
||||
@@ -2866,7 +2881,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
avatar.SpeedModifier = (float)SpeedModifier;
|
||||
}
|
||||
|
||||
public void osKickAvatar(string FirstName,string SurName,string alert)
|
||||
public void osKickAvatar(string FirstName, string SurName, string alert)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
|
||||
m_host.AddScriptLPS(1);
|
||||
@@ -2880,7 +2895,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
sp.ControllingClient.Kick(alert);
|
||||
|
||||
// ...and close on our side
|
||||
sp.Scene.IncomingCloseAgent(sp.UUID);
|
||||
sp.Scene.IncomingCloseAgent(sp.UUID, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -40,16 +40,75 @@ using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// To permit region owners to enable the extended scripting functionality
|
||||
/// of OSSL, without allowing malicious scripts to access potentially
|
||||
/// troublesome functions, each OSSL function is assigned a threat level,
|
||||
/// and access to the functions is granted or denied based on a default
|
||||
/// threshold set in OpenSim.ini (which can be overridden for individual
|
||||
/// functions on a case-by-case basis)
|
||||
/// </summary>
|
||||
public enum ThreatLevel
|
||||
{
|
||||
// Not documented, presumably means permanently disabled ?
|
||||
NoAccess = -1,
|
||||
|
||||
/// <summary>
|
||||
/// Function is no threat at all. It doesn't constitute a threat to
|
||||
/// either users or the system and has no known side effects.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Abuse of this command can cause a nuisance to the region operator,
|
||||
/// such as log message spew.
|
||||
/// </summary>
|
||||
Nuisance = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Extreme levels of abuse of this function can cause impaired
|
||||
/// functioning of the region, or very gullible users can be tricked
|
||||
/// into experiencing harmless effects.
|
||||
/// </summary>
|
||||
VeryLow = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Intentional abuse can cause crashes or malfunction under certain
|
||||
/// circumstances, which can be easily rectified; or certain users can
|
||||
/// be tricked into certain situations in an avoidable manner.
|
||||
/// </summary>
|
||||
Low = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Intentional abuse can cause denial of service and crashes with
|
||||
/// potential of data or state loss; or trusting users can be tricked
|
||||
/// into embarrassing or uncomfortable situations.
|
||||
/// </summary>
|
||||
Moderate = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Casual abuse can cause impaired functionality or temporary denial
|
||||
/// of service conditions. Intentional abuse can easily cause crashes
|
||||
/// with potential data loss, or can be used to trick experienced and
|
||||
/// cautious users into unwanted situations, or changes global data
|
||||
/// permanently and without undo ability.
|
||||
/// </summary>
|
||||
High = 5,
|
||||
|
||||
/// <summary>
|
||||
/// Even normal use may, depending on the number of instances, or
|
||||
/// frequency of use, result in severe service impairment or crash
|
||||
/// with loss of data, or can be used to cause unwanted or harmful
|
||||
/// effects on users without giving the user a means to avoid it.
|
||||
/// </summary>
|
||||
VeryHigh = 6,
|
||||
|
||||
/// <summary>
|
||||
/// Even casual use is a danger to region stability, or function allows
|
||||
/// console or OS command execution, or function allows taking money
|
||||
/// without consent, or allows deletion or modification of user data,
|
||||
/// or allows the compromise of sensitive data by design.
|
||||
/// </summary>
|
||||
Severe = 7
|
||||
};
|
||||
|
||||
|
||||
@@ -226,6 +226,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
public const int ATTACH_BELLY = 28;
|
||||
public const int ATTACH_RPEC = 29;
|
||||
public const int ATTACH_LPEC = 30;
|
||||
public const int ATTACH_LEFT_PEC = 29; // Same value as ATTACH_RPEC, see https://jira.secondlife.com/browse/SVC-580
|
||||
public const int ATTACH_RIGHT_PEC = 30; // Same value as ATTACH_LPEC, see https://jira.secondlife.com/browse/SVC-580
|
||||
public const int ATTACH_HUD_CENTER_2 = 31;
|
||||
public const int ATTACH_HUD_TOP_RIGHT = 32;
|
||||
public const int ATTACH_HUD_TOP_CENTER = 33;
|
||||
|
||||
@@ -1064,7 +1064,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||
{
|
||||
list ret = new list();
|
||||
double entry;
|
||||
for (int i = 0; i < src.Data.Length - 1; i++)
|
||||
for (int i = 0; i < src.Data.Length; i++)
|
||||
{
|
||||
if (double.TryParse(src.Data[i].ToString(), NumberStyles.Float, Culture.NumberFormatInfo, out entry))
|
||||
{
|
||||
|
||||
134
OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
Normal file
134
OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using Nini.Config;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
|
||||
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
|
||||
using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
|
||||
using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class LSL_ApiListTests
|
||||
{
|
||||
private LSL_Api m_lslApi;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
IConfigSource initConfigSource = new IniConfigSource();
|
||||
IConfig config = initConfigSource.AddConfig("XEngine");
|
||||
config.Set("Enabled", "true");
|
||||
|
||||
Scene scene = new SceneHelpers().SetupScene();
|
||||
SceneObjectPart part = SceneHelpers.AddSceneObject(scene).RootPart;
|
||||
|
||||
XEngine.XEngine engine = new XEngine.XEngine();
|
||||
engine.Initialise(initConfigSource);
|
||||
engine.AddRegion(scene);
|
||||
|
||||
m_lslApi = new LSL_Api();
|
||||
m_lslApi.Initialize(engine, part, null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestllListFindList()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
LSL_List src = new LSL_List(new LSL_Integer(1), new LSL_Integer(2), new LSL_Integer(3));
|
||||
|
||||
{
|
||||
// Test for a single item that should be found
|
||||
int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(4)));
|
||||
Assert.That(result, Is.EqualTo(-1));
|
||||
}
|
||||
|
||||
{
|
||||
// Test for a single item that should be found
|
||||
int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(2)));
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
{
|
||||
// Test for a constant that should be found
|
||||
int result = m_lslApi.llListFindList(src, new LSL_List(ScriptBaseClass.AGENT));
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
{
|
||||
// Test for a list that should be found
|
||||
int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(2), new LSL_Integer(3)));
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
{
|
||||
// Test for a single item not in the list
|
||||
int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_Integer(4)));
|
||||
Assert.That(result, Is.EqualTo(-1));
|
||||
}
|
||||
|
||||
{
|
||||
// Test for something that should not be cast
|
||||
int result = m_lslApi.llListFindList(src, new LSL_List(new LSL_String("4")));
|
||||
Assert.That(result, Is.EqualTo(-1));
|
||||
}
|
||||
|
||||
{
|
||||
// Test for a list not in the list
|
||||
int result
|
||||
= m_lslApi.llListFindList(
|
||||
src, new LSL_List(new LSL_Integer(2), new LSL_Integer(3), new LSL_Integer(4)));
|
||||
Assert.That(result, Is.EqualTo(-1));
|
||||
}
|
||||
|
||||
{
|
||||
LSL_List srcWithConstants
|
||||
= new LSL_List(new LSL_Integer(3), ScriptBaseClass.AGENT, ScriptBaseClass.OS_NPC_LAND_AT_TARGET);
|
||||
|
||||
// Test for constants that appears in the source list that should be found
|
||||
int result
|
||||
= m_lslApi.llListFindList(srcWithConstants, new LSL_List(new LSL_Integer(1), new LSL_Integer(2)));
|
||||
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -589,7 +589,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
if (m_Assemblies.ContainsKey(instance.AssetID))
|
||||
{
|
||||
string assembly = m_Assemblies[instance.AssetID];
|
||||
instance.SaveState(assembly);
|
||||
|
||||
try
|
||||
{
|
||||
instance.SaveState(assembly);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format(
|
||||
"[XEngine]: Failed final state save for script {0}.{1}, item UUID {2}, prim UUID {3} in {4}. Exception ",
|
||||
instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, World.Name)
|
||||
, e);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the event queue and abort the instance thread
|
||||
@@ -707,7 +719,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
assembly = m_Assemblies[i.AssetID];
|
||||
}
|
||||
|
||||
i.SaveState(assembly);
|
||||
try
|
||||
{
|
||||
i.SaveState(assembly);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(
|
||||
string.Format(
|
||||
"[XEngine]: Failed to save state of script {0}.{1}, item UUID {2}, prim UUID {3} in {4}. Exception ",
|
||||
i.PrimName, i.ScriptName, i.ItemID, i.ObjectID, World.Name)
|
||||
, e);
|
||||
}
|
||||
}
|
||||
|
||||
instances.Clear();
|
||||
@@ -900,6 +923,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
// This delay exists to stop mono problems where script compilation and startup would stop the sim
|
||||
// working properly for the session.
|
||||
System.Threading.Thread.Sleep(m_StartDelay);
|
||||
|
||||
m_log.InfoFormat("[XEngine]: Performing initial script startup on {0}", m_Scene.Name);
|
||||
}
|
||||
|
||||
object[] o;
|
||||
@@ -915,13 +940,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
if (m_InitialStartup)
|
||||
if (scriptsStarted % 50 == 0)
|
||||
m_log.InfoFormat(
|
||||
"[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
|
||||
"[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.Name);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_InitialStartup)
|
||||
m_log.InfoFormat(
|
||||
"[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
|
||||
"[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.Name);
|
||||
|
||||
// NOTE: Despite having a lockless queue, this lock is required
|
||||
// to make sure there is never no compile thread while there
|
||||
@@ -982,10 +1007,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
return false;
|
||||
}
|
||||
|
||||
UUID assetID = item.AssetID;
|
||||
m_log.DebugFormat(
|
||||
"[XEngine] Loading script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
|
||||
part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
|
||||
part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
|
||||
//m_log.DebugFormat("[XEngine] Compiling script {0} ({1} on object {2})",
|
||||
// item.Name, itemID.ToString(), part.ParentGroup.RootPart.Name);
|
||||
UUID assetID = item.AssetID;
|
||||
|
||||
ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID);
|
||||
|
||||
@@ -1164,10 +1191,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
stateSource, m_MaxScriptQueue);
|
||||
|
||||
// if (DebugLevel >= 1)
|
||||
m_log.DebugFormat(
|
||||
"[XEngine] Loaded script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
|
||||
part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
|
||||
part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
// m_log.DebugFormat(
|
||||
// "[XEngine] Loaded script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
|
||||
// part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
|
||||
// part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||
|
||||
if (presence != null)
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
@@ -71,10 +72,17 @@ namespace OpenSim.Server.Base
|
||||
//
|
||||
private string m_pidFile = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Time at which this server was started
|
||||
/// </summary>
|
||||
protected DateTime m_startuptime;
|
||||
|
||||
// Handle all the automagical stuff
|
||||
//
|
||||
public ServicesServerBase(string prompt, string[] args)
|
||||
{
|
||||
m_startuptime = DateTime.Now;
|
||||
|
||||
// Save raw arguments
|
||||
//
|
||||
m_Arguments = args;
|
||||
@@ -250,6 +258,10 @@ namespace OpenSim.Server.Base
|
||||
"command-script <script>",
|
||||
"Run a command script from file", HandleScript);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand("General", false, "show uptime",
|
||||
"show uptime",
|
||||
"Show server uptime", HandleShow);
|
||||
|
||||
|
||||
// Allow derived classes to perform initialization that
|
||||
// needs to be done after the console has opened
|
||||
@@ -345,5 +357,34 @@ namespace OpenSim.Server.Base
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void HandleShow(string module, string[] cmd)
|
||||
{
|
||||
List<string> args = new List<string>(cmd);
|
||||
|
||||
args.RemoveAt(0);
|
||||
|
||||
string[] showParams = args.ToArray();
|
||||
|
||||
switch (showParams[0])
|
||||
{
|
||||
case "uptime":
|
||||
MainConsole.Instance.Output(GetUptimeReport());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a report about the uptime of this server
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected string GetUptimeReport()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now));
|
||||
sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime));
|
||||
sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,8 @@ namespace OpenSim.Server.Handlers.Avatar
|
||||
if (!UUID.TryParse(request["UserID"].ToString(), out user))
|
||||
return FailureResult();
|
||||
|
||||
RemoveRequestParamsNotForStorage(request);
|
||||
|
||||
AvatarData avatar = new AvatarData(request);
|
||||
if (m_AvatarService.SetAvatar(user, avatar))
|
||||
return SuccessResult();
|
||||
@@ -153,11 +155,25 @@ namespace OpenSim.Server.Handlers.Avatar
|
||||
if (!UUID.TryParse(request["UserID"].ToString(), out user))
|
||||
return FailureResult();
|
||||
|
||||
RemoveRequestParamsNotForStorage(request);
|
||||
|
||||
if (m_AvatarService.ResetAvatar(user))
|
||||
return SuccessResult();
|
||||
|
||||
return FailureResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove parameters that were used to invoke the method and should not in themselves be persisted.
|
||||
/// </summary>
|
||||
/// <param name='request'></param>
|
||||
private void RemoveRequestParamsNotForStorage(Dictionary<string, object> request)
|
||||
{
|
||||
request.Remove("VERSIONMAX");
|
||||
request.Remove("VERSIONMIN");
|
||||
request.Remove("METHOD");
|
||||
request.Remove("UserID");
|
||||
}
|
||||
|
||||
byte[] SetItems(Dictionary<string, object> request)
|
||||
{
|
||||
@@ -173,6 +189,8 @@ namespace OpenSim.Server.Handlers.Avatar
|
||||
if (!(request["Names"] is List<string> || request["Values"] is List<string>))
|
||||
return FailureResult();
|
||||
|
||||
RemoveRequestParamsNotForStorage(request);
|
||||
|
||||
List<string> _names = (List<string>)request["Names"];
|
||||
names = _names.ToArray();
|
||||
List<string> _values = (List<string>)request["Values"];
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace OpenSim.Services.AssetService
|
||||
|
||||
m_Database = LoadPlugin<IAssetDataPlugin>(dllName);
|
||||
if (m_Database == null)
|
||||
throw new Exception("Could not find a storage interface in the given module");
|
||||
throw new Exception(string.Format("Could not find a storage interface in the module {0}", dllName));
|
||||
|
||||
m_Database.Initialise(connString);
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace OpenSim.Services.AssetService
|
||||
m_AssetLoader = LoadPlugin<IAssetLoader>(loaderName);
|
||||
|
||||
if (m_AssetLoader == null)
|
||||
throw new Exception("Asset loader could not be loaded");
|
||||
throw new Exception(string.Format("Asset loader could not be loaded from {0}", loaderName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||
public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
|
||||
{
|
||||
Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
|
||||
Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
|
||||
Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
|
||||
|
||||
OSDMap extraData = new OSDMap
|
||||
{
|
||||
@@ -286,7 +286,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||
List<GridRegion> foundRegions = new List<GridRegion>();
|
||||
|
||||
Vector3d minPosition = new Vector3d(xmin, ymin, 0.0);
|
||||
Vector3d maxPosition = new Vector3d(xmax, ymax, 4096.0);
|
||||
Vector3d maxPosition = new Vector3d(xmax, ymax, Constants.RegionHeight);
|
||||
|
||||
NameValueCollection requestArgs = new NameValueCollection
|
||||
{
|
||||
|
||||
@@ -94,6 +94,7 @@ namespace OpenSim.Services.InventoryService
|
||||
|
||||
m_Database = LoadPlugin<IXInventoryData>(dllName,
|
||||
new Object[] {connString, String.Empty});
|
||||
|
||||
if (m_Database == null)
|
||||
throw new Exception("Could not find a storage interface in the given module");
|
||||
}
|
||||
@@ -229,10 +230,28 @@ namespace OpenSim.Services.InventoryService
|
||||
public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
|
||||
{
|
||||
// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID);
|
||||
|
||||
InventoryFolderBase rootFolder = GetRootFolder(principalID);
|
||||
|
||||
if (rootFolder == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[XINVENTORY]: Found no root folder for {0} in GetFolderForType() when looking for {1}",
|
||||
principalID, type);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return GetSystemFolderForType(rootFolder, type);
|
||||
}
|
||||
|
||||
private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type)
|
||||
{
|
||||
// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID);
|
||||
|
||||
XInventoryFolder[] folders = m_Database.GetFolders(
|
||||
new string[] { "agentID", "type"},
|
||||
new string[] { principalID.ToString(), ((int)type).ToString() });
|
||||
new string[] { "agentID", "parentFolderID", "type"},
|
||||
new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() });
|
||||
|
||||
if (folders.Length == 0)
|
||||
{
|
||||
@@ -308,22 +327,38 @@ namespace OpenSim.Services.InventoryService
|
||||
if (check != null)
|
||||
return false;
|
||||
|
||||
if (folder.Type == (short)AssetType.Folder
|
||||
|| folder.Type == (short)AssetType.Unknown
|
||||
|| folder.Type == (short)AssetType.OutfitFolder
|
||||
|| GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null)
|
||||
if (folder.Type != (short)AssetType.Folder && folder.Type != (short)AssetType.Unknown)
|
||||
{
|
||||
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
|
||||
return m_Database.StoreFolder(xFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[XINVENTORY]: Folder of type {0} already exists when tried to add {1} to {2} for {3}",
|
||||
folder.Type, folder.Name, folder.ParentID, folder.Owner);
|
||||
InventoryFolderBase rootFolder = GetRootFolder(folder.Owner);
|
||||
|
||||
if (rootFolder == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[XINVENTORY]: Found no root folder for {0} in AddFolder() when looking for {1}",
|
||||
folder.Owner, folder.Type);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check we're not trying to add this as a system folder.
|
||||
if (folder.ParentID == rootFolder.ID)
|
||||
{
|
||||
InventoryFolderBase existingSystemFolder
|
||||
= GetSystemFolderForType(rootFolder, (AssetType)folder.Type);
|
||||
|
||||
if (existingSystemFolder != null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[XINVENTORY]: System folder of type {0} already exists when tried to add {1} to {2} for {3}",
|
||||
folder.Type, folder.Name, folder.ParentID, folder.Owner);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
XInventoryFolder xFolder = ConvertFromOpenSim(folder);
|
||||
return m_Database.StoreFolder(xFolder);
|
||||
}
|
||||
|
||||
public virtual bool UpdateFolder(InventoryFolderBase folder)
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace OpenSim.Tests.Common
|
||||
config.AddConfig("Modules");
|
||||
config.AddConfig("InventoryService");
|
||||
config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");
|
||||
config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
|
||||
config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:XInventoryService");
|
||||
config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
|
||||
|
||||
LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector();
|
||||
|
||||
@@ -199,7 +199,9 @@ namespace OpenSim.Tests.Common
|
||||
string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
|
||||
|
||||
InventoryFolderBase newFolder
|
||||
= new InventoryFolderBase(UUID.Random(), components[0], parentFolder.Owner, parentFolder.ID);
|
||||
= new InventoryFolderBase(
|
||||
UUID.Random(), components[0], parentFolder.Owner, (short)AssetType.Unknown, parentFolder.ID, 0);
|
||||
|
||||
inventoryService.AddFolder(newFolder);
|
||||
|
||||
if (components.Length > 1)
|
||||
|
||||
@@ -933,6 +933,11 @@ namespace OpenSim.Tests.Common.Mock
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Close(false);
|
||||
}
|
||||
|
||||
public void Close(bool force)
|
||||
{
|
||||
// Fire the callback for this connection closing
|
||||
// This is necesary to get the presence detector to notice that a client has logged out.
|
||||
|
||||
131
OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
Normal file
131
OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Data;
|
||||
|
||||
namespace OpenSim.Tests.Common.Mock
|
||||
{
|
||||
public class TestXInventoryDataPlugin : IXInventoryData
|
||||
{
|
||||
private Dictionary<UUID, XInventoryFolder> m_allFolders = new Dictionary<UUID, XInventoryFolder>();
|
||||
private Dictionary<UUID, XInventoryItem> m_allItems = new Dictionary<UUID, XInventoryItem>();
|
||||
|
||||
public TestXInventoryDataPlugin(string conn, string realm) {}
|
||||
|
||||
public XInventoryItem[] GetItems(string[] fields, string[] vals)
|
||||
{
|
||||
List<XInventoryItem> origItems = Get<XInventoryItem>(fields, vals, m_allItems.Values.ToList());
|
||||
|
||||
return origItems.Select(i => i.Clone()).ToArray();
|
||||
}
|
||||
|
||||
public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
|
||||
{
|
||||
List<XInventoryFolder> origFolders
|
||||
= Get<XInventoryFolder>(fields, vals, m_allFolders.Values.ToList());
|
||||
|
||||
return origFolders.Select(f => f.Clone()).ToArray();
|
||||
}
|
||||
|
||||
private List<T> Get<T>(string[] fields, string[] vals, List<T> inputEntities)
|
||||
{
|
||||
List<T> entities = inputEntities;
|
||||
|
||||
for (int i = 0; i < fields.Length; i++)
|
||||
{
|
||||
entities
|
||||
= entities.Where(
|
||||
e =>
|
||||
{
|
||||
FieldInfo fi = typeof(T).GetField(fields[i]);
|
||||
if (fi == null)
|
||||
throw new NotImplementedException(string.Format("No field {0} for val {1}", fields[i], vals[i]));
|
||||
|
||||
return fi.GetValue(e).ToString() == vals[i];
|
||||
}
|
||||
).ToList();
|
||||
}
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
public bool StoreFolder(XInventoryFolder folder)
|
||||
{
|
||||
m_allFolders[folder.folderID] = folder.Clone();
|
||||
|
||||
// Console.WriteLine("Added folder {0} {1}", folder.folderName, folder.folderID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool StoreItem(XInventoryItem item)
|
||||
{
|
||||
m_allItems[item.inventoryID] = item.Clone();
|
||||
|
||||
// Console.WriteLine("Added item {0} {1}, creator {2}, owner {3}", item.inventoryName, item.inventoryID, item.creatorID, item.avatarID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool DeleteFolders(string field, string val)
|
||||
{
|
||||
return DeleteFolders(new string[] { field }, new string[] { val });
|
||||
}
|
||||
|
||||
public bool DeleteFolders(string[] fields, string[] vals)
|
||||
{
|
||||
XInventoryFolder[] foldersToDelete = GetFolders(fields, vals);
|
||||
Array.ForEach(foldersToDelete, f => m_allFolders.Remove(f.folderID));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool DeleteItems(string field, string val)
|
||||
{
|
||||
return DeleteItems(new string[] { field }, new string[] { val });
|
||||
}
|
||||
|
||||
public bool DeleteItems(string[] fields, string[] vals)
|
||||
{
|
||||
XInventoryItem[] itemsToDelete = GetItems(fields, vals);
|
||||
Array.ForEach(itemsToDelete, i => m_allItems.Remove(i.inventoryID));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MoveItem(string id, string newParent) { throw new NotImplementedException(); }
|
||||
public XInventoryItem[] GetActiveGestures(UUID principalID) { throw new NotImplementedException(); }
|
||||
public int GetAssetPermissions(UUID principalID, UUID assetID) { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,7 @@ namespace OpenSim.Tests.Common
|
||||
public static void EnableLogging()
|
||||
{
|
||||
log4net.Config.XmlConfigurator.Configure(EnableLoggingConfigStream);
|
||||
EnableLoggingConfigStream.Position = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -47,10 +47,10 @@ using OpenSim.Services.AvatarService;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Tests.Torture
|
||||
namespace OpenSim.Tests.Performance
|
||||
{
|
||||
/// <summary>
|
||||
/// NPC torture tests
|
||||
/// NPC performance tests
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached,
|
||||
@@ -58,7 +58,7 @@ namespace OpenSim.Tests.Torture
|
||||
/// earlier tests.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public class NPCTortureTests
|
||||
public class NPCPerformanceTests
|
||||
{
|
||||
private TestScene scene;
|
||||
private AvatarFactoryModule afm;
|
||||
@@ -36,10 +36,10 @@ using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Tests.Torture
|
||||
namespace OpenSim.Tests.Performance
|
||||
{
|
||||
/// <summary>
|
||||
/// Object torture tests
|
||||
/// Object performance tests
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached,
|
||||
@@ -47,7 +47,7 @@ namespace OpenSim.Tests.Torture
|
||||
/// earlier tests.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public class ObjectTortureTests
|
||||
public class ObjectPerformanceTests
|
||||
{
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
@@ -42,10 +42,10 @@ using OpenSim.Region.ScriptEngine.XEngine;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Tests.Torture
|
||||
namespace OpenSim.Tests.Performance
|
||||
{
|
||||
/// <summary>
|
||||
/// Script torture tests
|
||||
/// Script performance tests
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached,
|
||||
@@ -53,7 +53,7 @@ namespace OpenSim.Tests.Torture
|
||||
/// earlier tests.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public class ScriptTortureTests
|
||||
public class ScriptPerformanceTests
|
||||
{
|
||||
private TestScene m_scene;
|
||||
private XEngine m_xEngine;
|
||||
132
OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs
Normal file
132
OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using log4net.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Assets;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
|
||||
using OpenSim.Region.CoreModules.Scripting.VectorRender;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Tests.Stress
|
||||
{
|
||||
[TestFixture]
|
||||
public class VectorRenderModuleStressTests : OpenSimTestCase
|
||||
{
|
||||
public Scene Scene { get; private set; }
|
||||
public DynamicTextureModule Dtm { get; private set; }
|
||||
public VectorRenderModule Vrm { get; private set; }
|
||||
|
||||
private void SetupScene(bool reuseTextures)
|
||||
{
|
||||
Scene = new SceneHelpers().SetupScene();
|
||||
|
||||
Dtm = new DynamicTextureModule();
|
||||
Dtm.ReuseTextures = reuseTextures;
|
||||
|
||||
Vrm = new VectorRenderModule();
|
||||
|
||||
SceneHelpers.SetupSceneModules(Scene, Dtm, Vrm);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConcurrentRepeatedDraw()
|
||||
{
|
||||
int threads = 4;
|
||||
TestHelpers.InMethod();
|
||||
|
||||
SetupScene(false);
|
||||
|
||||
List<Drawer> drawers = new List<Drawer>();
|
||||
|
||||
for (int i = 0; i < threads; i++)
|
||||
{
|
||||
Drawer d = new Drawer(this, i);
|
||||
drawers.Add(d);
|
||||
Console.WriteLine("Starting drawer {0}", i);
|
||||
Util.FireAndForget(o => d.Draw());
|
||||
}
|
||||
|
||||
Thread.Sleep(10 * 60 * 1000);
|
||||
|
||||
drawers.ForEach(d => d.Ready = false);
|
||||
drawers.ForEach(d => Console.WriteLine("Drawer {0} drew {1} textures", d.Number, d.Pass + 1));
|
||||
}
|
||||
|
||||
class Drawer
|
||||
{
|
||||
public int Number { get; private set; }
|
||||
public int Pass { get; private set; }
|
||||
public bool Ready { get; set; }
|
||||
|
||||
private VectorRenderModuleStressTests m_tests;
|
||||
|
||||
public Drawer(VectorRenderModuleStressTests tests, int number)
|
||||
{
|
||||
m_tests = tests;
|
||||
Number = number;
|
||||
Ready = true;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_tests.Scene);
|
||||
|
||||
while (Ready)
|
||||
{
|
||||
UUID originalTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
|
||||
|
||||
// Ensure unique text
|
||||
string text = string.Format("{0:D2}{1}", Number, Pass);
|
||||
|
||||
m_tests.Dtm.AddDynamicTextureData(
|
||||
m_tests.Scene.RegionInfo.RegionID,
|
||||
so.UUID,
|
||||
m_tests.Vrm.GetContentType(),
|
||||
string.Format("PenColour BLACK; MoveTo 40,220; FontSize 32; Text {0};", text),
|
||||
"",
|
||||
0);
|
||||
|
||||
Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
|
||||
|
||||
Pass++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,5 @@
|
||||
<configuration>
|
||||
<dllmap os="osx" dll="openjpeg-dotnet.dll" target="lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1.dylib" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-dotnet.dll" target="lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-dotnet-x86_64.dll" target="lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1-x86_64" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="openjpeg-dotnet.dll" target="lib32/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="openjpeg-dotnet-x86_64.dll" target="lib64/libopenjpeg-dotnet-2.1.3.0-dotnet-1-i686" />
|
||||
<dllmap os="osx" dll="openjpeg-dotnet.dll" target="lib64/libopenjpeg-dotnet-2.1.5.0-dotnet-1.dylib" />
|
||||
<dllmap os="!windows,osx" cpu="x86-64,ia64" dll="openjpeg-dotnet-x86_64.dll" target="lib64/libopenjpeg-dotnet-x86_64" />
|
||||
<dllmap os="!windows,osx" cpu="x86" dll="openjpeg-dotnet.dll" target="lib32/libopenjpeg-dotnet" />
|
||||
</configuration>
|
||||
|
||||
Binary file not shown.
@@ -87,6 +87,10 @@
|
||||
;; from the selected region_info_source.
|
||||
; allow_regionless = false
|
||||
|
||||
;# {MaxPrimUndos} {} {Maximum number of undos avialable for position, rotation and scale changes of each prim} {} 20
|
||||
;; Increasing the number of undos available number will increase memory usage.
|
||||
MaxPrimUndos = 20
|
||||
|
||||
;# {NonPhysicalPrimMax} {} {Maximum size of nonphysical prims?} {} 256
|
||||
;; Maximum size for non-physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonphysicalPrimMax!).
|
||||
; NonphysicalPrimMax = 256
|
||||
@@ -675,7 +679,9 @@
|
||||
;; Maximum number of events to queue for a script (excluding timers)
|
||||
; MaxScriptEventQueue = 300
|
||||
|
||||
;; Stack size per thread created
|
||||
;; Stack size per script engine thread in bytes.
|
||||
;; If you are experiencing StackOverflowExceptions you may want to increase this (e.g. double it).
|
||||
;; The trade-off may be increased memory usage by the script engine.
|
||||
; ThreadStackSize = 262144
|
||||
|
||||
;# {DeleteScriptsOnStartup} {} {Delete previously compiled script DLLs on startup?} (true false) true
|
||||
|
||||
@@ -85,8 +85,12 @@
|
||||
;; from the selected region_info_source.
|
||||
allow_regionless = false
|
||||
|
||||
; Maximum size of non physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonphysicalPrimMax!).
|
||||
NonphysicalPrimMax = 256
|
||||
; Maximum number of position, rotation and scale changes for each prim that the simulator will store for later undos
|
||||
; Increasing this number will increase memory usage.
|
||||
MaxPrimUndos = 20
|
||||
|
||||
; Maximum size of non physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonPhysicalPrimMax!).
|
||||
NonPhysicalPrimMax = 256
|
||||
|
||||
; Maximum size of physical prims. Affects resizing of existing prims. This can be overriden in the region config file.
|
||||
PhysicalPrimMax = 10
|
||||
@@ -669,8 +673,7 @@
|
||||
; If true, avatar appearance information is resent to other avatars in the simulator every 60 seconds.
|
||||
; This may help with some situations where avatars are persistently grey, though it will not help
|
||||
; in other situations (e.g. appearance baking failures where the avatar only appears as a cloud to others).
|
||||
; This setting is experimental.
|
||||
ResendAppearanceUpdates = false
|
||||
ResendAppearanceUpdates = true
|
||||
|
||||
|
||||
[Attachments]
|
||||
@@ -693,6 +696,24 @@
|
||||
;LevelUpload = 0
|
||||
|
||||
|
||||
[Textures]
|
||||
; If true, textures generated dynamically (i.e. through osSetDynamicTextureData() and similar OSSL functions) are reused where possible
|
||||
; Chiefly, reuse occurs if a texture has already been generated with identical data and settings, and that texture contains no dynamic components
|
||||
; (e.g. images pulled from an external HTTP address).
|
||||
; Reusing previously generated textures results in a much faster update on the viewer but may cause issues if the viewer didn't receive all resolutions of the texture.
|
||||
; Currently, it will also increase asset cache use since temporary dynamic textures are no longer deleted.
|
||||
; Hence, currently considered experimental.
|
||||
; Default is false.
|
||||
ReuseDynamicTextures = false
|
||||
|
||||
; If true, then textures generated dynamically that have a low data size relative to their pixel size are not reused
|
||||
; This is to workaround an apparent LL 3.3.4 and earlier viewer bug where such textures are not redisplayed properly when pulled from the viewer cache.
|
||||
; Only set this to true if you are sure that all the viewers using your simulator will not suffer from this problem.
|
||||
; This setting only has an affect is ReuseDynamicTextures = true
|
||||
; Default is false
|
||||
ReuseDynamicLowDataTextures = false
|
||||
|
||||
|
||||
[ODEPhysicsSettings]
|
||||
; ##
|
||||
; ## Physics stats settings
|
||||
|
||||
@@ -54,10 +54,3 @@
|
||||
|
||||
; Warning level for cache directory size
|
||||
;CacheWarnAt = 30000
|
||||
|
||||
; Perform a deep scan of all assets within all regions, looking for all assets
|
||||
; present or referenced. Mark all assets found that are already present in the
|
||||
; cache, and request all assets that are found that are not already cached (this
|
||||
; will cause those assets to be cached)
|
||||
;
|
||||
DeepScanBeforePurge = true
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user