aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs32
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs3
-rw-r--r--OpenSim/Data/Tests/BasicRegionTest.cs6
3 files changed, 25 insertions, 16 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index 26ec500..673ca6f 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -178,25 +178,38 @@ namespace OpenSim.Data.NHibernate
178 178
179 private SceneObjectGroup LoadObject(UUID uuid, UUID region) 179 private SceneObjectGroup LoadObject(UUID uuid, UUID region)
180 { 180 {
181 SceneObjectGroup group = new SceneObjectGroup();
182
183 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(SceneObjectPart)); 181 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(SceneObjectPart));
184 criteria.Add(Expression.Eq("RegionID", region)); 182 criteria.Add(Expression.Eq("RegionID", region));
185 criteria.Add(Expression.Eq("ParentUUID", uuid)); 183 criteria.Add(Expression.Eq("ParentUUID", uuid));
186 criteria.AddOrder(Order.Asc("ParentID")); 184 criteria.AddOrder(Order.Asc("ParentID"));
187 185
188 foreach (SceneObjectPart p in criteria.List()) 186 IList<SceneObjectPart> parts = criteria.List<SceneObjectPart>();
187
188 SceneObjectGroup group = null;
189
190 // Find the root part
191 for (int i = 0; i < parts.Count; i++)
189 { 192 {
190 // root part 193 if (parts[i].UUID == uuid)
191 if (p.UUID == uuid)
192 { 194 {
193 group.SetRootPart(p); 195 group = new SceneObjectGroup(parts[i]);
196 break;
194 } 197 }
195 else 198 }
199
200 // Add the children parts
201 if (group != null)
202 {
203 for (int i = 0; i < parts.Count; i++)
196 { 204 {
197 group.AddPart(p); 205 if (parts[i].UUID != uuid)
206 group.AddPart(parts[i]);
198 } 207 }
199 } 208 }
209 else
210 {
211 m_log.Error("[NHIBERNATE]: LoadObject() Attempted to load a SceneObjectGroup with no root SceneObjectPart ");
212 }
200 213
201 return group; 214 return group;
202 } 215 }
@@ -237,8 +250,7 @@ namespace OpenSim.Data.NHibernate
237 // root part 250 // root part
238 if (p.UUID == p.ParentUUID) 251 if (p.UUID == p.ParentUUID)
239 { 252 {
240 SceneObjectGroup group = new SceneObjectGroup(); 253 SceneObjectGroup group = new SceneObjectGroup(p);
241 group.SetRootPart(p);
242 SOG.Add(p.ParentUUID, group); 254 SOG.Add(p.ParentUUID, group);
243 } 255 }
244 else 256 else
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 0259ac5..ea076fe 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -416,7 +416,6 @@ namespace OpenSim.Data.SQLite
416 416
417 if (uuid == objID) //is new SceneObjectGroup ? 417 if (uuid == objID) //is new SceneObjectGroup ?
418 { 418 {
419 SceneObjectGroup group = new SceneObjectGroup();
420 prim = buildPrim(primRow); 419 prim = buildPrim(primRow);
421 DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); 420 DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString());
422 if (shapeRow != null) 421 if (shapeRow != null)
@@ -430,7 +429,7 @@ namespace OpenSim.Data.SQLite
430 prim.Shape = PrimitiveBaseShape.Default; 429 prim.Shape = PrimitiveBaseShape.Default;
431 } 430 }
432 431
433 group.SetRootPart(prim); 432 SceneObjectGroup group = new SceneObjectGroup(prim);
434 createdObjects.Add(group.UUID, group); 433 createdObjects.Add(group.UUID, group);
435 retvals.Add(group); 434 retvals.Add(group);
436 LoadItems(prim); 435 LoadItems(prim);
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs
index 8474921..c66ab7c 100644
--- a/OpenSim/Data/Tests/BasicRegionTest.cs
+++ b/OpenSim/Data/Tests/BasicRegionTest.cs
@@ -322,9 +322,8 @@ namespace OpenSim.Data.Tests
322 // This is necessary or object will not be inserted in DB 322 // This is necessary or object will not be inserted in DB
323 sop.ObjectFlags = 0; 323 sop.ObjectFlags = 0;
324 324
325 SceneObjectGroup sog = new SceneObjectGroup(); 325 SceneObjectGroup sog = new SceneObjectGroup(sop);
326 sog.SetScene(scene); // Reguired by nhibernate database module. 326 sog.SetScene(scene); // Reguired by nhibernate database module.
327 sog.SetRootPart(sop);
328 327
329 // Inserts group in DB 328 // Inserts group in DB
330 db.StoreObject(sog,region3); 329 db.StoreObject(sog,region3);
@@ -1003,9 +1002,8 @@ namespace OpenSim.Data.Tests
1003 sop.UUID = uuid; 1002 sop.UUID = uuid;
1004 sop.Shape = PrimitiveBaseShape.Default; 1003 sop.Shape = PrimitiveBaseShape.Default;
1005 1004
1006 SceneObjectGroup sog = new SceneObjectGroup(); 1005 SceneObjectGroup sog = new SceneObjectGroup(sop);
1007 sog.SetScene(scene); 1006 sog.SetScene(scene);
1008 sog.SetRootPart(sop);
1009 1007
1010 return sog; 1008 return sog;
1011 } 1009 }