diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs | 173 |
1 files changed, 93 insertions, 80 deletions
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs index ada6701..2730eee 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -132,30 +132,33 @@ 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 | foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values) | 135 | lock (m_UnchangedEntity.Children) |
136 | { | 136 | { |
137 | // if scene list no longer contains this part, display translucent part and mark with red aura | 137 | foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values) |
138 | if (!ContainsKey(sceneEntityList, part.UUID)) | ||
139 | { | 138 | { |
140 | // if already displaying a red aura over part, make sure its red | 139 | // if scene list no longer contains this part, display translucent part and mark with red aura |
141 | if (m_AuraEntities.ContainsKey(part.UUID)) | 140 | if (!ContainsKey(sceneEntityList, part.UUID)) |
142 | { | ||
143 | m_AuraEntities[part.UUID].SetAura(new Vector3(254,0,0), part.Scale); | ||
144 | } | ||
145 | else | ||
146 | { | 141 | { |
147 | AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, | 142 | // if already displaying a red aura over part, make sure its red |
148 | part.GetWorldPosition(), | 143 | if (m_AuraEntities.ContainsKey(part.UUID)) |
149 | MetaEntity.TRANSLUCENT, | 144 | { |
150 | new Vector3(254,0,0), | 145 | m_AuraEntities[part.UUID].SetAura(new Vector3(254,0,0), part.Scale); |
151 | part.Scale | 146 | } |
152 | ); | 147 | else |
153 | m_AuraEntities.Add(part.UUID, auraGroup); | 148 | { |
149 | AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, | ||
150 | part.GetWorldPosition(), | ||
151 | MetaEntity.TRANSLUCENT, | ||
152 | new Vector3(254,0,0), | ||
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); | ||
154 | } | 159 | } |
155 | SceneObjectPart metaPart = m_Entity.GetLinkNumPart(part.LinkNum); | 160 | // otherwise, scene will not contain the part. note: a group can not remove a part without changing group id |
156 | SetPartTransparency(metaPart, MetaEntity.TRANSLUCENT); | ||
157 | } | 161 | } |
158 | // otherwise, scene will not contain the part. note: a group can not remove a part without changing group id | ||
159 | } | 162 | } |
160 | 163 | ||
161 | // a deleted part has no where to point a beam particle system, | 164 | // a deleted part has no where to point a beam particle system, |
@@ -180,8 +183,10 @@ namespace OpenSim.Region.OptionalModules.ContentManagement | |||
180 | /// </summary> | 183 | /// </summary> |
181 | public bool HasChildPrim(UUID uuid) | 184 | public bool HasChildPrim(UUID uuid) |
182 | { | 185 | { |
183 | if (m_UnchangedEntity.Children.ContainsKey(uuid)) | 186 | lock (m_UnchangedEntity.Children) |
184 | return true; | 187 | if (m_UnchangedEntity.Children.ContainsKey(uuid)) |
188 | return true; | ||
189 | |||
185 | return false; | 190 | return false; |
186 | } | 191 | } |
187 | 192 | ||
@@ -190,9 +195,13 @@ namespace OpenSim.Region.OptionalModules.ContentManagement | |||
190 | /// </summary> | 195 | /// </summary> |
191 | public bool HasChildPrim(uint localID) | 196 | public bool HasChildPrim(uint localID) |
192 | { | 197 | { |
193 | foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values) | 198 | lock (m_UnchangedEntity.Children) |
194 | if (part.LocalId == localID) | 199 | { |
195 | return true; | 200 | foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values) |
201 | if (part.LocalId == localID) | ||
202 | return true; | ||
203 | } | ||
204 | |||
196 | return false; | 205 | return false; |
197 | } | 206 | } |
198 | 207 | ||
@@ -228,37 +237,72 @@ namespace OpenSim.Region.OptionalModules.ContentManagement | |||
228 | // Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user | 237 | // Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user |
229 | // had originally saved. | 238 | // had originally saved. |
230 | // m_Entity will NOT necessarily be the same entity as the user had saved. | 239 | // m_Entity will NOT necessarily be the same entity as the user had saved. |
231 | foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Children.Values) | 240 | lock (m_UnchangedEntity.Children) |
232 | { | 241 | { |
233 | //This is the part that we use to show changes. | 242 | foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Children.Values) |
234 | metaEntityPart = m_Entity.GetLinkNumPart(UnchangedPart.LinkNum); | ||
235 | if (sceneEntityGroup.Children.ContainsKey(UnchangedPart.UUID)) | ||
236 | { | 243 | { |
237 | sceneEntityPart = sceneEntityGroup.Children[UnchangedPart.UUID]; | 244 | //This is the part that we use to show changes. |
238 | differences = Difference.FindDifferences(UnchangedPart, sceneEntityPart); | 245 | metaEntityPart = m_Entity.GetLinkNumPart(UnchangedPart.LinkNum); |
239 | if (differences != Diff.NONE) | 246 | if (sceneEntityGroup.Children.ContainsKey(UnchangedPart.UUID)) |
240 | metaEntityPart.Text = "CHANGE: " + differences.ToString(); | ||
241 | if (differences != 0) | ||
242 | { | 247 | { |
243 | // Root Part that has been modified | 248 | sceneEntityPart = sceneEntityGroup.Children[UnchangedPart.UUID]; |
244 | if ((differences&Diff.POSITION) > 0) | 249 | differences = Difference.FindDifferences(UnchangedPart, sceneEntityPart); |
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 | ||
245 | { | 290 | { |
246 | // If the position of any part has changed, make sure the RootPart of the | ||
247 | // meta entity is pointing with a beam particle system | ||
248 | if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID)) | 291 | if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID)) |
249 | { | 292 | { |
250 | m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll(); | 293 | m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll(); |
251 | m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); | 294 | m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); |
252 | } | 295 | } |
253 | BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene, | 296 | if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) |
254 | m_UnchangedEntity.RootPart.GetWorldPosition(), | 297 | { |
255 | MetaEntity.TRANSLUCENT, | 298 | m_AuraEntities[UnchangedPart.UUID].HideFromAll(); |
256 | sceneEntityPart, | 299 | m_AuraEntities.Remove(UnchangedPart.UUID); |
257 | new Vector3(0,0,254) | 300 | } |
258 | ); | 301 | SetPartTransparency(metaEntityPart, MetaEntity.NONE); |
259 | m_BeamEntities.Add(m_UnchangedEntity.RootPart.UUID, beamGroup); | ||
260 | } | 302 | } |
261 | 303 | } | |
304 | else //The entity currently in the scene is missing parts from the metaentity saved, so mark parts red as deleted. | ||
305 | { | ||
262 | if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) | 306 | if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) |
263 | { | 307 | { |
264 | m_AuraEntities[UnchangedPart.UUID].HideFromAll(); | 308 | m_AuraEntities[UnchangedPart.UUID].HideFromAll(); |
@@ -267,48 +311,17 @@ namespace OpenSim.Region.OptionalModules.ContentManagement | |||
267 | AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, | 311 | AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, |
268 | UnchangedPart.GetWorldPosition(), | 312 | UnchangedPart.GetWorldPosition(), |
269 | MetaEntity.TRANSLUCENT, | 313 | MetaEntity.TRANSLUCENT, |
270 | new Vector3(0,0,254), | 314 | new Vector3(254,0,0), |
271 | UnchangedPart.Scale | 315 | UnchangedPart.Scale |
272 | ); | 316 | ); |
273 | m_AuraEntities.Add(UnchangedPart.UUID, auraGroup); | 317 | m_AuraEntities.Add(UnchangedPart.UUID, auraGroup); |
274 | SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT); | 318 | SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT); |
275 | 319 | ||
276 | DiffersFromSceneGroup = true; | 320 | DiffersFromSceneGroup = true; |
277 | } | 321 | } |
278 | else // no differences between scene part and meta part | ||
279 | { | ||
280 | if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID)) | ||
281 | { | ||
282 | m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll(); | ||
283 | m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); | ||
284 | } | ||
285 | if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) | ||
286 | { | ||
287 | m_AuraEntities[UnchangedPart.UUID].HideFromAll(); | ||
288 | m_AuraEntities.Remove(UnchangedPart.UUID); | ||
289 | } | ||
290 | SetPartTransparency(metaEntityPart, MetaEntity.NONE); | ||
291 | } | ||
292 | } | ||
293 | else //The entity currently in the scene is missing parts from the metaentity saved, so mark parts red as deleted. | ||
294 | { | ||
295 | if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) | ||
296 | { | ||
297 | m_AuraEntities[UnchangedPart.UUID].HideFromAll(); | ||
298 | m_AuraEntities.Remove(UnchangedPart.UUID); | ||
299 | } | ||
300 | AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, | ||
301 | UnchangedPart.GetWorldPosition(), | ||
302 | MetaEntity.TRANSLUCENT, | ||
303 | new Vector3(254,0,0), | ||
304 | UnchangedPart.Scale | ||
305 | ); | ||
306 | m_AuraEntities.Add(UnchangedPart.UUID, auraGroup); | ||
307 | SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT); | ||
308 | |||
309 | DiffersFromSceneGroup = true; | ||
310 | } | 322 | } |
311 | } | 323 | } |
324 | |||
312 | return changed; | 325 | return changed; |
313 | } | 326 | } |
314 | 327 | ||