aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2012-02-15 03:51:30 +0000
committerUbitUmarov2012-02-15 03:51:30 +0000
commit04279e36d1bc01f966940eb8cc0457064356fced (patch)
treebff74b33a2cf072877e8f1d876944905399d4be6
parent remove drawstuff from ubitode (diff)
parentMerge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into ... (diff)
downloadopensim-SC_OLD-04279e36d1bc01f966940eb8cc0457064356fced.zip
opensim-SC_OLD-04279e36d1bc01f966940eb8cc0457064356fced.tar.gz
opensim-SC_OLD-04279e36d1bc01f966940eb8cc0457064356fced.tar.bz2
opensim-SC_OLD-04279e36d1bc01f966940eb8cc0457064356fced.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MSSQL/Resources/GridStore.migrations9
-rw-r--r--OpenSim/Data/SQLite/Resources/RegionStore.migrations70
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs927
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs11
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs34
-rw-r--r--OpenSim/Framework/RegionInfo.cs1
-rw-r--r--OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs19
-rw-r--r--OpenSim/Framework/Util.cs5
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs15
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs150
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs7
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs1
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs89
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs150
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs14
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs71
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs12
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs43
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs29
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs5
-rwxr-xr-xbin/OpenSim.ini.example14
-rw-r--r--bin/OpenSimDefaults.ini6
30 files changed, 1239 insertions, 540 deletions
diff --git a/OpenSim/Data/MSSQL/Resources/GridStore.migrations b/OpenSim/Data/MSSQL/Resources/GridStore.migrations
index c6342fc..de0cea7 100644
--- a/OpenSim/Data/MSSQL/Resources/GridStore.migrations
+++ b/OpenSim/Data/MSSQL/Resources/GridStore.migrations
@@ -235,4 +235,11 @@ CREATE NONCLUSTERED INDEX IX_regions_name ON dbo.regions
235 regionName 235 regionName
236 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] 236 ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
237 237
238COMMIT \ No newline at end of file 238COMMIT
239
240:VERSION 9
241
242BEGIN TRANSACTION
243ALTER TABLE regions ADD parcelMapTexture uniqueidentifier NULL;
244
245COMMIT
diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
index 31195af..0f40cdc 100644
--- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations
+++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations
@@ -472,3 +472,73 @@ COMMIT;
472BEGIN; 472BEGIN;
473ALTER TABLE regionsettings ADD COLUMN covenant_datetime INTEGER NOT NULL default 0; 473ALTER TABLE regionsettings ADD COLUMN covenant_datetime INTEGER NOT NULL default 0;
474COMMIT; 474COMMIT;
475
476:VERSION 23
477BEGIN;
478CREATE TABLE regionwindlight (
479 region_id VARCHAR(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000' PRIMARY KEY,
480 water_color_r FLOAT NOT NULL DEFAULT '4.000000',
481 water_color_g FLOAT NOT NULL DEFAULT '38.000000',
482 water_color_b FLOAT NOT NULL DEFAULT '64.000000',
483 water_color_i FLOAT NOT NULL DEFAULT '1.000000',
484 water_fog_density_exponent FLOAT NOT NULL DEFAULT '4.0',
485 underwater_fog_modifier FLOAT NOT NULL DEFAULT '0.25',
486 reflection_wavelet_scale_1 FLOAT NOT NULL DEFAULT '2.0',
487 reflection_wavelet_scale_2 FLOAT NOT NULL DEFAULT '2.0',
488 reflection_wavelet_scale_3 FLOAT NOT NULL DEFAULT '2.0',
489 fresnel_scale FLOAT NOT NULL DEFAULT '0.40',
490 fresnel_offset FLOAT NOT NULL DEFAULT '0.50',
491 refract_scale_above FLOAT NOT NULL DEFAULT '0.03',
492 refract_scale_below FLOAT NOT NULL DEFAULT '0.20',
493 blur_multiplier FLOAT NOT NULL DEFAULT '0.040',
494 big_wave_direction_x FLOAT NOT NULL DEFAULT '1.05',
495 big_wave_direction_y FLOAT NOT NULL DEFAULT '-0.42',
496 little_wave_direction_x FLOAT NOT NULL DEFAULT '1.11',
497 little_wave_direction_y FLOAT NOT NULL DEFAULT '-1.16',
498 normal_map_texture VARCHAR(36) NOT NULL DEFAULT '822ded49-9a6c-f61c-cb89-6df54f42cdf4',
499 horizon_r FLOAT NOT NULL DEFAULT '0.25',
500 horizon_g FLOAT NOT NULL DEFAULT '0.25',
501 horizon_b FLOAT NOT NULL DEFAULT '0.32',
502 horizon_i FLOAT NOT NULL DEFAULT '0.32',
503 haze_horizon FLOAT NOT NULL DEFAULT '0.19',
504 blue_density_r FLOAT NOT NULL DEFAULT '0.12',
505 blue_density_g FLOAT NOT NULL DEFAULT '0.22',
506 blue_density_b FLOAT NOT NULL DEFAULT '0.38',
507 blue_density_i FLOAT NOT NULL DEFAULT '0.38',
508 haze_density FLOAT NOT NULL DEFAULT '0.70',
509 density_multiplier FLOAT NOT NULL DEFAULT '0.18',
510 distance_multiplier FLOAT NOT NULL DEFAULT '0.8',
511 max_altitude INTEGER NOT NULL DEFAULT '1605',
512 sun_moon_color_r FLOAT NOT NULL DEFAULT '0.24',
513 sun_moon_color_g FLOAT NOT NULL DEFAULT '0.26',
514 sun_moon_color_b FLOAT NOT NULL DEFAULT '0.30',
515 sun_moon_color_i FLOAT NOT NULL DEFAULT '0.30',
516 sun_moon_position FLOAT NOT NULL DEFAULT '0.317',
517 ambient_r FLOAT NOT NULL DEFAULT '0.35',
518 ambient_g FLOAT NOT NULL DEFAULT '0.35',
519 ambient_b FLOAT NOT NULL DEFAULT '0.35',
520 ambient_i FLOAT NOT NULL DEFAULT '0.35',
521 east_angle FLOAT NOT NULL DEFAULT '0.00',
522 sun_glow_focus FLOAT NOT NULL DEFAULT '0.10',
523 sun_glow_size FLOAT NOT NULL DEFAULT '1.75',
524 scene_gamma FLOAT NOT NULL DEFAULT '1.00',
525 star_brightness FLOAT NOT NULL DEFAULT '0.00',
526 cloud_color_r FLOAT NOT NULL DEFAULT '0.41',
527 cloud_color_g FLOAT NOT NULL DEFAULT '0.41',
528 cloud_color_b FLOAT NOT NULL DEFAULT '0.41',
529 cloud_color_i FLOAT NOT NULL DEFAULT '0.41',
530 cloud_x FLOAT NOT NULL DEFAULT '1.00',
531 cloud_y FLOAT NOT NULL DEFAULT '0.53',
532 cloud_density FLOAT NOT NULL DEFAULT '1.00',
533 cloud_coverage FLOAT NOT NULL DEFAULT '0.27',
534 cloud_scale FLOAT NOT NULL DEFAULT '0.42',
535 cloud_detail_x FLOAT NOT NULL DEFAULT '1.00',
536 cloud_detail_y FLOAT NOT NULL DEFAULT '0.53',
537 cloud_detail_density FLOAT NOT NULL DEFAULT '0.12',
538 cloud_scroll_x FLOAT NOT NULL DEFAULT '0.20',
539 cloud_scroll_x_lock INTEGER NOT NULL DEFAULT '0',
540 cloud_scroll_y FLOAT NOT NULL DEFAULT '0.01',
541 cloud_scroll_y_lock INTEGER NOT NULL DEFAULT '0',
542 draw_classic_clouds INTEGER NOT NULL DEFAULT '1');
543
544COMMIT; \ No newline at end of file
diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index a313c4f..ce1b7b4 100644
--- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -35,7 +35,7 @@ using log4net;
35#if CSharpSqlite 35#if CSharpSqlite
36 using Community.CsharpSqlite.Sqlite; 36 using Community.CsharpSqlite.Sqlite;
37#else 37#else
38 using Mono.Data.Sqlite; 38using Mono.Data.Sqlite;
39#endif 39#endif
40using OpenMetaverse; 40using OpenMetaverse;
41using OpenMetaverse.StructuredData; 41using OpenMetaverse.StructuredData;
@@ -60,6 +60,7 @@ namespace OpenSim.Data.SQLite
60 private const string landAccessListSelect = "select distinct * from landaccesslist"; 60 private const string landAccessListSelect = "select distinct * from landaccesslist";
61 private const string regionbanListSelect = "select * from regionban"; 61 private const string regionbanListSelect = "select * from regionban";
62 private const string regionSettingsSelect = "select * from regionsettings"; 62 private const string regionSettingsSelect = "select * from regionsettings";
63 private const string regionWindlightSelect = "select * from regionwindlight";
63 64
64 private DataSet ds; 65 private DataSet ds;
65 private SqliteDataAdapter primDa; 66 private SqliteDataAdapter primDa;
@@ -69,9 +70,9 @@ namespace OpenSim.Data.SQLite
69 private SqliteDataAdapter landDa; 70 private SqliteDataAdapter landDa;
70 private SqliteDataAdapter landAccessListDa; 71 private SqliteDataAdapter landAccessListDa;
71 private SqliteDataAdapter regionSettingsDa; 72 private SqliteDataAdapter regionSettingsDa;
73 private SqliteDataAdapter regionWindlightDa;
72 74
73 private SqliteConnection m_conn; 75 private SqliteConnection m_conn;
74
75 private String m_connectionString; 76 private String m_connectionString;
76 77
77 protected virtual Assembly Assembly 78 protected virtual Assembly Assembly
@@ -136,6 +137,9 @@ namespace OpenSim.Data.SQLite
136 137
137 SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); 138 SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
138 regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); 139 regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
140
141 SqliteCommand regionWindlightSelectCmd = new SqliteCommand(regionWindlightSelect, m_conn);
142 regionWindlightDa = new SqliteDataAdapter(regionWindlightSelectCmd);
139 // This actually does the roll forward assembly stuff 143 // This actually does the roll forward assembly stuff
140 Migration m = new Migration(m_conn, Assembly, "RegionStore"); 144 Migration m = new Migration(m_conn, Assembly, "RegionStore");
141 m.Update(); 145 m.Update();
@@ -163,6 +167,9 @@ namespace OpenSim.Data.SQLite
163 ds.Tables.Add(createRegionSettingsTable()); 167 ds.Tables.Add(createRegionSettingsTable());
164 setupRegionSettingsCommands(regionSettingsDa, m_conn); 168 setupRegionSettingsCommands(regionSettingsDa, m_conn);
165 169
170 ds.Tables.Add(createRegionWindlightTable());
171 setupRegionWindlightCommands(regionWindlightDa, m_conn);
172
166 // WORKAROUND: This is a work around for sqlite on 173 // WORKAROUND: This is a work around for sqlite on
167 // windows, which gets really unhappy with blob columns 174 // windows, which gets really unhappy with blob columns
168 // that have no sample data in them. At some point we 175 // that have no sample data in them. At some point we
@@ -171,63 +178,72 @@ namespace OpenSim.Data.SQLite
171 { 178 {
172 primDa.Fill(ds.Tables["prims"]); 179 primDa.Fill(ds.Tables["prims"]);
173 } 180 }
174 catch (Exception) 181 catch (Exception e)
175 { 182 {
176 m_log.Info("[SQLITE REGION DB]: Caught fill error on prims table"); 183 m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on prims table :{0}", e.Message);
177 } 184 }
178 185
179 try 186 try
180 { 187 {
181 shapeDa.Fill(ds.Tables["primshapes"]); 188 shapeDa.Fill(ds.Tables["primshapes"]);
182 } 189 }
183 catch (Exception) 190 catch (Exception e)
184 { 191 {
185 m_log.Info("[SQLITE REGION DB]: Caught fill error on primshapes table"); 192 m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on primshapes table :{0}", e.Message);
186 } 193 }
187 194
188 try 195 try
189 { 196 {
190 itemsDa.Fill(ds.Tables["primitems"]); 197 itemsDa.Fill(ds.Tables["primitems"]);
191 } 198 }
192 catch (Exception) 199 catch (Exception e)
193 { 200 {
194 m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table"); 201 m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on primitems table :{0}", e.Message);
195 } 202 }
196 203
197 try 204 try
198 { 205 {
199 terrainDa.Fill(ds.Tables["terrain"]); 206 terrainDa.Fill(ds.Tables["terrain"]);
200 } 207 }
201 catch (Exception) 208 catch (Exception e)
202 { 209 {
203 m_log.Info("[SQLITE REGION DB]: Caught fill error on terrain table"); 210 m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on terrain table :{0}", e.Message);
204 } 211 }
205 212
206 try 213 try
207 { 214 {
208 landDa.Fill(ds.Tables["land"]); 215 landDa.Fill(ds.Tables["land"]);
209 } 216 }
210 catch (Exception) 217 catch (Exception e)
211 { 218 {
212 m_log.Info("[SQLITE REGION DB]: Caught fill error on land table"); 219 m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on land table :{0}", e.Message);
213 } 220 }
214 221
215 try 222 try
216 { 223 {
217 landAccessListDa.Fill(ds.Tables["landaccesslist"]); 224 landAccessListDa.Fill(ds.Tables["landaccesslist"]);
218 } 225 }
219 catch (Exception) 226 catch (Exception e)
220 { 227 {
221 m_log.Info("[SQLITE REGION DB]: Caught fill error on landaccesslist table"); 228 m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on landaccesslist table :{0}", e.Message);
222 } 229 }
223 230
224 try 231 try
225 { 232 {
226 regionSettingsDa.Fill(ds.Tables["regionsettings"]); 233 regionSettingsDa.Fill(ds.Tables["regionsettings"]);
227 } 234 }
228 catch (Exception) 235 catch (Exception e)
236 {
237 m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionsettings table :{0}", e.Message);
238 }
239
240 try
241 {
242 regionWindlightDa.Fill(ds.Tables["regionwindlight"]);
243 }
244 catch (Exception e)
229 { 245 {
230 m_log.Info("[SQLITE REGION DB]: Caught fill error on regionsettings table"); 246 m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionwindlight table :{0}", e.Message);
231 } 247 }
232 248
233 // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! 249 // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
@@ -240,14 +256,14 @@ namespace OpenSim.Data.SQLite
240 CreateDataSetMapping(landDa, "land"); 256 CreateDataSetMapping(landDa, "land");
241 CreateDataSetMapping(landAccessListDa, "landaccesslist"); 257 CreateDataSetMapping(landAccessListDa, "landaccesslist");
242 CreateDataSetMapping(regionSettingsDa, "regionsettings"); 258 CreateDataSetMapping(regionSettingsDa, "regionsettings");
259 CreateDataSetMapping(regionWindlightDa, "regionwindlight");
243 } 260 }
244 } 261 }
245 catch (Exception e) 262 catch (Exception e)
246 { 263 {
247 m_log.Error(e); 264 m_log.ErrorFormat("[SQLITE REGION DB]: ", e);
248 Environment.Exit(23); 265 Environment.Exit(23);
249 } 266 }
250
251 return; 267 return;
252 } 268 }
253 269
@@ -298,6 +314,11 @@ namespace OpenSim.Data.SQLite
298 regionSettingsDa.Dispose(); 314 regionSettingsDa.Dispose();
299 regionSettingsDa = null; 315 regionSettingsDa = null;
300 } 316 }
317 if (regionWindlightDa != null)
318 {
319 regionWindlightDa.Dispose();
320 regionWindlightDa = null;
321 }
301 } 322 }
302 323
303 public void StoreRegionSettings(RegionSettings rs) 324 public void StoreRegionSettings(RegionSettings rs)
@@ -321,19 +342,76 @@ namespace OpenSim.Data.SQLite
321 Commit(); 342 Commit();
322 } 343 }
323 } 344 }
345
346 /// <summary>
347 /// Load windlight settings from region storage
348 /// </summary>
349 /// <param name="regionUUID">RegionID</param>
324 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) 350 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
325 { 351 {
326 //This connector doesn't support the windlight module yet 352 RegionLightShareData wl = null;
327 //Return default LL windlight settings 353
328 return new RegionLightShareData(); 354 lock (ds)
355 {
356 DataTable windlightTable = ds.Tables["regionwindlight"];
357 DataRow windlightRow = windlightTable.Rows.Find(regionUUID.ToString());
358 if (windlightRow == null)
359 {
360 wl = new RegionLightShareData();
361 wl.regionID = regionUUID;
362 StoreRegionWindlightSettings(wl);
363 return wl;
364 }
365 wl = buildRegionWindlight(windlightRow);
366 return wl;
367 }
329 } 368 }
369
370 /// <summary>
371 /// Remove windlight settings from region storage
372 /// </summary>
373 /// <param name="regionID">RegionID</param>
330 public void RemoveRegionWindlightSettings(UUID regionID) 374 public void RemoveRegionWindlightSettings(UUID regionID)
331 { 375 {
376 lock (ds)
377 {
378 DataTable windlightTable = ds.Tables["regionwindlight"];
379 DataRow windlightRow = windlightTable.Rows.Find(regionID.ToString());
380
381 if (windlightRow != null)
382 {
383 windlightRow.Delete();
384 }
385 }
386 Commit();
332 } 387 }
388
389 /// <summary>
390 /// Adds an windlight into region storage
391 /// </summary>
392 /// <param name="wl">RegionLightShareData</param>
333 public void StoreRegionWindlightSettings(RegionLightShareData wl) 393 public void StoreRegionWindlightSettings(RegionLightShareData wl)
334 { 394 {
335 //This connector doesn't support the windlight module yet 395 lock (ds)
396 {
397 DataTable windlightTable = ds.Tables["regionwindlight"];
398 DataRow windlightRow = windlightTable.Rows.Find(wl.regionID.ToString());
399
400 if (windlightRow == null)
401 {
402 windlightRow = windlightTable.NewRow();
403 fillRegionWindlightRow(windlightRow, wl);
404 windlightTable.Rows.Add(windlightRow);
405 }
406 else
407 {
408 fillRegionWindlightRow(windlightRow, wl);
409 }
410
411 Commit();
412 }
336 } 413 }
414
337 public RegionSettings LoadRegionSettings(UUID regionUUID) 415 public RegionSettings LoadRegionSettings(UUID regionUUID)
338 { 416 {
339 lock (ds) 417 lock (ds)
@@ -387,7 +465,7 @@ namespace OpenSim.Data.SQLite
387 } 465 }
388 466
389 Commit(); 467 Commit();
390 // m_log.Info("[Dump of prims]: " + ds.GetXml()); 468// m_log.Info("[Dump of prims]: " + ds.GetXml());
391 } 469 }
392 470
393 /// <summary> 471 /// <summary>
@@ -397,7 +475,7 @@ namespace OpenSim.Data.SQLite
397 /// <param name="regionUUID">the region UUID</param> 475 /// <param name="regionUUID">the region UUID</param>
398 public void RemoveObject(UUID obj, UUID regionUUID) 476 public void RemoveObject(UUID obj, UUID regionUUID)
399 { 477 {
400 // m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID); 478// m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID);
401 479
402 DataTable prims = ds.Tables["prims"]; 480 DataTable prims = ds.Tables["prims"];
403 DataTable shapes = ds.Tables["primshapes"]; 481 DataTable shapes = ds.Tables["primshapes"];
@@ -409,7 +487,7 @@ namespace OpenSim.Data.SQLite
409 foreach (DataRow row in primRows) 487 foreach (DataRow row in primRows)
410 { 488 {
411 // Remove shape rows 489 // Remove shape rows
412 UUID uuid = new UUID((string) row["UUID"]); 490 UUID uuid = new UUID((string)row["UUID"]);
413 DataRow shapeRow = shapes.Rows.Find(uuid.ToString()); 491 DataRow shapeRow = shapes.Rows.Find(uuid.ToString());
414 if (shapeRow != null) 492 if (shapeRow != null)
415 { 493 {
@@ -464,7 +542,7 @@ namespace OpenSim.Data.SQLite
464 { 542 {
465 DataRow[] primsForRegion = prims.Select(byRegion); 543 DataRow[] primsForRegion = prims.Select(byRegion);
466// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); 544// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
467 545
468 // First, create all groups 546 // First, create all groups
469 foreach (DataRow primRow in primsForRegion) 547 foreach (DataRow primRow in primsForRegion)
470 { 548 {
@@ -472,9 +550,9 @@ namespace OpenSim.Data.SQLite
472 { 550 {
473 SceneObjectPart prim = null; 551 SceneObjectPart prim = null;
474 552
475 string uuid = (string) primRow["UUID"]; 553 string uuid = (string)primRow["UUID"];
476 string objID = (string) primRow["SceneGroupID"]; 554 string objID = (string)primRow["SceneGroupID"];
477 555
478 if (uuid == objID) //is new SceneObjectGroup ? 556 if (uuid == objID) //is new SceneObjectGroup ?
479 { 557 {
480 prim = buildPrim(primRow); 558 prim = buildPrim(primRow);
@@ -489,7 +567,7 @@ namespace OpenSim.Data.SQLite
489 "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); 567 "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
490 prim.Shape = PrimitiveBaseShape.Default; 568 prim.Shape = PrimitiveBaseShape.Default;
491 } 569 }
492 570
493 SceneObjectGroup group = new SceneObjectGroup(prim); 571 SceneObjectGroup group = new SceneObjectGroup(prim);
494 createdObjects.Add(group.UUID, group); 572 createdObjects.Add(group.UUID, group);
495 retvals.Add(group); 573 retvals.Add(group);
@@ -506,7 +584,7 @@ namespace OpenSim.Data.SQLite
506 } 584 }
507 } 585 }
508 } 586 }
509 587
510 // Now fill the groups with part data 588 // Now fill the groups with part data
511 foreach (DataRow primRow in primsForRegion) 589 foreach (DataRow primRow in primsForRegion)
512 { 590 {
@@ -514,8 +592,8 @@ namespace OpenSim.Data.SQLite
514 { 592 {
515 SceneObjectPart prim = null; 593 SceneObjectPart prim = null;
516 594
517 string uuid = (string) primRow["UUID"]; 595 string uuid = (string)primRow["UUID"];
518 string objID = (string) primRow["SceneGroupID"]; 596 string objID = (string)primRow["SceneGroupID"];
519 if (uuid != objID) //is new SceneObjectGroup ? 597 if (uuid != objID) //is new SceneObjectGroup ?
520 { 598 {
521 prim = buildPrim(primRow); 599 prim = buildPrim(primRow);
@@ -562,8 +640,7 @@ namespace OpenSim.Data.SQLite
562 DataRow[] dbItemRows = dbItems.Select(sql); 640 DataRow[] dbItemRows = dbItems.Select(sql);
563 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 641 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
564 642
565// m_log.DebugFormat( 643// m_log.DebugFormat("[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
566// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
567 644
568 foreach (DataRow row in dbItemRows) 645 foreach (DataRow row in dbItemRows)
569 { 646 {
@@ -742,7 +819,7 @@ namespace OpenSim.Data.SQLite
742 // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString())); 819 // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString()));
743 // cmd.ExecuteNonQuery(); 820 // cmd.ExecuteNonQuery();
744 821
745// } 822 // }
746 823
747 // This is the slower.. but more appropriate thing to do 824 // This is the slower.. but more appropriate thing to do
748 825
@@ -805,7 +882,7 @@ namespace OpenSim.Data.SQLite
805 /// </summary> 882 /// </summary>
806 public void Commit() 883 public void Commit()
807 { 884 {
808 //m_log.Debug("[SQLITE]: Starting commit"); 885// m_log.Debug("[SQLITE]: Starting commit");
809 lock (ds) 886 lock (ds)
810 { 887 {
811 primDa.Update(ds, "prims"); 888 primDa.Update(ds, "prims");
@@ -819,6 +896,7 @@ namespace OpenSim.Data.SQLite
819 try 896 try
820 { 897 {
821 regionSettingsDa.Update(ds, "regionsettings"); 898 regionSettingsDa.Update(ds, "regionsettings");
899 regionWindlightDa.Update(ds, "regionwindlight");
822 } 900 }
823 catch (SqliteException SqlEx) 901 catch (SqliteException SqlEx)
824 { 902 {
@@ -875,9 +953,9 @@ namespace OpenSim.Data.SQLite
875 { 953 {
876 DataTable terrain = new DataTable("terrain"); 954 DataTable terrain = new DataTable("terrain");
877 955
878 createCol(terrain, "RegionUUID", typeof (String)); 956 createCol(terrain, "RegionUUID", typeof(String));
879 createCol(terrain, "Revision", typeof (Int32)); 957 createCol(terrain, "Revision", typeof(Int32));
880 createCol(terrain, "Heightfield", typeof (Byte[])); 958 createCol(terrain, "Heightfield", typeof(Byte[]));
881 959
882 return terrain; 960 return terrain;
883 } 961 }
@@ -890,62 +968,62 @@ namespace OpenSim.Data.SQLite
890 { 968 {
891 DataTable prims = new DataTable("prims"); 969 DataTable prims = new DataTable("prims");
892 970
893 createCol(prims, "UUID", typeof (String)); 971 createCol(prims, "UUID", typeof(String));
894 createCol(prims, "RegionUUID", typeof (String)); 972 createCol(prims, "RegionUUID", typeof(String));
895 createCol(prims, "CreationDate", typeof (Int32)); 973 createCol(prims, "CreationDate", typeof(Int32));
896 createCol(prims, "Name", typeof (String)); 974 createCol(prims, "Name", typeof(String));
897 createCol(prims, "SceneGroupID", typeof (String)); 975 createCol(prims, "SceneGroupID", typeof(String));
898 // various text fields 976 // various text fields
899 createCol(prims, "Text", typeof (String)); 977 createCol(prims, "Text", typeof(String));
900 createCol(prims, "ColorR", typeof (Int32)); 978 createCol(prims, "ColorR", typeof(Int32));
901 createCol(prims, "ColorG", typeof (Int32)); 979 createCol(prims, "ColorG", typeof(Int32));
902 createCol(prims, "ColorB", typeof (Int32)); 980 createCol(prims, "ColorB", typeof(Int32));
903 createCol(prims, "ColorA", typeof (Int32)); 981 createCol(prims, "ColorA", typeof(Int32));
904 createCol(prims, "Description", typeof (String)); 982 createCol(prims, "Description", typeof(String));
905 createCol(prims, "SitName", typeof (String)); 983 createCol(prims, "SitName", typeof(String));
906 createCol(prims, "TouchName", typeof (String)); 984 createCol(prims, "TouchName", typeof(String));
907 // permissions 985 // permissions
908 createCol(prims, "ObjectFlags", typeof (Int32)); 986 createCol(prims, "ObjectFlags", typeof(Int32));
909 createCol(prims, "CreatorID", typeof (String)); 987 createCol(prims, "CreatorID", typeof(String));
910 createCol(prims, "OwnerID", typeof (String)); 988 createCol(prims, "OwnerID", typeof(String));
911 createCol(prims, "GroupID", typeof (String)); 989 createCol(prims, "GroupID", typeof(String));
912 createCol(prims, "LastOwnerID", typeof (String)); 990 createCol(prims, "LastOwnerID", typeof(String));
913 createCol(prims, "OwnerMask", typeof (Int32)); 991 createCol(prims, "OwnerMask", typeof(Int32));
914 createCol(prims, "NextOwnerMask", typeof (Int32)); 992 createCol(prims, "NextOwnerMask", typeof(Int32));
915 createCol(prims, "GroupMask", typeof (Int32)); 993 createCol(prims, "GroupMask", typeof(Int32));
916 createCol(prims, "EveryoneMask", typeof (Int32)); 994 createCol(prims, "EveryoneMask", typeof(Int32));
917 createCol(prims, "BaseMask", typeof (Int32)); 995 createCol(prims, "BaseMask", typeof(Int32));
918 // vectors 996 // vectors
919 createCol(prims, "PositionX", typeof (Double)); 997 createCol(prims, "PositionX", typeof(Double));
920 createCol(prims, "PositionY", typeof (Double)); 998 createCol(prims, "PositionY", typeof(Double));
921 createCol(prims, "PositionZ", typeof (Double)); 999 createCol(prims, "PositionZ", typeof(Double));
922 createCol(prims, "GroupPositionX", typeof (Double)); 1000 createCol(prims, "GroupPositionX", typeof(Double));
923 createCol(prims, "GroupPositionY", typeof (Double)); 1001 createCol(prims, "GroupPositionY", typeof(Double));
924 createCol(prims, "GroupPositionZ", typeof (Double)); 1002 createCol(prims, "GroupPositionZ", typeof(Double));
925 createCol(prims, "VelocityX", typeof (Double)); 1003 createCol(prims, "VelocityX", typeof(Double));
926 createCol(prims, "VelocityY", typeof (Double)); 1004 createCol(prims, "VelocityY", typeof(Double));
927 createCol(prims, "VelocityZ", typeof (Double)); 1005 createCol(prims, "VelocityZ", typeof(Double));
928 createCol(prims, "AngularVelocityX", typeof (Double)); 1006 createCol(prims, "AngularVelocityX", typeof(Double));
929 createCol(prims, "AngularVelocityY", typeof (Double)); 1007 createCol(prims, "AngularVelocityY", typeof(Double));
930 createCol(prims, "AngularVelocityZ", typeof (Double)); 1008 createCol(prims, "AngularVelocityZ", typeof(Double));
931 createCol(prims, "AccelerationX", typeof (Double)); 1009 createCol(prims, "AccelerationX", typeof(Double));
932 createCol(prims, "AccelerationY", typeof (Double)); 1010 createCol(prims, "AccelerationY", typeof(Double));
933 createCol(prims, "AccelerationZ", typeof (Double)); 1011 createCol(prims, "AccelerationZ", typeof(Double));
934 // quaternions 1012 // quaternions
935 createCol(prims, "RotationX", typeof (Double)); 1013 createCol(prims, "RotationX", typeof(Double));
936 createCol(prims, "RotationY", typeof (Double)); 1014 createCol(prims, "RotationY", typeof(Double));
937 createCol(prims, "RotationZ", typeof (Double)); 1015 createCol(prims, "RotationZ", typeof(Double));
938 createCol(prims, "RotationW", typeof (Double)); 1016 createCol(prims, "RotationW", typeof(Double));
939 1017
940 // sit target 1018 // sit target
941 createCol(prims, "SitTargetOffsetX", typeof (Double)); 1019 createCol(prims, "SitTargetOffsetX", typeof(Double));
942 createCol(prims, "SitTargetOffsetY", typeof (Double)); 1020 createCol(prims, "SitTargetOffsetY", typeof(Double));
943 createCol(prims, "SitTargetOffsetZ", typeof (Double)); 1021 createCol(prims, "SitTargetOffsetZ", typeof(Double));
944 1022
945 createCol(prims, "SitTargetOrientW", typeof (Double)); 1023 createCol(prims, "SitTargetOrientW", typeof(Double));
946 createCol(prims, "SitTargetOrientX", typeof (Double)); 1024 createCol(prims, "SitTargetOrientX", typeof(Double));
947 createCol(prims, "SitTargetOrientY", typeof (Double)); 1025 createCol(prims, "SitTargetOrientY", typeof(Double));
948 createCol(prims, "SitTargetOrientZ", typeof (Double)); 1026 createCol(prims, "SitTargetOrientZ", typeof(Double));
949 1027
950 createCol(prims, "PayPrice", typeof(Int32)); 1028 createCol(prims, "PayPrice", typeof(Int32));
951 createCol(prims, "PayButton1", typeof(Int32)); 1029 createCol(prims, "PayButton1", typeof(Int32));
@@ -981,7 +1059,7 @@ namespace OpenSim.Data.SQLite
981 createCol(prims, "SaleType", typeof(Int16)); 1059 createCol(prims, "SaleType", typeof(Int16));
982 1060
983 // click action 1061 // click action
984 createCol(prims, "ClickAction", typeof (Byte)); 1062 createCol(prims, "ClickAction", typeof(Byte));
985 1063
986 createCol(prims, "Material", typeof(Byte)); 1064 createCol(prims, "Material", typeof(Byte));
987 1065
@@ -993,7 +1071,7 @@ namespace OpenSim.Data.SQLite
993 createCol(prims, "MediaURL", typeof(String)); 1071 createCol(prims, "MediaURL", typeof(String));
994 1072
995 // Add in contraints 1073 // Add in contraints
996 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; 1074 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
997 1075
998 return prims; 1076 return prims;
999 } 1077 }
@@ -1005,42 +1083,42 @@ namespace OpenSim.Data.SQLite
1005 private static DataTable createShapeTable() 1083 private static DataTable createShapeTable()
1006 { 1084 {
1007 DataTable shapes = new DataTable("primshapes"); 1085 DataTable shapes = new DataTable("primshapes");
1008 createCol(shapes, "UUID", typeof (String)); 1086 createCol(shapes, "UUID", typeof(String));
1009 // shape is an enum 1087 // shape is an enum
1010 createCol(shapes, "Shape", typeof (Int32)); 1088 createCol(shapes, "Shape", typeof(Int32));
1011 // vectors 1089 // vectors
1012 createCol(shapes, "ScaleX", typeof (Double)); 1090 createCol(shapes, "ScaleX", typeof(Double));
1013 createCol(shapes, "ScaleY", typeof (Double)); 1091 createCol(shapes, "ScaleY", typeof(Double));
1014 createCol(shapes, "ScaleZ", typeof (Double)); 1092 createCol(shapes, "ScaleZ", typeof(Double));
1015 // paths 1093 // paths
1016 createCol(shapes, "PCode", typeof (Int32)); 1094 createCol(shapes, "PCode", typeof(Int32));
1017 createCol(shapes, "PathBegin", typeof (Int32)); 1095 createCol(shapes, "PathBegin", typeof(Int32));
1018 createCol(shapes, "PathEnd", typeof (Int32)); 1096 createCol(shapes, "PathEnd", typeof(Int32));
1019 createCol(shapes, "PathScaleX", typeof (Int32)); 1097 createCol(shapes, "PathScaleX", typeof(Int32));
1020 createCol(shapes, "PathScaleY", typeof (Int32)); 1098 createCol(shapes, "PathScaleY", typeof(Int32));
1021 createCol(shapes, "PathShearX", typeof (Int32)); 1099 createCol(shapes, "PathShearX", typeof(Int32));
1022 createCol(shapes, "PathShearY", typeof (Int32)); 1100 createCol(shapes, "PathShearY", typeof(Int32));
1023 createCol(shapes, "PathSkew", typeof (Int32)); 1101 createCol(shapes, "PathSkew", typeof(Int32));
1024 createCol(shapes, "PathCurve", typeof (Int32)); 1102 createCol(shapes, "PathCurve", typeof(Int32));
1025 createCol(shapes, "PathRadiusOffset", typeof (Int32)); 1103 createCol(shapes, "PathRadiusOffset", typeof(Int32));
1026 createCol(shapes, "PathRevolutions", typeof (Int32)); 1104 createCol(shapes, "PathRevolutions", typeof(Int32));
1027 createCol(shapes, "PathTaperX", typeof (Int32)); 1105 createCol(shapes, "PathTaperX", typeof(Int32));
1028 createCol(shapes, "PathTaperY", typeof (Int32)); 1106 createCol(shapes, "PathTaperY", typeof(Int32));
1029 createCol(shapes, "PathTwist", typeof (Int32)); 1107 createCol(shapes, "PathTwist", typeof(Int32));
1030 createCol(shapes, "PathTwistBegin", typeof (Int32)); 1108 createCol(shapes, "PathTwistBegin", typeof(Int32));
1031 // profile 1109 // profile
1032 createCol(shapes, "ProfileBegin", typeof (Int32)); 1110 createCol(shapes, "ProfileBegin", typeof(Int32));
1033 createCol(shapes, "ProfileEnd", typeof (Int32)); 1111 createCol(shapes, "ProfileEnd", typeof(Int32));
1034 createCol(shapes, "ProfileCurve", typeof (Int32)); 1112 createCol(shapes, "ProfileCurve", typeof(Int32));
1035 createCol(shapes, "ProfileHollow", typeof (Int32)); 1113 createCol(shapes, "ProfileHollow", typeof(Int32));
1036 createCol(shapes, "State", typeof(Int32)); 1114 createCol(shapes, "State", typeof(Int32));
1037 // text TODO: this isn't right, but I'm not sure the right 1115 // text TODO: this isn't right, but I'm not sure the right
1038 // way to specify this as a blob atm 1116 // way to specify this as a blob atm
1039 createCol(shapes, "Texture", typeof (Byte[])); 1117 createCol(shapes, "Texture", typeof(Byte[]));
1040 createCol(shapes, "ExtraParams", typeof (Byte[])); 1118 createCol(shapes, "ExtraParams", typeof(Byte[]));
1041 createCol(shapes, "Media", typeof(String)); 1119 createCol(shapes, "Media", typeof(String));
1042 1120
1043 shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; 1121 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] };
1044 1122
1045 return shapes; 1123 return shapes;
1046 } 1124 }
@@ -1053,29 +1131,29 @@ namespace OpenSim.Data.SQLite
1053 { 1131 {
1054 DataTable items = new DataTable("primitems"); 1132 DataTable items = new DataTable("primitems");
1055 1133
1056 createCol(items, "itemID", typeof (String)); 1134 createCol(items, "itemID", typeof(String));
1057 createCol(items, "primID", typeof (String)); 1135 createCol(items, "primID", typeof(String));
1058 createCol(items, "assetID", typeof (String)); 1136 createCol(items, "assetID", typeof(String));
1059 createCol(items, "parentFolderID", typeof (String)); 1137 createCol(items, "parentFolderID", typeof(String));
1060 1138
1061 createCol(items, "invType", typeof (Int32)); 1139 createCol(items, "invType", typeof(Int32));
1062 createCol(items, "assetType", typeof (Int32)); 1140 createCol(items, "assetType", typeof(Int32));
1063 1141
1064 createCol(items, "name", typeof (String)); 1142 createCol(items, "name", typeof(String));
1065 createCol(items, "description", typeof (String)); 1143 createCol(items, "description", typeof(String));
1066 1144
1067 createCol(items, "creationDate", typeof (Int64)); 1145 createCol(items, "creationDate", typeof(Int64));
1068 createCol(items, "creatorID", typeof (String)); 1146 createCol(items, "creatorID", typeof(String));
1069 createCol(items, "ownerID", typeof (String)); 1147 createCol(items, "ownerID", typeof(String));
1070 createCol(items, "lastOwnerID", typeof (String)); 1148 createCol(items, "lastOwnerID", typeof(String));
1071 createCol(items, "groupID", typeof (String)); 1149 createCol(items, "groupID", typeof(String));
1072 1150
1073 createCol(items, "nextPermissions", typeof (UInt32)); 1151 createCol(items, "nextPermissions", typeof(UInt32));
1074 createCol(items, "currentPermissions", typeof (UInt32)); 1152 createCol(items, "currentPermissions", typeof(UInt32));
1075 createCol(items, "basePermissions", typeof (UInt32)); 1153 createCol(items, "basePermissions", typeof(UInt32));
1076 createCol(items, "everyonePermissions", typeof (UInt32)); 1154 createCol(items, "everyonePermissions", typeof(UInt32));
1077 createCol(items, "groupPermissions", typeof (UInt32)); 1155 createCol(items, "groupPermissions", typeof(UInt32));
1078 createCol(items, "flags", typeof (UInt32)); 1156 createCol(items, "flags", typeof(UInt32));
1079 1157
1080 items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] }; 1158 items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] };
1081 1159
@@ -1089,44 +1167,44 @@ namespace OpenSim.Data.SQLite
1089 private static DataTable createLandTable() 1167 private static DataTable createLandTable()
1090 { 1168 {
1091 DataTable land = new DataTable("land"); 1169 DataTable land = new DataTable("land");
1092 createCol(land, "UUID", typeof (String)); 1170 createCol(land, "UUID", typeof(String));
1093 createCol(land, "RegionUUID", typeof (String)); 1171 createCol(land, "RegionUUID", typeof(String));
1094 createCol(land, "LocalLandID", typeof (UInt32)); 1172 createCol(land, "LocalLandID", typeof(UInt32));
1095 1173
1096 // Bitmap is a byte[512] 1174 // Bitmap is a byte[512]
1097 createCol(land, "Bitmap", typeof (Byte[])); 1175 createCol(land, "Bitmap", typeof(Byte[]));
1098 1176
1099 createCol(land, "Name", typeof (String)); 1177 createCol(land, "Name", typeof(String));
1100 createCol(land, "Desc", typeof (String)); 1178 createCol(land, "Desc", typeof(String));
1101 createCol(land, "OwnerUUID", typeof (String)); 1179 createCol(land, "OwnerUUID", typeof(String));
1102 createCol(land, "IsGroupOwned", typeof (Boolean)); 1180 createCol(land, "IsGroupOwned", typeof(Boolean));
1103 createCol(land, "Area", typeof (Int32)); 1181 createCol(land, "Area", typeof(Int32));
1104 createCol(land, "AuctionID", typeof (Int32)); //Unemplemented 1182 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented
1105 createCol(land, "Category", typeof (Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory 1183 createCol(land, "Category", typeof(Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory
1106 createCol(land, "ClaimDate", typeof (Int32)); 1184 createCol(land, "ClaimDate", typeof(Int32));
1107 createCol(land, "ClaimPrice", typeof (Int32)); 1185 createCol(land, "ClaimPrice", typeof(Int32));
1108 createCol(land, "GroupUUID", typeof (string)); 1186 createCol(land, "GroupUUID", typeof(string));
1109 createCol(land, "SalePrice", typeof (Int32)); 1187 createCol(land, "SalePrice", typeof(Int32));
1110 createCol(land, "LandStatus", typeof (Int32)); //Enum. OpenMetaverse.Parcel.ParcelStatus 1188 createCol(land, "LandStatus", typeof(Int32)); //Enum. OpenMetaverse.Parcel.ParcelStatus
1111 createCol(land, "LandFlags", typeof (UInt32)); 1189 createCol(land, "LandFlags", typeof(UInt32));
1112 createCol(land, "LandingType", typeof (Byte)); 1190 createCol(land, "LandingType", typeof(Byte));
1113 createCol(land, "MediaAutoScale", typeof (Byte)); 1191 createCol(land, "MediaAutoScale", typeof(Byte));
1114 createCol(land, "MediaTextureUUID", typeof (String)); 1192 createCol(land, "MediaTextureUUID", typeof(String));
1115 createCol(land, "MediaURL", typeof (String)); 1193 createCol(land, "MediaURL", typeof(String));
1116 createCol(land, "MusicURL", typeof (String)); 1194 createCol(land, "MusicURL", typeof(String));
1117 createCol(land, "PassHours", typeof (Double)); 1195 createCol(land, "PassHours", typeof(Double));
1118 createCol(land, "PassPrice", typeof (UInt32)); 1196 createCol(land, "PassPrice", typeof(UInt32));
1119 createCol(land, "SnapshotUUID", typeof (String)); 1197 createCol(land, "SnapshotUUID", typeof(String));
1120 createCol(land, "UserLocationX", typeof (Double)); 1198 createCol(land, "UserLocationX", typeof(Double));
1121 createCol(land, "UserLocationY", typeof (Double)); 1199 createCol(land, "UserLocationY", typeof(Double));
1122 createCol(land, "UserLocationZ", typeof (Double)); 1200 createCol(land, "UserLocationZ", typeof(Double));
1123 createCol(land, "UserLookAtX", typeof (Double)); 1201 createCol(land, "UserLookAtX", typeof(Double));
1124 createCol(land, "UserLookAtY", typeof (Double)); 1202 createCol(land, "UserLookAtY", typeof(Double));
1125 createCol(land, "UserLookAtZ", typeof (Double)); 1203 createCol(land, "UserLookAtZ", typeof(Double));
1126 createCol(land, "AuthbuyerID", typeof(String)); 1204 createCol(land, "AuthbuyerID", typeof(String));
1127 createCol(land, "OtherCleanTime", typeof(Int32)); 1205 createCol(land, "OtherCleanTime", typeof(Int32));
1128 1206
1129 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; 1207 land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] };
1130 1208
1131 return land; 1209 return land;
1132 } 1210 }
@@ -1138,9 +1216,9 @@ namespace OpenSim.Data.SQLite
1138 private static DataTable createLandAccessListTable() 1216 private static DataTable createLandAccessListTable()
1139 { 1217 {
1140 DataTable landaccess = new DataTable("landaccesslist"); 1218 DataTable landaccess = new DataTable("landaccesslist");
1141 createCol(landaccess, "LandUUID", typeof (String)); 1219 createCol(landaccess, "LandUUID", typeof(String));
1142 createCol(landaccess, "AccessUUID", typeof (String)); 1220 createCol(landaccess, "AccessUUID", typeof(String));
1143 createCol(landaccess, "Flags", typeof (UInt32)); 1221 createCol(landaccess, "Flags", typeof(UInt32));
1144 1222
1145 return landaccess; 1223 return landaccess;
1146 } 1224 }
@@ -1149,41 +1227,41 @@ namespace OpenSim.Data.SQLite
1149 { 1227 {
1150 DataTable regionsettings = new DataTable("regionsettings"); 1228 DataTable regionsettings = new DataTable("regionsettings");
1151 createCol(regionsettings, "regionUUID", typeof(String)); 1229 createCol(regionsettings, "regionUUID", typeof(String));
1152 createCol(regionsettings, "block_terraform", typeof (Int32)); 1230 createCol(regionsettings, "block_terraform", typeof(Int32));
1153 createCol(regionsettings, "block_fly", typeof (Int32)); 1231 createCol(regionsettings, "block_fly", typeof(Int32));
1154 createCol(regionsettings, "allow_damage", typeof (Int32)); 1232 createCol(regionsettings, "allow_damage", typeof(Int32));
1155 createCol(regionsettings, "restrict_pushing", typeof (Int32)); 1233 createCol(regionsettings, "restrict_pushing", typeof(Int32));
1156 createCol(regionsettings, "allow_land_resell", typeof (Int32)); 1234 createCol(regionsettings, "allow_land_resell", typeof(Int32));
1157 createCol(regionsettings, "allow_land_join_divide", typeof (Int32)); 1235 createCol(regionsettings, "allow_land_join_divide", typeof(Int32));
1158 createCol(regionsettings, "block_show_in_search", typeof (Int32)); 1236 createCol(regionsettings, "block_show_in_search", typeof(Int32));
1159 createCol(regionsettings, "agent_limit", typeof (Int32)); 1237 createCol(regionsettings, "agent_limit", typeof(Int32));
1160 createCol(regionsettings, "object_bonus", typeof (Double)); 1238 createCol(regionsettings, "object_bonus", typeof(Double));
1161 createCol(regionsettings, "maturity", typeof (Int32)); 1239 createCol(regionsettings, "maturity", typeof(Int32));
1162 createCol(regionsettings, "disable_scripts", typeof (Int32)); 1240 createCol(regionsettings, "disable_scripts", typeof(Int32));
1163 createCol(regionsettings, "disable_collisions", typeof (Int32)); 1241 createCol(regionsettings, "disable_collisions", typeof(Int32));
1164 createCol(regionsettings, "disable_physics", typeof (Int32)); 1242 createCol(regionsettings, "disable_physics", typeof(Int32));
1165 createCol(regionsettings, "terrain_texture_1", typeof(String)); 1243 createCol(regionsettings, "terrain_texture_1", typeof(String));
1166 createCol(regionsettings, "terrain_texture_2", typeof(String)); 1244 createCol(regionsettings, "terrain_texture_2", typeof(String));
1167 createCol(regionsettings, "terrain_texture_3", typeof(String)); 1245 createCol(regionsettings, "terrain_texture_3", typeof(String));
1168 createCol(regionsettings, "terrain_texture_4", typeof(String)); 1246 createCol(regionsettings, "terrain_texture_4", typeof(String));
1169 createCol(regionsettings, "elevation_1_nw", typeof (Double)); 1247 createCol(regionsettings, "elevation_1_nw", typeof(Double));
1170 createCol(regionsettings, "elevation_2_nw", typeof (Double)); 1248 createCol(regionsettings, "elevation_2_nw", typeof(Double));
1171 createCol(regionsettings, "elevation_1_ne", typeof (Double)); 1249 createCol(regionsettings, "elevation_1_ne", typeof(Double));
1172 createCol(regionsettings, "elevation_2_ne", typeof (Double)); 1250 createCol(regionsettings, "elevation_2_ne", typeof(Double));
1173 createCol(regionsettings, "elevation_1_se", typeof (Double)); 1251 createCol(regionsettings, "elevation_1_se", typeof(Double));
1174 createCol(regionsettings, "elevation_2_se", typeof (Double)); 1252 createCol(regionsettings, "elevation_2_se", typeof(Double));
1175 createCol(regionsettings, "elevation_1_sw", typeof (Double)); 1253 createCol(regionsettings, "elevation_1_sw", typeof(Double));
1176 createCol(regionsettings, "elevation_2_sw", typeof (Double)); 1254 createCol(regionsettings, "elevation_2_sw", typeof(Double));
1177 createCol(regionsettings, "water_height", typeof (Double)); 1255 createCol(regionsettings, "water_height", typeof(Double));
1178 createCol(regionsettings, "terrain_raise_limit", typeof (Double)); 1256 createCol(regionsettings, "terrain_raise_limit", typeof(Double));
1179 createCol(regionsettings, "terrain_lower_limit", typeof (Double)); 1257 createCol(regionsettings, "terrain_lower_limit", typeof(Double));
1180 createCol(regionsettings, "use_estate_sun", typeof (Int32)); 1258 createCol(regionsettings, "use_estate_sun", typeof(Int32));
1181 createCol(regionsettings, "sandbox", typeof (Int32)); 1259 createCol(regionsettings, "sandbox", typeof(Int32));
1182 createCol(regionsettings, "sunvectorx",typeof (Double)); 1260 createCol(regionsettings, "sunvectorx", typeof(Double));
1183 createCol(regionsettings, "sunvectory",typeof (Double)); 1261 createCol(regionsettings, "sunvectory", typeof(Double));
1184 createCol(regionsettings, "sunvectorz",typeof (Double)); 1262 createCol(regionsettings, "sunvectorz", typeof(Double));
1185 createCol(regionsettings, "fixed_sun", typeof (Int32)); 1263 createCol(regionsettings, "fixed_sun", typeof(Int32));
1186 createCol(regionsettings, "sun_position", typeof (Double)); 1264 createCol(regionsettings, "sun_position", typeof(Double));
1187 createCol(regionsettings, "covenant", typeof(String)); 1265 createCol(regionsettings, "covenant", typeof(String));
1188 createCol(regionsettings, "covenant_datetime", typeof(Int32)); 1266 createCol(regionsettings, "covenant_datetime", typeof(Int32));
1189 createCol(regionsettings, "map_tile_ID", typeof(String)); 1267 createCol(regionsettings, "map_tile_ID", typeof(String));
@@ -1191,6 +1269,82 @@ namespace OpenSim.Data.SQLite
1191 return regionsettings; 1269 return regionsettings;
1192 } 1270 }
1193 1271
1272 /// <summary>
1273 /// create "regionwindlight" table
1274 /// </summary>
1275 /// <returns>RegionWindlight DataTable</returns>
1276 private static DataTable createRegionWindlightTable()
1277 {
1278 DataTable regionwindlight = new DataTable("regionwindlight");
1279 createCol(regionwindlight, "region_id", typeof(String));
1280 createCol(regionwindlight, "water_color_r", typeof(Double));
1281 createCol(regionwindlight, "water_color_g", typeof(Double));
1282 createCol(regionwindlight, "water_color_b", typeof(Double));
1283 createCol(regionwindlight, "water_color_i", typeof(Double));
1284 createCol(regionwindlight, "water_fog_density_exponent", typeof(Double));
1285 createCol(regionwindlight, "underwater_fog_modifier", typeof(Double));
1286 createCol(regionwindlight, "reflection_wavelet_scale_1", typeof(Double));
1287 createCol(regionwindlight, "reflection_wavelet_scale_2", typeof(Double));
1288 createCol(regionwindlight, "reflection_wavelet_scale_3", typeof(Double));
1289 createCol(regionwindlight, "fresnel_scale", typeof(Double));
1290 createCol(regionwindlight, "fresnel_offset", typeof(Double));
1291 createCol(regionwindlight, "refract_scale_above", typeof(Double));
1292 createCol(regionwindlight, "refract_scale_below", typeof(Double));
1293 createCol(regionwindlight, "blur_multiplier", typeof(Double));
1294 createCol(regionwindlight, "big_wave_direction_x", typeof(Double));
1295 createCol(regionwindlight, "big_wave_direction_y", typeof(Double));
1296 createCol(regionwindlight, "little_wave_direction_x", typeof(Double));
1297 createCol(regionwindlight, "little_wave_direction_y", typeof(Double));
1298 createCol(regionwindlight, "normal_map_texture", typeof(String));
1299 createCol(regionwindlight, "horizon_r", typeof(Double));
1300 createCol(regionwindlight, "horizon_g", typeof(Double));
1301 createCol(regionwindlight, "horizon_b", typeof(Double));
1302 createCol(regionwindlight, "horizon_i", typeof(Double));
1303 createCol(regionwindlight, "haze_horizon", typeof(Double));
1304 createCol(regionwindlight, "blue_density_r", typeof(Double));
1305 createCol(regionwindlight, "blue_density_g", typeof(Double));
1306 createCol(regionwindlight, "blue_density_b", typeof(Double));
1307 createCol(regionwindlight, "blue_density_i", typeof(Double));
1308 createCol(regionwindlight, "haze_density", typeof(Double));
1309 createCol(regionwindlight, "density_multiplier", typeof(Double));
1310 createCol(regionwindlight, "distance_multiplier", typeof(Double));
1311 createCol(regionwindlight, "max_altitude", typeof(Int32));
1312 createCol(regionwindlight, "sun_moon_color_r", typeof(Double));
1313 createCol(regionwindlight, "sun_moon_color_g", typeof(Double));
1314 createCol(regionwindlight, "sun_moon_color_b", typeof(Double));
1315 createCol(regionwindlight, "sun_moon_color_i", typeof(Double));
1316 createCol(regionwindlight, "sun_moon_position", typeof(Double));
1317 createCol(regionwindlight, "ambient_r", typeof(Double));
1318 createCol(regionwindlight, "ambient_g", typeof(Double));
1319 createCol(regionwindlight, "ambient_b", typeof(Double));
1320 createCol(regionwindlight, "ambient_i", typeof(Double));
1321 createCol(regionwindlight, "east_angle", typeof(Double));
1322 createCol(regionwindlight, "sun_glow_focus", typeof(Double));
1323 createCol(regionwindlight, "sun_glow_size", typeof(Double));
1324 createCol(regionwindlight, "scene_gamma", typeof(Double));
1325 createCol(regionwindlight, "star_brightness", typeof(Double));
1326 createCol(regionwindlight, "cloud_color_r", typeof(Double));
1327 createCol(regionwindlight, "cloud_color_g", typeof(Double));
1328 createCol(regionwindlight, "cloud_color_b", typeof(Double));
1329 createCol(regionwindlight, "cloud_color_i", typeof(Double));
1330 createCol(regionwindlight, "cloud_x", typeof(Double));
1331 createCol(regionwindlight, "cloud_y", typeof(Double));
1332 createCol(regionwindlight, "cloud_density", typeof(Double));
1333 createCol(regionwindlight, "cloud_coverage", typeof(Double));
1334 createCol(regionwindlight, "cloud_scale", typeof(Double));
1335 createCol(regionwindlight, "cloud_detail_x", typeof(Double));
1336 createCol(regionwindlight, "cloud_detail_y", typeof(Double));
1337 createCol(regionwindlight, "cloud_detail_density", typeof(Double));
1338 createCol(regionwindlight, "cloud_scroll_x", typeof(Double));
1339 createCol(regionwindlight, "cloud_scroll_x_lock", typeof(Int32));
1340 createCol(regionwindlight, "cloud_scroll_y", typeof(Double));
1341 createCol(regionwindlight, "cloud_scroll_y_lock", typeof(Int32));
1342 createCol(regionwindlight, "draw_classic_clouds", typeof(Int32));
1343
1344 regionwindlight.PrimaryKey = new DataColumn[] { regionwindlight.Columns["region_id"] };
1345 return regionwindlight;
1346 }
1347
1194 /*********************************************************************** 1348 /***********************************************************************
1195 * 1349 *
1196 * Convert between ADO.NET <=> OpenSim Objects 1350 * Convert between ADO.NET <=> OpenSim Objects
@@ -1229,26 +1383,26 @@ namespace OpenSim.Data.SQLite
1229 // back out. Not enough time to figure it out yet. 1383 // back out. Not enough time to figure it out yet.
1230 1384
1231 SceneObjectPart prim = new SceneObjectPart(); 1385 SceneObjectPart prim = new SceneObjectPart();
1232 prim.UUID = new UUID((String) row["UUID"]); 1386 prim.UUID = new UUID((String)row["UUID"]);
1233 // explicit conversion of integers is required, which sort 1387 // explicit conversion of integers is required, which sort
1234 // of sucks. No idea if there is a shortcut here or not. 1388 // of sucks. No idea if there is a shortcut here or not.
1235 prim.CreationDate = Convert.ToInt32(row["CreationDate"]); 1389 prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
1236 prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"]; 1390 prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"];
1237 // various text fields 1391 // various text fields
1238 prim.Text = (String) row["Text"]; 1392 prim.Text = (String)row["Text"];
1239 prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), 1393 prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
1240 Convert.ToInt32(row["ColorR"]), 1394 Convert.ToInt32(row["ColorR"]),
1241 Convert.ToInt32(row["ColorG"]), 1395 Convert.ToInt32(row["ColorG"]),
1242 Convert.ToInt32(row["ColorB"])); 1396 Convert.ToInt32(row["ColorB"]));
1243 prim.Description = (String) row["Description"]; 1397 prim.Description = (String)row["Description"];
1244 prim.SitName = (String) row["SitName"]; 1398 prim.SitName = (String)row["SitName"];
1245 prim.TouchName = (String) row["TouchName"]; 1399 prim.TouchName = (String)row["TouchName"];
1246 // permissions 1400 // permissions
1247 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); 1401 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]);
1248 prim.CreatorIdentification = (String) row["CreatorID"]; 1402 prim.CreatorIdentification = (String)row["CreatorID"];
1249 prim.OwnerID = new UUID((String) row["OwnerID"]); 1403 prim.OwnerID = new UUID((String)row["OwnerID"]);
1250 prim.GroupID = new UUID((String) row["GroupID"]); 1404 prim.GroupID = new UUID((String)row["GroupID"]);
1251 prim.LastOwnerID = new UUID((String) row["LastOwnerID"]); 1405 prim.LastOwnerID = new UUID((String)row["LastOwnerID"]);
1252 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); 1406 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
1253 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); 1407 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
1254 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); 1408 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
@@ -1360,7 +1514,7 @@ namespace OpenSim.Data.SQLite
1360 1514
1361 if (!(row["MediaURL"] is System.DBNull)) 1515 if (!(row["MediaURL"] is System.DBNull))
1362 { 1516 {
1363 //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); 1517// m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
1364 prim.MediaUrl = (string)row["MediaURL"]; 1518 prim.MediaUrl = (string)row["MediaURL"];
1365 } 1519 }
1366 1520
@@ -1376,28 +1530,28 @@ namespace OpenSim.Data.SQLite
1376 { 1530 {
1377 TaskInventoryItem taskItem = new TaskInventoryItem(); 1531 TaskInventoryItem taskItem = new TaskInventoryItem();
1378 1532
1379 taskItem.ItemID = new UUID((String)row["itemID"]); 1533 taskItem.ItemID = new UUID((String)row["itemID"]);
1380 taskItem.ParentPartID = new UUID((String)row["primID"]); 1534 taskItem.ParentPartID = new UUID((String)row["primID"]);
1381 taskItem.AssetID = new UUID((String)row["assetID"]); 1535 taskItem.AssetID = new UUID((String)row["assetID"]);
1382 taskItem.ParentID = new UUID((String)row["parentFolderID"]); 1536 taskItem.ParentID = new UUID((String)row["parentFolderID"]);
1383 1537
1384 taskItem.InvType = Convert.ToInt32(row["invType"]); 1538 taskItem.InvType = Convert.ToInt32(row["invType"]);
1385 taskItem.Type = Convert.ToInt32(row["assetType"]); 1539 taskItem.Type = Convert.ToInt32(row["assetType"]);
1386 1540
1387 taskItem.Name = (String)row["name"]; 1541 taskItem.Name = (String)row["name"];
1388 taskItem.Description = (String)row["description"]; 1542 taskItem.Description = (String)row["description"];
1389 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); 1543 taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
1390 taskItem.CreatorIdentification = (String)row["creatorID"]; 1544 taskItem.CreatorIdentification = (String)row["creatorID"];
1391 taskItem.OwnerID = new UUID((String)row["ownerID"]); 1545 taskItem.OwnerID = new UUID((String)row["ownerID"]);
1392 taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]); 1546 taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]);
1393 taskItem.GroupID = new UUID((String)row["groupID"]); 1547 taskItem.GroupID = new UUID((String)row["groupID"]);
1394 1548
1395 taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); 1549 taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]);
1396 taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); 1550 taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]);
1397 taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); 1551 taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]);
1398 taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); 1552 taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]);
1399 taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); 1553 taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]);
1400 taskItem.Flags = Convert.ToUInt32(row["flags"]); 1554 taskItem.Flags = Convert.ToUInt32(row["flags"]);
1401 1555
1402 return taskItem; 1556 return taskItem;
1403 } 1557 }
@@ -1411,35 +1565,35 @@ namespace OpenSim.Data.SQLite
1411 { 1565 {
1412 LandData newData = new LandData(); 1566 LandData newData = new LandData();
1413 1567
1414 newData.GlobalID = new UUID((String) row["UUID"]); 1568 newData.GlobalID = new UUID((String)row["UUID"]);
1415 newData.LocalID = Convert.ToInt32(row["LocalLandID"]); 1569 newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
1416 1570
1417 // Bitmap is a byte[512] 1571 // Bitmap is a byte[512]
1418 newData.Bitmap = (Byte[]) row["Bitmap"]; 1572 newData.Bitmap = (Byte[])row["Bitmap"];
1419 1573
1420 newData.Name = (String) row["Name"]; 1574 newData.Name = (String)row["Name"];
1421 newData.Description = (String) row["Desc"]; 1575 newData.Description = (String)row["Desc"];
1422 newData.OwnerID = (UUID)(String) row["OwnerUUID"]; 1576 newData.OwnerID = (UUID)(String)row["OwnerUUID"];
1423 newData.IsGroupOwned = (Boolean) row["IsGroupOwned"]; 1577 newData.IsGroupOwned = (Boolean)row["IsGroupOwned"];
1424 newData.Area = Convert.ToInt32(row["Area"]); 1578 newData.Area = Convert.ToInt32(row["Area"]);
1425 newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented 1579 newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
1426 newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]); 1580 newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]);
1427 //Enum OpenMetaverse.Parcel.ParcelCategory 1581 //Enum OpenMetaverse.Parcel.ParcelCategory
1428 newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); 1582 newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
1429 newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); 1583 newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
1430 newData.GroupID = new UUID((String) row["GroupUUID"]); 1584 newData.GroupID = new UUID((String)row["GroupUUID"]);
1431 newData.SalePrice = Convert.ToInt32(row["SalePrice"]); 1585 newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
1432 newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]); 1586 newData.Status = (ParcelStatus)Convert.ToInt32(row["LandStatus"]);
1433 //Enum. OpenMetaverse.Parcel.ParcelStatus 1587 //Enum. OpenMetaverse.Parcel.ParcelStatus
1434 newData.Flags = Convert.ToUInt32(row["LandFlags"]); 1588 newData.Flags = Convert.ToUInt32(row["LandFlags"]);
1435 newData.LandingType = (Byte) row["LandingType"]; 1589 newData.LandingType = (Byte)row["LandingType"];
1436 newData.MediaAutoScale = (Byte) row["MediaAutoScale"]; 1590 newData.MediaAutoScale = (Byte)row["MediaAutoScale"];
1437 newData.MediaID = new UUID((String) row["MediaTextureUUID"]); 1591 newData.MediaID = new UUID((String)row["MediaTextureUUID"]);
1438 newData.MediaURL = (String) row["MediaURL"]; 1592 newData.MediaURL = (String)row["MediaURL"];
1439 newData.MusicURL = (String) row["MusicURL"]; 1593 newData.MusicURL = (String)row["MusicURL"];
1440 newData.PassHours = Convert.ToSingle(row["PassHours"]); 1594 newData.PassHours = Convert.ToSingle(row["PassHours"]);
1441 newData.PassPrice = Convert.ToInt32(row["PassPrice"]); 1595 newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
1442 newData.SnapshotID = (UUID)(String) row["SnapshotUUID"]; 1596 newData.SnapshotID = (UUID)(String)row["SnapshotUUID"];
1443 try 1597 try
1444 { 1598 {
1445 1599
@@ -1471,7 +1625,7 @@ namespace OpenSim.Data.SQLite
1471 { 1625 {
1472 RegionSettings newSettings = new RegionSettings(); 1626 RegionSettings newSettings = new RegionSettings();
1473 1627
1474 newSettings.RegionUUID = new UUID((string) row["regionUUID"]); 1628 newSettings.RegionUUID = new UUID((string)row["regionUUID"]);
1475 newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); 1629 newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
1476 newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); 1630 newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
1477 newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); 1631 newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
@@ -1485,10 +1639,10 @@ namespace OpenSim.Data.SQLite
1485 newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); 1639 newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
1486 newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); 1640 newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
1487 newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); 1641 newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
1488 newSettings.TerrainTexture1 = new UUID((String) row["terrain_texture_1"]); 1642 newSettings.TerrainTexture1 = new UUID((String)row["terrain_texture_1"]);
1489 newSettings.TerrainTexture2 = new UUID((String) row["terrain_texture_2"]); 1643 newSettings.TerrainTexture2 = new UUID((String)row["terrain_texture_2"]);
1490 newSettings.TerrainTexture3 = new UUID((String) row["terrain_texture_3"]); 1644 newSettings.TerrainTexture3 = new UUID((String)row["terrain_texture_3"]);
1491 newSettings.TerrainTexture4 = new UUID((String) row["terrain_texture_4"]); 1645 newSettings.TerrainTexture4 = new UUID((String)row["terrain_texture_4"]);
1492 newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); 1646 newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
1493 newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); 1647 newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
1494 newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); 1648 newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
@@ -1502,14 +1656,14 @@ namespace OpenSim.Data.SQLite
1502 newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); 1656 newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
1503 newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); 1657 newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
1504 newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); 1658 newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
1505 newSettings.SunVector = new Vector3 ( 1659 newSettings.SunVector = new Vector3(
1506 Convert.ToSingle(row["sunvectorx"]), 1660 Convert.ToSingle(row["sunvectorx"]),
1507 Convert.ToSingle(row["sunvectory"]), 1661 Convert.ToSingle(row["sunvectory"]),
1508 Convert.ToSingle(row["sunvectorz"]) 1662 Convert.ToSingle(row["sunvectorz"])
1509 ); 1663 );
1510 newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); 1664 newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
1511 newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); 1665 newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
1512 newSettings.Covenant = new UUID((String) row["covenant"]); 1666 newSettings.Covenant = new UUID((String)row["covenant"]);
1513 newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); 1667 newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]);
1514 newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); 1668 newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]);
1515 1669
@@ -1517,6 +1671,83 @@ namespace OpenSim.Data.SQLite
1517 } 1671 }
1518 1672
1519 /// <summary> 1673 /// <summary>
1674 /// Build a windlight entry from the persisted data.
1675 /// </summary>
1676 /// <param name="row"></param>
1677 /// <returns>RegionLightShareData</returns>
1678 private RegionLightShareData buildRegionWindlight(DataRow row)
1679 {
1680 RegionLightShareData windlight = new RegionLightShareData();
1681
1682 windlight.regionID = new UUID((string)row["region_id"]);
1683 windlight.waterColor.X = Convert.ToSingle(row["water_color_r"]);
1684 windlight.waterColor.Y = Convert.ToSingle(row["water_color_g"]);
1685 windlight.waterColor.Z = Convert.ToSingle(row["water_color_b"]);
1686 //windlight.waterColor.W = Convert.ToSingle(row["water_color_i"]); //not implemented
1687 windlight.waterFogDensityExponent = Convert.ToSingle(row["water_fog_density_exponent"]);
1688 windlight.underwaterFogModifier = Convert.ToSingle(row["underwater_fog_modifier"]);
1689 windlight.reflectionWaveletScale.X = Convert.ToSingle(row["reflection_wavelet_scale_1"]);
1690 windlight.reflectionWaveletScale.Y = Convert.ToSingle(row["reflection_wavelet_scale_2"]);
1691 windlight.reflectionWaveletScale.Z = Convert.ToSingle(row["reflection_wavelet_scale_3"]);
1692 windlight.fresnelScale = Convert.ToSingle(row["fresnel_scale"]);
1693 windlight.fresnelOffset = Convert.ToSingle(row["fresnel_offset"]);
1694 windlight.refractScaleAbove = Convert.ToSingle(row["refract_scale_above"]);
1695 windlight.refractScaleBelow = Convert.ToSingle(row["refract_scale_below"]);
1696 windlight.blurMultiplier = Convert.ToSingle(row["blur_multiplier"]);
1697 windlight.bigWaveDirection.X = Convert.ToSingle(row["big_wave_direction_x"]);
1698 windlight.bigWaveDirection.Y = Convert.ToSingle(row["big_wave_direction_y"]);
1699 windlight.littleWaveDirection.X = Convert.ToSingle(row["little_wave_direction_x"]);
1700 windlight.littleWaveDirection.Y = Convert.ToSingle(row["little_wave_direction_y"]);
1701 windlight.normalMapTexture = new UUID((string)row["normal_map_texture"]);
1702 windlight.horizon.X = Convert.ToSingle(row["horizon_r"]);
1703 windlight.horizon.Y = Convert.ToSingle(row["horizon_g"]);
1704 windlight.horizon.Z = Convert.ToSingle(row["horizon_b"]);
1705 windlight.horizon.W = Convert.ToSingle(row["horizon_i"]);
1706 windlight.hazeHorizon = Convert.ToSingle(row["haze_horizon"]);
1707 windlight.blueDensity.X = Convert.ToSingle(row["blue_density_r"]);
1708 windlight.blueDensity.Y = Convert.ToSingle(row["blue_density_g"]);
1709 windlight.blueDensity.Z = Convert.ToSingle(row["blue_density_b"]);
1710 windlight.blueDensity.W = Convert.ToSingle(row["blue_density_i"]);
1711 windlight.hazeDensity = Convert.ToSingle(row["haze_density"]);
1712 windlight.densityMultiplier = Convert.ToSingle(row["density_multiplier"]);
1713 windlight.distanceMultiplier = Convert.ToSingle(row["distance_multiplier"]);
1714 windlight.maxAltitude = Convert.ToUInt16(row["max_altitude"]);
1715 windlight.sunMoonColor.X = Convert.ToSingle(row["sun_moon_color_r"]);
1716 windlight.sunMoonColor.Y = Convert.ToSingle(row["sun_moon_color_g"]);
1717 windlight.sunMoonColor.Z = Convert.ToSingle(row["sun_moon_color_b"]);
1718 windlight.sunMoonColor.W = Convert.ToSingle(row["sun_moon_color_i"]);
1719 windlight.sunMoonPosition = Convert.ToSingle(row["sun_moon_position"]);
1720 windlight.ambient.X = Convert.ToSingle(row["ambient_r"]);
1721 windlight.ambient.Y = Convert.ToSingle(row["ambient_g"]);
1722 windlight.ambient.Z = Convert.ToSingle(row["ambient_b"]);
1723 windlight.ambient.W = Convert.ToSingle(row["ambient_i"]);
1724 windlight.eastAngle = Convert.ToSingle(row["east_angle"]);
1725 windlight.sunGlowFocus = Convert.ToSingle(row["sun_glow_focus"]);
1726 windlight.sunGlowSize = Convert.ToSingle(row["sun_glow_size"]);
1727 windlight.sceneGamma = Convert.ToSingle(row["scene_gamma"]);
1728 windlight.starBrightness = Convert.ToSingle(row["star_brightness"]);
1729 windlight.cloudColor.X = Convert.ToSingle(row["cloud_color_r"]);
1730 windlight.cloudColor.Y = Convert.ToSingle(row["cloud_color_g"]);
1731 windlight.cloudColor.Z = Convert.ToSingle(row["cloud_color_b"]);
1732 windlight.cloudColor.W = Convert.ToSingle(row["cloud_color_i"]);
1733 windlight.cloudXYDensity.X = Convert.ToSingle(row["cloud_x"]);
1734 windlight.cloudXYDensity.Y = Convert.ToSingle(row["cloud_y"]);
1735 windlight.cloudXYDensity.Z = Convert.ToSingle(row["cloud_density"]);
1736 windlight.cloudCoverage = Convert.ToSingle(row["cloud_coverage"]);
1737 windlight.cloudScale = Convert.ToSingle(row["cloud_scale"]);
1738 windlight.cloudDetailXYDensity.X = Convert.ToSingle(row["cloud_detail_x"]);
1739 windlight.cloudDetailXYDensity.Y = Convert.ToSingle(row["cloud_detail_y"]);
1740 windlight.cloudDetailXYDensity.Z = Convert.ToSingle(row["cloud_detail_density"]);
1741 windlight.cloudScrollX = Convert.ToSingle(row["cloud_scroll_x"]);
1742 windlight.cloudScrollXLock = Convert.ToBoolean(row["cloud_scroll_x_lock"]);
1743 windlight.cloudScrollY = Convert.ToSingle(row["cloud_scroll_y"]);
1744 windlight.cloudScrollYLock = Convert.ToBoolean(row["cloud_scroll_y_lock"]);
1745 windlight.drawClassicClouds = Convert.ToBoolean(row["draw_classic_clouds"]);
1746
1747 return windlight;
1748 }
1749
1750 /// <summary>
1520 /// Build a land access entry from the persisted data. 1751 /// Build a land access entry from the persisted data.
1521 /// </summary> 1752 /// </summary>
1522 /// <param name="row"></param> 1753 /// <param name="row"></param>
@@ -1524,8 +1755,8 @@ namespace OpenSim.Data.SQLite
1524 private static LandAccessEntry buildLandAccessData(DataRow row) 1755 private static LandAccessEntry buildLandAccessData(DataRow row)
1525 { 1756 {
1526 LandAccessEntry entry = new LandAccessEntry(); 1757 LandAccessEntry entry = new LandAccessEntry();
1527 entry.AgentID = new UUID((string) row["AccessUUID"]); 1758 entry.AgentID = new UUID((string)row["AccessUUID"]);
1528 entry.Flags = (AccessList) row["Flags"]; 1759 entry.Flags = (AccessList)row["Flags"];
1529 entry.Expires = 0; 1760 entry.Expires = 0;
1530 return entry; 1761 return entry;
1531 } 1762 }
@@ -1537,7 +1768,7 @@ namespace OpenSim.Data.SQLite
1537 /// <returns></returns> 1768 /// <returns></returns>
1538 private static Array serializeTerrain(double[,] val) 1769 private static Array serializeTerrain(double[,] val)
1539 { 1770 {
1540 MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); 1771 MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) * sizeof(double));
1541 BinaryWriter bw = new BinaryWriter(str); 1772 BinaryWriter bw = new BinaryWriter(str);
1542 1773
1543 // TODO: COMPATIBILITY - Add byte-order conversions 1774 // TODO: COMPATIBILITY - Add byte-order conversions
@@ -1548,21 +1779,21 @@ namespace OpenSim.Data.SQLite
1548 return str.ToArray(); 1779 return str.ToArray();
1549 } 1780 }
1550 1781
1551// private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val) 1782 // private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val)
1552// { 1783 // {
1553// row["RegionUUID"] = regionUUID; 1784 // row["RegionUUID"] = regionUUID;
1554// row["Revision"] = rev; 1785 // row["Revision"] = rev;
1555 1786
1556 // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double)); 1787 // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double));
1557// BinaryWriter bw = new BinaryWriter(str); 1788 // BinaryWriter bw = new BinaryWriter(str);
1558 1789
1559// // TODO: COMPATIBILITY - Add byte-order conversions 1790 // // TODO: COMPATIBILITY - Add byte-order conversions
1560 // for (int x = 0; x < (int)Constants.RegionSize; x++) 1791 // for (int x = 0; x < (int)Constants.RegionSize; x++)
1561 // for (int y = 0; y < (int)Constants.RegionSize; y++) 1792 // for (int y = 0; y < (int)Constants.RegionSize; y++)
1562// bw.Write(val[x, y]); 1793 // bw.Write(val[x, y]);
1563 1794
1564// row["Heightfield"] = str.ToArray(); 1795 // row["Heightfield"] = str.ToArray();
1565// } 1796 // }
1566 1797
1567 /// <summary> 1798 /// <summary>
1568 /// 1799 ///
@@ -1843,6 +2074,79 @@ namespace OpenSim.Data.SQLite
1843 /// 2074 ///
1844 /// </summary> 2075 /// </summary>
1845 /// <param name="row"></param> 2076 /// <param name="row"></param>
2077 /// <param name="windlight"></param>
2078 private static void fillRegionWindlightRow(DataRow row, RegionLightShareData windlight)
2079 {
2080 row["region_id"] = windlight.regionID.ToString();
2081 row["water_color_r"] = windlight.waterColor.X;
2082 row["water_color_g"] = windlight.waterColor.Y;
2083 row["water_color_b"] = windlight.waterColor.Z;
2084 row["water_color_i"] = 1; //windlight.waterColor.W; //not implemented
2085 row["water_fog_density_exponent"] = windlight.waterFogDensityExponent;
2086 row["underwater_fog_modifier"] = windlight.underwaterFogModifier;
2087 row["reflection_wavelet_scale_1"] = windlight.reflectionWaveletScale.X;
2088 row["reflection_wavelet_scale_2"] = windlight.reflectionWaveletScale.Y;
2089 row["reflection_wavelet_scale_3"] = windlight.reflectionWaveletScale.Z;
2090 row["fresnel_scale"] = windlight.fresnelScale;
2091 row["fresnel_offset"] = windlight.fresnelOffset;
2092 row["refract_scale_above"] = windlight.refractScaleAbove;
2093 row["refract_scale_below"] = windlight.refractScaleBelow;
2094 row["blur_multiplier"] = windlight.blurMultiplier;
2095 row["big_wave_direction_x"] = windlight.bigWaveDirection.X;
2096 row["big_wave_direction_y"] = windlight.bigWaveDirection.Y;
2097 row["little_wave_direction_x"] = windlight.littleWaveDirection.X;
2098 row["little_wave_direction_y"] = windlight.littleWaveDirection.Y;
2099 row["normal_map_texture"] = windlight.normalMapTexture.ToString();
2100 row["horizon_r"] = windlight.horizon.X;
2101 row["horizon_g"] = windlight.horizon.Y;
2102 row["horizon_b"] = windlight.horizon.Z;
2103 row["horizon_i"] = windlight.horizon.W;
2104 row["haze_horizon"] = windlight.hazeHorizon;
2105 row["blue_density_r"] = windlight.blueDensity.X;
2106 row["blue_density_g"] = windlight.blueDensity.Y;
2107 row["blue_density_b"] = windlight.blueDensity.Z;
2108 row["blue_density_i"] = windlight.blueDensity.W;
2109 row["haze_density"] = windlight.hazeDensity;
2110 row["density_multiplier"] = windlight.densityMultiplier;
2111 row["distance_multiplier"] = windlight.distanceMultiplier;
2112 row["max_altitude"] = windlight.maxAltitude;
2113 row["sun_moon_color_r"] = windlight.sunMoonColor.X;
2114 row["sun_moon_color_g"] = windlight.sunMoonColor.Y;
2115 row["sun_moon_color_b"] = windlight.sunMoonColor.Z;
2116 row["sun_moon_color_i"] = windlight.sunMoonColor.W;
2117 row["sun_moon_position"] = windlight.sunMoonPosition;
2118 row["ambient_r"] = windlight.ambient.X;
2119 row["ambient_g"] = windlight.ambient.Y;
2120 row["ambient_b"] = windlight.ambient.Z;
2121 row["ambient_i"] = windlight.ambient.W;
2122 row["east_angle"] = windlight.eastAngle;
2123 row["sun_glow_focus"] = windlight.sunGlowFocus;
2124 row["sun_glow_size"] = windlight.sunGlowSize;
2125 row["scene_gamma"] = windlight.sceneGamma;
2126 row["star_brightness"] = windlight.starBrightness;
2127 row["cloud_color_r"] = windlight.cloudColor.X;
2128 row["cloud_color_g"] = windlight.cloudColor.Y;
2129 row["cloud_color_b"] = windlight.cloudColor.Z;
2130 row["cloud_color_i"] = windlight.cloudColor.W;
2131 row["cloud_x"] = windlight.cloudXYDensity.X;
2132 row["cloud_y"] = windlight.cloudXYDensity.Y;
2133 row["cloud_density"] = windlight.cloudXYDensity.Z;
2134 row["cloud_coverage"] = windlight.cloudCoverage;
2135 row["cloud_scale"] = windlight.cloudScale;
2136 row["cloud_detail_x"] = windlight.cloudDetailXYDensity.X;
2137 row["cloud_detail_y"] = windlight.cloudDetailXYDensity.Y;
2138 row["cloud_detail_density"] = windlight.cloudDetailXYDensity.Z;
2139 row["cloud_scroll_x"] = windlight.cloudScrollX;
2140 row["cloud_scroll_x_lock"] = windlight.cloudScrollXLock;
2141 row["cloud_scroll_y"] = windlight.cloudScrollY;
2142 row["cloud_scroll_y_lock"] = windlight.cloudScrollYLock;
2143 row["draw_classic_clouds"] = windlight.drawClassicClouds;
2144 }
2145
2146 /// <summary>
2147 ///
2148 /// </summary>
2149 /// <param name="row"></param>
1846 /// <returns></returns> 2150 /// <returns></returns>
1847 private PrimitiveBaseShape buildShape(DataRow row) 2151 private PrimitiveBaseShape buildShape(DataRow row)
1848 { 2152 {
@@ -1878,7 +2182,7 @@ namespace OpenSim.Data.SQLite
1878 byte[] textureEntry = (byte[])row["Texture"]; 2182 byte[] textureEntry = (byte[])row["Texture"];
1879 s.TextureEntry = textureEntry; 2183 s.TextureEntry = textureEntry;
1880 2184
1881 s.ExtraParams = (byte[]) row["ExtraParams"]; 2185 s.ExtraParams = (byte[])row["ExtraParams"];
1882 2186
1883 if (!(row["Media"] is System.DBNull)) 2187 if (!(row["Media"] is System.DBNull))
1884 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); 2188 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
@@ -1986,10 +2290,10 @@ namespace OpenSim.Data.SQLite
1986 // repalce with current inventory details 2290 // repalce with current inventory details
1987 foreach (TaskInventoryItem newItem in items) 2291 foreach (TaskInventoryItem newItem in items)
1988 { 2292 {
1989// m_log.InfoFormat( 2293 // m_log.InfoFormat(
1990// "[DATASTORE]: ", 2294 // "[DATASTORE]: ",
1991// "Adding item {0}, {1} to prim ID {2}", 2295 // "Adding item {0}, {1} to prim ID {2}",
1992// newItem.Name, newItem.ItemID, newItem.ParentPartID); 2296 // newItem.Name, newItem.ItemID, newItem.ParentPartID);
1993 2297
1994 DataRow newItemRow = dbItems.NewRow(); 2298 DataRow newItemRow = dbItems.NewRow();
1995 fillItemRow(newItemRow, newItem); 2299 fillItemRow(newItemRow, newItem);
@@ -2040,7 +2344,7 @@ namespace OpenSim.Data.SQLite
2040 sql += ") values (:"; 2344 sql += ") values (:";
2041 sql += String.Join(", :", cols); 2345 sql += String.Join(", :", cols);
2042 sql += ")"; 2346 sql += ")";
2043 //m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql); 2347// m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql);
2044 SqliteCommand cmd = new SqliteCommand(sql); 2348 SqliteCommand cmd = new SqliteCommand(sql);
2045 2349
2046 // this provides the binding for all our parameters, so 2350 // this provides the binding for all our parameters, so
@@ -2192,7 +2496,7 @@ namespace OpenSim.Data.SQLite
2192 da.UpdateCommand.Connection = conn; 2496 da.UpdateCommand.Connection = conn;
2193 2497
2194 SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); 2498 SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID");
2195 delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); 2499 delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
2196 delete.Connection = conn; 2500 delete.Connection = conn;
2197 da.DeleteCommand = delete; 2501 da.DeleteCommand = delete;
2198 } 2502 }
@@ -2211,7 +2515,7 @@ namespace OpenSim.Data.SQLite
2211 da.UpdateCommand.Connection = conn; 2515 da.UpdateCommand.Connection = conn;
2212 2516
2213 SqliteCommand delete = new SqliteCommand("delete from primitems where itemID = :itemID"); 2517 SqliteCommand delete = new SqliteCommand("delete from primitems where itemID = :itemID");
2214 delete.Parameters.Add(createSqliteParameter("itemID", typeof (String))); 2518 delete.Parameters.Add(createSqliteParameter("itemID", typeof(String)));
2215 delete.Connection = conn; 2519 delete.Connection = conn;
2216 da.DeleteCommand = delete; 2520 da.DeleteCommand = delete;
2217 } 2521 }
@@ -2279,6 +2583,19 @@ namespace OpenSim.Data.SQLite
2279 /// </summary> 2583 /// </summary>
2280 /// <param name="da"></param> 2584 /// <param name="da"></param>
2281 /// <param name="conn"></param> 2585 /// <param name="conn"></param>
2586 private void setupRegionWindlightCommands(SqliteDataAdapter da, SqliteConnection conn)
2587 {
2588 da.InsertCommand = createInsertCommand("regionwindlight", ds.Tables["regionwindlight"]);
2589 da.InsertCommand.Connection = conn;
2590 da.UpdateCommand = createUpdateCommand("regionwindlight", "region_id=:region_id", ds.Tables["regionwindlight"]);
2591 da.UpdateCommand.Connection = conn;
2592 }
2593
2594 /// <summary>
2595 ///
2596 /// </summary>
2597 /// <param name="da"></param>
2598 /// <param name="conn"></param>
2282 private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) 2599 private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn)
2283 { 2600 {
2284 da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); 2601 da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]);
@@ -2288,7 +2605,7 @@ namespace OpenSim.Data.SQLite
2288 da.UpdateCommand.Connection = conn; 2605 da.UpdateCommand.Connection = conn;
2289 2606
2290 SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); 2607 SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID");
2291 delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); 2608 delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
2292 delete.Connection = conn; 2609 delete.Connection = conn;
2293 da.DeleteCommand = delete; 2610 da.DeleteCommand = delete;
2294 } 2611 }
@@ -2306,27 +2623,27 @@ namespace OpenSim.Data.SQLite
2306 /// <returns></returns> 2623 /// <returns></returns>
2307 private static DbType dbtypeFromType(Type type) 2624 private static DbType dbtypeFromType(Type type)
2308 { 2625 {
2309 if (type == typeof (String)) 2626 if (type == typeof(String))
2310 { 2627 {
2311 return DbType.String; 2628 return DbType.String;
2312 } 2629 }
2313 else if (type == typeof (Int32)) 2630 else if (type == typeof(Int32))
2314 { 2631 {
2315 return DbType.Int32; 2632 return DbType.Int32;
2316 } 2633 }
2317 else if (type == typeof (Double)) 2634 else if (type == typeof(Double))
2318 { 2635 {
2319 return DbType.Double; 2636 return DbType.Double;
2320 } 2637 }
2321 else if (type == typeof (Byte)) 2638 else if (type == typeof(Byte))
2322 { 2639 {
2323 return DbType.Byte; 2640 return DbType.Byte;
2324 } 2641 }
2325 else if (type == typeof (Double)) 2642 else if (type == typeof(Double))
2326 { 2643 {
2327 return DbType.Double; 2644 return DbType.Double;
2328 } 2645 }
2329 else if (type == typeof (Byte[])) 2646 else if (type == typeof(Byte[]))
2330 { 2647 {
2331 return DbType.Binary; 2648 return DbType.Binary;
2332 } 2649 }
@@ -2338,32 +2655,32 @@ namespace OpenSim.Data.SQLite
2338 2655
2339 static void PrintDataSet(DataSet ds) 2656 static void PrintDataSet(DataSet ds)
2340 { 2657 {
2341 // Print out any name and extended properties. 2658 // Print out any name and extended properties.
2342 Console.WriteLine("DataSet is named: {0}", ds.DataSetName); 2659 Console.WriteLine("DataSet is named: {0}", ds.DataSetName);
2343 foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties) 2660 foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties)
2344 {
2345 Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
2346 }
2347 Console.WriteLine();
2348 foreach (DataTable dt in ds.Tables)
2349 {
2350 Console.WriteLine("=> {0} Table:", dt.TableName);
2351 // Print out the column names.
2352 for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
2353 { 2661 {
2354 Console.Write(dt.Columns[curCol].ColumnName + "\t"); 2662 Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
2355 } 2663 }
2356 Console.WriteLine("\n----------------------------------"); 2664 Console.WriteLine();
2357 // Print the DataTable. 2665 foreach (DataTable dt in ds.Tables)
2358 for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
2359 { 2666 {
2360 for (int curCol = 0; curCol < dt.Columns.Count; curCol++) 2667 Console.WriteLine("=> {0} Table:", dt.TableName);
2361 { 2668 // Print out the column names.
2362 Console.Write(dt.Rows[curRow][curCol].ToString() + "\t"); 2669 for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
2363 } 2670 {
2364 Console.WriteLine(); 2671 Console.Write(dt.Columns[curCol].ColumnName + "\t");
2672 }
2673 Console.WriteLine("\n----------------------------------");
2674 // Print the DataTable.
2675 for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
2676 {
2677 for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
2678 {
2679 Console.Write(dt.Rows[curRow][curCol].ToString() + "\t");
2680 }
2681 Console.WriteLine();
2682 }
2365 } 2683 }
2366 }
2367 } 2684 }
2368 2685
2369 } 2686 }
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 6d048f4..fe12874 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -308,6 +308,8 @@ namespace OpenSim.Framework
308 public Animation[] Anims; 308 public Animation[] Anims;
309 309
310 public UUID GranterID; 310 public UUID GranterID;
311 public UUID ParentPart;
312 public Vector3 SitOffset;
311 313
312 // Appearance 314 // Appearance
313 public AvatarAppearance Appearance; 315 public AvatarAppearance Appearance;
@@ -468,6 +470,10 @@ namespace OpenSim.Framework
468 } 470 }
469 args["attach_objects"] = attObjs; 471 args["attach_objects"] = attObjs;
470 } 472 }
473
474 args["parent_part"] = OSD.FromUUID(ParentPart);
475 args["sit_offset"] = OSD.FromString(SitOffset.ToString());
476
471 return args; 477 return args;
472 } 478 }
473 479
@@ -675,6 +681,11 @@ namespace OpenSim.Framework
675 } 681 }
676 } 682 }
677 } 683 }
684
685 if (args["parent_part"] != null)
686 ParentPart = args["parent_part"].AsUUID();
687 if (args["sit_offset"] != null)
688 Vector3.TryParse(args["sit_offset"].AsString(), out SitOffset);
678 } 689 }
679 690
680 public AgentData() 691 public AgentData()
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index a0d3541..0d6288b 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Diagnostics; 31using System.Diagnostics;
32using System.Reflection; 32using System.Reflection;
33using System.Text; 33using System.Text;
34using System.Text.RegularExpressions;
34using System.Threading; 35using System.Threading;
35using log4net; 36using log4net;
36using OpenSim.Framework; 37using OpenSim.Framework;
@@ -531,6 +532,11 @@ namespace OpenSim.Framework.Console
531 532
532 public class Parser 533 public class Parser
533 { 534 {
535 // If an unquoted portion ends with an element matching this regex
536 // and the next element contains a space, then we have stripped
537 // embedded quotes that should not have been stripped
538 private static Regex optionRegex = new Regex("^--[a-zA-Z0-9-]+=$");
539
534 public static string[] Parse(string text) 540 public static string[] Parse(string text)
535 { 541 {
536 List<string> result = new List<string>(); 542 List<string> result = new List<string>();
@@ -544,10 +550,38 @@ namespace OpenSim.Framework.Console
544 if (index % 2 == 0) 550 if (index % 2 == 0)
545 { 551 {
546 string[] words = unquoted[index].Split(new char[] {' '}); 552 string[] words = unquoted[index].Split(new char[] {' '});
553
554 bool option = false;
547 foreach (string w in words) 555 foreach (string w in words)
548 { 556 {
549 if (w != String.Empty) 557 if (w != String.Empty)
558 {
559 if (optionRegex.Match(w) == Match.Empty)
560 option = false;
561 else
562 option = true;
550 result.Add(w); 563 result.Add(w);
564 }
565 }
566 // The last item matched the regex, put the quotes back
567 if (option)
568 {
569 // If the line ended with it, don't do anything
570 if (index < (unquoted.Length - 1))
571 {
572 // Get and remove the option name
573 string optionText = result[result.Count - 1];
574 result.RemoveAt(result.Count - 1);
575
576 // Add the quoted value back
577 optionText += "\"" + unquoted[index + 1] + "\"";
578
579 // Push the result into our return array
580 result.Add(optionText);
581
582 // Skip the already used value
583 index++;
584 }
551 } 585 }
552 } 586 }
553 else 587 else
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index c531e8a..7a3e67f 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -627,7 +627,6 @@ namespace OpenSim.Framework
627 627
628 foreach (String s in allKeys) 628 foreach (String s in allKeys)
629 { 629 {
630 string val = config.GetString(s);
631 SetOtherSetting(s, config.GetString(s)); 630 SetOtherSetting(s, config.GetString(s));
632 } 631 }
633 } 632 }
diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
index a392af6..c56f213 100644
--- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
+++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
@@ -49,15 +49,16 @@ namespace OpenSim.Framework.Serialization.External
49 /// <param name="nodeToFill"></param> 49 /// <param name="nodeToFill"></param>
50 /// <param name="processors">/param> 50 /// <param name="processors">/param>
51 /// <param name="xtr"></param> 51 /// <param name="xtr"></param>
52 public static void ExecuteReadProcessors<NodeType>( 52 /// <returns>true on successful, false if there were any processing failures</returns>
53 public static bool ExecuteReadProcessors<NodeType>(
53 NodeType nodeToFill, Dictionary<string, Action<NodeType, XmlTextReader>> processors, XmlTextReader xtr) 54 NodeType nodeToFill, Dictionary<string, Action<NodeType, XmlTextReader>> processors, XmlTextReader xtr)
54 { 55 {
55 ExecuteReadProcessors( 56 return ExecuteReadProcessors(
56 nodeToFill, 57 nodeToFill,
57 processors, 58 processors,
58 xtr, 59 xtr,
59 (o, name, e) 60 (o, name, e)
60 => m_log.ErrorFormat( 61 => m_log.DebugFormat(
61 "[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}", 62 "[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}",
62 name, e.Message, e.StackTrace)); 63 name, e.Message, e.StackTrace));
63 } 64 }
@@ -71,12 +72,15 @@ namespace OpenSim.Framework.Serialization.External
71 /// <param name="parseExceptionAction"> 72 /// <param name="parseExceptionAction">
72 /// Action to take if there is a parsing problem. This will usually just be to log the exception 73 /// Action to take if there is a parsing problem. This will usually just be to log the exception
73 /// </param> 74 /// </param>
74 public static void ExecuteReadProcessors<NodeType>( 75 /// <returns>true on successful, false if there were any processing failures</returns>
76 public static bool ExecuteReadProcessors<NodeType>(
75 NodeType nodeToFill, 77 NodeType nodeToFill,
76 Dictionary<string, Action<NodeType, XmlTextReader>> processors, 78 Dictionary<string, Action<NodeType, XmlTextReader>> processors,
77 XmlTextReader xtr, 79 XmlTextReader xtr,
78 Action<NodeType, string, Exception> parseExceptionAction) 80 Action<NodeType, string, Exception> parseExceptionAction)
79 { 81 {
82 bool errors = false;
83
80 string nodeName = string.Empty; 84 string nodeName = string.Empty;
81 while (xtr.NodeType != XmlNodeType.EndElement) 85 while (xtr.NodeType != XmlNodeType.EndElement)
82 { 86 {
@@ -95,6 +99,7 @@ namespace OpenSim.Framework.Serialization.External
95 } 99 }
96 catch (Exception e) 100 catch (Exception e)
97 { 101 {
102 errors = true;
98 parseExceptionAction(nodeToFill, nodeName, e); 103 parseExceptionAction(nodeToFill, nodeName, e);
99 104
100 if (xtr.NodeType == XmlNodeType.EndElement) 105 if (xtr.NodeType == XmlNodeType.EndElement)
@@ -107,6 +112,8 @@ namespace OpenSim.Framework.Serialization.External
107 xtr.ReadOuterXml(); // ignore 112 xtr.ReadOuterXml(); // ignore
108 } 113 }
109 } 114 }
115
116 return errors;
110 } 117 }
111 118
112 /// <summary> 119 /// <summary>
@@ -140,6 +147,7 @@ namespace OpenSim.Framework.Serialization.External
140 UUID.TryParse(node.InnerText, out uuid); 147 UUID.TryParse(node.InnerText, out uuid);
141 creator = userService.GetUserAccount(scopeID, uuid); 148 creator = userService.GetUserAccount(scopeID, uuid);
142 } 149 }
150
143 if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty) 151 if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
144 hasCreatorData = true; 152 hasCreatorData = true;
145 153
@@ -163,7 +171,6 @@ namespace OpenSim.Framework.Serialization.External
163 doc.Save(wr); 171 doc.Save(wr);
164 return wr.ToString(); 172 return wr.ToString();
165 } 173 }
166
167 } 174 }
168 } 175 }
169} 176} \ No newline at end of file
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index fae6802..dd30c2f 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1676,13 +1676,14 @@ namespace OpenSim.Framework
1676 /// </summary> 1676 /// </summary>
1677 public static void PrintCallStack() 1677 public static void PrintCallStack()
1678 { 1678 {
1679 StackTrace stackTrace = new StackTrace(); // get call stack 1679 StackTrace stackTrace = new StackTrace(true); // get call stack
1680 StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) 1680 StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames)
1681 1681
1682 // write call stack method names 1682 // write call stack method names
1683 foreach (StackFrame stackFrame in stackFrames) 1683 foreach (StackFrame stackFrame in stackFrames)
1684 { 1684 {
1685 m_log.Debug(stackFrame.GetMethod().DeclaringType + "." + stackFrame.GetMethod().Name); // write method name 1685 MethodBase mb = stackFrame.GetMethod();
1686 m_log.DebugFormat("{0}.{1}:{2}", mb.DeclaringType, mb.Name, stackFrame.GetFileLineNumber()); // write method name
1686 } 1687 }
1687 } 1688 }
1688 1689
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index c20f7b2..161feda 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -1549,7 +1549,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1549 1549
1550 public void SendKillObject(ulong regionHandle, List<uint> localIDs) 1550 public void SendKillObject(ulong regionHandle, List<uint> localIDs)
1551 { 1551 {
1552// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); 1552// foreach (uint id in localIDs)
1553// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle);
1553 1554
1554 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); 1555 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
1555 // TODO: don't create new blocks if recycling an old packet 1556 // TODO: don't create new blocks if recycling an old packet
@@ -7689,6 +7690,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7689 } 7690 }
7690 } 7691 }
7691 } 7692 }
7693 else
7694 if (transfer.TransferInfo.SourceType == (int)SourceType.SimEstate)
7695 {
7696 //TransferRequestPacket does not include covenant uuid?
7697 //get scene covenant uuid
7698 taskID = m_scene.RegionInfo.RegionSettings.Covenant;
7699 }
7692 7700
7693 MakeAssetRequest(transfer, taskID); 7701 MakeAssetRequest(transfer, taskID);
7694 7702
@@ -12113,6 +12121,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12113 { 12121 {
12114 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 12122 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
12115 } 12123 }
12124 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimEstate)
12125 {
12126 requestID = taskID;
12127 }
12128
12116 12129
12117// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID); 12130// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
12118 12131
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 8d503bd..c7f4c20 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -111,6 +111,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
111 111
112 #region IAvatarFactoryModule 112 #region IAvatarFactoryModule
113 113
114 /// </summary>
115 /// <param name="sp"></param>
116 /// <param name="texture"></param>
117 /// <param name="visualParam"></param>
118 public void SetAppearance(IScenePresence sp, AvatarAppearance appearance)
119 {
120 SetAppearance(sp, appearance.Texture, appearance.VisualParams);
121 }
122
114 /// <summary> 123 /// <summary>
115 /// Set appearance data (texture asset IDs and slider settings) 124 /// Set appearance data (texture asset IDs and slider settings)
116 /// </summary> 125 /// </summary>
@@ -156,14 +165,23 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
156 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; 165 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
157 166
158// WriteBakedTexturesReport(sp, m_log.DebugFormat); 167// WriteBakedTexturesReport(sp, m_log.DebugFormat);
159 if (!ValidateBakedTextureCache(sp)) 168
169 // If bake textures are missing and this is not an NPC, request a rebake from client
170 if (!ValidateBakedTextureCache(sp) && (((ScenePresence)sp).PresenceType != PresenceType.Npc))
160 RequestRebake(sp, true); 171 RequestRebake(sp, true);
161 172
162 // This appears to be set only in the final stage of the appearance 173 // This appears to be set only in the final stage of the appearance
163 // update transaction. In theory, we should be able to do an immediate 174 // update transaction. In theory, we should be able to do an immediate
164 // appearance send and save here. 175 // appearance send and save here.
165 } 176 }
166 177
178 // NPC should send to clients immediately and skip saving appearance
179 if (((ScenePresence)sp).PresenceType == PresenceType.Npc)
180 {
181 SendAppearance((ScenePresence)sp);
182 return;
183 }
184
167 // save only if there were changes, send no matter what (doesn't hurt to send twice) 185 // save only if there were changes, send no matter what (doesn't hurt to send twice)
168 if (changed) 186 if (changed)
169 QueueAppearanceSave(sp.ControllingClient.AgentId); 187 QueueAppearanceSave(sp.ControllingClient.AgentId);
@@ -174,6 +192,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
174 // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); 192 // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
175 } 193 }
176 194
195 private void SendAppearance(ScenePresence sp)
196 {
197 // Send the appearance to everyone in the scene
198 sp.SendAppearanceToAllOtherAgents();
199
200 // Send animations back to the avatar as well
201 sp.Animator.SendAnimPack();
202 }
203
177 public bool SendAppearance(UUID agentId) 204 public bool SendAppearance(UUID agentId)
178 { 205 {
179// m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId); 206// m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId);
@@ -185,12 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
185 return false; 212 return false;
186 } 213 }
187 214
188 // Send the appearance to everyone in the scene 215 SendAppearance(sp);
189 sp.SendAppearanceToAllOtherAgents();
190
191 // Send animations back to the avatar as well
192 sp.Animator.SendAnimPack();
193
194 return true; 216 return true;
195 } 217 }
196 218
@@ -626,4 +648,4 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
626 outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt"); 648 outputAction("{0} baked appearance texture is {1}", sp.Name, bakedTextureValid ? "OK" : "corrupt");
627 } 649 }
628 } 650 }
629} \ No newline at end of file 651}
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index f1399af..9a6dfe1 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -681,11 +681,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
681 681
682 #region Agent Crossings 682 #region Agent Crossings
683 683
684 public bool Cross(ScenePresence agent, bool isFlying) 684 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos)
685 { 685 {
686 Scene scene = agent.Scene; 686 version = String.Empty;
687 Vector3 pos = agent.AbsolutePosition; 687 newpos = new Vector3(pos.X, pos.Y, pos.Z);
688 Vector3 newpos = new Vector3(pos.X, pos.Y, pos.Z);
689 uint neighbourx = scene.RegionInfo.RegionLocX; 688 uint neighbourx = scene.RegionInfo.RegionLocX;
690 uint neighboury = scene.RegionInfo.RegionLocY; 689 uint neighboury = scene.RegionInfo.RegionLocY;
691 const float boundaryDistance = 1.7f; 690 const float boundaryDistance = 1.7f;
@@ -706,53 +705,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
706 } 705 }
707 else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) 706 else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
708 { 707 {
709 Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S); 708 neighboury--;
710 if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0) 709 newpos.Y = Constants.RegionSize - enterDistance;
711 {
712 neighboury--;
713 newpos.Y = Constants.RegionSize - enterDistance;
714 }
715 else
716 {
717 agent.IsInTransit = true;
718
719 neighboury = b.TriggerRegionY;
720 neighbourx = b.TriggerRegionX;
721
722 Vector3 newposition = pos;
723 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
724 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
725 agent.ControllingClient.SendAgentAlertMessage(
726 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
727 InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
728 return true;
729 }
730 }
731
732 Border ba = scene.GetCrossedBorder(pos + westCross, Cardinals.W);
733 if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0)
734 {
735 neighbourx--;
736 newpos.X = Constants.RegionSize - enterDistance;
737 } 710 }
738 else
739 {
740 agent.IsInTransit = true;
741
742 neighboury = ba.TriggerRegionY;
743 neighbourx = ba.TriggerRegionX;
744
745
746 Vector3 newposition = pos;
747 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
748 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
749 agent.ControllingClient.SendAgentAlertMessage(
750 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
751 InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
752 711
753 712 neighbourx--;
754 return true; 713 newpos.X = Constants.RegionSize - enterDistance;
755 }
756 714
757 } 715 }
758 else if (scene.TestBorderCross(pos + eastCross, Cardinals.E)) 716 else if (scene.TestBorderCross(pos + eastCross, Cardinals.E))
@@ -763,26 +721,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
763 721
764 if (scene.TestBorderCross(pos + southCross, Cardinals.S)) 722 if (scene.TestBorderCross(pos + southCross, Cardinals.S))
765 { 723 {
766 Border ba = scene.GetCrossedBorder(pos + southCross, Cardinals.S); 724 neighboury--;
767 if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0) 725 newpos.Y = Constants.RegionSize - enterDistance;
768 {
769 neighboury--;
770 newpos.Y = Constants.RegionSize - enterDistance;
771 }
772 else
773 {
774 agent.IsInTransit = true;
775
776 neighboury = ba.TriggerRegionY;
777 neighbourx = ba.TriggerRegionX;
778 Vector3 newposition = pos;
779 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
780 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
781 agent.ControllingClient.SendAgentAlertMessage(
782 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
783 InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
784 return true;
785 }
786 } 726 }
787 else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) 727 else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
788 { 728 {
@@ -790,35 +730,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
790 neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize); 730 neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize);
791 newpos.Y = enterDistance; 731 newpos.Y = enterDistance;
792 } 732 }
793
794
795 } 733 }
796 else if (scene.TestBorderCross(pos + southCross, Cardinals.S)) 734 else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
797 { 735 {
798 Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S); 736 Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
799 if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0) 737 neighboury--;
800 { 738 newpos.Y = Constants.RegionSize - enterDistance;
801 neighboury--;
802 newpos.Y = Constants.RegionSize - enterDistance;
803 }
804 else
805 {
806 agent.IsInTransit = true;
807
808 neighboury = b.TriggerRegionY;
809 neighbourx = b.TriggerRegionX;
810 Vector3 newposition = pos;
811 newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
812 newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
813 agent.ControllingClient.SendAgentAlertMessage(
814 String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
815 InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
816 return true;
817 }
818 } 739 }
819 else if (scene.TestBorderCross(pos + northCross, Cardinals.N)) 740 else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
820 { 741 {
821
822 Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N); 742 Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
823 neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize); 743 neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
824 newpos.Y = enterDistance; 744 newpos.Y = enterDistance;
@@ -849,19 +769,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
849 } 769 }
850 */ 770 */
851 771
852 ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); 772 xDest = neighbourx;
773 yDest = neighboury;
853 774
854 int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize); 775 int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize);
855 776
777 ulong neighbourHandle = Utils.UIntsToLong((uint)x, (uint)y);
778
856 ExpiringCache<ulong, DateTime> r; 779 ExpiringCache<ulong, DateTime> r;
857 DateTime banUntil; 780 DateTime banUntil;
858 781
859 if (m_bannedRegions.TryGetValue(agent.ControllingClient.AgentId, out r)) 782 if (m_bannedRegions.TryGetValue(agentID, out r))
860 { 783 {
861 if (r.TryGetValue(neighbourHandle, out banUntil)) 784 if (r.TryGetValue(neighbourHandle, out banUntil))
862 { 785 {
863 if (DateTime.Now < banUntil) 786 if (DateTime.Now < banUntil)
864 return false; 787 return null;
865 r.Remove(neighbourHandle); 788 r.Remove(neighbourHandle);
866 } 789 }
867 } 790 }
@@ -873,28 +796,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
873 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 796 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
874 797
875 string reason; 798 string reason;
876 string version; 799 if (!scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out reason))
877 if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out version, out reason))
878 { 800 {
879 agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
880 if (r == null) 801 if (r == null)
881 { 802 {
882 r = new ExpiringCache<ulong, DateTime>(); 803 r = new ExpiringCache<ulong, DateTime>();
883 r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); 804 r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
884 805
885 m_bannedRegions.Add(agent.ControllingClient.AgentId, r, TimeSpan.FromSeconds(45)); 806 m_bannedRegions.Add(agentID, r, TimeSpan.FromSeconds(45));
886 } 807 }
887 else 808 else
888 { 809 {
889 r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15)); 810 r.Add(neighbourHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
890 } 811 }
812 return null;
813 }
814
815 return neighbourRegion;
816 }
817
818 public bool Cross(ScenePresence agent, bool isFlying)
819 {
820 uint x;
821 uint y;
822 Vector3 newpos;
823 string version;
824
825 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos);
826 if (neighbourRegion == null)
827 {
828 agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
891 return false; 829 return false;
892 } 830 }
893 831
894 agent.IsInTransit = true; 832 agent.IsInTransit = true;
895 833
896 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync; 834 CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
897 d.BeginInvoke(agent, newpos, neighbourx, neighboury, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d); 835 d.BeginInvoke(agent, newpos, x, y, neighbourRegion, isFlying, version, CrossAgentToNewRegionCompleted, d);
898 836
899 return true; 837 return true;
900 } 838 }
@@ -951,13 +889,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
951 icon.EndInvoke(iar); 889 icon.EndInvoke(iar);
952 } 890 }
953 891
954 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version);
955
956 /// <summary> 892 /// <summary>
957 /// This Closes child agents on neighbouring regions 893 /// This Closes child agents on neighbouring regions
958 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 894 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
959 /// </summary> 895 /// </summary>
960 protected ScenePresence CrossAgentToNewRegionAsync( 896 public ScenePresence CrossAgentToNewRegionAsync(
961 ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, 897 ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion,
962 bool isFlying, string version) 898 bool isFlying, string version)
963 { 899 {
@@ -1731,17 +1667,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1731 { 1667 {
1732 m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID); 1668 m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID);
1733 1669
1670 // Need to turn off the physics flags, otherwise the object will continue to attempt to
1671 // move out of the region creating an infinite loop of failed attempts to cross
1672 grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false);
1673
1734 // We are going to move the object back to the old position so long as the old position 1674 // We are going to move the object back to the old position so long as the old position
1735 // is in the region 1675 // is in the region
1736 oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1); 1676 oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1);
1737 oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1); 1677 oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1);
1738 oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z,1.0f,4096.0f); 1678 oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z,1.0f,4096.0f);
1739 1679
1740 grp.RootPart.GroupPosition = oldGroupPosition; 1680 grp.AbsolutePosition = oldGroupPosition;
1741
1742 // Need to turn off the physics flags, otherwise the object will continue to attempt to
1743 // move out of the region creating an infinite loop of failed attempts to cross
1744 grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false);
1745 1681
1746 grp.ScheduleGroupForFullUpdate(); 1682 grp.ScheduleGroupForFullUpdate();
1747 } 1683 }
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index a47bc9a..82a035b 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -560,12 +560,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
560 return null; 560 return null;
561 561
562 userID = remoteClient.AgentId; 562 userID = remoteClient.AgentId;
563
564// m_log.DebugFormat(
565// "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is {1} {2}",
566// action, remoteClient.Name, userID);
563 } 567 }
564 else 568 else
565 { 569 {
566 // All returns / deletes go to the object owner 570 // All returns / deletes go to the object owner
567 // 571 //
568 userID = so.RootPart.OwnerID; 572 userID = so.RootPart.OwnerID;
573
574// m_log.DebugFormat(
575// "[INVENTORY ACCESS MODULE]: Target of {0} in CreateItemForObject() is object owner {1}",
576// action, userID);
569 } 577 }
570 578
571 if (userID == UUID.Zero) // Can't proceed 579 if (userID == UUID.Zero) // Can't proceed
@@ -651,11 +659,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
651 } 659 }
652 660
653 // Override and put into where it came from, if it came 661 // Override and put into where it came from, if it came
654 // from anywhere in inventory 662 // from anywhere in inventory and the owner is taking it back.
655 // 663 //
656 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) 664 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
657 { 665 {
658 if (so.RootPart.FromFolderID != UUID.Zero) 666 if (so.RootPart.FromFolderID != UUID.Zero && userID == remoteClient.AgentId)
659 { 667 {
660 InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); 668 InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID);
661 if (f != null) 669 if (f != null)
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 5e7d37a..ba38488 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -707,7 +707,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
707 // Object owners should be able to edit their own content 707 // Object owners should be able to edit their own content
708 if (currentUser == objectOwner) 708 if (currentUser == objectOwner)
709 { 709 {
710 permission = true; 710 // there is no way that later code can change this back to false
711 // so just return true immediately and short circuit the more
712 // expensive group checks
713 return true;
714
715 //permission = true;
711 } 716 }
712 else if (group.IsAttachment) 717 else if (group.IsAttachment)
713 { 718 {
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
index 39a760c..34aca33 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
@@ -35,6 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces
35 35
36 public interface IAvatarFactoryModule 36 public interface IAvatarFactoryModule
37 { 37 {
38 void SetAppearance(IScenePresence sp, AvatarAppearance appearance);
38 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams); 39 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams);
39 40
40 /// <summary> 41 /// <summary>
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index c38ecd9..76f1641 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
@@ -35,6 +35,8 @@ using OpenSim.Region.Framework.Scenes;
35 35
36namespace OpenSim.Region.Framework.Interfaces 36namespace OpenSim.Region.Framework.Interfaces
37{ 37{
38 public delegate ScenePresence CrossAgentToNewRegionDelegate(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version);
39
38 public interface IEntityTransferModule 40 public interface IEntityTransferModule
39 { 41 {
40 void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position, 42 void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position,
@@ -53,7 +55,12 @@ namespace OpenSim.Region.Framework.Interfaces
53 55
54 void EnableChildAgent(ScenePresence agent, GridRegion region); 56 void EnableChildAgent(ScenePresence agent, GridRegion region);
55 57
58 GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos);
59
56 void Cross(SceneObjectGroup sog, Vector3 position, bool silent); 60 void Cross(SceneObjectGroup sog, Vector3 position, bool silent);
61
62 ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, uint neighbourx, uint neighboury, GridRegion neighbourRegion, bool isFlying, string version);
63
57 } 64 }
58 65
59 public interface IUserAgentVerificationModule 66 public interface IUserAgentVerificationModule
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 5dfd3e0..f678d07 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -148,7 +148,8 @@ namespace OpenSim.Region.Framework.Scenes
148 x = m_inventoryDeletes.Dequeue(); 148 x = m_inventoryDeletes.Dequeue();
149 149
150 m_log.DebugFormat( 150 m_log.DebugFormat(
151 "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", left, x.action, x.objectGroups.Count); 151 "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.",
152 left, x.action, x.objectGroups.Count);
152 153
153 try 154 try
154 { 155 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 456e86b..8552d4c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3408,9 +3408,9 @@ namespace OpenSim.Region.Framework.Scenes
3408 3408
3409 // Don't disable this log message - it's too helpful 3409 // Don't disable this log message - it's too helpful
3410 m_log.DebugFormat( 3410 m_log.DebugFormat(
3411 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6}, position {7})", 3411 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags {8}, position {9})",
3412 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3412 RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname,
3413 agent.AgentID, agent.circuitcode, teleportFlags, agent.startpos); 3413 agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, teleportFlags, agent.startpos);
3414 3414
3415 if (LoginsDisabled) 3415 if (LoginsDisabled)
3416 { 3416 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 9961438..644b78a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -465,7 +465,77 @@ namespace OpenSim.Region.Framework.Scenes
465 || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) 465 || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
466 && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) 466 && !IsAttachmentCheckFull() && (!Scene.LoadingPrims))
467 { 467 {
468 m_scene.CrossPrimGroupIntoNewRegion(val, this, true); 468 IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
469 uint x = 0;
470 uint y = 0;
471 string version = String.Empty;
472 Vector3 newpos = Vector3.Zero;
473 OpenSim.Services.Interfaces.GridRegion destination = null;
474
475 bool canCross = true;
476 foreach (ScenePresence av in m_linkedAvatars)
477 {
478 // We need to cross these agents. First, let's find
479 // out if any of them can't cross for some reason.
480 // We have to deny the crossing entirely if any
481 // of them are banned. Alternatively, we could
482 // unsit banned agents....
483
484
485 // We set the avatar position as being the object
486 // position to get the region to send to
487 if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out x, out y, out version, out newpos)) == null)
488 {
489 canCross = false;
490 break;
491 }
492
493 m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName);
494 }
495
496 if (canCross)
497 {
498 // We unparent the SP quietly so that it won't
499 // be made to stand up
500 foreach (ScenePresence av in m_linkedAvatars)
501 {
502 SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID);
503 if (parentPart != null)
504 av.ParentUUID = parentPart.UUID;
505
506 av.ParentID = 0;
507 }
508
509 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
510
511 // Normalize
512 if (val.X >= Constants.RegionSize)
513 val.X -= Constants.RegionSize;
514 if (val.Y >= Constants.RegionSize)
515 val.Y -= Constants.RegionSize;
516 if (val.X < 0)
517 val.X += Constants.RegionSize;
518 if (val.Y < 0)
519 val.Y += Constants.RegionSize;
520
521 // If it's deleted, crossing was successful
522 if (IsDeleted)
523 {
524 foreach (ScenePresence av in m_linkedAvatars)
525 {
526 m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);
527
528 av.IsInTransit = true;
529
530 CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync;
531 d.BeginInvoke(av, val, x, y, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d);
532 }
533
534 return;
535 }
536 }
537
538 val = AbsolutePosition;
469 } 539 }
470 } 540 }
471 541
@@ -524,6 +594,23 @@ namespace OpenSim.Region.Framework.Scenes
524 } 594 }
525 } 595 }
526 596
597 private void CrossAgentToNewRegionCompleted(IAsyncResult iar)
598 {
599 CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState;
600 ScenePresence agent = icon.EndInvoke(iar);
601
602 //// If the cross was successful, this agent is a child agent
603 //if (agent.IsChildAgent)
604 // agent.Reset();
605 //else // Not successful
606 // agent.RestoreInCurrentScene();
607
608 // In any case
609 agent.IsInTransit = false;
610
611 m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
612 }
613
527 public override uint LocalId 614 public override uint LocalId
528 { 615 {
529 get { return m_rootPart.LocalId; } 616 get { return m_rootPart.LocalId; }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9100c29..8a42616 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -233,6 +233,8 @@ namespace OpenSim.Region.Framework.Scenes
233 private bool m_collisionEventFlag = false; 233 private bool m_collisionEventFlag = false;
234 private object m_collisionEventLock = new Object(); 234 private object m_collisionEventLock = new Object();
235 235
236 private Vector3 m_prevSitOffset;
237
236 protected AvatarAppearance m_appearance; 238 protected AvatarAppearance m_appearance;
237 239
238 public AvatarAppearance Appearance 240 public AvatarAppearance Appearance
@@ -295,13 +297,10 @@ namespace OpenSim.Region.Framework.Scenes
295 /// </summary> 297 /// </summary>
296 public PhysicsActor PhysicsActor { get; private set; } 298 public PhysicsActor PhysicsActor { get; private set; }
297 299
298 private byte m_movementflag; 300 /// <summary>
299 301 /// Record user movement inputs.
300 public byte MovementFlag 302 /// </summary>
301 { 303 public byte MovementFlag { get; private set; }
302 set { m_movementflag = value; }
303 get { return m_movementflag; }
304 }
305 304
306 private bool m_updateflag; 305 private bool m_updateflag;
307 306
@@ -647,6 +646,13 @@ namespace OpenSim.Region.Framework.Scenes
647 } 646 }
648 private uint m_parentID; 647 private uint m_parentID;
649 648
649 public UUID ParentUUID
650 {
651 get { return m_parentUUID; }
652 set { m_parentUUID = value; }
653 }
654 private UUID m_parentUUID = UUID.Zero;
655
650 public float Health 656 public float Health
651 { 657 {
652 get { return m_health; } 658 get { return m_health; }
@@ -868,7 +874,26 @@ namespace OpenSim.Region.Framework.Scenes
868 "[SCENE]: Upgrading child to root agent for {0} in {1}", 874 "[SCENE]: Upgrading child to root agent for {0} in {1}",
869 Name, m_scene.RegionInfo.RegionName); 875 Name, m_scene.RegionInfo.RegionName);
870 876
871 //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); 877 if (ParentUUID != UUID.Zero)
878 {
879 m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID);
880 SceneObjectPart part = m_scene.GetSceneObjectPart(ParentUUID);
881 if (part == null)
882 {
883 m_log.ErrorFormat("[SCENE PRESENCE]: Can't find prim {0} to sit on", ParentUUID);
884 }
885 else
886 {
887 part.ParentGroup.AddAvatar(UUID);
888 if (part.SitTargetPosition != Vector3.Zero)
889 part.SitTargetAvatar = UUID;
890 ParentPosition = part.GetWorldPosition();
891 ParentID = part.LocalId;
892 m_pos = m_prevSitOffset;
893 pos = ParentPosition;
894 }
895 ParentUUID = UUID.Zero;
896 }
872 897
873 bool wasChild = IsChildAgent; 898 bool wasChild = IsChildAgent;
874 IsChildAgent = false; 899 IsChildAgent = false;
@@ -881,62 +906,64 @@ namespace OpenSim.Region.Framework.Scenes
881 906
882 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); 907 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
883 908
884 // Moved this from SendInitialData to ensure that Appearance is initialized 909 if (ParentID == 0)
885 // before the inventory is processed in MakeRootAgent. This fixes a race condition
886 // related to the handling of attachments
887 //m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
888 if (m_scene.TestBorderCross(pos, Cardinals.E))
889 { 910 {
890 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E); 911 // Moved this from SendInitialData to ensure that Appearance is initialized
891 pos.X = crossedBorder.BorderLine.Z - 1; 912 // before the inventory is processed in MakeRootAgent. This fixes a race condition
892 } 913 // related to the handling of attachments
914 //m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
915 if (m_scene.TestBorderCross(pos, Cardinals.E))
916 {
917 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
918 pos.X = crossedBorder.BorderLine.Z - 1;
919 }
893 920
894 if (m_scene.TestBorderCross(pos, Cardinals.N)) 921 if (m_scene.TestBorderCross(pos, Cardinals.N))
895 { 922 {
896 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N); 923 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N);
897 pos.Y = crossedBorder.BorderLine.Z - 1; 924 pos.Y = crossedBorder.BorderLine.Z - 1;
898 } 925 }
899 926
900 CheckAndAdjustLandingPoint(ref pos); 927 CheckAndAdjustLandingPoint(ref pos);
901 928
902 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) 929 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f)
903 { 930 {
904 m_log.WarnFormat( 931 m_log.WarnFormat(
905 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping", 932 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Clamping",
906 pos, Name, UUID); 933 pos, Name, UUID);
907 934
908 if (pos.X < 0f) pos.X = 0f; 935 if (pos.X < 0f) pos.X = 0f;
909 if (pos.Y < 0f) pos.Y = 0f; 936 if (pos.Y < 0f) pos.Y = 0f;
910 if (pos.Z < 0f) pos.Z = 0f; 937 if (pos.Z < 0f) pos.Z = 0f;
911 } 938 }
912 939
913 float localAVHeight = 1.56f; 940 float localAVHeight = 1.56f;
914 if (Appearance.AvatarHeight > 0) 941 if (Appearance.AvatarHeight > 0)
915 localAVHeight = Appearance.AvatarHeight; 942 localAVHeight = Appearance.AvatarHeight;
916 943
917 float posZLimit = 0; 944 float posZLimit = 0;
918 945
919 if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize) 946 if (pos.X < Constants.RegionSize && pos.Y < Constants.RegionSize)
920 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; 947 posZLimit = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
921 948
922 float newPosZ = posZLimit + localAVHeight / 2; 949 float newPosZ = posZLimit + localAVHeight / 2;
923 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) 950 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
924 { 951 {
925 pos.Z = newPosZ; 952 pos.Z = newPosZ;
926 } 953 }
927 AbsolutePosition = pos; 954 AbsolutePosition = pos;
928 955
929 AddToPhysicalScene(isFlying); 956 AddToPhysicalScene(isFlying);
930 957
931 if (ForceFly) 958 if (ForceFly)
932 { 959 {
933 Flying = true; 960 Flying = true;
934 } 961 }
935 else if (FlyDisabled) 962 else if (FlyDisabled)
936 { 963 {
937 Flying = false; 964 Flying = false;
965 }
938 } 966 }
939
940 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying 967 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
941 // avatar to return to the standing position in mid-air. On login it looks like this is being sent 968 // avatar to return to the standing position in mid-air. On login it looks like this is being sent
942 // elsewhere anyway 969 // elsewhere anyway
@@ -954,11 +981,13 @@ namespace OpenSim.Region.Framework.Scenes
954 { 981 {
955 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); 982 m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments...");
956 // Resume scripts 983 // Resume scripts
957 foreach (SceneObjectGroup sog in m_attachments) 984 Util.FireAndForget(delegate(object x) {
958 { 985 foreach (SceneObjectGroup sog in m_attachments)
959 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 986 {
960 sog.ResumeScripts(); 987 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
961 } 988 sog.ResumeScripts();
989 }
990 });
962 } 991 }
963 } 992 }
964 993
@@ -3122,6 +3151,9 @@ namespace OpenSim.Region.Framework.Scenes
3122 cAgent.AlwaysRun = SetAlwaysRun; 3151 cAgent.AlwaysRun = SetAlwaysRun;
3123 3152
3124 cAgent.Appearance = new AvatarAppearance(Appearance); 3153 cAgent.Appearance = new AvatarAppearance(Appearance);
3154
3155 cAgent.ParentPart = ParentUUID;
3156 cAgent.SitOffset = m_pos;
3125 3157
3126 lock (scriptedcontrols) 3158 lock (scriptedcontrols)
3127 { 3159 {
@@ -3181,6 +3213,8 @@ namespace OpenSim.Region.Framework.Scenes
3181 CameraAtAxis = cAgent.AtAxis; 3213 CameraAtAxis = cAgent.AtAxis;
3182 CameraLeftAxis = cAgent.LeftAxis; 3214 CameraLeftAxis = cAgent.LeftAxis;
3183 m_CameraUpAxis = cAgent.UpAxis; 3215 m_CameraUpAxis = cAgent.UpAxis;
3216 ParentUUID = cAgent.ParentPart;
3217 m_prevSitOffset = cAgent.SitOffset;
3184 3218
3185 // When we get to the point of re-computing neighbors everytime this 3219 // When we get to the point of re-computing neighbors everytime this
3186 // changes, then start using the agent's drawdistance rather than the 3220 // changes, then start using the agent's drawdistance rather than the
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index ba33122..4b80e37 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1486,7 +1486,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1486 m_SOPXmlProcessors, 1486 m_SOPXmlProcessors,
1487 reader, 1487 reader,
1488 (o, nodeName, e) 1488 (o, nodeName, e)
1489 => m_log.ErrorFormat( 1489 => m_log.DebugFormat(
1490 "[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}", 1490 "[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}",
1491 ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace)); 1491 ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace));
1492 1492
@@ -1539,14 +1539,18 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1539 1539
1540 reader.ReadStartElement(name, String.Empty); // Shape 1540 reader.ReadStartElement(name, String.Empty); // Shape
1541 1541
1542 ExternalRepresentationUtils.ExecuteReadProcessors( 1542 errors = ExternalRepresentationUtils.ExecuteReadProcessors(
1543 shape, 1543 shape,
1544 m_ShapeXmlProcessors, 1544 m_ShapeXmlProcessors,
1545 reader, 1545 reader,
1546 (o, nodeName, e) 1546 (o, nodeName, e)
1547 => m_log.ErrorFormat( 1547 =>
1548 "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", 1548 {
1549 nodeName, e.Message, e.StackTrace)); 1549 m_log.DebugFormat(
1550 "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}",
1551 nodeName, e.Message, e.StackTrace);
1552 }
1553 );
1550 1554
1551 reader.ReadEndElement(); // Shape 1555 reader.ReadEndElement(); // Shape
1552 1556
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 1b675a6..8af3652 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -63,9 +63,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
64 64
65 // Capability string prefixes 65 // Capability string prefixes
66 private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; 66 private static readonly string m_parcelVoiceInfoRequestPath = "0207/";
67 private static readonly string m_provisionVoiceAccountRequestPath = "0008/"; 67 private static readonly string m_provisionVoiceAccountRequestPath = "0208/";
68 private static readonly string m_chatSessionRequestPath = "0009/"; 68 private static readonly string m_chatSessionRequestPath = "0209/";
69 69
70 // Control info 70 // Control info
71 private static bool m_Enabled = false; 71 private static bool m_Enabled = false;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 42008da..130513d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Collections.Specialized; 31using System.Collections.Specialized;
32using System.Reflection; 32using System.Reflection;
33using System.Threading;
33 34
34using Nwc.XmlRpc; 35using Nwc.XmlRpc;
35 36
@@ -167,6 +168,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
167 168
168 private bool m_debugEnabled = false; 169 private bool m_debugEnabled = false;
169 170
171 private Dictionary<string, bool> m_pendingRequests = new Dictionary<string,bool>();
172
170 private ExpiringCache<string, OSDMap> m_memoryCache; 173 private ExpiringCache<string, OSDMap> m_memoryCache;
171 private int m_cacheTimeout = 30; 174 private int m_cacheTimeout = 30;
172 175
@@ -1348,6 +1351,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1348 // Immediately forward the request if the cache is disabled. 1351 // Immediately forward the request if the cache is disabled.
1349 if (m_cacheTimeout == 0) 1352 if (m_cacheTimeout == 0)
1350 { 1353 {
1354 m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: cache is disabled");
1351 return WebUtil.PostToService(m_groupsServerURI, requestArgs); 1355 return WebUtil.PostToService(m_groupsServerURI, requestArgs);
1352 } 1356 }
1353 1357
@@ -1355,6 +1359,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1355 if (requestArgs["RequestMethod"] == "RemoveGeneric" 1359 if (requestArgs["RequestMethod"] == "RemoveGeneric"
1356 || requestArgs["RequestMethod"] == "AddGeneric") 1360 || requestArgs["RequestMethod"] == "AddGeneric")
1357 { 1361 {
1362 m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: clearing generics cache");
1363
1358 // Any and all updates cause the cache to clear 1364 // Any and all updates cause the cache to clear
1359 m_memoryCache.Clear(); 1365 m_memoryCache.Clear();
1360 1366
@@ -1366,18 +1372,67 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1366 1372
1367 // Create the cache key for the request and see if we have it cached 1373 // Create the cache key for the request and see if we have it cached
1368 string CacheKey = WebUtil.BuildQueryString(requestArgs); 1374 string CacheKey = WebUtil.BuildQueryString(requestArgs);
1369 OSDMap response = null; 1375
1370 if (!m_memoryCache.TryGetValue(CacheKey, out response)) 1376 // This code uses a leader/follower pattern. On a cache miss, the request is added
1377 // to a queue; the first thread to add it to the queue completes the request while
1378 // follow on threads busy wait for the results, this situation seems to happen
1379 // often when checking permissions
1380 while (true)
1371 { 1381 {
1372 // if it wasn't in the cache, pass the request to the Simian Grid Services 1382 OSDMap response = null;
1373 response = WebUtil.PostToService(m_groupsServerURI, requestArgs); 1383 bool firstRequest = false;
1374 1384
1375 // and cache the response 1385 lock (m_memoryCache)
1376 m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout)); 1386 {
1387 if (m_memoryCache.TryGetValue(CacheKey, out response))
1388 return response;
1389
1390 if (! m_pendingRequests.ContainsKey(CacheKey))
1391 {
1392 m_pendingRequests.Add(CacheKey,true);
1393 firstRequest = true;
1394 }
1395 }
1396
1397 if (firstRequest)
1398 {
1399 // if it wasn't in the cache, pass the request to the Simian Grid Services
1400 try
1401 {
1402 response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
1403 }
1404 catch (Exception e)
1405 {
1406 m_log.InfoFormat("[SIMIAN GROUPS CONNECTOR] request failed {0}",CacheKey);
1407 }
1408
1409 // and cache the response
1410 lock (m_memoryCache)
1411 {
1412 m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout));
1413 m_pendingRequests.Remove(CacheKey);
1414 }
1415
1416 return response;
1417 }
1418
1419 Thread.Sleep(50); // waiting for a web request to complete, 50msecs is reasonable
1377 } 1420 }
1378 1421
1379 // return cached response 1422 // if (!m_memoryCache.TryGetValue(CacheKey, out response))
1380 return response; 1423 // {
1424 // m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: query not in the cache");
1425 // Util.PrintCallStack();
1426
1427 // // if it wasn't in the cache, pass the request to the Simian Grid Services
1428 // response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
1429
1430 // // and cache the response
1431 // m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout));
1432 // }
1433
1434 // // return cached response
1435 // return response;
1381 } 1436 }
1382 #endregion 1437 #endregion
1383 1438
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 6803644..d395206 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -96,15 +96,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
96 if (!m_avatars.ContainsKey(agentId)) 96 if (!m_avatars.ContainsKey(agentId))
97 return false; 97 return false;
98 98
99 // Delete existing sp attachments
99 scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); 100 scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false);
100 101
101 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); 102 // Set new sp appearance. Also sends to clients.
102 sp.Appearance = npcAppearance; 103 scene.RequestModuleInterface<IAvatarFactoryModule>().SetAppearance(sp, new AvatarAppearance(appearance, true));
104
105 // Rez needed sp attachments
103 scene.AttachmentsModule.RezAttachments(sp); 106 scene.AttachmentsModule.RezAttachments(sp);
104 107
105 IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>();
106 module.SendAppearance(sp.UUID);
107
108 return true; 108 return true;
109 } 109 }
110 110
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 7c1c046..6d1f41d 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -156,6 +156,22 @@ namespace OpenSim.Region.Physics.OdePlugin
156 internal UUID m_uuid { get; private set; } 156 internal UUID m_uuid { get; private set; }
157 internal bool bad = false; 157 internal bool bad = false;
158 158
159 /// <summary>
160 /// ODE Avatar.
161 /// </summary>
162 /// <param name="avName"></param>
163 /// <param name="parent_scene"></param>
164 /// <param name="pos"></param>
165 /// <param name="size"></param>
166 /// <param name="pid_d"></param>
167 /// <param name="pid_p"></param>
168 /// <param name="capsule_radius"></param>
169 /// <param name="tensor"></param>
170 /// <param name="density">
171 /// Only used right now to return information to LSL. Not actually used to set mass in ODE!
172 /// </param>
173 /// <param name="walk_divisor"></param>
174 /// <param name="rundivisor"></param>
159 public OdeCharacter( 175 public OdeCharacter(
160 String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p, 176 String avName, OdeScene parent_scene, Vector3 pos, Vector3 size, float pid_d, float pid_p,
161 float capsule_radius, float tensor, float density, 177 float capsule_radius, float tensor, float density,
@@ -786,6 +802,10 @@ namespace OpenSim.Region.Physics.OdePlugin
786 Vector3 vec = Vector3.Zero; 802 Vector3 vec = Vector3.Zero;
787 d.Vector3 vel = d.BodyGetLinearVel(Body); 803 d.Vector3 vel = d.BodyGetLinearVel(Body);
788 804
805// m_log.DebugFormat(
806// "[ODE CHARACTER]: Current velocity in Move() is <{0},{1},{2}>, target {3} for {4}",
807// vel.X, vel.Y, vel.Z, _target_velocity, Name);
808
789 float movementdivisor = 1f; 809 float movementdivisor = 1f;
790 810
791 if (!m_alwaysRun) 811 if (!m_alwaysRun)
@@ -884,18 +904,20 @@ namespace OpenSim.Region.Physics.OdePlugin
884 904
885 if (flying) 905 if (flying)
886 { 906 {
907 // This also acts as anti-gravity so that we hover when flying rather than fall.
887 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); 908 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
888 } 909 }
889 } 910 }
890 911
891 if (flying) 912 if (flying)
892 { 913 {
914 // Anti-gravity so that we hover when flying rather than fall.
893 vec.Z += ((-1 * _parent_scene.gravityz) * m_mass); 915 vec.Z += ((-1 * _parent_scene.gravityz) * m_mass);
894 916
895 //Added for auto fly height. Kitto Flora 917 //Added for auto fly height. Kitto Flora
896 //d.Vector3 pos = d.BodyGetPosition(Body); 918 //d.Vector3 pos = d.BodyGetPosition(Body);
897 float target_altitude = _parent_scene.GetTerrainHeightAtXY(_position.X, _position.Y) + MinimumGroundFlightOffset; 919 float target_altitude = _parent_scene.GetTerrainHeightAtXY(_position.X, _position.Y) + MinimumGroundFlightOffset;
898 920
899 if (_position.Z < target_altitude) 921 if (_position.Z < target_altitude)
900 { 922 {
901 vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f; 923 vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f;
@@ -921,6 +943,25 @@ namespace OpenSim.Region.Physics.OdePlugin
921 943
922 return; 944 return;
923 } 945 }
946
947 d.Vector3 newVel = d.BodyGetLinearVel(Body);
948 if (newVel.X >= 256 || newVel.X <= 256 || newVel.Y >= 256 || newVel.Y <= 256 || newVel.Z >= 256 || newVel.Z <= 256)
949 {
950// m_log.DebugFormat(
951// "[ODE CHARACTER]: Limiting falling velocity from {0} to {1} for {2}", newVel.Z, -9.8, Name);
952
953 newVel.X = Util.Clamp<float>(newVel.X, -255f, 255f);
954 newVel.Y = Util.Clamp<float>(newVel.Y, -255f, 255f);
955
956 if (!flying)
957 newVel.Z
958 = Util.Clamp<float>(
959 newVel.Z, -_parent_scene.AvatarTerminalVelocity, _parent_scene.AvatarTerminalVelocity);
960 else
961 newVel.Z = Util.Clamp<float>(newVel.Z, -255f, 255f);
962
963 d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
964 }
924 } 965 }
925 966
926 /// <summary> 967 /// <summary>
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 4530c09..598530c 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -144,6 +144,8 @@ namespace OpenSim.Region.Physics.OdePlugin
144 public float gravityy = 0f; 144 public float gravityy = 0f;
145 public float gravityz = -9.8f; 145 public float gravityz = -9.8f;
146 146
147 public float AvatarTerminalVelocity { get; set; }
148
147 private float contactsurfacelayer = 0.001f; 149 private float contactsurfacelayer = 0.001f;
148 150
149 private int worldHashspaceLow = -4; 151 private int worldHashspaceLow = -4;
@@ -459,6 +461,15 @@ namespace OpenSim.Region.Physics.OdePlugin
459 gravityy = physicsconfig.GetFloat("world_gravityy", 0f); 461 gravityy = physicsconfig.GetFloat("world_gravityy", 0f);
460 gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f); 462 gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f);
461 463
464 float avatarTerminalVelocity = physicsconfig.GetFloat("avatar_terminal_velocity", 54f);
465 AvatarTerminalVelocity = Util.Clamp<float>(avatarTerminalVelocity, 0, 255f);
466 if (AvatarTerminalVelocity != avatarTerminalVelocity)
467 {
468 m_log.WarnFormat(
469 "[ODE SCENE]: avatar_terminal_velocity of {0} is invalid. Clamping to {1}",
470 avatarTerminalVelocity, AvatarTerminalVelocity);
471 }
472
462 worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4); 473 worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4);
463 worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128); 474 worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128);
464 475
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b0b1b16..1529140 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2188,7 +2188,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2188 if (part.ParentGroup.RootPart == part) 2188 if (part.ParentGroup.RootPart == part)
2189 { 2189 {
2190 SceneObjectGroup parent = part.ParentGroup; 2190 SceneObjectGroup parent = part.ParentGroup;
2191 parent.UpdateGroupPosition(new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z)); 2191 Util.FireAndForget(delegate(object x) {
2192 parent.UpdateGroupPosition(new Vector3((float)toPos.x, (float)toPos.y, (float)toPos.z));
2193 });
2192 } 2194 }
2193 else 2195 else
2194 { 2196 {
@@ -7973,7 +7975,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7973 if (part.ParentGroup.RootPart == part) 7975 if (part.ParentGroup.RootPart == part)
7974 { 7976 {
7975 SceneObjectGroup parent = part.ParentGroup; 7977 SceneObjectGroup parent = part.ParentGroup;
7976 parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); 7978 Util.FireAndForget(delegate(object x) {
7979 parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z));
7980 });
7977 } 7981 }
7978 else 7982 else
7979 { 7983 {
@@ -7990,7 +7994,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7990 if (part.ParentGroup.RootPart == part) 7994 if (part.ParentGroup.RootPart == part)
7991 { 7995 {
7992 SceneObjectGroup parent = part.ParentGroup; 7996 SceneObjectGroup parent = part.ParentGroup;
7993 parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z)); 7997 Util.FireAndForget(delegate(object x) {
7998 parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z));
7999 });
7994 } 8000 }
7995 else 8001 else
7996 { 8002 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 2a0ce44..5c200d6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -450,17 +450,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
450 Vector3 toRegionPos; 450 Vector3 toRegionPos;
451 double dis; 451 double dis;
452 452
453 Action<ScenePresence> senseEntity = new Action<ScenePresence>(delegate(ScenePresence presence) 453 Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence =>
454 { 454 {
455 if ((ts.type & NPC) == 0 455 if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc)
456 && presence.PresenceType == PresenceType.Npc 456 {
457 && !npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent) 457 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
458 return; 458 if (npcData == null || !npcData.SenseAsAgent)
459 return;
460 }
459 461
460 if ((ts.type & AGENT) == 0 462 if ((ts.type & AGENT) == 0)
461 && (presence.PresenceType == PresenceType.User 463 {
462 || npcModule.GetNPC(presence.UUID, presence.Scene).SenseAsAgent)) 464 if (presence.PresenceType == PresenceType.User)
463 return; 465 {
466 return;
467 }
468 else
469 {
470 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
471 if (npcData != null && npcData.SenseAsAgent)
472 return;
473 }
474 }
464 475
465 if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0) 476 if (presence.IsDeleted || presence.IsChildAgent || presence.GodLevel > 0.0)
466 return; 477 return;
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 24a23dd..8ab3b64 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -433,11 +433,14 @@ namespace OpenSim.Services.Connectors.Simulation
433 args["destination_name"] = OSD.FromString(destination.RegionName); 433 args["destination_name"] = OSD.FromString(destination.RegionName);
434 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 434 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
435 435
436 WebUtil.PostToService(uri, args, 40000); 436 OSDMap response = WebUtil.PostToService(uri, args, 40000);
437 if (response["Success"] == "False")
438 return false;
437 } 439 }
438 catch (Exception e) 440 catch (Exception e)
439 { 441 {
440 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CreateObject failed with exception; {0}",e.ToString()); 442 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CreateObject failed with exception; {0}",e.ToString());
443 return false;
441 } 444 }
442 445
443 return true; 446 return true;
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index d45f72b..a820ddf 100755
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -484,7 +484,6 @@
484 ;; such as the Meta7 viewer. 484 ;; such as the Meta7 viewer.
485 ;; It has no ill effect on viewers which do not support server-side 485 ;; It has no ill effect on viewers which do not support server-side
486 ;; windlight settings. 486 ;; windlight settings.
487 ;; Currently we only have support for MySQL databases.
488 ; enable_windlight = false 487 ; enable_windlight = false
489 488
490 489
@@ -573,10 +572,15 @@
573 ; DeleteScriptsOnStartup = true 572 ; DeleteScriptsOnStartup = true
574 573
575 ;; Set this to true (the default) to load each script into a separate 574 ;; Set this to true (the default) to load each script into a separate
576 ;; AppDomain. Setting this to false will load all script assemblies into the 575 ;; AppDomain.
577 ;; current AppDomain, which will reduce the per-script overhead at the 576 ;;
578 ;; expense of reduced security and the inability to garbage collect the 577 ;; Setting this to false will load all script assemblies into the
579 ;; script assemblies 578 ;; current AppDomain, which will significantly improve script loading times.
579 ;; It will also reduce initial per-script memory overhead.
580 ;;
581 ;; However, setting this to false will also prevent script DLLs from being unloaded from memory if the script is deleted.
582 ;; This may cause an OutOfMemory problem over time when avatars with scripted attachments move in and out of the region.
583 ;; Some Windows users have also reported script loading problems when AppDomainLoading = false
580 ; AppDomainLoading = true 584 ; AppDomainLoading = true
581 585
582 ;# {DefaultCompileLanguage} {Enabled:true} {Default script language?} {lsl vb cs} lsl 586 ;# {DefaultCompileLanguage} {Enabled:true} {Default script language?} {lsl vb cs} lsl
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 07e7533..8671e31 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -655,6 +655,11 @@
655 world_gravityy = 0 655 world_gravityy = 0
656 world_gravityz = -9.8 656 world_gravityz = -9.8
657 657
658 ; Terminal velocity of a falling avatar
659 ; This is the same http://en.wikipedia.org/wiki/Terminal_velocity#Examples
660 ; Max value is 255, min value is 0
661 avatar_terminal_velocity = 54
662
658 ; World Step size. (warning these are dangerous. Changing these will probably cause your scene to explode dramatically) 663 ; World Step size. (warning these are dangerous. Changing these will probably cause your scene to explode dramatically)
659 ; reference: fps = (0.089/ODE_STEPSIZE) * 1000; 664 ; reference: fps = (0.089/ODE_STEPSIZE) * 1000;
660 world_stepsize = 0.0178 665 world_stepsize = 0.0178
@@ -1065,7 +1070,6 @@
1065[LightShare] 1070[LightShare]
1066 ; This enables the transmission of Windlight scenes to supporting clients, such as the Meta7 viewer. 1071 ; This enables the transmission of Windlight scenes to supporting clients, such as the Meta7 viewer.
1067 ; It has no ill effect on viewers which do not support server-side windlight settings. 1072 ; It has no ill effect on viewers which do not support server-side windlight settings.
1068 ; Currently we only have support for MySQL databases.
1069 enable_windlight = false 1073 enable_windlight = false
1070 1074
1071 1075