aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authormingchen2007-07-14 15:11:36 +0000
committermingchen2007-07-14 15:11:36 +0000
commit423d03eaefcae1bcaff8e4d16da014d350c91c42 (patch)
tree1caf9a940dc856be765b7b000d4360d954b6741a /OpenSim/Region/Environment/Scenes
parentSet up parcel manager and the master avatar in SimpleApp. (diff)
downloadopensim-SC_OLD-423d03eaefcae1bcaff8e4d16da014d350c91c42.zip
opensim-SC_OLD-423d03eaefcae1bcaff8e4d16da014d350c91c42.tar.gz
opensim-SC_OLD-423d03eaefcae1bcaff8e4d16da014d350c91c42.tar.bz2
opensim-SC_OLD-423d03eaefcae1bcaff8e4d16da014d350c91c42.tar.xz
*Added support for prim counting on parcels
**No restrictions yet in place, or total prim count
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs26
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs23
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs11
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs60
4 files changed, 107 insertions, 13 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index e20870f..79d5785 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -45,6 +45,8 @@ namespace OpenSim.Region.Environment.Scenes
45 public bool m_isRootPrim; 45 public bool m_isRootPrim;
46 public EntityBase m_Parent; 46 public EntityBase m_Parent;
47 47
48 private ParcelManager m_parcelManager;
49
48 #region Properties 50 #region Properties
49 /// <summary> 51 /// <summary>
50 /// If rootprim, will return world position 52 /// If rootprim, will return world position
@@ -130,10 +132,12 @@ namespace OpenSim.Region.Environment.Scenes
130 /// <param name="isRoot"></param> 132 /// <param name="isRoot"></param>
131 /// <param name="parent"></param> 133 /// <param name="parent"></param>
132 /// <param name="rootObject"></param> 134 /// <param name="rootObject"></param>
133 public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos) 135 public Primitive(ulong regionHandle, Scene world, ParcelManager parcelManager, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
134 { 136 {
137
135 m_regionHandle = regionHandle; 138 m_regionHandle = regionHandle;
136 m_world = world; 139 m_world = world;
140 m_parcelManager = parcelManager;
137 inventoryItems = new Dictionary<LLUUID, InventoryItem>(); 141 inventoryItems = new Dictionary<LLUUID, InventoryItem>();
138 this.m_Parent = parent; 142 this.m_Parent = parent;
139 this.m_isRootPrim = isRoot; 143 this.m_isRootPrim = isRoot;
@@ -141,6 +145,9 @@ namespace OpenSim.Region.Environment.Scenes
141 145
142 this.CreateFromShape(ownerID, localID, pos, shape); 146 this.CreateFromShape(ownerID, localID, pos, shape);
143 this.Rotation = Axiom.Math.Quaternion.Identity; 147 this.Rotation = Axiom.Math.Quaternion.Identity;
148
149
150 m_parcelManager.setPrimsTainted();
144 } 151 }
145 152
146 /// <summary> 153 /// <summary>
@@ -149,11 +156,19 @@ namespace OpenSim.Region.Environment.Scenes
149 /// <remarks>Empty constructor for duplication</remarks> 156 /// <remarks>Empty constructor for duplication</remarks>
150 public Primitive() 157 public Primitive()
151 { 158 {
152 159 m_parcelManager.setPrimsTainted();
153 } 160 }
154 161
155 #endregion 162 #endregion
156 163
164 #region Destructors
165
166 ~Primitive()
167 {
168 m_parcelManager.setPrimsTainted();
169 }
170 #endregion
171
157 #region Duplication 172 #region Duplication
158 173
159 public Primitive Copy(EntityBase parent, SceneObject rootParent) 174 public Primitive Copy(EntityBase parent, SceneObject rootParent)
@@ -260,6 +275,8 @@ namespace OpenSim.Region.Environment.Scenes
260 275
261 this.m_world.DeleteEntity(linkObject.rootUUID); 276 this.m_world.DeleteEntity(linkObject.rootUUID);
262 linkObject.DeleteAllChildren(); 277 linkObject.DeleteAllChildren();
278
279 m_parcelManager.setPrimsTainted();
263 } 280 }
264 281
265 /// <summary> 282 /// <summary>
@@ -335,6 +352,7 @@ namespace OpenSim.Region.Environment.Scenes
335 prim.m_pos += offset; 352 prim.m_pos += offset;
336 prim.updateFlag = 2; 353 prim.updateFlag = 2;
337 } 354 }
355 m_parcelManager.setPrimsTainted();
338 } 356 }
339 357
340 /// <summary> 358 /// <summary>
@@ -385,6 +403,8 @@ namespace OpenSim.Region.Environment.Scenes
385 403
386 this.Pos = newPos; 404 this.Pos = newPos;
387 this.updateFlag = 2; 405 this.updateFlag = 2;
406
407 m_parcelManager.setPrimsTainted();
388 } 408 }
389 409
390 /// <summary> 410 /// <summary>
@@ -419,6 +439,8 @@ namespace OpenSim.Region.Environment.Scenes
419 this.m_pos = newPos; 439 this.m_pos = newPos;
420 this.updateFlag = 2; 440 this.updateFlag = 2;
421 } 441 }
442
443 m_parcelManager.setPrimsTainted();
422 } 444 }
423 445
424 #endregion 446 #endregion
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 01e6752..81bab9a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -59,6 +59,7 @@ namespace OpenSim.Region.Environment.Scenes
59 private uint _primCount = 702000; 59 private uint _primCount = 702000;
60 private System.Threading.Mutex _primAllocateMutex = new Mutex(false); 60 private System.Threading.Mutex _primAllocateMutex = new Mutex(false);
61 private int storageCount; 61 private int storageCount;
62 private int parcelPrimCheckCount;
62 private Mutex updateLock; 63 private Mutex updateLock;
63 64
64 protected AuthenticateSessionsBase authenticateHandler; 65 protected AuthenticateSessionsBase authenticateHandler;
@@ -144,6 +145,8 @@ namespace OpenSim.Region.Environment.Scenes
144 Terrain = new TerrainEngine(); 145 Terrain = new TerrainEngine();
145 146
146 ScenePresence.LoadAnims(); 147 ScenePresence.LoadAnims();
148
149 this.performParcelPrimCountUpdate();
147 this.httpListener = httpServer; 150 this.httpListener = httpServer;
148 } 151 }
149 #endregion 152 #endregion
@@ -211,6 +214,18 @@ namespace OpenSim.Region.Environment.Scenes
211 this.Backup(); 214 this.Backup();
212 storageCount = 0; 215 storageCount = 0;
213 } 216 }
217
218 this.parcelPrimCheckCount++;
219 if (this.parcelPrimCheckCount > 50) //check every 5 seconds for tainted prims
220 {
221 if (m_parcelManager.parcelPrimCountTainted)
222 {
223 //Perform parcel update of prim count
224 performParcelPrimCountUpdate();
225 this.parcelPrimCheckCount = 0;
226 }
227 }
228
214 } 229 }
215 catch (Exception e) 230 catch (Exception e)
216 { 231 {
@@ -441,7 +456,7 @@ namespace OpenSim.Region.Environment.Scenes
441 { 456 {
442 try 457 try
443 { 458 {
444 SceneObject sceneOb = new SceneObject(m_regionHandle, this, ownerID, this.PrimIDAllocate(), pos, shape); 459 SceneObject sceneOb = new SceneObject(m_regionHandle, this, this.m_eventManager,this.m_parcelManager, ownerID, this.PrimIDAllocate(), pos, shape);
445 this.Entities.Add(sceneOb.rootUUID, sceneOb); 460 this.Entities.Add(sceneOb.rootUUID, sceneOb);
446 461
447 // Trigger event for listeners 462 // Trigger event for listeners
@@ -809,6 +824,12 @@ namespace OpenSim.Region.Environment.Scenes
809 return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position); 824 return this.commsManager.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position);
810 } 825 }
811 826
827 public void performParcelPrimCountUpdate()
828 {
829 m_parcelManager.resetAllParcelPrimCounts();
830 m_eventManager.TriggerParcelPrimCountUpdate();
831 m_parcelManager.parcelPrimCountTainted = false;
832 }
812 #endregion 833 #endregion
813 834
814 } 835 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index deecfd5..685ed8c 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -19,6 +19,9 @@ namespace OpenSim.Region.Environment.Scenes
19 public delegate void OnRemovePresenceDelegate(LLUUID uuid); 19 public delegate void OnRemovePresenceDelegate(LLUUID uuid);
20 public event OnRemovePresenceDelegate OnRemovePresence; 20 public event OnRemovePresenceDelegate OnRemovePresence;
21 21
22 public delegate void OnParcelPrimCountUpdateDelegate();
23 public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
24
22 public void TriggerOnFrame() 25 public void TriggerOnFrame()
23 { 26 {
24 if (OnFrame != null) 27 if (OnFrame != null)
@@ -48,5 +51,13 @@ namespace OpenSim.Region.Environment.Scenes
48 OnBackup(dstore); 51 OnBackup(dstore);
49 } 52 }
50 } 53 }
54
55 public void TriggerParcelPrimCountUpdate()
56 {
57 if (OnParcelPrimCountUpdate != null)
58 {
59 OnParcelPrimCountUpdate();
60 }
61 }
51 } 62 }
52} 63}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index d1a3e70..f4c4083 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -47,6 +47,9 @@ namespace OpenSim.Region.Environment.Scenes
47 private PhysicsScene m_PhysScene; 47 private PhysicsScene m_PhysScene;
48 private PhysicsActor m_PhysActor; 48 private PhysicsActor m_PhysActor;
49 49
50 private EventManager m_eventManager;
51 private ParcelManager m_parcelManager;
52
50 public LLUUID rootUUID 53 public LLUUID rootUUID
51 { 54 {
52 get 55 get
@@ -65,38 +68,71 @@ namespace OpenSim.Region.Environment.Scenes
65 } 68 }
66 } 69 }
67 70
71 public int primCount
72 {
73 get
74 {
75 return this.ChildPrimitives.Count;
76 }
77 }
78
68 /// <summary> 79 /// <summary>
69 /// 80 ///
70 /// </summary> 81 /// </summary>
71 public SceneObject(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) 82 public SceneObject(ulong regionHandle, Scene world, EventManager eventManager, ParcelManager parcelManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
72 { 83 {
73 m_regionHandle = regionHandle; 84 m_regionHandle = regionHandle;
74 m_world = world; 85 m_world = world;
86 m_eventManager = eventManager;
87 m_parcelManager = parcelManager;
88
75 this.Pos = pos; 89 this.Pos = pos;
76 this.CreateRootFromShape(ownerID, localID, shape, pos); 90 this.CreateRootFromShape(ownerID, localID, shape, pos);
77 91
78 // Setup a backup event listener 92 registerEvents();
79 world.EventManager.OnBackup += new EventManager.OnBackupDelegate(ProcessBackup); 93
94 }
95
96 /// <summary>
97 ///
98 /// </summary>
99 /// <remarks>Need a null constructor for duplication</remarks>
100 public SceneObject()
101 {
102
80 } 103 }
81 104
105 public void registerEvents()
106 {
107 m_eventManager.OnBackup += new EventManager.OnBackupDelegate(ProcessBackup);
108 m_eventManager.OnParcelPrimCountUpdate += new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
109 }
110 public void unregisterEvents()
111 {
112 m_eventManager.OnBackup -= new EventManager.OnBackupDelegate(ProcessBackup);
113 m_eventManager.OnParcelPrimCountUpdate -= new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
114 }
82 /// <summary> 115 /// <summary>
83 /// Processes backup 116 /// Processes backup
84 /// </summary> 117 /// </summary>
85 /// <param name="datastore"></param> 118 /// <param name="datastore"></param>
86 void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore) 119 public void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore)
87 { 120 {
88 datastore.StoreObject(this); 121 datastore.StoreObject(this);
89 } 122 }
90 123
124
91 /// <summary> 125 /// <summary>
92 /// 126 /// Sends my primitive info to the parcel manager for it to keep tally of all of the prims!
93 /// </summary> 127 /// </summary>
94 /// <remarks>Need a null constructor for duplication</remarks> 128 private void ProcessParcelPrimCountUpdate()
95 public SceneObject()
96 { 129 {
97 130 m_parcelManager.addPrimToParcelCounts(this);
98 } 131 }
99 132
133
134
135
100 /// <summary> 136 /// <summary>
101 /// 137 ///
102 /// </summary> 138 /// </summary>
@@ -105,7 +141,7 @@ namespace OpenSim.Region.Environment.Scenes
105 /// <param name="localID"></param> 141 /// <param name="localID"></param>
106 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos) 142 public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
107 { 143 {
108 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos); 144 this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world,this.m_parcelManager, agentID, localID, true, this, this, shape, pos);
109 this.children.Add(rootPrimitive); 145 this.children.Add(rootPrimitive);
110 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); 146 this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
111 } 147 }
@@ -120,7 +156,7 @@ namespace OpenSim.Region.Environment.Scenes
120 } 156 }
121 157
122 /// <summary> 158 /// <summary>
123 /// 159 /// Copies a prim or group of prims (SceneObject) -- TODO: cleanup code
124 /// </summary> 160 /// </summary>
125 /// <returns>A complete copy of the object</returns> 161 /// <returns>A complete copy of the object</returns>
126 public new SceneObject Copy() 162 public new SceneObject Copy()
@@ -136,6 +172,8 @@ namespace OpenSim.Region.Environment.Scenes
136 dupe.Rotation = this.Rotation; 172 dupe.Rotation = this.Rotation;
137 LLUUID rootu= dupe.rootUUID; 173 LLUUID rootu= dupe.rootUUID;
138 uint rooti = dupe.rootLocalID; 174 uint rooti = dupe.rootLocalID;
175
176 dupe.registerEvents();
139 return dupe; 177 return dupe;
140 } 178 }
141 179
@@ -147,6 +185,7 @@ namespace OpenSim.Region.Environment.Scenes
147 this.children.Clear(); 185 this.children.Clear();
148 this.ChildPrimitives.Clear(); 186 this.ChildPrimitives.Clear();
149 this.rootPrimitive = null; 187 this.rootPrimitive = null;
188 unregisterEvents();
150 } 189 }
151 190
152 /// <summary> 191 /// <summary>
@@ -256,5 +295,6 @@ namespace OpenSim.Region.Environment.Scenes
256 295
257 client.OutPacket(proper); 296 client.OutPacket(proper);
258 } 297 }
298
259 } 299 }
260} 300}