aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs32
1 files changed, 22 insertions, 10 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