aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
diff options
context:
space:
mode:
authorJohn Hurliman2010-09-16 17:30:46 -0700
committerJohn Hurliman2010-09-16 17:30:46 -0700
commit860b2a502f797e5822c6705d4639f370f3ac5861 (patch)
tree5a74ddbd626142e27f6c3439ea267b8ea348ce9c /OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
parentAdd the modules include line back that i dropped by mistake (diff)
downloadopensim-SC-860b2a502f797e5822c6705d4639f370f3ac5861.zip
opensim-SC-860b2a502f797e5822c6705d4639f370f3ac5861.tar.gz
opensim-SC-860b2a502f797e5822c6705d4639f370f3ac5861.tar.bz2
opensim-SC-860b2a502f797e5822c6705d4639f370f3ac5861.tar.xz
Changed SceneObjectGroup to store parts with the fast and thread-safe MapAndArray collection
Diffstat (limited to 'OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs')
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs169
1 files changed, 78 insertions, 91 deletions
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
index 49d20e1..0248f36 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
@@ -132,33 +132,30 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
132 // if group is not contained in scene's list 132 // if group is not contained in scene's list
133 if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID)) 133 if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID))
134 { 134 {
135 lock (m_UnchangedEntity.Children) 135 foreach (SceneObjectPart part in m_UnchangedEntity.Parts)
136 { 136 {
137 foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values) 137 // if scene list no longer contains this part, display translucent part and mark with red aura
138 if (!ContainsKey(sceneEntityList, part.UUID))
138 { 139 {
139 // if scene list no longer contains this part, display translucent part and mark with red aura 140 // if already displaying a red aura over part, make sure its red
140 if (!ContainsKey(sceneEntityList, part.UUID)) 141 if (m_AuraEntities.ContainsKey(part.UUID))
141 { 142 {
142 // if already displaying a red aura over part, make sure its red 143 m_AuraEntities[part.UUID].SetAura(new Vector3(254, 0, 0), part.Scale);
143 if (m_AuraEntities.ContainsKey(part.UUID)) 144 }
144 { 145 else
145 m_AuraEntities[part.UUID].SetAura(new Vector3(254,0,0), part.Scale); 146 {
146 } 147 AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
147 else 148 part.GetWorldPosition(),
148 { 149 MetaEntity.TRANSLUCENT,
149 AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, 150 new Vector3(254, 0, 0),
150 part.GetWorldPosition(), 151 part.Scale
151 MetaEntity.TRANSLUCENT, 152 );
152 new Vector3(254,0,0), 153 m_AuraEntities.Add(part.UUID, auraGroup);
153 part.Scale
154 );
155 m_AuraEntities.Add(part.UUID, auraGroup);
156 }
157 SceneObjectPart metaPart = m_Entity.GetLinkNumPart(part.LinkNum);
158 SetPartTransparency(metaPart, MetaEntity.TRANSLUCENT);
159 } 154 }
160 // otherwise, scene will not contain the part. note: a group can not remove a part without changing group id 155 SceneObjectPart metaPart = m_Entity.GetLinkNumPart(part.LinkNum);
156 SetPartTransparency(metaPart, MetaEntity.TRANSLUCENT);
161 } 157 }
158 // otherwise, scene will not contain the part. note: a group can not remove a part without changing group id
162 } 159 }
163 160
164 // a deleted part has no where to point a beam particle system, 161 // a deleted part has no where to point a beam particle system,
@@ -183,11 +180,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
183 /// </summary> 180 /// </summary>
184 public bool HasChildPrim(UUID uuid) 181 public bool HasChildPrim(UUID uuid)
185 { 182 {
186 lock (m_UnchangedEntity.Children) 183 return m_UnchangedEntity.ContainsPart(uuid);
187 if (m_UnchangedEntity.Children.ContainsKey(uuid))
188 return true;
189
190 return false;
191 } 184 }
192 185
193 /// <summary> 186 /// <summary>
@@ -195,12 +188,9 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
195 /// </summary> 188 /// </summary>
196 public bool HasChildPrim(uint localID) 189 public bool HasChildPrim(uint localID)
197 { 190 {
198 lock (m_UnchangedEntity.Children) 191 foreach (SceneObjectPart part in m_UnchangedEntity.Parts)
199 { 192 if (part.LocalId == localID)
200 foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values) 193 return true;
201 if (part.LocalId == localID)
202 return true;
203 }
204 194
205 return false; 195 return false;
206 } 196 }
@@ -237,72 +227,37 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
237 // Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user 227 // Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user
238 // had originally saved. 228 // had originally saved.
239 // m_Entity will NOT necessarily be the same entity as the user had saved. 229 // m_Entity will NOT necessarily be the same entity as the user had saved.
240 lock (m_UnchangedEntity.Children) 230 foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Parts)
241 { 231 {
242 foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Children.Values) 232 //This is the part that we use to show changes.
233 metaEntityPart = m_Entity.GetLinkNumPart(UnchangedPart.LinkNum);
234 if (sceneEntityGroup.ContainsPart(UnchangedPart.UUID))
243 { 235 {
244 //This is the part that we use to show changes. 236 sceneEntityPart = sceneEntityGroup.GetChildPart(UnchangedPart.UUID);
245 metaEntityPart = m_Entity.GetLinkNumPart(UnchangedPart.LinkNum); 237 differences = Difference.FindDifferences(UnchangedPart, sceneEntityPart);
246 if (sceneEntityGroup.Children.ContainsKey(UnchangedPart.UUID)) 238 if (differences != Diff.NONE)
239 metaEntityPart.Text = "CHANGE: " + differences.ToString();
240 if (differences != 0)
247 { 241 {
248 sceneEntityPart = sceneEntityGroup.Children[UnchangedPart.UUID]; 242 // Root Part that has been modified
249 differences = Difference.FindDifferences(UnchangedPart, sceneEntityPart); 243 if ((differences & Diff.POSITION) > 0)
250 if (differences != Diff.NONE)
251 metaEntityPart.Text = "CHANGE: " + differences.ToString();
252 if (differences != 0)
253 {
254 // Root Part that has been modified
255 if ((differences&Diff.POSITION) > 0)
256 {
257 // If the position of any part has changed, make sure the RootPart of the
258 // meta entity is pointing with a beam particle system
259 if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
260 {
261 m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
262 m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
263 }
264 BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene,
265 m_UnchangedEntity.RootPart.GetWorldPosition(),
266 MetaEntity.TRANSLUCENT,
267 sceneEntityPart,
268 new Vector3(0,0,254)
269 );
270 m_BeamEntities.Add(m_UnchangedEntity.RootPart.UUID, beamGroup);
271 }
272
273 if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
274 {
275 m_AuraEntities[UnchangedPart.UUID].HideFromAll();
276 m_AuraEntities.Remove(UnchangedPart.UUID);
277 }
278 AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
279 UnchangedPart.GetWorldPosition(),
280 MetaEntity.TRANSLUCENT,
281 new Vector3(0,0,254),
282 UnchangedPart.Scale
283 );
284 m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
285 SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);
286
287 DiffersFromSceneGroup = true;
288 }
289 else // no differences between scene part and meta part
290 { 244 {
245 // If the position of any part has changed, make sure the RootPart of the
246 // meta entity is pointing with a beam particle system
291 if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID)) 247 if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
292 { 248 {
293 m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll(); 249 m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
294 m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); 250 m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
295 } 251 }
296 if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) 252 BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene,
297 { 253 m_UnchangedEntity.RootPart.GetWorldPosition(),
298 m_AuraEntities[UnchangedPart.UUID].HideFromAll(); 254 MetaEntity.TRANSLUCENT,
299 m_AuraEntities.Remove(UnchangedPart.UUID); 255 sceneEntityPart,
300 } 256 new Vector3(0, 0, 254)
301 SetPartTransparency(metaEntityPart, MetaEntity.NONE); 257 );
258 m_BeamEntities.Add(m_UnchangedEntity.RootPart.UUID, beamGroup);
302 } 259 }
303 } 260
304 else //The entity currently in the scene is missing parts from the metaentity saved, so mark parts red as deleted.
305 {
306 if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) 261 if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
307 { 262 {
308 m_AuraEntities[UnchangedPart.UUID].HideFromAll(); 263 m_AuraEntities[UnchangedPart.UUID].HideFromAll();
@@ -311,14 +266,46 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
311 AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, 266 AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
312 UnchangedPart.GetWorldPosition(), 267 UnchangedPart.GetWorldPosition(),
313 MetaEntity.TRANSLUCENT, 268 MetaEntity.TRANSLUCENT,
314 new Vector3(254,0,0), 269 new Vector3(0, 0, 254),
315 UnchangedPart.Scale 270 UnchangedPart.Scale
316 ); 271 );
317 m_AuraEntities.Add(UnchangedPart.UUID, auraGroup); 272 m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
318 SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT); 273 SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);
319 274
320 DiffersFromSceneGroup = true; 275 DiffersFromSceneGroup = true;
321 } 276 }
277 else // no differences between scene part and meta part
278 {
279 if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
280 {
281 m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
282 m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
283 }
284 if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
285 {
286 m_AuraEntities[UnchangedPart.UUID].HideFromAll();
287 m_AuraEntities.Remove(UnchangedPart.UUID);
288 }
289 SetPartTransparency(metaEntityPart, MetaEntity.NONE);
290 }
291 }
292 else //The entity currently in the scene is missing parts from the metaentity saved, so mark parts red as deleted.
293 {
294 if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
295 {
296 m_AuraEntities[UnchangedPart.UUID].HideFromAll();
297 m_AuraEntities.Remove(UnchangedPart.UUID);
298 }
299 AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
300 UnchangedPart.GetWorldPosition(),
301 MetaEntity.TRANSLUCENT,
302 new Vector3(254, 0, 0),
303 UnchangedPart.Scale
304 );
305 m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
306 SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);
307
308 DiffersFromSceneGroup = true;
322 } 309 }
323 } 310 }
324 311