aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMarck2010-12-10 22:13:05 +0100
committerMarck2010-12-10 22:20:35 +0100
commitb512ecd1dc538f029e6772f526db78eb6687d938 (patch)
tree4796be07591156845a0cb94f4bcc77b27a4fcee2 /OpenSim/Region
parentRevert "A stab at mantis #5256. Separate ScenePresence updates from SceneObje... (diff)
downloadopensim-SC-b512ecd1dc538f029e6772f526db78eb6687d938.zip
opensim-SC-b512ecd1dc538f029e6772f526db78eb6687d938.tar.gz
opensim-SC-b512ecd1dc538f029e6772f526db78eb6687d938.tar.bz2
opensim-SC-b512ecd1dc538f029e6772f526db78eb6687d938.tar.xz
Normalization of OSSL function names.
Added the following replacement functions for compliance to the OSSL standards stated on the wiki: osGetTerrainHeight osSetTerrainHeight osGetSunParam osSetSunParam osSetPenColor The functions that do not comply to the standard give a warning when used but work normally otherwise. The graphics primitive drawing command "PenColor" has also been added as well as dynamic texture parameter "bgcolor" as an alternative to "bgcolour". The following two functions have been renamed because they are not enabled yet aynway: osWindParamSet => osSetWindParam osWindParamGet => osGetWindParam
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs23
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs71
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs19
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs33
4 files changed, 115 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 3291be4..7316e5b 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
165 int width = 256; 165 int width = 256;
166 int height = 256; 166 int height = 256;
167 int alpha = 255; // 0 is transparent 167 int alpha = 255; // 0 is transparent
168 Color bgColour = Color.White; // Default background color 168 Color bgColor = Color.White; // Default background color
169 char altDataDelim = ';'; 169 char altDataDelim = ';';
170 170
171 char[] paramDelimiter = { ',' }; 171 char[] paramDelimiter = { ',' };
@@ -253,15 +253,16 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
253 alpha = 256; 253 alpha = 256;
254 } 254 }
255 break; 255 break;
256 case "bgcolor":
256 case "bgcolour": 257 case "bgcolour":
257 int hex = 0; 258 int hex = 0;
258 if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) 259 if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
259 { 260 {
260 bgColour = Color.FromArgb(hex); 261 bgColor = Color.FromArgb(hex);
261 } 262 }
262 else 263 else
263 { 264 {
264 bgColour = Color.FromName(value); 265 bgColor = Color.FromName(value);
265 } 266 }
266 break; 267 break;
267 case "altdatadelim": 268 case "altdatadelim":
@@ -315,7 +316,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
315 // background color in their scripts, only do when fully opaque 316 // background color in their scripts, only do when fully opaque
316 if (alpha >= 255) 317 if (alpha >= 255)
317 { 318 {
318 graph.FillRectangle(new SolidBrush(bgColour), 0, 0, width, height); 319 graph.FillRectangle(new SolidBrush(bgColor), 0, 0, width, height);
319 } 320 }
320 321
321 for (int w = 0; w < bitmap.Width; w++) 322 for (int w = 0; w < bitmap.Width; w++)
@@ -616,25 +617,25 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
616 } 617 }
617 } 618 }
618 } 619 }
619 else if (nextLine.StartsWith("PenColour")) 620 else if (nextLine.StartsWith("PenColour") || nextLine.StartsWith("PenColor"))
620 { 621 {
621 nextLine = nextLine.Remove(0, 9); 622 nextLine = nextLine.Remove(0, 9);
622 nextLine = nextLine.Trim(); 623 nextLine = nextLine.Trim();
623 int hex = 0; 624 int hex = 0;
624 625
625 Color newColour; 626 Color newColor;
626 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) 627 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
627 { 628 {
628 newColour = Color.FromArgb(hex); 629 newColor = Color.FromArgb(hex);
629 } 630 }
630 else 631 else
631 { 632 {
632 // this doesn't fail, it just returns black if nothing is found 633 // this doesn't fail, it just returns black if nothing is found
633 newColour = Color.FromName(nextLine); 634 newColor = Color.FromName(nextLine);
634 } 635 }
635 636
636 myBrush.Color = newColour; 637 myBrush.Color = newColor;
637 drawPen.Color = newColour; 638 drawPen.Color = newColor;
638 } 639 }
639 } 640 }
640 } 641 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 827626f..691b67f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -336,6 +336,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
336 } 336 }
337 } 337 }
338 338
339 internal void OSSLDeprecated(string function, string replacement)
340 {
341 OSSLShoutError(string.Format("Use of function {0} is deprecated. Use {1} instead.", function, replacement));
342 }
343
339 protected void ScriptSleep(int delay) 344 protected void ScriptSleep(int delay)
340 { 345 {
341 delay = (int)((float)delay * m_ScriptDelayFactor); 346 delay = (int)((float)delay * m_ScriptDelayFactor);
@@ -347,13 +352,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
347 // 352 //
348 // OpenSim functions 353 // OpenSim functions
349 // 354 //
355 public LSL_Integer osSetTerrainHeight(int x, int y, double val)
356 {
357 CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight");
358 return SetTerrainHeight(x, y, val);
359 }
350 public LSL_Integer osTerrainSetHeight(int x, int y, double val) 360 public LSL_Integer osTerrainSetHeight(int x, int y, double val)
351 { 361 {
352 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); 362 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight");
353 363 OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight");
364 return SetTerrainHeight(x, y, val);
365 }
366 private LSL_Integer SetTerrainHeight(int x, int y, double val)
367 {
354 m_host.AddScriptLPS(1); 368 m_host.AddScriptLPS(1);
355 if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) 369 if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0)
356 OSSLError("osTerrainSetHeight: Coordinate out of bounds"); 370 OSSLError("osSetTerrainHeight: Coordinate out of bounds");
357 371
358 if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0))) 372 if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0)))
359 { 373 {
@@ -366,13 +380,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
366 } 380 }
367 } 381 }
368 382
383 public LSL_Float osGetTerrainHeight(int x, int y)
384 {
385 CheckThreatLevel(ThreatLevel.None, "osGetTerrainHeight");
386 return GetTerrainHeight(x, y);
387 }
369 public LSL_Float osTerrainGetHeight(int x, int y) 388 public LSL_Float osTerrainGetHeight(int x, int y)
370 { 389 {
371 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); 390 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight");
372 391 OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight");
392 return GetTerrainHeight(x, y);
393 }
394 private LSL_Float GetTerrainHeight(int x, int y)
395 {
373 m_host.AddScriptLPS(1); 396 m_host.AddScriptLPS(1);
374 if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) 397 if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0)
375 OSSLError("osTerrainGetHeight: Coordinate out of bounds"); 398 OSSLError("osGetTerrainHeight: Coordinate out of bounds");
376 399
377 return World.Heightmap[x, y]; 400 return World.Heightmap[x, y];
378 } 401 }
@@ -1001,9 +1024,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1001 return drawList; 1024 return drawList;
1002 } 1025 }
1003 1026
1027 public string osSetPenColor(string drawList, string color)
1028 {
1029 CheckThreatLevel(ThreatLevel.None, "osSetPenColor");
1030
1031 m_host.AddScriptLPS(1);
1032 drawList += "PenColor " + color + "; ";
1033 return drawList;
1034 }
1035 // Deprecated
1004 public string osSetPenColour(string drawList, string colour) 1036 public string osSetPenColour(string drawList, string colour)
1005 { 1037 {
1006 CheckThreatLevel(ThreatLevel.None, "osSetPenColour"); 1038 CheckThreatLevel(ThreatLevel.None, "osSetPenColour");
1039 OSSLDeprecated("osSetPenColour", "osSetPenColor");
1007 1040
1008 m_host.AddScriptLPS(1); 1041 m_host.AddScriptLPS(1);
1009 drawList += "PenColour " + colour + "; "; 1042 drawList += "PenColour " + colour + "; ";
@@ -1012,7 +1045,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1012 1045
1013 public string osSetPenCap(string drawList, string direction, string type) 1046 public string osSetPenCap(string drawList, string direction, string type)
1014 { 1047 {
1015 CheckThreatLevel(ThreatLevel.None, "osSetPenColour"); 1048 CheckThreatLevel(ThreatLevel.None, "osSetPenCap");
1016 1049
1017 m_host.AddScriptLPS(1); 1050 m_host.AddScriptLPS(1);
1018 drawList += "PenCap " + direction + "," + type + "; "; 1051 drawList += "PenCap " + direction + "," + type + "; ";
@@ -1157,6 +1190,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1157 public double osSunGetParam(string param) 1190 public double osSunGetParam(string param)
1158 { 1191 {
1159 CheckThreatLevel(ThreatLevel.None, "osSunGetParam"); 1192 CheckThreatLevel(ThreatLevel.None, "osSunGetParam");
1193 OSSLDeprecated("osSunGetParam", "osGetSunParam");
1194 return GetSunParam(param);
1195 }
1196 public double osGetSunParam(string param)
1197 {
1198 CheckThreatLevel(ThreatLevel.None, "osGetSunParam");
1199 return GetSunParam(param);
1200 }
1201 private double GetSunParam(string param)
1202 {
1160 m_host.AddScriptLPS(1); 1203 m_host.AddScriptLPS(1);
1161 1204
1162 double value = 0.0; 1205 double value = 0.0;
@@ -1173,6 +1216,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1173 public void osSunSetParam(string param, double value) 1216 public void osSunSetParam(string param, double value)
1174 { 1217 {
1175 CheckThreatLevel(ThreatLevel.None, "osSunSetParam"); 1218 CheckThreatLevel(ThreatLevel.None, "osSunSetParam");
1219 OSSLDeprecated("osSunSetParam", "osSetSunParam");
1220 SetSunParam(param, value);
1221 }
1222 public void osSetSunParam(string param, double value)
1223 {
1224 CheckThreatLevel(ThreatLevel.None, "osSetSunParam");
1225 SetSunParam(param, value);
1226 }
1227 private void SetSunParam(string param, double value)
1228 {
1176 m_host.AddScriptLPS(1); 1229 m_host.AddScriptLPS(1);
1177 1230
1178 ISunModule module = World.RequestModuleInterface<ISunModule>(); 1231 ISunModule module = World.RequestModuleInterface<ISunModule>();
@@ -1198,9 +1251,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1198 return String.Empty; 1251 return String.Empty;
1199 } 1252 }
1200 1253
1201 public void osWindParamSet(string plugin, string param, float value) 1254 public void osSetWindParam(string plugin, string param, float value)
1202 { 1255 {
1203 CheckThreatLevel(ThreatLevel.VeryLow, "osWindParamSet"); 1256 CheckThreatLevel(ThreatLevel.VeryLow, "osSetWindParam");
1204 m_host.AddScriptLPS(1); 1257 m_host.AddScriptLPS(1);
1205 1258
1206 IWindModule module = World.RequestModuleInterface<IWindModule>(); 1259 IWindModule module = World.RequestModuleInterface<IWindModule>();
@@ -1214,9 +1267,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1214 } 1267 }
1215 } 1268 }
1216 1269
1217 public float osWindParamGet(string plugin, string param) 1270 public float osGetWindParam(string plugin, string param)
1218 { 1271 {
1219 CheckThreatLevel(ThreatLevel.VeryLow, "osWindParamGet"); 1272 CheckThreatLevel(ThreatLevel.VeryLow, "osGetWindParam");
1220 m_host.AddScriptLPS(1); 1273 m_host.AddScriptLPS(1);
1221 1274
1222 IWindModule module = World.RequestModuleInterface<IWindModule>(); 1275 IWindModule module = World.RequestModuleInterface<IWindModule>();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 10d61ca..da81a51 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -67,8 +67,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
67 string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, 67 string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams,
68 bool blend, int disp, int timer, int alpha, int face); 68 bool blend, int disp, int timer, int alpha, int face);
69 69
70 LSL_Float osTerrainGetHeight(int x, int y); 70 LSL_Float osGetTerrainHeight(int x, int y);
71 LSL_Integer osTerrainSetHeight(int x, int y, double val); 71 LSL_Float osTerrainGetHeight(int x, int y); // Deprecated
72 LSL_Integer osSetTerrainHeight(int x, int y, double val);
73 LSL_Integer osTerrainSetHeight(int x, int y, double val); //Deprecated
72 void osTerrainFlush(); 74 void osTerrainFlush();
73 75
74 int osRegionRestart(double seconds); 76 int osRegionRestart(double seconds);
@@ -107,7 +109,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
107 string osSetFontName(string drawList, string fontName); 109 string osSetFontName(string drawList, string fontName);
108 string osSetFontSize(string drawList, int fontSize); 110 string osSetFontSize(string drawList, int fontSize);
109 string osSetPenSize(string drawList, int penSize); 111 string osSetPenSize(string drawList, int penSize);
110 string osSetPenColour(string drawList, string colour); 112 string osSetPenColor(string drawList, string color);
113 string osSetPenColour(string drawList, string colour); // Deprecated
111 string osSetPenCap(string drawList, string direction, string type); 114 string osSetPenCap(string drawList, string direction, string type);
112 string osDrawImage(string drawList, int width, int height, string imageUrl); 115 string osDrawImage(string drawList, int width, int height, string imageUrl);
113 vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize); 116 vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize);
@@ -119,13 +122,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
119 void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour); 122 void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour);
120 void osSetEstateSunSettings(bool sunFixed, double sunHour); 123 void osSetEstateSunSettings(bool sunFixed, double sunHour);
121 double osGetCurrentSunHour(); 124 double osGetCurrentSunHour();
122 double osSunGetParam(string param); 125 double osGetSunParam(string param);
123 void osSunSetParam(string param, double value); 126 double osSunGetParam(string param); // Deprecated
127 void osSetSunParam(string param, double value);
128 void osSunSetParam(string param, double value); // Deprecated
124 129
125 // Wind Module Functions 130 // Wind Module Functions
126 string osWindActiveModelPluginName(); 131 string osWindActiveModelPluginName();
127 void osWindParamSet(string plugin, string param, float value); 132 void osSetWindParam(string plugin, string param, float value);
128 float osWindParamGet(string plugin, string param); 133 float osGetWindParam(string plugin, string param);
129 134
130 // Parcel commands 135 // Parcel commands
131 void osParcelJoin(vector pos1, vector pos2); 136 void osParcelJoin(vector pos1, vector pos2);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index f3142e6..70d489e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -81,11 +81,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
81 return m_OSSL_Functions.osGetCurrentSunHour(); 81 return m_OSSL_Functions.osGetCurrentSunHour();
82 } 82 }
83 83
84 public double osGetSunParam(string param)
85 {
86 return m_OSSL_Functions.osGetSunParam(param);
87 }
88 // Deprecated
84 public double osSunGetParam(string param) 89 public double osSunGetParam(string param)
85 { 90 {
86 return m_OSSL_Functions.osSunGetParam(param); 91 return m_OSSL_Functions.osSunGetParam(param);
87 } 92 }
88 93
94 public void osSetSunParam(string param, double value)
95 {
96 m_OSSL_Functions.osSetSunParam(param, value);
97 }
98 // Deprecated
89 public void osSunSetParam(string param, double value) 99 public void osSunSetParam(string param, double value)
90 { 100 {
91 m_OSSL_Functions.osSunSetParam(param, value); 101 m_OSSL_Functions.osSunSetParam(param, value);
@@ -97,14 +107,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
97 } 107 }
98 108
99// Not yet plugged in as available OSSL functions, so commented out 109// Not yet plugged in as available OSSL functions, so commented out
100// void osWindParamSet(string plugin, string param, float value) 110// void osSetWindParam(string plugin, string param, float value)
101// { 111// {
102// m_OSSL_Functions.osWindParamSet(plugin, param, value); 112// m_OSSL_Functions.osSetWindParam(plugin, param, value);
103// } 113// }
104// 114//
105// float osWindParamGet(string plugin, string param) 115// float osGetWindParam(string plugin, string param)
106// { 116// {
107// return m_OSSL_Functions.osWindParamGet(plugin, param); 117// return m_OSSL_Functions.osGetWindParam(plugin, param);
108// } 118// }
109 119
110 public void osParcelJoin(vector pos1, vector pos2) 120 public void osParcelJoin(vector pos1, vector pos2)
@@ -165,11 +175,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
165 blend, disp, timer, alpha, face); 175 blend, disp, timer, alpha, face);
166 } 176 }
167 177
178 public LSL_Float osGetTerrainHeight(int x, int y)
179 {
180 return m_OSSL_Functions.osGetTerrainHeight(x, y);
181 }
182 // Deprecated
168 public LSL_Float osTerrainGetHeight(int x, int y) 183 public LSL_Float osTerrainGetHeight(int x, int y)
169 { 184 {
170 return m_OSSL_Functions.osTerrainGetHeight(x, y); 185 return m_OSSL_Functions.osTerrainGetHeight(x, y);
171 } 186 }
172 187
188 public LSL_Integer osSetTerrainHeight(int x, int y, double val)
189 {
190 return m_OSSL_Functions.osSetTerrainHeight(x, y, val);
191 }
192 // Deprecated
173 public LSL_Integer osTerrainSetHeight(int x, int y, double val) 193 public LSL_Integer osTerrainSetHeight(int x, int y, double val)
174 { 194 {
175 return m_OSSL_Functions.osTerrainSetHeight(x, y, val); 195 return m_OSSL_Functions.osTerrainSetHeight(x, y, val);
@@ -333,6 +353,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
333 return m_OSSL_Functions.osSetPenCap(drawList, direction, type); 353 return m_OSSL_Functions.osSetPenCap(drawList, direction, type);
334 } 354 }
335 355
356 public string osSetPenColor(string drawList, string color)
357 {
358 return m_OSSL_Functions.osSetPenColor(drawList, color);
359 }
360 // Deprecated
336 public string osSetPenColour(string drawList, string colour) 361 public string osSetPenColour(string drawList, string colour)
337 { 362 {
338 return m_OSSL_Functions.osSetPenColour(drawList, colour); 363 return m_OSSL_Functions.osSetPenColour(drawList, colour);