diff options
Diffstat (limited to 'OpenSim/Region/Storage')
-rw-r--r-- | OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index 5d1592c..bd6658c 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | |||
@@ -308,7 +308,6 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
308 | 308 | ||
309 | private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID) | 309 | private void fillPrimRow(DataRow row, SceneObjectPart prim, LLUUID sceneGroupID) |
310 | { | 310 | { |
311 | Console.WriteLine("scene Group for this prim is " + sceneGroupID); | ||
312 | row["UUID"] = prim.UUID; | 311 | row["UUID"] = prim.UUID; |
313 | row["ParentID"] = prim.ParentID; | 312 | row["ParentID"] = prim.ParentID; |
314 | row["CreationDate"] = prim.CreationDate; | 313 | row["CreationDate"] = prim.CreationDate; |
@@ -481,37 +480,54 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
481 | 480 | ||
482 | public List<SceneObjectGroup> LoadObjects() | 481 | public List<SceneObjectGroup> LoadObjects() |
483 | { | 482 | { |
483 | Dictionary<LLUUID, SceneObjectGroup> createdObjects = new Dictionary<LLUUID, SceneObjectGroup>(); | ||
484 | List<SceneObjectGroup> retvals = new List<SceneObjectGroup>(); | 484 | List<SceneObjectGroup> retvals = new List<SceneObjectGroup>(); |
485 | 485 | ||
486 | DataTable prims = ds.Tables["prims"]; | 486 | DataTable prims = ds.Tables["prims"]; |
487 | DataTable shapes = ds.Tables["primshapes"]; | 487 | DataTable shapes = ds.Tables["primshapes"]; |
488 | 488 | ||
489 | // This only supports 1 prim per SceneObjectGroup. Need to fix later | ||
490 | foreach (DataRow primRow in prims.Rows) | 489 | foreach (DataRow primRow in prims.Rows) |
491 | { | 490 | { |
492 | SceneObjectGroup group = new SceneObjectGroup(); | 491 | string uuid = (string)primRow["UUID"]; |
493 | SceneObjectPart prim = buildPrim(primRow); | 492 | string objID = (string)primRow["SceneGroupID"]; |
494 | DataRow shapeRow = shapes.Rows.Find(prim.UUID); | 493 | if (uuid == objID) //is new SceneObjectGroup ? |
495 | if (shapeRow != null) | ||
496 | { | 494 | { |
497 | prim.Shape = buildShape(shapeRow); | 495 | SceneObjectGroup group = new SceneObjectGroup(); |
496 | SceneObjectPart prim = buildPrim(primRow); | ||
497 | DataRow shapeRow = shapes.Rows.Find(prim.UUID); | ||
498 | if (shapeRow != null) | ||
499 | { | ||
500 | prim.Shape = buildShape(shapeRow); | ||
501 | } | ||
502 | else | ||
503 | { | ||
504 | Console.WriteLine("No shape found for prim in storage, so setting default box shape"); | ||
505 | prim.Shape = BoxShape.Default; | ||
506 | } | ||
507 | group.AddPart(prim); | ||
508 | group.RootPart = prim; | ||
509 | |||
510 | createdObjects.Add(group.UUID, group); | ||
511 | retvals.Add(group); | ||
498 | } | 512 | } |
499 | else | 513 | else |
500 | { | 514 | { |
501 | Console.WriteLine("No shape found for prim in storage, so setting default box shape"); | 515 | SceneObjectPart prim = buildPrim(primRow); |
502 | prim.Shape = BoxShape.Default; | 516 | DataRow shapeRow = shapes.Rows.Find(prim.UUID); |
517 | if (shapeRow != null) | ||
518 | { | ||
519 | prim.Shape = buildShape(shapeRow); | ||
520 | } | ||
521 | else | ||
522 | { | ||
523 | Console.WriteLine("No shape found for prim in storage, so setting default box shape"); | ||
524 | prim.Shape = BoxShape.Default; | ||
525 | } | ||
526 | createdObjects[new LLUUID(objID)].AddPart(prim); | ||
503 | } | 527 | } |
504 | group.AddPart(prim); | ||
505 | // TODO: there are a couple of known issues to get this to work | ||
506 | // * While we can add Children, we can't set the root part (or | ||
507 | // or even figure out which should be the root part) | ||
508 | // * region handle may need to be persisted, it isn't now | ||
509 | group.RootPart = prim; | ||
510 | |||
511 | retvals.Add(group); | ||
512 | } | 528 | } |
513 | 529 | ||
514 | MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + prims.Rows.Count + " objects"); | 530 | MainLog.Instance.Verbose("DATASTORE", "Sqlite - LoadObjects found " + prims.Rows.Count + " primitives"); |
515 | 531 | ||
516 | return retvals; | 532 | return retvals; |
517 | } | 533 | } |