aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorMW2007-08-10 13:59:19 +0000
committerMW2007-08-10 13:59:19 +0000
commit94c7e41ef1978a5be21e1a063c68ffc1c8a89b97 (patch)
treef40b2951bfbabe0bff2553355e3603450c737b0a /OpenSim/Region/Environment
parentCouldn't leave this one alone. Data is now flowing both ways in (diff)
downloadopensim-SC_OLD-94c7e41ef1978a5be21e1a063c68ffc1c8a89b97.zip
opensim-SC_OLD-94c7e41ef1978a5be21e1a063c68ffc1c8a89b97.tar.gz
opensim-SC_OLD-94c7e41ef1978a5be21e1a063c68ffc1c8a89b97.tar.bz2
opensim-SC_OLD-94c7e41ef1978a5be21e1a063c68ffc1c8a89b97.tar.xz
Made a few changes so that once we enable the sqlite data store (simple line change in OpenSimMain), then basic ( with a few limits at moment) prim database backup will work.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs33
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs56
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs1
4 files changed, 80 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index c2eac60..ef7346d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -151,15 +151,6 @@ namespace OpenSim.Region.Environment.Scenes
151 Avatars = new Dictionary<LLUUID, ScenePresence>(); 151 Avatars = new Dictionary<LLUUID, ScenePresence>();
152 Prims = new Dictionary<LLUUID, SceneObjectGroup>(); 152 Prims = new Dictionary<LLUUID, SceneObjectGroup>();
153 153
154 MainLog.Instance.Verbose("Loading objects from datastore");
155 List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects();
156 foreach (SceneObjectGroup prim in PrimsFromDB)
157 {
158 AddEntity(prim);
159 }
160 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " object(s)");
161
162
163 MainLog.Instance.Verbose("Creating LandMap"); 154 MainLog.Instance.Verbose("Creating LandMap");
164 Terrain = new TerrainEngine((int)this.RegionInfo.RegionLocX, (int)this.RegionInfo.RegionLocY); 155 Terrain = new TerrainEngine((int)this.RegionInfo.RegionLocX, (int)this.RegionInfo.RegionLocY);
165 156
@@ -238,7 +229,7 @@ namespace OpenSim.Region.Environment.Scenes
238 229
239 //backup scene data 230 //backup scene data
240 storageCount++; 231 storageCount++;
241 if (storageCount > 1200) //set to how often you want to backup 232 if (storageCount > 600) //set to how often you want to backup
242 { 233 {
243 Backup(); 234 Backup();
244 storageCount = 0; 235 storageCount = 0;
@@ -462,12 +453,13 @@ namespace OpenSim.Region.Environment.Scenes
462 /// </summary> 453 /// </summary>
463 public void LoadPrimsFromStorage() 454 public void LoadPrimsFromStorage()
464 { 455 {
465 MainLog.Instance.Verbose("World.cs: LoadPrimsFromStorage() - Loading primitives"); 456 MainLog.Instance.Verbose("Loading objects from datastore");
466 List<SceneObjectGroup> NewObjectsList = storageManager.DataStore.LoadObjects(); 457 List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects();
467 foreach (SceneObjectGroup obj in NewObjectsList) 458 foreach (SceneObjectGroup prim in PrimsFromDB)
468 { 459 {
469 this.Objects.Add(obj.UUID, obj); 460 AddEntityFromStorage(prim);
470 } 461 }
462 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " object(s)");
471 } 463 }
472 464
473 /// <summary> 465 /// <summary>
@@ -520,6 +512,17 @@ namespace OpenSim.Region.Environment.Scenes
520 } 512 }
521 } 513 }
522 514
515 public void AddEntityFromStorage(SceneObjectGroup sceneObject)
516 {
517 sceneObject.RegionHandle = this.m_regionHandle;
518 sceneObject.SetScene(this);
519 foreach (SceneObjectPart part in sceneObject.Children.Values)
520 {
521 part.LocalID = this.PrimIDAllocate();
522 }
523 this.AddEntity(sceneObject);
524 }
525
523 public void AddEntity(SceneObjectGroup sceneObject) 526 public void AddEntity(SceneObjectGroup sceneObject)
524 { 527 {
525 Entities.Add(sceneObject.UUID, sceneObject); 528 Entities.Add(sceneObject.UUID, sceneObject);
@@ -781,7 +784,7 @@ namespace OpenSim.Region.Environment.Scenes
781 { 784 {
782 if (ent is SceneObjectGroup) 785 if (ent is SceneObjectGroup)
783 { 786 {
784 // ((SceneObject) ent).SendAllChildPrimsToClient(client); 787 ((SceneObjectGroup) ent).SendFullUpdateToClient(client);
785 } 788 }
786 } 789 }
787 } 790 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 78dd69c..8b761f6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -44,6 +44,27 @@ namespace OpenSim.Region.Environment.Scenes
44 set { m_parts = value; } 44 set { m_parts = value; }
45 } 45 }
46 46
47 public SceneObjectPart RootPart
48 {
49 set { m_rootPart = value; }
50 }
51
52 public ulong RegionHandle
53 {
54 get { return m_regionHandle; }
55 set
56 {
57 m_regionHandle = value;
58 lock (this.m_parts)
59 {
60 foreach (SceneObjectPart part in this.m_parts.Values)
61 {
62 part.RegionHandle = m_regionHandle;
63 }
64 }
65 }
66 }
67
47 public override LLVector3 Pos 68 public override LLVector3 Pos
48 { 69 {
49 get { return m_rootPart.GroupPosition; } 70 get { return m_rootPart.GroupPosition; }
@@ -79,9 +100,9 @@ namespace OpenSim.Region.Environment.Scenes
79 /// <summary> 100 /// <summary>
80 /// Added because the Parcel code seems to use it 101 /// Added because the Parcel code seems to use it
81 /// but not sure a object should have this 102 /// but not sure a object should have this
82 /// as what does it tell us? that some avatar has selected it 103 /// as what does it tell us? that some avatar has selected it (but not what Avatar/user)
83 /// think really there should be a list (or whatever) in each scenepresence 104 /// think really there should be a list (or whatever) in each scenepresence
84 /// saying what prim(s) that user has selected at any time. 105 /// saying what prim(s) that user has selected.
85 /// </summary> 106 /// </summary>
86 protected bool m_isSelected = false; 107 protected bool m_isSelected = false;
87 public bool IsSelected 108 public bool IsSelected
@@ -114,7 +135,7 @@ namespace OpenSim.Region.Environment.Scenes
114 m_regionHandle = regionHandle; 135 m_regionHandle = regionHandle;
115 m_scene = scene; 136 m_scene = scene;
116 137
117 this.Pos = pos; 138 // this.Pos = pos;
118 LLVector3 rootOffset = new LLVector3(0, 0, 0); 139 LLVector3 rootOffset = new LLVector3(0, 0, 0);
119 SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset); 140 SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset);
120 this.m_parts.Add(newPart.UUID, newPart); 141 this.m_parts.Add(newPart.UUID, newPart);
@@ -136,6 +157,7 @@ namespace OpenSim.Region.Environment.Scenes
136 dupe.m_regionHandle = this.m_regionHandle; 157 dupe.m_regionHandle = this.m_regionHandle;
137 158
138 dupe.CopyRootPart(this.m_rootPart); 159 dupe.CopyRootPart(this.m_rootPart);
160 m_scene.EventManager.OnBackup += dupe.ProcessBackup;
139 161
140 foreach (SceneObjectPart part in this.m_parts.Values) 162 foreach (SceneObjectPart part in this.m_parts.Values)
141 { 163 {
@@ -148,6 +170,23 @@ namespace OpenSim.Region.Environment.Scenes
148 } 170 }
149 171
150 /// <summary> 172 /// <summary>
173 /// Added as a way for the storage provider to reset the scene,
174 /// most likely a better way to do this sort of thing but for now...
175 /// </summary>
176 /// <param name="scene"></param>
177 public void SetScene(Scene scene)
178 {
179 m_scene = scene;
180 m_scene.EventManager.OnBackup += this.ProcessBackup;
181 }
182
183 public void AddPart(SceneObjectPart part)
184 {
185 part.SetParent(this);
186 this.m_parts.Add(part.UUID, part);
187 }
188
189 /// <summary>
151 /// 190 ///
152 /// </summary> 191 /// </summary>
153 /// <param name="part"></param> 192 /// <param name="part"></param>
@@ -619,6 +658,17 @@ namespace OpenSim.Region.Environment.Scenes
619 return m_scene.RequestAvatarList(); 658 return m_scene.RequestAvatarList();
620 } 659 }
621 660
661 public void SendFullUpdateToClient(IClientAPI remoteClient)
662 {
663 lock (this.m_parts)
664 {
665 foreach (SceneObjectPart part in this.m_parts.Values)
666 {
667 this.SendPartFullUpdate(remoteClient, part);
668 }
669 }
670 }
671
622 /// <summary> 672 /// <summary>
623 /// 673 ///
624 /// </summary> 674 /// </summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 5e62082..1b373aa 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -249,6 +249,14 @@ namespace OpenSim.Region.Environment.Scenes
249 } 249 }
250 #endregion 250 #endregion
251 251
252 /// <summary>
253 ///
254 /// </summary>
255 public void SetParent(SceneObjectGroup parent)
256 {
257 m_parentGroup = parent;
258 }
259
252 #region Copying 260 #region Copying
253 /// <summary> 261 /// <summary>
254 /// 262 ///
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index b021b44..114623a 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -556,6 +556,7 @@ namespace OpenSim.Region.Environment.Scenes
556 } 556 }
557 } 557 }
558 #endregion 558 #endregion
559
559 #region Border Crossing Methods 560 #region Border Crossing Methods
560 /// <summary> 561 /// <summary>
561 /// 562 ///