diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementEntity.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementEntity.cs | 650 |
1 files changed, 343 insertions, 307 deletions
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementEntity.cs index fb9df8f..bdf8560 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementEntity.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/ContentManagementEntity.cs | |||
@@ -1,326 +1,362 @@ | |||
1 | #region Header | ||
2 | |||
1 | // ContentManagementEntity.cs | 3 | // ContentManagementEntity.cs |
2 | // User: bongiojp | 4 | // User: bongiojp |
3 | // | 5 | // |
4 | // | 6 | // |
5 | 7 | ||
8 | #endregion Header | ||
9 | |||
6 | using System; | 10 | using System; |
7 | using System.Collections.Generic; | 11 | using System.Collections.Generic; |
8 | using System.Drawing; | 12 | using System.Drawing; |
13 | |||
9 | using libsecondlife; | 14 | using libsecondlife; |
15 | |||
10 | using Nini.Config; | 16 | using Nini.Config; |
17 | |||
11 | using OpenSim.Framework; | 18 | using OpenSim.Framework; |
12 | using OpenSim.Region.Environment.Interfaces; | 19 | using OpenSim.Region.Environment.Interfaces; |
13 | using OpenSim.Region.Environment.Scenes; | 20 | using OpenSim.Region.Environment.Scenes; |
14 | using log4net; | ||
15 | using OpenSim.Region.Physics.Manager; | 21 | using OpenSim.Region.Physics.Manager; |
22 | |||
23 | using log4net; | ||
24 | |||
16 | using Axiom.Math; | 25 | using Axiom.Math; |
17 | 26 | ||
18 | namespace OpenSim.Region.Environment.Modules.ContentManagement | 27 | namespace OpenSim.Region.Environment.Modules.ContentManagement |
19 | { | 28 | { |
20 | public class ContentManagementEntity : MetaEntity | 29 | public class ContentManagementEntity : MetaEntity |
21 | { | 30 | { |
22 | static float TimeToDiff = 0; | 31 | #region Static Fields |
23 | static float TimeToCreateEntities = 0; | 32 | |
24 | 33 | static float TimeToDiff = 0; | |
25 | // The LinkNum of parts in m_Entity and m_UnchangedEntity are the same though UUID and LocalId are different. | 34 | static float TimeToCreateEntities = 0; |
26 | // This can come in handy. | 35 | |
27 | protected SceneObjectGroup m_UnchangedEntity = null; | 36 | #endregion Static Fields |
28 | protected Dictionary<LLUUID, BeamMetaEntity> m_BeamEntities = new Dictionary<LLUUID, BeamMetaEntity>(); | 37 | |
29 | protected Dictionary<LLUUID, AuraMetaEntity> m_AuraEntities = new Dictionary<LLUUID, AuraMetaEntity>(); | 38 | #region Fields |
30 | 39 | ||
31 | /// <value> | 40 | protected Dictionary<LLUUID, AuraMetaEntity> m_AuraEntities = new Dictionary<LLUUID, AuraMetaEntity>(); |
32 | /// Should be set to true when there is a difference between m_UnchangedEntity and the corresponding scene object group in the scene entity list. | 41 | protected Dictionary<LLUUID, BeamMetaEntity> m_BeamEntities = new Dictionary<LLUUID, BeamMetaEntity>(); |
33 | /// </value> | 42 | |
34 | bool DiffersFromSceneGroup = false; | 43 | // The LinkNum of parts in m_Entity and m_UnchangedEntity are the same though UUID and LocalId are different. |
35 | 44 | // This can come in handy. | |
36 | public SceneObjectGroup UnchangedEntity | 45 | protected SceneObjectGroup m_UnchangedEntity = null; |
37 | { | 46 | |
38 | get { return m_UnchangedEntity; } | 47 | /// <value> |
39 | } | 48 | /// Should be set to true when there is a difference between m_UnchangedEntity and the corresponding scene object group in the scene entity list. |
40 | 49 | /// </value> | |
41 | public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics) : base(Unchanged, false) | 50 | bool DiffersFromSceneGroup = false; |
42 | { | 51 | |
43 | m_UnchangedEntity = Unchanged.Copy(Unchanged.RootPart.OwnerID, Unchanged.RootPart.GroupID, false); | 52 | #endregion Fields |
44 | } | 53 | |
45 | 54 | #region Constructors | |
46 | public ContentManagementEntity(string objectXML, Scene scene, bool physics) : base(objectXML, scene, false) | 55 | |
47 | { | 56 | public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics) |
48 | m_UnchangedEntity = new SceneObjectGroup(objectXML); | 57 | : base(Unchanged, false) |
49 | } | 58 | { |
50 | 59 | m_UnchangedEntity = Unchanged.Copy(Unchanged.RootPart.OwnerID, Unchanged.RootPart.GroupID, false); | |
51 | public override void Hide(IClientAPI client) | 60 | } |
52 | { | 61 | |
53 | base.Hide(client); | 62 | public ContentManagementEntity(string objectXML, Scene scene, bool physics) |
54 | foreach(MetaEntity group in m_AuraEntities.Values) | 63 | : base(objectXML, scene, false) |
55 | group.Hide(client); | 64 | { |
56 | foreach(MetaEntity group in m_BeamEntities.Values) | 65 | m_UnchangedEntity = new SceneObjectGroup(objectXML); |
57 | group.Hide(client); | 66 | } |
58 | } | 67 | |
59 | 68 | #endregion Constructors | |
60 | public override void HideFromAll() | 69 | |
61 | { | 70 | #region Public Properties |
62 | base.HideFromAll(); | 71 | |
63 | foreach(MetaEntity group in m_AuraEntities.Values) | 72 | public SceneObjectGroup UnchangedEntity |
64 | group.HideFromAll(); | 73 | { |
65 | foreach(MetaEntity group in m_BeamEntities.Values) | 74 | get { return m_UnchangedEntity; } |
66 | group.HideFromAll(); | 75 | } |
67 | } | 76 | |
68 | 77 | #endregion Public Properties | |
69 | public void SendFullDiffUpdateToAll() | 78 | |
70 | { | 79 | #region Private Methods |
71 | FindDifferences(); | 80 | |
72 | if (DiffersFromSceneGroup) | 81 | /// <summary> |
73 | { | 82 | /// Check if an entitybase list (like that returned by scene.GetEntities() ) contains a group with the rootpart uuid that matches the current uuid. |
74 | SendFullUpdateToAll(); | 83 | /// </summary> |
75 | SendFullAuraUpdateToAll(); | 84 | private bool ContainsKey(List<EntityBase> list, LLUUID uuid) |
76 | SendFullBeamUpdateToAll(); | 85 | { |
77 | } | 86 | foreach( EntityBase part in list) |
78 | } | 87 | if (part.UUID == uuid) |
79 | 88 | return true; | |
80 | public void SendFullDiffUpdate(IClientAPI client) | 89 | return false; |
81 | { | 90 | } |
82 | FindDifferences(); | 91 | |
83 | if (DiffersFromSceneGroup) | 92 | private SceneObjectGroup GetGroupByUUID(System.Collections.Generic.List<EntityBase> list, LLUUID uuid) |
84 | { | 93 | { |
85 | SendFullUpdate(client); | 94 | foreach (EntityBase ent in list) |
86 | SendFullAuraUpdate(client); | 95 | { |
87 | SendFullBeamUpdate(client); | 96 | if (ent is SceneObjectGroup) |
88 | } | 97 | if (ent.UUID == uuid) |
89 | } | 98 | return (SceneObjectGroup)ent; |
90 | 99 | } | |
91 | public void SendFullBeamUpdate(IClientAPI client) | 100 | return null; |
92 | { | 101 | } |
93 | if (DiffersFromSceneGroup) | 102 | |
94 | { | 103 | #endregion Private Methods |
95 | foreach(BeamMetaEntity group in m_BeamEntities.Values) | 104 | |
96 | group.SendFullUpdate(client); | 105 | #region Public Methods |
97 | } | 106 | |
98 | } | 107 | /// <summary> |
99 | 108 | /// Search for a corresponding group UUID in the scene. If not found, then the revisioned group this CMEntity represents has been deleted. Mark the metaentity appropriately. | |
100 | public void SendFullAuraUpdate(IClientAPI client) | 109 | /// If a matching UUID is found in a scene object group, compare the two for differences. If differences exist, Mark the metaentity appropriately. |
101 | { | 110 | /// </summary> |
102 | if (DiffersFromSceneGroup) | 111 | public void FindDifferences() |
103 | { | 112 | { |
104 | foreach(AuraMetaEntity group in m_AuraEntities.Values) | 113 | System.Collections.Generic.List<EntityBase> sceneEntityList = m_Entity.Scene.GetEntities(); |
105 | group.SendFullUpdate(client); | 114 | DiffersFromSceneGroup = false; |
106 | } | 115 | // if group is not contained in scene's list |
107 | } | 116 | if(!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID)) |
108 | 117 | { | |
109 | public void SendFullBeamUpdateToAll() | 118 | foreach(SceneObjectPart part in m_UnchangedEntity.Children.Values) |
110 | { | 119 | { |
111 | if (DiffersFromSceneGroup) | 120 | // if scene list no longer contains this part, display translucent part and mark with red aura |
112 | { | 121 | if(! ContainsKey(sceneEntityList, part.UUID)) |
113 | foreach(BeamMetaEntity group in m_BeamEntities.Values) | 122 | { |
114 | group.SendFullUpdateToAll(); | 123 | // if already displaying a red aura over part, make sure its red |
115 | } | 124 | if (m_AuraEntities.ContainsKey(part.UUID)) |
116 | } | 125 | { |
117 | 126 | m_AuraEntities[part.UUID].SetAura(new LLVector3(254,0,0), part.Scale); | |
118 | public void SendFullAuraUpdateToAll() | 127 | } |
119 | { | 128 | else |
120 | if (DiffersFromSceneGroup) | 129 | { |
121 | { | 130 | AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, |
122 | foreach(AuraMetaEntity group in m_AuraEntities.Values) | 131 | m_Entity.Scene.PrimIDAllocate(), |
123 | group.SendFullUpdateToAll(); | 132 | part.GetWorldPosition(), |
124 | } | 133 | MetaEntity.TRANSLUCENT, |
125 | } | 134 | new LLVector3(254,0,0), |
126 | 135 | part.Scale | |
127 | /// <summary> | 136 | ); |
128 | /// Search for a corresponding group UUID in the scene. If not found, then the revisioned group this CMEntity represents has been deleted. Mark the metaentity appropriately. | 137 | m_AuraEntities.Add(part.UUID, auraGroup); |
129 | /// If a matching UUID is found in a scene object group, compare the two for differences. If differences exist, Mark the metaentity appropriately. | 138 | } |
130 | /// </summary> | 139 | SceneObjectPart metaPart = m_Entity.GetLinkNumPart(part.LinkNum); |
131 | public void FindDifferences() | 140 | SetPartTransparency(metaPart, MetaEntity.TRANSLUCENT); |
132 | { | 141 | } |
133 | System.Collections.Generic.List<EntityBase> sceneEntityList = m_Entity.Scene.GetEntities(); | 142 | // otherwise, scene will not contain the part. note: a group can not remove a part without changing group id |
134 | DiffersFromSceneGroup = false; | 143 | } |
135 | // if group is not contained in scene's list | 144 | |
136 | if(!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID)) | 145 | // a deleted part has no where to point a beam particle system, |
137 | { | 146 | // if a metapart had a particle system (maybe it represented a moved part) remove it |
138 | foreach(SceneObjectPart part in m_UnchangedEntity.Children.Values) | 147 | if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID)) |
139 | { | 148 | { |
140 | // if scene list no longer contains this part, display translucent part and mark with red aura | 149 | m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll(); |
141 | if(! ContainsKey(sceneEntityList, part.UUID)) | 150 | m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); |
142 | { | 151 | } |
143 | // if already displaying a red aura over part, make sure its red | 152 | |
144 | if (m_AuraEntities.ContainsKey(part.UUID)) | 153 | DiffersFromSceneGroup = true; |
145 | { | 154 | } |
146 | m_AuraEntities[part.UUID].SetAura(new LLVector3(254,0,0), part.Scale); | 155 | // if scene list does contain group, compare each part in group for differences and display beams and auras appropriately |
147 | } | 156 | else |
148 | else | 157 | { |
149 | { | 158 | MarkWithDifferences((SceneObjectGroup)GetGroupByUUID(sceneEntityList, m_UnchangedEntity.UUID)); |
150 | AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, | 159 | } |
151 | m_Entity.Scene.PrimIDAllocate(), | 160 | } |
152 | part.GetWorldPosition(), | 161 | |
153 | MetaEntity.TRANSLUCENT, | 162 | /// <summary> |
154 | new LLVector3(254,0,0), | 163 | /// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given UUID. |
155 | part.Scale | 164 | /// </summary> |
156 | ); | 165 | public bool HasChildPrim(LLUUID uuid) |
157 | m_AuraEntities.Add(part.UUID, auraGroup); | 166 | { |
158 | } | 167 | if (m_UnchangedEntity.Children.ContainsKey(uuid)) |
159 | SceneObjectPart metaPart = m_Entity.GetLinkNumPart(part.LinkNum); | 168 | return true; |
160 | SetPartTransparency(metaPart, MetaEntity.TRANSLUCENT); | 169 | return false; |
161 | } | 170 | } |
162 | // otherwise, scene will not contain the part. note: a group can not remove a part without changing group id | 171 | |
163 | } | 172 | /// <summary> |
164 | 173 | /// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given LocalId. | |
165 | // a deleted part has no where to point a beam particle system, | 174 | /// </summary> |
166 | // if a metapart had a particle system (maybe it represented a moved part) remove it | 175 | public bool HasChildPrim(uint localID) |
167 | if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID)) | 176 | { |
168 | { | 177 | foreach( SceneObjectPart part in m_UnchangedEntity.Children.Values) |
169 | m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll(); | 178 | if ( part.LocalId == localID ) |
170 | m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); | 179 | return true; |
171 | } | 180 | return false; |
172 | 181 | } | |
173 | DiffersFromSceneGroup = true; | 182 | |
174 | } | 183 | public override void Hide(IClientAPI client) |
175 | // if scene list does contain group, compare each part in group for differences and display beams and auras appropriately | 184 | { |
176 | else | 185 | base.Hide(client); |
177 | { | 186 | foreach(MetaEntity group in m_AuraEntities.Values) |
178 | MarkWithDifferences((SceneObjectGroup)GetGroupByUUID(sceneEntityList, m_UnchangedEntity.UUID)); | 187 | group.Hide(client); |
179 | } | 188 | foreach(MetaEntity group in m_BeamEntities.Values) |
180 | } | 189 | group.Hide(client); |
181 | 190 | } | |
182 | /// <summary> | 191 | |
183 | /// Returns true if there was a change between meta entity and the entity group, false otherwise. | 192 | public override void HideFromAll() |
184 | /// If true is returned, it is assumed the metaentity's appearance has changed to reflect the difference (though clients haven't been updated). | 193 | { |
185 | /// </summary> | 194 | base.HideFromAll(); |
186 | public bool MarkWithDifferences(SceneObjectGroup sceneEntityGroup) | 195 | foreach(MetaEntity group in m_AuraEntities.Values) |
187 | { | 196 | group.HideFromAll(); |
188 | SceneObjectPart sceneEntityPart; | 197 | foreach(MetaEntity group in m_BeamEntities.Values) |
189 | SceneObjectPart metaEntityPart; | 198 | group.HideFromAll(); |
190 | Diff differences; | 199 | } |
191 | bool changed = false; | 200 | |
192 | 201 | /// <summary> | |
193 | // Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user | 202 | /// Returns true if there was a change between meta entity and the entity group, false otherwise. |
194 | // had originally saved. | 203 | /// If true is returned, it is assumed the metaentity's appearance has changed to reflect the difference (though clients haven't been updated). |
195 | // m_Entity will NOT necessarily be the same entity as the user had saved. | 204 | /// </summary> |
196 | foreach(SceneObjectPart UnchangedPart in m_UnchangedEntity.Children.Values) | 205 | public bool MarkWithDifferences(SceneObjectGroup sceneEntityGroup) |
197 | { | ||
198 | //This is the part that we use to show changes. | ||
199 | metaEntityPart = m_Entity.GetLinkNumPart(UnchangedPart.LinkNum); | ||
200 | if (sceneEntityGroup.Children.ContainsKey(UnchangedPart.UUID)) | ||
201 | { | ||
202 | sceneEntityPart = sceneEntityGroup.Children[UnchangedPart.UUID]; | ||
203 | differences = Difference.FindDifferences(UnchangedPart, sceneEntityPart); | ||
204 | if (differences != Diff.NONE) | ||
205 | metaEntityPart.Text = "CHANGE: " + differences.ToString(); | ||
206 | if (differences != 0) | ||
207 | { | ||
208 | // Root Part that has been modified | ||
209 | if ((differences&Diff.POSITION) > 0) | ||
210 | { | ||
211 | // If the position of any part has changed, make sure the RootPart of the | ||
212 | // meta entity is pointing with a beam particle system | ||
213 | if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID)) | ||
214 | { | ||
215 | m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll(); | ||
216 | m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); | ||
217 | } | ||
218 | BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene, | ||
219 | m_Entity.Scene.PrimIDAllocate(), | ||
220 | m_UnchangedEntity.RootPart.GetWorldPosition(), | ||
221 | MetaEntity.TRANSLUCENT, | ||
222 | sceneEntityPart, | ||
223 | new LLVector3(0,0,254) | ||
224 | ); | ||
225 | m_BeamEntities.Add(m_UnchangedEntity.RootPart.UUID, beamGroup); | ||
226 | } | ||
227 | |||
228 | if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) | ||
229 | { | ||
230 | m_AuraEntities[UnchangedPart.UUID].HideFromAll(); | ||
231 | m_AuraEntities.Remove(UnchangedPart.UUID); | ||
232 | } | ||
233 | AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, | ||
234 | m_Entity.Scene.PrimIDAllocate(), | ||
235 | UnchangedPart.GetWorldPosition(), | ||
236 | MetaEntity.TRANSLUCENT, | ||
237 | new LLVector3(0,0,254), | ||
238 | UnchangedPart.Scale | ||
239 | ); | ||
240 | m_AuraEntities.Add(UnchangedPart.UUID, auraGroup); | ||
241 | SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT); | ||
242 | |||
243 | DiffersFromSceneGroup = true; | ||
244 | } | ||
245 | else // no differences between scene part and meta part | ||
246 | { | ||
247 | if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID)) | ||
248 | { | ||
249 | m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll(); | ||
250 | m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); | ||
251 | } | ||
252 | if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) | ||
253 | { | ||
254 | m_AuraEntities[UnchangedPart.UUID].HideFromAll(); | ||
255 | m_AuraEntities.Remove(UnchangedPart.UUID); | ||
256 | } | ||
257 | SetPartTransparency(metaEntityPart, MetaEntity.NONE); | ||
258 | } | ||
259 | } | ||
260 | else //The entity currently in the scene is missing parts from the metaentity saved, so mark parts red as deleted. | ||
261 | { | ||
262 | if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) | ||
263 | { | ||
264 | m_AuraEntities[UnchangedPart.UUID].HideFromAll(); | ||
265 | m_AuraEntities.Remove(UnchangedPart.UUID); | ||
266 | } | ||
267 | AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, | ||
268 | m_Entity.Scene.PrimIDAllocate(), | ||
269 | UnchangedPart.GetWorldPosition(), | ||
270 | MetaEntity.TRANSLUCENT, | ||
271 | new LLVector3(254,0,0), | ||
272 | UnchangedPart.Scale | ||
273 | ); | ||
274 | m_AuraEntities.Add(UnchangedPart.UUID, auraGroup); | ||
275 | SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT); | ||
276 | |||
277 | DiffersFromSceneGroup = true; | ||
278 | } | ||
279 | } | ||
280 | return changed; | ||
281 | } | ||
282 | |||
283 | private SceneObjectGroup GetGroupByUUID(System.Collections.Generic.List<EntityBase> list, LLUUID uuid) | ||
284 | { | 206 | { |
285 | foreach (EntityBase ent in list) | 207 | SceneObjectPart sceneEntityPart; |
286 | { | 208 | SceneObjectPart metaEntityPart; |
287 | if (ent is SceneObjectGroup) | 209 | Diff differences; |
288 | if (ent.UUID == uuid) | 210 | bool changed = false; |
289 | return (SceneObjectGroup)ent; | 211 | |
290 | } | 212 | // Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user |
291 | return null; | 213 | // had originally saved. |
292 | } | 214 | // m_Entity will NOT necessarily be the same entity as the user had saved. |
293 | 215 | foreach(SceneObjectPart UnchangedPart in m_UnchangedEntity.Children.Values) | |
294 | /// <summary> | 216 | { |
295 | /// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given UUID. | 217 | //This is the part that we use to show changes. |
296 | /// </summary> | 218 | metaEntityPart = m_Entity.GetLinkNumPart(UnchangedPart.LinkNum); |
297 | public bool HasChildPrim(LLUUID uuid) | 219 | if (sceneEntityGroup.Children.ContainsKey(UnchangedPart.UUID)) |
298 | { | 220 | { |
299 | if (m_UnchangedEntity.Children.ContainsKey(uuid)) | 221 | sceneEntityPart = sceneEntityGroup.Children[UnchangedPart.UUID]; |
300 | return true; | 222 | differences = Difference.FindDifferences(UnchangedPart, sceneEntityPart); |
301 | return false; | 223 | if (differences != Diff.NONE) |
302 | } | 224 | metaEntityPart.Text = "CHANGE: " + differences.ToString(); |
303 | 225 | if (differences != 0) | |
304 | /// <summary> | 226 | { |
305 | /// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given LocalId. | 227 | // Root Part that has been modified |
306 | /// </summary> | 228 | if ((differences&Diff.POSITION) > 0) |
307 | public bool HasChildPrim(uint localID) | 229 | { |
308 | { | 230 | // If the position of any part has changed, make sure the RootPart of the |
309 | foreach( SceneObjectPart part in m_UnchangedEntity.Children.Values) | 231 | // meta entity is pointing with a beam particle system |
310 | if ( part.LocalId == localID ) | 232 | if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID)) |
311 | return true; | 233 | { |
312 | return false; | 234 | m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll(); |
313 | } | 235 | m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); |
314 | 236 | } | |
315 | /// <summary> | 237 | BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene, |
316 | /// Check if an entitybase list (like that returned by scene.GetEntities() ) contains a group with the rootpart uuid that matches the current uuid. | 238 | m_Entity.Scene.PrimIDAllocate(), |
317 | /// </summary> | 239 | m_UnchangedEntity.RootPart.GetWorldPosition(), |
318 | private bool ContainsKey(List<EntityBase> list, LLUUID uuid) | 240 | MetaEntity.TRANSLUCENT, |
319 | { | 241 | sceneEntityPart, |
320 | foreach( EntityBase part in list) | 242 | new LLVector3(0,0,254) |
321 | if (part.UUID == uuid) | 243 | ); |
322 | return true; | 244 | m_BeamEntities.Add(m_UnchangedEntity.RootPart.UUID, beamGroup); |
323 | return false; | 245 | } |
324 | } | 246 | |
325 | } | 247 | if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) |
326 | } | 248 | { |
249 | m_AuraEntities[UnchangedPart.UUID].HideFromAll(); | ||
250 | m_AuraEntities.Remove(UnchangedPart.UUID); | ||
251 | } | ||
252 | AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, | ||
253 | m_Entity.Scene.PrimIDAllocate(), | ||
254 | UnchangedPart.GetWorldPosition(), | ||
255 | MetaEntity.TRANSLUCENT, | ||
256 | new LLVector3(0,0,254), | ||
257 | UnchangedPart.Scale | ||
258 | ); | ||
259 | m_AuraEntities.Add(UnchangedPart.UUID, auraGroup); | ||
260 | SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT); | ||
261 | |||
262 | DiffersFromSceneGroup = true; | ||
263 | } | ||
264 | else // no differences between scene part and meta part | ||
265 | { | ||
266 | if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID)) | ||
267 | { | ||
268 | m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll(); | ||
269 | m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID); | ||
270 | } | ||
271 | if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) | ||
272 | { | ||
273 | m_AuraEntities[UnchangedPart.UUID].HideFromAll(); | ||
274 | m_AuraEntities.Remove(UnchangedPart.UUID); | ||
275 | } | ||
276 | SetPartTransparency(metaEntityPart, MetaEntity.NONE); | ||
277 | } | ||
278 | } | ||
279 | else //The entity currently in the scene is missing parts from the metaentity saved, so mark parts red as deleted. | ||
280 | { | ||
281 | if (m_AuraEntities.ContainsKey(UnchangedPart.UUID)) | ||
282 | { | ||
283 | m_AuraEntities[UnchangedPart.UUID].HideFromAll(); | ||
284 | m_AuraEntities.Remove(UnchangedPart.UUID); | ||
285 | } | ||
286 | AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene, | ||
287 | m_Entity.Scene.PrimIDAllocate(), | ||
288 | UnchangedPart.GetWorldPosition(), | ||
289 | MetaEntity.TRANSLUCENT, | ||
290 | new LLVector3(254,0,0), | ||
291 | UnchangedPart.Scale | ||
292 | ); | ||
293 | m_AuraEntities.Add(UnchangedPart.UUID, auraGroup); | ||
294 | SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT); | ||
295 | |||
296 | DiffersFromSceneGroup = true; | ||
297 | } | ||
298 | } | ||
299 | return changed; | ||
300 | } | ||
301 | |||
302 | public void SendFullAuraUpdate(IClientAPI client) | ||
303 | { | ||
304 | if (DiffersFromSceneGroup) | ||
305 | { | ||
306 | foreach(AuraMetaEntity group in m_AuraEntities.Values) | ||
307 | group.SendFullUpdate(client); | ||
308 | } | ||
309 | } | ||
310 | |||
311 | public void SendFullAuraUpdateToAll() | ||
312 | { | ||
313 | if (DiffersFromSceneGroup) | ||
314 | { | ||
315 | foreach(AuraMetaEntity group in m_AuraEntities.Values) | ||
316 | group.SendFullUpdateToAll(); | ||
317 | } | ||
318 | } | ||
319 | |||
320 | public void SendFullBeamUpdate(IClientAPI client) | ||
321 | { | ||
322 | if (DiffersFromSceneGroup) | ||
323 | { | ||
324 | foreach(BeamMetaEntity group in m_BeamEntities.Values) | ||
325 | group.SendFullUpdate(client); | ||
326 | } | ||
327 | } | ||
328 | |||
329 | public void SendFullBeamUpdateToAll() | ||
330 | { | ||
331 | if (DiffersFromSceneGroup) | ||
332 | { | ||
333 | foreach(BeamMetaEntity group in m_BeamEntities.Values) | ||
334 | group.SendFullUpdateToAll(); | ||
335 | } | ||
336 | } | ||
337 | |||
338 | public void SendFullDiffUpdate(IClientAPI client) | ||
339 | { | ||
340 | FindDifferences(); | ||
341 | if (DiffersFromSceneGroup) | ||
342 | { | ||
343 | SendFullUpdate(client); | ||
344 | SendFullAuraUpdate(client); | ||
345 | SendFullBeamUpdate(client); | ||
346 | } | ||
347 | } | ||
348 | |||
349 | public void SendFullDiffUpdateToAll() | ||
350 | { | ||
351 | FindDifferences(); | ||
352 | if (DiffersFromSceneGroup) | ||
353 | { | ||
354 | SendFullUpdateToAll(); | ||
355 | SendFullAuraUpdateToAll(); | ||
356 | SendFullBeamUpdateToAll(); | ||
357 | } | ||
358 | } | ||
359 | |||
360 | #endregion Public Methods | ||
361 | } | ||
362 | } \ No newline at end of file | ||