diff options
author | mingchen | 2007-07-14 15:11:36 +0000 |
---|---|---|
committer | mingchen | 2007-07-14 15:11:36 +0000 |
commit | 423d03eaefcae1bcaff8e4d16da014d350c91c42 (patch) | |
tree | 1caf9a940dc856be765b7b000d4360d954b6741a /OpenSim/Region/Environment/Scenes/SceneObject.cs | |
parent | Set up parcel manager and the master avatar in SimpleApp. (diff) | |
download | opensim-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/SceneObject.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObject.cs | 60 |
1 files changed, 50 insertions, 10 deletions
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 | } |