diff options
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EntityBase.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 61 |
2 files changed, 44 insertions, 24 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index a7b9d75..2caab9e 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -109,13 +109,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
109 | } | 109 | } |
110 | 110 | ||
111 | /// <summary> | 111 | /// <summary> |
112 | /// Called at a set interval to inform entities that they should back themsleves up to the DB | ||
113 | /// </summary> | ||
114 | public virtual void BackUp() | ||
115 | { | ||
116 | } | ||
117 | |||
118 | /// <summary> | ||
119 | /// Copies the entity | 112 | /// Copies the entity |
120 | /// </summary> | 113 | /// </summary> |
121 | /// <returns></returns> | 114 | /// <returns></returns> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index eff622a..99f1900 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -149,6 +149,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
149 | /// saying what prim(s) that user has selected. | 149 | /// saying what prim(s) that user has selected. |
150 | /// </summary> | 150 | /// </summary> |
151 | protected bool m_isSelected = false; | 151 | protected bool m_isSelected = false; |
152 | |||
153 | protected virtual bool InSceneBackup | ||
154 | { | ||
155 | get | ||
156 | { | ||
157 | return true; | ||
158 | } | ||
159 | } | ||
160 | |||
152 | public bool IsSelected | 161 | public bool IsSelected |
153 | { | 162 | { |
154 | get { return m_isSelected; } | 163 | get { return m_isSelected; } |
@@ -218,10 +227,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
218 | this.m_rootPart.ParentID = 0; | 227 | this.m_rootPart.ParentID = 0; |
219 | this.m_rootPart.RegionHandle = m_regionHandle; | 228 | this.m_rootPart.RegionHandle = m_regionHandle; |
220 | this.UpdateParentIDs(); | 229 | this.UpdateParentIDs(); |
221 | m_scene.EventManager.OnBackup += this.ProcessBackup; | 230 | |
231 | AttachToBackup(); | ||
232 | |||
222 | this.ScheduleGroupForFullUpdate(); | 233 | this.ScheduleGroupForFullUpdate(); |
223 | } | 234 | } |
224 | 235 | ||
236 | private void AttachToBackup() | ||
237 | { | ||
238 | if (InSceneBackup) | ||
239 | { | ||
240 | m_scene.EventManager.OnBackup += this.ProcessBackup; | ||
241 | } | ||
242 | } | ||
243 | |||
225 | /// <summary> | 244 | /// <summary> |
226 | /// | 245 | /// |
227 | /// </summary> | 246 | /// </summary> |
@@ -243,7 +262,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
243 | SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset); | 262 | SceneObjectPart newPart = new SceneObjectPart(m_regionHandle, this, ownerID, localID, shape, pos, rootOffset); |
244 | this.m_parts.Add(newPart.UUID, newPart); | 263 | this.m_parts.Add(newPart.UUID, newPart); |
245 | this.SetPartAsRoot(newPart); | 264 | this.SetPartAsRoot(newPart); |
246 | m_scene.EventManager.OnBackup += this.ProcessBackup; | 265 | |
266 | AttachToBackup(); | ||
247 | } | 267 | } |
248 | #endregion | 268 | #endregion |
249 | 269 | ||
@@ -307,7 +327,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
307 | } | 327 | } |
308 | dupe.UpdateParentIDs(); | 328 | dupe.UpdateParentIDs(); |
309 | 329 | ||
310 | m_scene.EventManager.OnBackup += dupe.ProcessBackup; | 330 | dupe.AttachToBackup(); |
331 | |||
311 | return dupe; | 332 | return dupe; |
312 | } | 333 | } |
313 | 334 | ||
@@ -523,13 +544,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
523 | } | 544 | } |
524 | } | 545 | } |
525 | 546 | ||
526 | m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup; | 547 | DetachFromBackup(objectGroup); |
548 | |||
527 | m_scene.DeleteEntity(objectGroup.UUID); | 549 | m_scene.DeleteEntity(objectGroup.UUID); |
528 | 550 | ||
529 | objectGroup.DeleteParts(); | 551 | objectGroup.DeleteParts(); |
530 | this.ScheduleGroupForFullUpdate(); | 552 | this.ScheduleGroupForFullUpdate(); |
531 | } | 553 | } |
532 | 554 | ||
555 | private void DetachFromBackup(SceneObjectGroup objectGroup) | ||
556 | { | ||
557 | m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup; | ||
558 | } | ||
559 | |||
533 | 560 | ||
534 | private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation) | 561 | private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation) |
535 | { | 562 | { |
@@ -583,7 +610,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
583 | proper.ObjectData[0].FolderID = LLUUID.Zero; | 610 | proper.ObjectData[0].FolderID = LLUUID.Zero; |
584 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; | 611 | proper.ObjectData[0].FromTaskID = LLUUID.Zero; |
585 | proper.ObjectData[0].GroupID = LLUUID.Zero; | 612 | proper.ObjectData[0].GroupID = LLUUID.Zero; |
586 | proper.ObjectData[0].InventorySerial = (short) this.m_rootPart.InventorySerial; | 613 | proper.ObjectData[0].InventorySerial = (short)this.m_rootPart.InventorySerial; |
587 | proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; | 614 | proper.ObjectData[0].LastOwnerID = this.m_rootPart.LastOwnerID; |
588 | proper.ObjectData[0].ObjectID = this.UUID; | 615 | proper.ObjectData[0].ObjectID = this.UUID; |
589 | proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; | 616 | proper.ObjectData[0].OwnerID = this.m_rootPart.OwnerID; |
@@ -672,7 +699,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
672 | SceneObjectPart part = this.GetChildPart(localID); | 699 | SceneObjectPart part = this.GetChildPart(localID); |
673 | if (part != null) | 700 | if (part != null) |
674 | { | 701 | { |
675 | return part.GetInventoryFileName(remoteClient, localID); | 702 | return part.GetInventoryFileName(remoteClient, localID); |
676 | } | 703 | } |
677 | return false; | 704 | return false; |
678 | } | 705 | } |
@@ -682,7 +709,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
682 | SceneObjectPart part = this.GetChildPart(localID); | 709 | SceneObjectPart part = this.GetChildPart(localID); |
683 | if (part != null) | 710 | if (part != null) |
684 | { | 711 | { |
685 | part.RequestInventoryFile(xferManager); | 712 | part.RequestInventoryFile(xferManager); |
686 | } | 713 | } |
687 | return ""; | 714 | return ""; |
688 | } | 715 | } |
@@ -705,7 +732,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
705 | return true; | 732 | return true; |
706 | } | 733 | } |
707 | return false; | 734 | return false; |
708 | 735 | ||
709 | } | 736 | } |
710 | 737 | ||
711 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) | 738 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) |
@@ -730,19 +757,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
730 | } | 757 | } |
731 | else | 758 | else |
732 | { | 759 | { |
733 | return AddInventoryItem(remoteClient, localID, item); | 760 | return AddInventoryItem(remoteClient, localID, item); |
734 | } | 761 | } |
735 | return false; | 762 | return false; |
736 | } | 763 | } |
737 | 764 | ||
738 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) | 765 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) |
739 | { | 766 | { |
740 | SceneObjectPart part = this.GetChildPart(localID); | 767 | SceneObjectPart part = this.GetChildPart(localID); |
741 | if (part != null) | 768 | if (part != null) |
742 | { | 769 | { |
743 | return part.RemoveInventoryItem(remoteClient, localID, itemID); | 770 | return part.RemoveInventoryItem(remoteClient, localID, itemID); |
744 | } | 771 | } |
745 | return -1; | 772 | return -1; |
746 | } | 773 | } |
747 | 774 | ||
748 | /// <summary> | 775 | /// <summary> |
@@ -1077,7 +1104,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1077 | public void SetScene(Scene scene) | 1104 | public void SetScene(Scene scene) |
1078 | { | 1105 | { |
1079 | m_scene = scene; | 1106 | m_scene = scene; |
1080 | m_scene.EventManager.OnBackup += this.ProcessBackup; | 1107 | AttachToBackup(); |
1081 | } | 1108 | } |
1082 | 1109 | ||
1083 | /// <summary> | 1110 | /// <summary> |
@@ -1153,7 +1180,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1153 | 1180 | ||
1154 | public void DeleteGroup() | 1181 | public void DeleteGroup() |
1155 | { | 1182 | { |
1156 | m_scene.EventManager.OnBackup -= this.ProcessBackup; | 1183 | DetachFromBackup( this ); |
1157 | foreach (SceneObjectPart part in this.m_parts.Values) | 1184 | foreach (SceneObjectPart part in this.m_parts.Values) |
1158 | { | 1185 | { |
1159 | List<ScenePresence> avatars = this.RequestSceneAvatars(); | 1186 | List<ScenePresence> avatars = this.RequestSceneAvatars(); |