diff options
author | Jeff Ames | 2008-09-09 01:26:48 +0000 |
---|---|---|
committer | Jeff Ames | 2008-09-09 01:26:48 +0000 |
commit | fae34bb10cfa10702faf5c19d8c8517faa018cb5 (patch) | |
tree | 2001f24703b010957254dbb49ef5e222ff30b84d /OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs | |
parent | Fix state xxx within state xxx itself triggering a state "change" to (diff) | |
download | opensim-SC-fae34bb10cfa10702faf5c19d8c8517faa018cb5.zip opensim-SC-fae34bb10cfa10702faf5c19d8c8517faa018cb5.tar.gz opensim-SC-fae34bb10cfa10702faf5c19d8c8517faa018cb5.tar.bz2 opensim-SC-fae34bb10cfa10702faf5c19d8c8517faa018cb5.tar.xz |
Update svn properties, formatting cleanup.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs | 394 |
1 files changed, 197 insertions, 197 deletions
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs index 072de5e..cdd4f4e 100644 --- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs +++ b/OpenSim/Region/Environment/Modules/ContentManagementSystem/CMController.cs | |||
@@ -82,7 +82,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
82 | CMModel m_model = null; | 82 | CMModel m_model = null; |
83 | 83 | ||
84 | /// <value> | 84 | /// <value> |
85 | /// A list of all the scenes that should be revisioned. Controller is the only class that keeps track of all scenes in the region. | 85 | /// A list of all the scenes that should be revisioned. Controller is the only class that keeps track of all scenes in the region. |
86 | /// </value> | 86 | /// </value> |
87 | Hashtable m_sceneList = Hashtable.Synchronized(new Hashtable()); | 87 | Hashtable m_sceneList = Hashtable.Synchronized(new Hashtable()); |
88 | State m_state = State.NONE; | 88 | State m_state = State.NONE; |
@@ -129,31 +129,31 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
129 | /// </summary> | 129 | /// </summary> |
130 | private SceneObjectGroup GetGroupByPrim(uint localID) | 130 | private SceneObjectGroup GetGroupByPrim(uint localID) |
131 | { | 131 | { |
132 | foreach(Object currScene in m_sceneList.Values) | 132 | foreach (Object currScene in m_sceneList.Values) |
133 | { | 133 | { |
134 | foreach (EntityBase ent in ((Scene)currScene).GetEntities()) | 134 | foreach (EntityBase ent in ((Scene)currScene).GetEntities()) |
135 | { | 135 | { |
136 | if (ent is SceneObjectGroup) | 136 | if (ent is SceneObjectGroup) |
137 | { | 137 | { |
138 | if (((SceneObjectGroup)ent).HasChildPrim(localID)) | 138 | if (((SceneObjectGroup)ent).HasChildPrim(localID)) |
139 | return (SceneObjectGroup)ent; | 139 | return (SceneObjectGroup)ent; |
140 | } | 140 | } |
141 | } | 141 | } |
142 | } | 142 | } |
143 | return null; | 143 | return null; |
144 | } | 144 | } |
145 | 145 | ||
146 | private void Initialize(CMModel model, CMView view, Scene scene, int channel) | 146 | private void Initialize(CMModel model, CMView view, Scene scene, int channel) |
147 | { | 147 | { |
148 | lock(this) | 148 | lock (this) |
149 | { | 149 | { |
150 | m_estateModule = scene.RequestModuleInterface<IEstateModule>(); | 150 | m_estateModule = scene.RequestModuleInterface<IEstateModule>(); |
151 | m_thread = new Thread( MainLoop ); | 151 | m_thread = new Thread(MainLoop); |
152 | m_thread.Name = "Content Management"; | 152 | m_thread.Name = "Content Management"; |
153 | m_thread.IsBackground = true; | 153 | m_thread.IsBackground = true; |
154 | m_thread.Start(); | 154 | m_thread.Start(); |
155 | ThreadTracker.Add(m_thread); | 155 | ThreadTracker.Add(m_thread); |
156 | m_state = State.NONE; | 156 | m_state = State.NONE; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
@@ -164,41 +164,41 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
164 | { | 164 | { |
165 | CMModel model = m_model; CMView view = m_view; int channel = m_channel; | 165 | CMModel model = m_model; CMView view = m_view; int channel = m_channel; |
166 | Work currentJob = new Work(); | 166 | Work currentJob = new Work(); |
167 | while(true) | 167 | while (true) |
168 | { | 168 | { |
169 | currentJob = m_WorkQueue.Dequeue(); | 169 | currentJob = m_WorkQueue.Dequeue(); |
170 | m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- DeQueued a request"); | 170 | m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- DeQueued a request"); |
171 | m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- Work type: " + currentJob.Type); | 171 | m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- Work type: " + currentJob.Type); |
172 | switch(currentJob.Type) | 172 | switch (currentJob.Type) |
173 | { | 173 | { |
174 | case WorkType.NONE: | 174 | case WorkType.NONE: |
175 | break; | 175 | break; |
176 | case WorkType.OBJECTATTRIBUTECHANGE: | 176 | case WorkType.OBJECTATTRIBUTECHANGE: |
177 | ObjectAttributeChanged(model, view, currentJob.LocalId); | 177 | ObjectAttributeChanged(model, view, currentJob.LocalId); |
178 | break; | 178 | break; |
179 | case WorkType.PRIMITIVEADDED: | 179 | case WorkType.PRIMITIVEADDED: |
180 | PrimitiveAdded(model, view, currentJob); | 180 | PrimitiveAdded(model, view, currentJob); |
181 | break; | 181 | break; |
182 | case WorkType.OBJECTDUPLICATED: | 182 | case WorkType.OBJECTDUPLICATED: |
183 | ObjectDuplicated(model, view, currentJob.LocalId); | 183 | ObjectDuplicated(model, view, currentJob.LocalId); |
184 | break; | 184 | break; |
185 | case WorkType.OBJECTKILLED: | 185 | case WorkType.OBJECTKILLED: |
186 | ObjectKilled(model, view, (SceneObjectGroup) currentJob.Data1); | 186 | ObjectKilled(model, view, (SceneObjectGroup) currentJob.Data1); |
187 | break; | 187 | break; |
188 | case WorkType.UNDODID: | 188 | case WorkType.UNDODID: |
189 | UndoDid(model, view, currentJob.UUID); | 189 | UndoDid(model, view, currentJob.UUID); |
190 | break; | 190 | break; |
191 | case WorkType.NEWCLIENT: | 191 | case WorkType.NEWCLIENT: |
192 | NewClient(view, (IClientAPI) currentJob.Data1); | 192 | NewClient(view, (IClientAPI) currentJob.Data1); |
193 | break; | 193 | break; |
194 | case WorkType.SIMCHAT: | 194 | case WorkType.SIMCHAT: |
195 | m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- Message received: " + ((OSChatMessage) currentJob.Data1).Message); | 195 | m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- Message received: " + ((OSChatMessage) currentJob.Data1).Message); |
196 | SimChat(model, view, (OSChatMessage) currentJob.Data1, channel); | 196 | SimChat(model, view, (OSChatMessage) currentJob.Data1, channel); |
197 | break; | 197 | break; |
198 | default: | 198 | default: |
199 | m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- uuuuuuuuuh, what?"); | 199 | m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- uuuuuuuuuh, what?"); |
200 | break; | 200 | break; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
@@ -207,24 +207,24 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
207 | /// </summary> | 207 | /// </summary> |
208 | private void NewClient(CMView view, IClientAPI client) | 208 | private void NewClient(CMView view, IClientAPI client) |
209 | { | 209 | { |
210 | if ((m_state & State.SHOWING_CHANGES) > 0) | 210 | if ((m_state & State.SHOWING_CHANGES) > 0) |
211 | view.SendMetaEntitiesToNewClient(client); | 211 | view.SendMetaEntitiesToNewClient(client); |
212 | } | 212 | } |
213 | 213 | ||
214 | /// <summary> | 214 | /// <summary> |
215 | /// Only called by the MainLoop. | 215 | /// Only called by the MainLoop. |
216 | /// </summary> | 216 | /// </summary> |
217 | private void ObjectAttributeChanged(CMModel model, CMView view, uint LocalId) | 217 | private void ObjectAttributeChanged(CMModel model, CMView view, uint LocalId) |
218 | { | 218 | { |
219 | SceneObjectGroup group = null; | 219 | SceneObjectGroup group = null; |
220 | if ((m_state & State.SHOWING_CHANGES) > 0) | 220 | if ((m_state & State.SHOWING_CHANGES) > 0) |
221 | { | 221 | { |
222 | group = GetGroupByPrim(LocalId); | 222 | group = GetGroupByPrim(LocalId); |
223 | if (group != null) | 223 | if (group != null) |
224 | { | 224 | { |
225 | view.DisplayAuras( model.UpdateNormalEntityEffects(group) ); //Might be a normal entity (green aura) | 225 | view.DisplayAuras(model.UpdateNormalEntityEffects(group)); //Might be a normal entity (green aura) |
226 | m_view.DisplayMetaEntity(group.UUID); //Might be a meta entity (blue aura) | 226 | m_view.DisplayMetaEntity(group.UUID); //Might be a meta entity (blue aura) |
227 | } | 227 | } |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
@@ -234,43 +234,43 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
234 | private void ObjectDuplicated(CMModel model, CMView view, uint localId) | 234 | private void ObjectDuplicated(CMModel model, CMView view, uint localId) |
235 | { | 235 | { |
236 | if ((m_state & State.SHOWING_CHANGES) > 0) | 236 | if ((m_state & State.SHOWING_CHANGES) > 0) |
237 | view.DisplayAuras(model.CheckForNewEntitiesMissingAuras( GetGroupByPrim(localId).Scene )); | 237 | view.DisplayAuras(model.CheckForNewEntitiesMissingAuras(GetGroupByPrim(localId).Scene)); |
238 | } | 238 | } |
239 | 239 | ||
240 | /// <summary> | 240 | /// <summary> |
241 | /// Only called by the MainLoop. | 241 | /// Only called by the MainLoop. |
242 | /// </summary> | 242 | /// </summary> |
243 | private void ObjectKilled(CMModel model, CMView view, SceneObjectGroup group) | 243 | private void ObjectKilled(CMModel model, CMView view, SceneObjectGroup group) |
244 | { | 244 | { |
245 | if ((m_state & State.SHOWING_CHANGES) > 0) | 245 | if ((m_state & State.SHOWING_CHANGES) > 0) |
246 | { | 246 | { |
247 | view.RemoveOrUpdateDeletedEntity(group); | 247 | view.RemoveOrUpdateDeletedEntity(group); |
248 | model.RemoveOrUpdateDeletedEntity(group); | 248 | model.RemoveOrUpdateDeletedEntity(group); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | /// <summary> | 252 | /// <summary> |
253 | /// Only called by the MainLoop. | 253 | /// Only called by the MainLoop. |
254 | /// </summary> | 254 | /// </summary> |
255 | private void PrimitiveAdded(CMModel model, CMView view, Work currentJob) | 255 | private void PrimitiveAdded(CMModel model, CMView view, Work currentJob) |
256 | { | 256 | { |
257 | if ((m_state & State.SHOWING_CHANGES) > 0) | 257 | if ((m_state & State.SHOWING_CHANGES) > 0) |
258 | { | 258 | { |
259 | foreach(Object scene in m_sceneList.Values) | 259 | foreach (Object scene in m_sceneList.Values) |
260 | m_view.DisplayAuras(model.CheckForNewEntitiesMissingAuras((Scene) scene)); | 260 | m_view.DisplayAuras(model.CheckForNewEntitiesMissingAuras((Scene) scene)); |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | /// <summary> | 264 | /// <summary> |
265 | /// Only called by the MainLoop. | 265 | /// Only called by the MainLoop. |
266 | /// </summary> | 266 | /// </summary> |
267 | private void UndoDid(CMModel model, CMView view, UUID uuid) | 267 | private void UndoDid(CMModel model, CMView view, UUID uuid) |
268 | { | 268 | { |
269 | if ((m_state & State.SHOWING_CHANGES) > 0) | 269 | if ((m_state & State.SHOWING_CHANGES) > 0) |
270 | { | 270 | { |
271 | ContentManagementEntity ent = model.FindMetaEntityAffectedByUndo(uuid); | 271 | ContentManagementEntity ent = model.FindMetaEntityAffectedByUndo(uuid); |
272 | if (ent != null) | 272 | if (ent != null) |
273 | view.DisplayEntity(ent); | 273 | view.DisplayEntity(ent); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
@@ -328,38 +328,38 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
328 | /// <summary> | 328 | /// <summary> |
329 | /// Takes a list of scenes and forms a new orderd list according to the proximity of scenes to the second argument. | 329 | /// Takes a list of scenes and forms a new orderd list according to the proximity of scenes to the second argument. |
330 | /// </summary> | 330 | /// </summary> |
331 | protected static System.Collections.Generic.List<Scene> ScenesInOrderOfProximity( Hashtable sceneList, Scene scene) | 331 | protected static System.Collections.Generic.List<Scene> ScenesInOrderOfProximity(Hashtable sceneList, Scene scene) |
332 | { | 332 | { |
333 | int somethingAddedToList = 1; | 333 | int somethingAddedToList = 1; |
334 | System.Collections.Generic.List<Scene> newList = new List<Scene>(); | 334 | System.Collections.Generic.List<Scene> newList = new List<Scene>(); |
335 | newList.Add(scene); | 335 | newList.Add(scene); |
336 | 336 | ||
337 | if (! sceneList.ContainsValue(scene)) | 337 | if (!sceneList.ContainsValue(scene)) |
338 | { | 338 | { |
339 | foreach(Object sceneObj in sceneList) | 339 | foreach (Object sceneObj in sceneList) |
340 | newList.Add((Scene) sceneObj); | 340 | newList.Add((Scene) sceneObj); |
341 | return newList; | 341 | return newList; |
342 | } | 342 | } |
343 | 343 | ||
344 | while(somethingAddedToList > 0) | 344 | while (somethingAddedToList > 0) |
345 | { | 345 | { |
346 | somethingAddedToList = 0; | 346 | somethingAddedToList = 0; |
347 | for(int i = 0; i < newList.Count; i++) | 347 | for (int i = 0; i < newList.Count; i++) |
348 | { | 348 | { |
349 | foreach(Object sceneObj in sceneList.Values) | 349 | foreach (Object sceneObj in sceneList.Values) |
350 | { | 350 | { |
351 | if (newList[i].CheckNeighborRegion(((Scene)sceneObj).RegionInfo) && (! newList.Contains((Scene)sceneObj)) ) | 351 | if (newList[i].CheckNeighborRegion(((Scene)sceneObj).RegionInfo) && (!newList.Contains((Scene)sceneObj))) |
352 | { | 352 | { |
353 | newList.Add((Scene)sceneObj); | 353 | newList.Add((Scene)sceneObj); |
354 | somethingAddedToList++; | 354 | somethingAddedToList++; |
355 | } | 355 | } |
356 | } | 356 | } |
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | foreach(Object sceneObj in sceneList.Values) | 360 | foreach (Object sceneObj in sceneList.Values) |
361 | if (! newList.Contains((Scene)sceneObj)) | 361 | if (!newList.Contains((Scene)sceneObj)) |
362 | newList.Add((Scene)sceneObj); | 362 | newList.Add((Scene)sceneObj); |
363 | 363 | ||
364 | return newList; | 364 | return newList; |
365 | } | 365 | } |
@@ -381,7 +381,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
381 | protected void StartManaging(IClientAPI client) | 381 | protected void StartManaging(IClientAPI client) |
382 | { | 382 | { |
383 | m_log.Debug("[CONTENT MANAGEMENT] Registering channel with chat services."); | 383 | m_log.Debug("[CONTENT MANAGEMENT] Registering channel with chat services."); |
384 | client.OnChatFromViewer += SimChatSent; | 384 | client.OnChatFromViewer += SimChatSent; |
385 | //init = true; | 385 | //init = true; |
386 | 386 | ||
387 | OnNewClient(client); | 387 | OnNewClient(client); |
@@ -401,19 +401,19 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
401 | } | 401 | } |
402 | 402 | ||
403 | /// <summary> | 403 | /// <summary> |
404 | /// | 404 | /// |
405 | /// </summary> | 405 | /// </summary> |
406 | protected void StopManaging(UUID clientUUID) | 406 | protected void StopManaging(UUID clientUUID) |
407 | { | 407 | { |
408 | foreach(Object sceneobj in m_sceneList.Values) | 408 | foreach (Object sceneobj in m_sceneList.Values) |
409 | { | 409 | { |
410 | ScenePresence presence = ((Scene)sceneobj).GetScenePresence(clientUUID); | 410 | ScenePresence presence = ((Scene)sceneobj).GetScenePresence(clientUUID); |
411 | if (presence != null) | 411 | if (presence != null) |
412 | { | 412 | { |
413 | IClientAPI client = presence.ControllingClient; | 413 | IClientAPI client = presence.ControllingClient; |
414 | m_log.Debug("[CONTENT MANAGEMENT] Unregistering channel with chat services."); | 414 | m_log.Debug("[CONTENT MANAGEMENT] Unregistering channel with chat services."); |
415 | client.OnChatFromViewer -= SimChatSent; | 415 | client.OnChatFromViewer -= SimChatSent; |
416 | 416 | ||
417 | m_log.Debug("[CONTENT MANAGEMENT] Removing handlers to client"); | 417 | m_log.Debug("[CONTENT MANAGEMENT] Removing handlers to client"); |
418 | client.OnUpdatePrimScale -= UpdateSingleScale; | 418 | client.OnUpdatePrimScale -= UpdateSingleScale; |
419 | client.OnUpdatePrimGroupScale -= UpdateMultipleScale; | 419 | client.OnUpdatePrimGroupScale -= UpdateMultipleScale; |
@@ -427,10 +427,10 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
427 | client.OnUndo -= OnUnDid; | 427 | client.OnUndo -= OnUnDid; |
428 | //client.OnUpdatePrimGroupMouseRotation += m_innerScene.UpdatePrimRotation; | 428 | //client.OnUpdatePrimGroupMouseRotation += m_innerScene.UpdatePrimRotation; |
429 | return; | 429 | return; |
430 | } | 430 | } |
431 | } | 431 | } |
432 | } | 432 | } |
433 | 433 | ||
434 | protected void UpdateMultiplePosition(uint localID, Vector3 pos, IClientAPI remoteClient) | 434 | protected void UpdateMultiplePosition(uint localID, Vector3 pos, IClientAPI remoteClient) |
435 | { | 435 | { |
436 | Work moreWork = new Work(); | 436 | Work moreWork = new Work(); |
@@ -479,7 +479,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
479 | } | 479 | } |
480 | 480 | ||
481 | /// <summary> | 481 | /// <summary> |
482 | /// | 482 | /// |
483 | /// </summary> | 483 | /// </summary> |
484 | protected void UpdateSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient) | 484 | protected void UpdateSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient) |
485 | { | 485 | { |
@@ -504,47 +504,47 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
504 | /// </summary> | 504 | /// </summary> |
505 | protected void commit(string message, Scene scene, CMModel model, CMView view) | 505 | protected void commit(string message, Scene scene, CMModel model, CMView view) |
506 | { | 506 | { |
507 | System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity( m_sceneList, scene); | 507 | System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity(m_sceneList, scene); |
508 | 508 | ||
509 | string[] args = message.Split(new char[] {' '}); | 509 | string[] args = message.Split(new char[] {' '}); |
510 | 510 | ||
511 | char[] logMessage = {' '}; | 511 | char[] logMessage = {' '}; |
512 | if (args.Length > 1) | 512 | if (args.Length > 1) |
513 | { | 513 | { |
514 | logMessage = new char[message.Length - (args[0].Length)]; | 514 | logMessage = new char[message.Length - (args[0].Length)]; |
515 | message.CopyTo(args[0].Length, logMessage, 0, message.Length - (args[0].Length)); | 515 | message.CopyTo(args[0].Length, logMessage, 0, message.Length - (args[0].Length)); |
516 | } | 516 | } |
517 | 517 | ||
518 | m_log.Debug("[CONTENT MANAGEMENT] Saving terrain and objects of region."); | 518 | m_log.Debug("[CONTENT MANAGEMENT] Saving terrain and objects of region."); |
519 | foreach(Scene currScene in proximitySceneList) | 519 | foreach (Scene currScene in proximitySceneList) |
520 | { | 520 | { |
521 | model.CommitRegion(currScene, new String(logMessage)); | 521 | model.CommitRegion(currScene, new String(logMessage)); |
522 | view.SendSimChatMessage(scene, "Region Saved Successfully: " + currScene.RegionInfo.RegionName); | 522 | view.SendSimChatMessage(scene, "Region Saved Successfully: " + currScene.RegionInfo.RegionName); |
523 | } | 523 | } |
524 | 524 | ||
525 | view.SendSimChatMessage(scene, "Successfully saved all regions."); | 525 | view.SendSimChatMessage(scene, "Successfully saved all regions."); |
526 | m_state |= State.DIRTY; | 526 | m_state |= State.DIRTY; |
527 | 527 | ||
528 | if ((m_state & State.SHOWING_CHANGES) > 0) //DISPLAY NEW CHANGES INSTEAD OF OLD CHANGES | 528 | if ((m_state & State.SHOWING_CHANGES) > 0) //DISPLAY NEW CHANGES INSTEAD OF OLD CHANGES |
529 | { | 529 | { |
530 | view.SendSimChatMessage(scene, "Updating differences between new revision and current environment."); | 530 | view.SendSimChatMessage(scene, "Updating differences between new revision and current environment."); |
531 | //Hide objects from users and Forget about them | 531 | //Hide objects from users and Forget about them |
532 | view.HideAllMetaEntities(); | 532 | view.HideAllMetaEntities(); |
533 | view.HideAllAuras(); | 533 | view.HideAllAuras(); |
534 | model.DeleteAllMetaObjects(); | 534 | model.DeleteAllMetaObjects(); |
535 | 535 | ||
536 | //Recreate them from backend files | 536 | //Recreate them from backend files |
537 | foreach(Scene currScene in proximitySceneList) | 537 | foreach (Scene currScene in proximitySceneList) |
538 | { | 538 | { |
539 | model.UpdateCMEntities(currScene); | 539 | model.UpdateCMEntities(currScene); |
540 | view.SendSimChatMessage(scene, "Finished updating differences between current scene and last revision: " + currScene.RegionInfo.RegionName); | 540 | view.SendSimChatMessage(scene, "Finished updating differences between current scene and last revision: " + currScene.RegionInfo.RegionName); |
541 | } | 541 | } |
542 | 542 | ||
543 | //Display new objects to users1 | 543 | //Display new objects to users1 |
544 | view.DisplayRecentChanges(); | 544 | view.DisplayRecentChanges(); |
545 | view.SendSimChatMessage(scene, "Finished updating for DIFF-MODE."); | 545 | view.SendSimChatMessage(scene, "Finished updating for DIFF-MODE."); |
546 | m_state &= ~(State.DIRTY); | 546 | m_state &= ~(State.DIRTY); |
547 | m_state |= State.SHOWING_CHANGES; | 547 | m_state |= State.SHOWING_CHANGES; |
548 | } | 548 | } |
549 | } | 549 | } |
550 | 550 | ||
@@ -553,74 +553,74 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
553 | /// </summary> | 553 | /// </summary> |
554 | protected void diffmode(Scene scene, CMModel model, CMView view) | 554 | protected void diffmode(Scene scene, CMModel model, CMView view) |
555 | { | 555 | { |
556 | System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity( m_sceneList, scene); | 556 | System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity(m_sceneList, scene); |
557 | 557 | ||
558 | if ((m_state & State.SHOWING_CHANGES) > 0) // TURN OFF | 558 | if ((m_state & State.SHOWING_CHANGES) > 0) // TURN OFF |
559 | { | 559 | { |
560 | view.SendSimChatMessage(scene, "Hiding all meta objects."); | 560 | view.SendSimChatMessage(scene, "Hiding all meta objects."); |
561 | view.HideAllMetaEntities(); | 561 | view.HideAllMetaEntities(); |
562 | view.HideAllAuras(); | 562 | view.HideAllAuras(); |
563 | view.SendSimChatMessage(scene, "Diff-mode = OFF"); | 563 | view.SendSimChatMessage(scene, "Diff-mode = OFF"); |
564 | 564 | ||
565 | m_state &= ~State.SHOWING_CHANGES; | 565 | m_state &= ~State.SHOWING_CHANGES; |
566 | return; | 566 | return; |
567 | } | 567 | } |
568 | else // TURN ON | 568 | else // TURN ON |
569 | { | 569 | { |
570 | if ((m_state & State.DIRTY) != 0 || m_state == State.NONE) | 570 | if ((m_state & State.DIRTY) != 0 || m_state == State.NONE) |
571 | { | 571 | { |
572 | view.SendSimChatMessage(scene, "Hiding meta objects and replacing with latest revision"); | 572 | view.SendSimChatMessage(scene, "Hiding meta objects and replacing with latest revision"); |
573 | //Hide objects from users and Forget about them | 573 | //Hide objects from users and Forget about them |
574 | view.HideAllMetaEntities(); | 574 | view.HideAllMetaEntities(); |
575 | view.HideAllAuras(); | 575 | view.HideAllAuras(); |
576 | model.DeleteAllMetaObjects(); | 576 | model.DeleteAllMetaObjects(); |
577 | //Recreate them from backend files | 577 | //Recreate them from backend files |
578 | foreach(Object currScene in m_sceneList.Values) | 578 | foreach (Object currScene in m_sceneList.Values) |
579 | model.UpdateCMEntities((Scene) currScene); | 579 | model.UpdateCMEntities((Scene) currScene); |
580 | } | 580 | } |
581 | else if ((m_state & State.DIRTY) != 0) { | 581 | else if ((m_state & State.DIRTY) != 0) { |
582 | view.SendSimChatMessage(scene, "Forming list of meta entities with latest revision"); | 582 | view.SendSimChatMessage(scene, "Forming list of meta entities with latest revision"); |
583 | foreach(Scene currScene in proximitySceneList) | 583 | foreach (Scene currScene in proximitySceneList) |
584 | model.UpdateCMEntities(currScene); | 584 | model.UpdateCMEntities(currScene); |
585 | } | 585 | } |
586 | 586 | ||
587 | view.SendSimChatMessage(scene, "Displaying differences between last revision and current environment"); | 587 | view.SendSimChatMessage(scene, "Displaying differences between last revision and current environment"); |
588 | foreach(Scene currScene in proximitySceneList) | 588 | foreach (Scene currScene in proximitySceneList) |
589 | model.CheckForNewEntitiesMissingAuras(currScene); | 589 | model.CheckForNewEntitiesMissingAuras(currScene); |
590 | view.DisplayRecentChanges(); | 590 | view.DisplayRecentChanges(); |
591 | 591 | ||
592 | view.SendSimChatMessage(scene, "Diff-mode = ON"); | 592 | view.SendSimChatMessage(scene, "Diff-mode = ON"); |
593 | m_state |= State.SHOWING_CHANGES; | 593 | m_state |= State.SHOWING_CHANGES; |
594 | m_state &= ~State.DIRTY; | 594 | m_state &= ~State.DIRTY; |
595 | } | 595 | } |
596 | } | 596 | } |
597 | 597 | ||
598 | /// <summary> | 598 | /// <summary> |
599 | /// Only called from within the SimChat method. Hides all auras and meta entities, | 599 | /// Only called from within the SimChat method. Hides all auras and meta entities, |
600 | /// retrieves the current scene object list with the most recent revision retrieved from the model for each scene, | 600 | /// retrieves the current scene object list with the most recent revision retrieved from the model for each scene, |
601 | /// then lets the view update the clients of the new objects. | 601 | /// then lets the view update the clients of the new objects. |
602 | /// </summary> | 602 | /// </summary> |
603 | protected void rollback(Scene scene, CMModel model, CMView view) | 603 | protected void rollback(Scene scene, CMModel model, CMView view) |
604 | { | 604 | { |
605 | if ((m_state & State.SHOWING_CHANGES) > 0) | 605 | if ((m_state & State.SHOWING_CHANGES) > 0) |
606 | { | 606 | { |
607 | view.HideAllAuras(); | 607 | view.HideAllAuras(); |
608 | view.HideAllMetaEntities(); | 608 | view.HideAllMetaEntities(); |
609 | } | 609 | } |
610 | 610 | ||
611 | System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity( m_sceneList, scene); | 611 | System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity(m_sceneList, scene); |
612 | foreach(Scene currScene in proximitySceneList) | 612 | foreach (Scene currScene in proximitySceneList) |
613 | model.RollbackRegion(currScene); | 613 | model.RollbackRegion(currScene); |
614 | 614 | ||
615 | if ((m_state & State.DIRTY) != 0 ) | 615 | if ((m_state & State.DIRTY) != 0) |
616 | { | 616 | { |
617 | model.DeleteAllMetaObjects(); | 617 | model.DeleteAllMetaObjects(); |
618 | foreach(Scene currScene in proximitySceneList) | 618 | foreach (Scene currScene in proximitySceneList) |
619 | model.UpdateCMEntities(currScene); | 619 | model.UpdateCMEntities(currScene); |
620 | } | 620 | } |
621 | 621 | ||
622 | if ((m_state & State.SHOWING_CHANGES) > 0) | 622 | if ((m_state & State.SHOWING_CHANGES) > 0) |
623 | view.DisplayRecentChanges(); | 623 | view.DisplayRecentChanges(); |
624 | } | 624 | } |
625 | 625 | ||
626 | #endregion Protected Methods | 626 | #endregion Protected Methods |
@@ -642,7 +642,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
642 | 642 | ||
643 | scene.EventManager.OnNewClient += StartManaging; | 643 | scene.EventManager.OnNewClient += StartManaging; |
644 | scene.EventManager.OnRemovePresence += StopManaging; | 644 | scene.EventManager.OnRemovePresence += StopManaging; |
645 | // scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | 645 | // scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; |
646 | scene.EventManager.OnObjectBeingRemovedFromScene += GroupBeingDeleted; | 646 | scene.EventManager.OnObjectBeingRemovedFromScene += GroupBeingDeleted; |
647 | } | 647 | } |
648 | 648 | ||
@@ -652,9 +652,9 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
652 | public void SimChat(CMModel model, CMView view, OSChatMessage e, int channel) | 652 | public void SimChat(CMModel model, CMView view, OSChatMessage e, int channel) |
653 | { | 653 | { |
654 | if (e.Channel != channel) | 654 | if (e.Channel != channel) |
655 | return; | 655 | return; |
656 | if (e.Sender == null) | 656 | if (e.Sender == null) |
657 | return; | 657 | return; |
658 | 658 | ||
659 | m_log.Debug("[CONTENT MANAGEMENT] Message received: " + e.Message); | 659 | m_log.Debug("[CONTENT MANAGEMENT] Message received: " + e.Message); |
660 | 660 | ||
@@ -667,31 +667,31 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
667 | 667 | ||
668 | if (!(m_estateModule.IsManager(avatar.UUID))) | 668 | if (!(m_estateModule.IsManager(avatar.UUID))) |
669 | { | 669 | { |
670 | m_log.Debug("[CONTENT MANAGEMENT] Message sent from non Estate Manager ... ignoring."); | 670 | m_log.Debug("[CONTENT MANAGEMENT] Message sent from non Estate Manager ... ignoring."); |
671 | view.SendSimChatMessage(scene, "You must be an estate manager to perform that action."); | 671 | view.SendSimChatMessage(scene, "You must be an estate manager to perform that action."); |
672 | return; | 672 | return; |
673 | } | 673 | } |
674 | 674 | ||
675 | switch(args[0]) | 675 | switch (args[0]) |
676 | { | 676 | { |
677 | case "ci": | 677 | case "ci": |
678 | case "commit": | 678 | case "commit": |
679 | commit(message, scene, model, view); | 679 | commit(message, scene, model, view); |
680 | break; | 680 | break; |
681 | case "dm": | 681 | case "dm": |
682 | case "diff-mode": | 682 | case "diff-mode": |
683 | diffmode(scene, model, view); | 683 | diffmode(scene, model, view); |
684 | break; | 684 | break; |
685 | case "rb": | 685 | case "rb": |
686 | case "rollback": | 686 | case "rollback": |
687 | rollback(scene, model, view); | 687 | rollback(scene, model, view); |
688 | break; | 688 | break; |
689 | case "help": | 689 | case "help": |
690 | m_view.DisplayHelpMenu(scene); | 690 | m_view.DisplayHelpMenu(scene); |
691 | break; | 691 | break; |
692 | default: | 692 | default: |
693 | view.SendSimChatMessage(scene, "Command not found: " + args[0]); | 693 | view.SendSimChatMessage(scene, "Command not found: " + args[0]); |
694 | break; | 694 | break; |
695 | } | 695 | } |
696 | } | 696 | } |
697 | 697 | ||
@@ -705,7 +705,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement | |||
705 | [Flags] | 705 | [Flags] |
706 | private enum State | 706 | private enum State |
707 | { | 707 | { |
708 | NONE = 0, | 708 | NONE = 0, |
709 | DIRTY = 1, // The meta entities may not correctly represent the last revision. | 709 | DIRTY = 1, // The meta entities may not correctly represent the last revision. |
710 | SHOWING_CHANGES = 1<<1 // The meta entities are being shown to user. | 710 | SHOWING_CHANGES = 1<<1 // The meta entities are being shown to user. |
711 | } | 711 | } |