diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 415 |
1 files changed, 379 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1bb5854..a703377 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -77,6 +77,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
77 | touch = 8, | 77 | touch = 8, |
78 | touch_end = 536870912, | 78 | touch_end = 536870912, |
79 | touch_start = 2097152, | 79 | touch_start = 2097152, |
80 | transaction_result = 33554432, | ||
80 | object_rez = 4194304 | 81 | object_rez = 4194304 |
81 | } | 82 | } |
82 | 83 | ||
@@ -121,12 +122,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
121 | /// since the group's last persistent backup | 122 | /// since the group's last persistent backup |
122 | /// </summary> | 123 | /// </summary> |
123 | private bool m_hasGroupChanged = false; | 124 | private bool m_hasGroupChanged = false; |
125 | <<<<<<< HEAD | ||
126 | private long timeFirstChanged; | ||
127 | private long timeLastChanged; | ||
128 | ======= | ||
124 | private long timeFirstChanged = 0; | 129 | private long timeFirstChanged = 0; |
125 | private long timeLastChanged = 0; | 130 | private long timeLastChanged = 0; |
126 | private long m_maxPersistTime = 0; | 131 | private long m_maxPersistTime = 0; |
127 | private long m_minPersistTime = 0; | 132 | private long m_minPersistTime = 0; |
128 | // private Random m_rand; | 133 | // private Random m_rand; |
129 | private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); | 134 | private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); |
135 | >>>>>>> avn/ubitvar | ||
130 | 136 | ||
131 | /// <summary> | 137 | /// <summary> |
132 | /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage | 138 | /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage |
@@ -190,12 +196,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
190 | 196 | ||
191 | get { return m_hasGroupChanged; } | 197 | get { return m_hasGroupChanged; } |
192 | } | 198 | } |
199 | |||
200 | private bool m_groupContainsForeignPrims = false; | ||
193 | 201 | ||
194 | /// <summary> | 202 | /// <summary> |
195 | /// Has the group changed due to an unlink operation? We record this in order to optimize deletion, since | 203 | /// Whether the group contains prims that came from a different group. This happens when |
196 | /// an unlinked group currently has to be persisted to the database before we can perform an unlink operation. | 204 | /// linking or delinking groups. The implication is that until the group is persisted, |
205 | /// the prims in the database still use the old SceneGroupID. That's a problem if the group | ||
206 | /// is deleted, because we delete groups by searching for prims by their SceneGroupID. | ||
197 | /// </summary> | 207 | /// </summary> |
208 | <<<<<<< HEAD | ||
209 | public bool GroupContainsForeignPrims | ||
210 | { | ||
211 | private set | ||
212 | { | ||
213 | m_groupContainsForeignPrims = value; | ||
214 | if (m_groupContainsForeignPrims) | ||
215 | HasGroupChanged = true; | ||
216 | } | ||
217 | |||
218 | get { return m_groupContainsForeignPrims; } | ||
219 | } | ||
220 | |||
221 | ======= | ||
198 | public bool HasGroupChangedDueToDelink { get; set; } | 222 | public bool HasGroupChangedDueToDelink { get; set; } |
223 | >>>>>>> avn/ubitvar | ||
199 | 224 | ||
200 | private bool isTimeToPersist() | 225 | private bool isTimeToPersist() |
201 | { | 226 | { |
@@ -325,7 +350,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
325 | get { return RootPart.VolumeDetectActive; } | 350 | get { return RootPart.VolumeDetectActive; } |
326 | } | 351 | } |
327 | 352 | ||
353 | <<<<<<< HEAD | ||
354 | private Vector3 lastPhysGroupPos; | ||
355 | private Quaternion lastPhysGroupRot; | ||
356 | |||
357 | /// <summary> | ||
358 | /// Is this entity set to be saved in persistent storage? | ||
359 | /// </summary> | ||
360 | public bool Backup { get; private set; } | ||
361 | ======= | ||
328 | private bool m_isBackedUp; | 362 | private bool m_isBackedUp; |
363 | >>>>>>> avn/ubitvar | ||
329 | 364 | ||
330 | public bool IsBackedUp | 365 | public bool IsBackedUp |
331 | { | 366 | { |
@@ -507,7 +542,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
507 | /// <returns></returns> | 542 | /// <returns></returns> |
508 | public bool IsAttachmentCheckFull() | 543 | public bool IsAttachmentCheckFull() |
509 | { | 544 | { |
510 | return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); | 545 | return (IsAttachment || (m_rootPart.Shape.PCode == (byte)PCodeEnum.Primitive && m_rootPart.Shape.State != 0)); |
511 | } | 546 | } |
512 | 547 | ||
513 | private struct avtocrossInfo | 548 | private struct avtocrossInfo |
@@ -535,11 +570,146 @@ namespace OpenSim.Region.Framework.Scenes | |||
535 | && !Scene.LoadingPrims | 570 | && !Scene.LoadingPrims |
536 | ) | 571 | ) |
537 | { | 572 | { |
573 | <<<<<<< HEAD | ||
574 | if ( | ||
575 | !Scene.PositionIsInCurrentRegion(val) | ||
576 | && !IsAttachmentCheckFull() | ||
577 | && (!Scene.LoadingPrims) | ||
578 | ) | ||
579 | { | ||
580 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | ||
581 | string version = String.Empty; | ||
582 | Vector3 newpos = Vector3.Zero; | ||
583 | string failureReason = String.Empty; | ||
584 | OpenSim.Services.Interfaces.GridRegion destination = null; | ||
585 | |||
586 | if (m_rootPart.KeyframeMotion != null) | ||
587 | m_rootPart.KeyframeMotion.StartCrossingCheck(); | ||
588 | |||
589 | bool canCross = true; | ||
590 | foreach (ScenePresence av in GetSittingAvatars()) | ||
591 | { | ||
592 | // We need to cross these agents. First, let's find | ||
593 | // out if any of them can't cross for some reason. | ||
594 | // We have to deny the crossing entirely if any | ||
595 | // of them are banned. Alternatively, we could | ||
596 | // unsit banned agents.... | ||
597 | |||
598 | |||
599 | // We set the avatar position as being the object | ||
600 | // position to get the region to send to | ||
601 | if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out version, out newpos, out failureReason)) == null) | ||
602 | { | ||
603 | canCross = false; | ||
604 | break; | ||
605 | } | ||
606 | |||
607 | m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); | ||
608 | } | ||
609 | |||
610 | if (canCross) | ||
611 | { | ||
612 | // We unparent the SP quietly so that it won't | ||
613 | // be made to stand up | ||
614 | |||
615 | List<avtocrossInfo> avsToCross = new List<avtocrossInfo>(); | ||
616 | |||
617 | foreach (ScenePresence av in GetSittingAvatars()) | ||
618 | { | ||
619 | avtocrossInfo avinfo = new avtocrossInfo(); | ||
620 | SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID); | ||
621 | if (parentPart != null) | ||
622 | av.ParentUUID = parentPart.UUID; | ||
623 | |||
624 | avinfo.av = av; | ||
625 | avinfo.ParentID = av.ParentID; | ||
626 | avsToCross.Add(avinfo); | ||
627 | |||
628 | av.PrevSitOffset = av.OffsetPosition; | ||
629 | av.ParentID = 0; | ||
630 | } | ||
631 | |||
632 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | ||
633 | |||
634 | // Normalize | ||
635 | if (val.X >= m_scene.RegionInfo.RegionSizeX) | ||
636 | val.X -= m_scene.RegionInfo.RegionSizeX; | ||
637 | if (val.Y >= m_scene.RegionInfo.RegionSizeY) | ||
638 | val.Y -= m_scene.RegionInfo.RegionSizeY; | ||
639 | if (val.X < 0) | ||
640 | val.X += m_scene.RegionInfo.RegionSizeX; | ||
641 | if (val.Y < 0) | ||
642 | val.Y += m_scene.RegionInfo.RegionSizeY; | ||
643 | |||
644 | // If it's deleted, crossing was successful | ||
645 | if (IsDeleted) | ||
646 | { | ||
647 | foreach (avtocrossInfo avinfo in avsToCross) | ||
648 | { | ||
649 | ScenePresence av = avinfo.av; | ||
650 | if (!av.IsInTransit) // just in case... | ||
651 | { | ||
652 | m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); | ||
653 | |||
654 | av.IsInTransit = true; | ||
655 | |||
656 | // A temporary measure to allow regression tests to work. | ||
657 | // Quite possibly, all BeginInvoke() calls should be replaced by Util.FireAndForget | ||
658 | // or similar since BeginInvoke() always uses the system threadpool to launch | ||
659 | // threads rather than any replace threadpool that we might be using. | ||
660 | if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest) | ||
661 | { | ||
662 | entityTransfer.CrossAgentToNewRegionAsync(av, val, destination, av.Flying, version); | ||
663 | CrossAgentToNewRegionCompleted(av); | ||
664 | } | ||
665 | else | ||
666 | { | ||
667 | CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync; | ||
668 | d.BeginInvoke( | ||
669 | av, val, destination, av.Flying, version, | ||
670 | ar => CrossAgentToNewRegionCompleted(d.EndInvoke(ar)), null); | ||
671 | } | ||
672 | } | ||
673 | else | ||
674 | { | ||
675 | m_log.DebugFormat("[SCENE OBJECT]: Not crossing avatar {0} to {1} because it's already in transit", av.Name, val); | ||
676 | } | ||
677 | } | ||
678 | |||
679 | return; | ||
680 | } | ||
681 | else // cross failed, put avas back ?? | ||
682 | { | ||
683 | foreach (avtocrossInfo avinfo in avsToCross) | ||
684 | { | ||
685 | ScenePresence av = avinfo.av; | ||
686 | av.ParentUUID = UUID.Zero; | ||
687 | av.ParentID = avinfo.ParentID; | ||
688 | } | ||
689 | } | ||
690 | } | ||
691 | else | ||
692 | { | ||
693 | if (m_rootPart.KeyframeMotion != null) | ||
694 | m_rootPart.KeyframeMotion.CrossingFailure(); | ||
695 | |||
696 | if (RootPart.PhysActor != null) | ||
697 | { | ||
698 | RootPart.PhysActor.CrossingFailure(); | ||
699 | } | ||
700 | } | ||
701 | |||
702 | Vector3 oldp = AbsolutePosition; | ||
703 | val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)m_scene.RegionInfo.RegionSizeX - 0.5f); | ||
704 | val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)m_scene.RegionInfo.RegionSizeY - 0.5f); | ||
705 | val.Z = Util.Clamp<float>(oldp.Z, 0.5f, Constants.RegionHeight); | ||
706 | ======= | ||
538 | if (!inTransit) | 707 | if (!inTransit) |
539 | { | 708 | { |
540 | inTransit = true; | 709 | inTransit = true; |
541 | SOGCrossDelegate d = CrossAsync; | 710 | SOGCrossDelegate d = CrossAsync; |
542 | d.BeginInvoke(this, val, CrossAsyncCompleted, d); | 711 | d.BeginInvoke(this, val, CrossAsyncCompleted, d); |
712 | >>>>>>> avn/ubitvar | ||
543 | } | 713 | } |
544 | return; | 714 | return; |
545 | } | 715 | } |
@@ -780,11 +950,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
780 | } | 950 | } |
781 | } | 951 | } |
782 | 952 | ||
783 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) | 953 | private void CrossAgentToNewRegionCompleted(ScenePresence agent) |
784 | { | 954 | { |
785 | CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState; | ||
786 | ScenePresence agent = icon.EndInvoke(iar); | ||
787 | |||
788 | //// If the cross was successful, this agent is a child agent | 955 | //// If the cross was successful, this agent is a child agent |
789 | if (agent.IsChildAgent) | 956 | if (agent.IsChildAgent) |
790 | { | 957 | { |
@@ -871,7 +1038,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
871 | set { m_rootPart.Text = value; } | 1038 | set { m_rootPart.Text = value; } |
872 | } | 1039 | } |
873 | 1040 | ||
874 | protected virtual bool InSceneBackup | 1041 | /// <summary> |
1042 | /// If set to true then the scene object can be backed up in principle, though this will only actually occur | ||
1043 | /// if Backup is set. If false then the scene object will never be backed up, Backup will always be false. | ||
1044 | /// </summary> | ||
1045 | protected virtual bool CanBeBackedUp | ||
875 | { | 1046 | { |
876 | get { return true; } | 1047 | get { return true; } |
877 | } | 1048 | } |
@@ -1014,6 +1185,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1014 | public UUID FromFolderID { get; set; } | 1185 | public UUID FromFolderID { get; set; } |
1015 | 1186 | ||
1016 | /// <summary> | 1187 | /// <summary> |
1188 | /// If true then grabs are blocked no matter what the individual part BlockGrab setting. | ||
1189 | /// </summary> | ||
1190 | /// <value><c>true</c> if block grab override; otherwise, <c>false</c>.</value> | ||
1191 | public bool BlockGrabOverride { get; set; } | ||
1192 | |||
1193 | /// <summary> | ||
1017 | /// IDs of all avatars sat on this scene object. | 1194 | /// IDs of all avatars sat on this scene object. |
1018 | /// </summary> | 1195 | /// </summary> |
1019 | /// <remarks> | 1196 | /// <remarks> |
@@ -1023,7 +1200,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1023 | /// No avatar should appear more than once in this list. | 1200 | /// No avatar should appear more than once in this list. |
1024 | /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. | 1201 | /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. |
1025 | /// </remarks> | 1202 | /// </remarks> |
1026 | protected internal List<UUID> m_sittingAvatars = new List<UUID>(); | 1203 | protected internal List<ScenePresence> m_sittingAvatars = new List<ScenePresence>(); |
1027 | 1204 | ||
1028 | #endregion | 1205 | #endregion |
1029 | 1206 | ||
@@ -1089,23 +1266,67 @@ namespace OpenSim.Region.Framework.Scenes | |||
1089 | } | 1266 | } |
1090 | } | 1267 | } |
1091 | 1268 | ||
1269 | public void LoadScriptState(XmlReader reader) | ||
1270 | { | ||
1271 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Looking for script state for {0}", Name); | ||
1272 | |||
1273 | while (true) | ||
1274 | { | ||
1275 | if (reader.Name == "SavedScriptState" && reader.NodeType == XmlNodeType.Element) | ||
1276 | { | ||
1277 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Loading script state for {0}", Name); | ||
1278 | |||
1279 | if (m_savedScriptState == null) | ||
1280 | m_savedScriptState = new Dictionary<UUID, string>(); | ||
1281 | |||
1282 | string uuid = reader.GetAttribute("UUID"); | ||
1283 | |||
1284 | // Even if there is no UUID attribute for some strange reason, we must always read the inner XML | ||
1285 | // so we don't continually keep checking the same SavedScriptedState element. | ||
1286 | string innerXml = reader.ReadInnerXml(); | ||
1287 | |||
1288 | if (uuid != null) | ||
1289 | { | ||
1290 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name); | ||
1291 | |||
1292 | UUID itemid = new UUID(uuid); | ||
1293 | if (itemid != UUID.Zero) | ||
1294 | m_savedScriptState[itemid] = innerXml; | ||
1295 | } | ||
1296 | else | ||
1297 | { | ||
1298 | m_log.WarnFormat("[SCENE OBJECT GROUP]: SavedScriptState element had no UUID in object {0}", Name); | ||
1299 | } | ||
1300 | } | ||
1301 | else | ||
1302 | { | ||
1303 | if (!reader.Read()) | ||
1304 | break; | ||
1305 | } | ||
1306 | } | ||
1307 | } | ||
1308 | |||
1092 | /// <summary> | 1309 | /// <summary> |
1093 | /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. | 1310 | /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. |
1094 | /// </summary> | 1311 | /// </summary> |
1095 | public virtual void AttachToBackup() | 1312 | public virtual void AttachToBackup() |
1096 | { | 1313 | { |
1314 | <<<<<<< HEAD | ||
1315 | if (CanBeBackedUp) | ||
1316 | ======= | ||
1097 | if (IsAttachment) return; | 1317 | if (IsAttachment) return; |
1098 | m_scene.SceneGraph.FireAttachToBackup(this); | 1318 | m_scene.SceneGraph.FireAttachToBackup(this); |
1099 | 1319 | ||
1100 | if (InSceneBackup) | 1320 | if (InSceneBackup) |
1321 | >>>>>>> avn/ubitvar | ||
1101 | { | 1322 | { |
1102 | //m_log.DebugFormat( | 1323 | // m_log.DebugFormat( |
1103 | // "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID); | 1324 | // "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID); |
1104 | 1325 | ||
1105 | if (!m_isBackedUp) | 1326 | if (!Backup) |
1106 | m_scene.EventManager.OnBackup += ProcessBackup; | 1327 | m_scene.EventManager.OnBackup += ProcessBackup; |
1107 | 1328 | ||
1108 | m_isBackedUp = true; | 1329 | Backup = true; |
1109 | } | 1330 | } |
1110 | } | 1331 | } |
1111 | 1332 | ||
@@ -1210,12 +1431,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1210 | /// <returns></returns> | 1431 | /// <returns></returns> |
1211 | public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) | 1432 | public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) |
1212 | { | 1433 | { |
1434 | <<<<<<< HEAD | ||
1435 | maxX = -256f; | ||
1436 | maxY = -256f; | ||
1437 | maxZ = -256f; | ||
1438 | minX = 10000f; | ||
1439 | minY = 10000f; | ||
1440 | minZ = 10000f; | ||
1441 | ======= | ||
1213 | maxX = float.MinValue; | 1442 | maxX = float.MinValue; |
1214 | maxY = float.MinValue; | 1443 | maxY = float.MinValue; |
1215 | maxZ = float.MinValue; | 1444 | maxZ = float.MinValue; |
1216 | minX = float.MaxValue; | 1445 | minX = float.MaxValue; |
1217 | minY = float.MaxValue; | 1446 | minY = float.MaxValue; |
1218 | minZ = float.MaxValue; | 1447 | minZ = float.MaxValue; |
1448 | >>>>>>> avn/ubitvar | ||
1219 | 1449 | ||
1220 | SceneObjectPart[] parts = m_parts.GetArray(); | 1450 | SceneObjectPart[] parts = m_parts.GetArray(); |
1221 | foreach (SceneObjectPart part in parts) | 1451 | foreach (SceneObjectPart part in parts) |
@@ -1613,6 +1843,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1613 | } | 1843 | } |
1614 | } | 1844 | } |
1615 | 1845 | ||
1846 | <<<<<<< HEAD | ||
1847 | |||
1848 | /// <summary> | ||
1849 | /// | ||
1850 | /// </summary> | ||
1851 | /// <param name="part"></param> | ||
1852 | private void SetPartAsNonRoot(SceneObjectPart part) | ||
1853 | { | ||
1854 | part.ParentID = m_rootPart.LocalId; | ||
1855 | part.ClearUndoState(); | ||
1856 | ======= | ||
1616 | /// <summary> | 1857 | /// <summary> |
1617 | /// Add the avatar to this linkset (avatar is sat). | 1858 | /// Add the avatar to this linkset (avatar is sat). |
1618 | /// </summary> | 1859 | /// </summary> |
@@ -1652,6 +1893,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1652 | public List<ScenePresence> GetLinkedAvatars() | 1893 | public List<ScenePresence> GetLinkedAvatars() |
1653 | { | 1894 | { |
1654 | return m_linkedAvatars; | 1895 | return m_linkedAvatars; |
1896 | >>>>>>> avn/ubitvar | ||
1655 | } | 1897 | } |
1656 | 1898 | ||
1657 | /// <summary> | 1899 | /// <summary> |
@@ -1955,7 +2197,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1955 | 2197 | ||
1956 | if (Scene != null) | 2198 | if (Scene != null) |
1957 | { | 2199 | { |
2200 | <<<<<<< HEAD | ||
2201 | if (!sp.IsChildAgent && sp.ParentID == part.LocalId) | ||
2202 | sp.StandUp(); | ||
2203 | |||
2204 | if (!silent) | ||
2205 | ======= | ||
1958 | Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) | 2206 | Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) |
2207 | >>>>>>> avn/ubitvar | ||
1959 | { | 2208 | { |
1960 | if (avatar.ParentID == LocalId) | 2209 | if (avatar.ParentID == LocalId) |
1961 | avatar.StandUp(); | 2210 | avatar.StandUp(); |
@@ -2097,7 +2346,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2097 | /// <param name="datastore"></param> | 2346 | /// <param name="datastore"></param> |
2098 | public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup) | 2347 | public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup) |
2099 | { | 2348 | { |
2100 | if (!m_isBackedUp) | 2349 | if (!Backup) |
2101 | { | 2350 | { |
2102 | // m_log.DebugFormat( | 2351 | // m_log.DebugFormat( |
2103 | // "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); | 2352 | // "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); |
@@ -2187,7 +2436,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2187 | backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; | 2436 | backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; |
2188 | backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; | 2437 | backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; |
2189 | HasGroupChanged = false; | 2438 | HasGroupChanged = false; |
2190 | HasGroupChangedDueToDelink = false; | 2439 | GroupContainsForeignPrims = false; |
2191 | 2440 | ||
2192 | m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); | 2441 | m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); |
2193 | 2442 | ||
@@ -2255,6 +2504,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2255 | /// <returns></returns> | 2504 | /// <returns></returns> |
2256 | public SceneObjectGroup Copy(bool userExposed) | 2505 | public SceneObjectGroup Copy(bool userExposed) |
2257 | { | 2506 | { |
2507 | <<<<<<< HEAD | ||
2508 | // FIXME: This is dangerous since it's easy to forget to reset some references when necessary and end up | ||
2509 | // with bugs that only occur in some circumstances (e.g. crossing between regions on the same simulator | ||
2510 | // but not between regions on different simulators). Really, all copying should be done explicitly. | ||
2511 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); | ||
2512 | |||
2513 | dupe.Backup = false; | ||
2514 | dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>(); | ||
2515 | dupe.m_sittingAvatars = new List<ScenePresence>(); | ||
2516 | ======= | ||
2258 | m_dupeInProgress = true; | 2517 | m_dupeInProgress = true; |
2259 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); | 2518 | SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); |
2260 | dupe.m_isBackedUp = false; | 2519 | dupe.m_isBackedUp = false; |
@@ -2266,6 +2525,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2266 | dupe.m_linkedAvatars = new List<ScenePresence>(); | 2525 | dupe.m_linkedAvatars = new List<ScenePresence>(); |
2267 | dupe.m_sittingAvatars = new List<UUID>(); | 2526 | dupe.m_sittingAvatars = new List<UUID>(); |
2268 | 2527 | ||
2528 | >>>>>>> avn/ubitvar | ||
2269 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); | 2529 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); |
2270 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; | 2530 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; |
2271 | 2531 | ||
@@ -2440,16 +2700,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2440 | return RootPart.Torque; | 2700 | return RootPart.Torque; |
2441 | } | 2701 | } |
2442 | 2702 | ||
2703 | <<<<<<< HEAD | ||
2704 | public void MoveToTarget(Vector3 target, float tau) | ||
2705 | ======= | ||
2443 | // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object | 2706 | // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object |
2444 | public void moveToTarget(Vector3 target, float tau) | 2707 | public void moveToTarget(Vector3 target, float tau) |
2708 | >>>>>>> avn/ubitvar | ||
2445 | { | 2709 | { |
2446 | if (IsAttachment) | 2710 | if (IsAttachment) |
2447 | { | 2711 | { |
2448 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); | 2712 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
2713 | |||
2449 | if (avatar != null) | 2714 | if (avatar != null) |
2450 | { | ||
2451 | avatar.MoveToTarget(target, false, false); | 2715 | avatar.MoveToTarget(target, false, false); |
2452 | } | ||
2453 | } | 2716 | } |
2454 | else | 2717 | else |
2455 | { | 2718 | { |
@@ -2464,11 +2727,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
2464 | } | 2727 | } |
2465 | } | 2728 | } |
2466 | 2729 | ||
2467 | public void stopMoveToTarget() | 2730 | public void StopMoveToTarget() |
2468 | { | 2731 | { |
2469 | if (IsAttachment) | 2732 | if (IsAttachment) |
2470 | { | 2733 | { |
2471 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); | 2734 | ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); |
2735 | <<<<<<< HEAD | ||
2736 | |||
2737 | if (avatar != null) | ||
2738 | avatar.ResetMoveToTarget(); | ||
2739 | } | ||
2740 | else | ||
2741 | { | ||
2742 | PhysicsActor pa = RootPart.PhysActor; | ||
2743 | |||
2744 | if (pa != null && pa.PIDActive) | ||
2745 | { | ||
2746 | pa.PIDActive = false; | ||
2747 | |||
2748 | ScheduleGroupForTerseUpdate(); | ||
2749 | ======= | ||
2472 | if (avatar != null) | 2750 | if (avatar != null) |
2473 | { | 2751 | { |
2474 | avatar.ResetMoveToTarget(); | 2752 | avatar.ResetMoveToTarget(); |
@@ -2508,6 +2786,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2508 | rootpart.PhysActor.APIDDamping = damping; | 2786 | rootpart.PhysActor.APIDDamping = damping; |
2509 | rootpart.PhysActor.APIDActive = true; | 2787 | rootpart.PhysActor.APIDActive = true; |
2510 | } | 2788 | } |
2789 | >>>>>>> avn/ubitvar | ||
2511 | } | 2790 | } |
2512 | } | 2791 | } |
2513 | } | 2792 | } |
@@ -3055,7 +3334,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3055 | // objectGroup.m_rootPart = null; | 3334 | // objectGroup.m_rootPart = null; |
3056 | 3335 | ||
3057 | // If linking prims with different permissions, fix them | 3336 | // If linking prims with different permissions, fix them |
3058 | AdjustChildPrimPermissions(); | 3337 | AdjustChildPrimPermissions(false); |
3338 | |||
3339 | GroupContainsForeignPrims = true; | ||
3059 | 3340 | ||
3060 | AttachToBackup(); | 3341 | AttachToBackup(); |
3061 | 3342 | ||
@@ -3203,6 +3484,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3203 | 3484 | ||
3204 | linkPart.Rezzed = RootPart.Rezzed; | 3485 | linkPart.Rezzed = RootPart.Rezzed; |
3205 | 3486 | ||
3487 | <<<<<<< HEAD | ||
3488 | // We must persist the delinked group to the database immediately, for safety. The problem | ||
3489 | // is that although in memory the new group has a new SceneGroupID, in the database it | ||
3490 | // still has the parent group's SceneGroupID (until the next backup). This means that if the | ||
3491 | // parent group is deleted then the delinked group will also be deleted from the database. | ||
3492 | // This problem will disappear if the region remains alive long enough for another backup, | ||
3493 | // since at that time the delinked group's new SceneGroupID will be written to the database. | ||
3494 | // But if the region crashes before that then the prims will be permanently gone, and this must | ||
3495 | // not happen. (We can't use a just-in-time trick like GroupContainsForeignPrims in this case | ||
3496 | // because the delinked group doesn't know when the source group is deleted.) | ||
3497 | m_scene.ForceSceneObjectBackup(objectGroup); | ||
3498 | ======= | ||
3206 | // When we delete a group, we currently have to force persist to the database if the object id has changed | 3499 | // When we delete a group, we currently have to force persist to the database if the object id has changed |
3207 | // (since delete works by deleting all rows which have a given object id) | 3500 | // (since delete works by deleting all rows which have a given object id) |
3208 | 3501 | ||
@@ -3214,6 +3507,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3214 | m_rootPart.PhysActor.Building = false; | 3507 | m_rootPart.PhysActor.Building = false; |
3215 | 3508 | ||
3216 | objectGroup.HasGroupChangedDueToDelink = true; | 3509 | objectGroup.HasGroupChangedDueToDelink = true; |
3510 | >>>>>>> avn/ubitvar | ||
3217 | 3511 | ||
3218 | if (sendEvents) | 3512 | if (sendEvents) |
3219 | linkPart.TriggerScriptChangedEvent(Changed.LINK); | 3513 | linkPart.TriggerScriptChangedEvent(Changed.LINK); |
@@ -3227,12 +3521,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3227 | /// <param name="objectGroup"></param> | 3521 | /// <param name="objectGroup"></param> |
3228 | public virtual void DetachFromBackup() | 3522 | public virtual void DetachFromBackup() |
3229 | { | 3523 | { |
3524 | <<<<<<< HEAD | ||
3525 | if (Backup && Scene != null) | ||
3526 | ======= | ||
3230 | if (m_scene != null) | 3527 | if (m_scene != null) |
3231 | m_scene.SceneGraph.FireDetachFromBackup(this); | 3528 | m_scene.SceneGraph.FireDetachFromBackup(this); |
3232 | if (m_isBackedUp && Scene != null) | 3529 | if (m_isBackedUp && Scene != null) |
3530 | >>>>>>> avn/ubitvar | ||
3233 | m_scene.EventManager.OnBackup -= ProcessBackup; | 3531 | m_scene.EventManager.OnBackup -= ProcessBackup; |
3234 | 3532 | ||
3235 | m_isBackedUp = false; | 3533 | Backup = false; |
3236 | } | 3534 | } |
3237 | 3535 | ||
3238 | // This links an SOP from a previous linkset into my linkset. | 3536 | // This links an SOP from a previous linkset into my linkset. |
@@ -3295,20 +3593,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
3295 | /// If object is physical, apply force to move it around | 3593 | /// If object is physical, apply force to move it around |
3296 | /// If object is not physical, just put it at the resulting location | 3594 | /// If object is not physical, just put it at the resulting location |
3297 | /// </summary> | 3595 | /// </summary> |
3596 | /// <param name="partID">Part ID to check for grab</param> | ||
3298 | /// <param name="offset">Always seems to be 0,0,0, so ignoring</param> | 3597 | /// <param name="offset">Always seems to be 0,0,0, so ignoring</param> |
3299 | /// <param name="pos">New position. We do the math here to turn it into a force</param> | 3598 | /// <param name="pos">New position. We do the math here to turn it into a force</param> |
3300 | /// <param name="remoteClient"></param> | 3599 | /// <param name="remoteClient"></param> |
3301 | public void GrabMovement(Vector3 offset, Vector3 pos, IClientAPI remoteClient) | 3600 | public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClient) |
3302 | { | 3601 | { |
3303 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) | 3602 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) |
3304 | { | 3603 | { |
3604 | SceneObjectPart part = GetPart(partID); | ||
3605 | |||
3606 | if (part == null) | ||
3607 | return; | ||
3608 | |||
3305 | PhysicsActor pa = m_rootPart.PhysActor; | 3609 | PhysicsActor pa = m_rootPart.PhysActor; |
3306 | 3610 | ||
3307 | if (pa != null) | 3611 | if (pa != null) |
3308 | { | 3612 | { |
3309 | if (pa.IsPhysical) | 3613 | if (pa.IsPhysical) |
3310 | { | 3614 | { |
3311 | if (!m_rootPart.BlockGrab) | 3615 | if (!BlockGrabOverride && !part.BlockGrab) |
3312 | { | 3616 | { |
3313 | /* Vector3 llmoveforce = pos - AbsolutePosition; | 3617 | /* Vector3 llmoveforce = pos - AbsolutePosition; |
3314 | Vector3 grabforce = llmoveforce; | 3618 | Vector3 grabforce = llmoveforce; |
@@ -3323,20 +3627,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
3323 | } | 3627 | } |
3324 | else | 3628 | else |
3325 | { | 3629 | { |
3326 | //NonPhysicalGrabMovement(pos); | 3630 | NonPhysicalGrabMovement(pos); |
3327 | } | 3631 | } |
3328 | } | 3632 | } |
3329 | else | 3633 | else |
3330 | { | 3634 | { |
3331 | //NonPhysicalGrabMovement(pos); | 3635 | NonPhysicalGrabMovement(pos); |
3332 | } | 3636 | } |
3333 | } | 3637 | } |
3334 | } | 3638 | } |
3335 | 3639 | ||
3640 | /// <summary> | ||
3641 | /// Apply possition for grabbing non-physical linksets (Ctrl+Drag) | ||
3642 | /// This MUST be blocked for linksets that contain touch scripts because the viewer triggers grab on the touch | ||
3643 | /// event (Viewer Bug?) This would allow anyone to drag a linkset with a touch script. SL behaviour is also to | ||
3644 | /// block grab on prims with touch events. | ||
3645 | /// </summary> | ||
3646 | /// <param name="pos">New Position</param> | ||
3336 | public void NonPhysicalGrabMovement(Vector3 pos) | 3647 | public void NonPhysicalGrabMovement(Vector3 pos) |
3337 | { | 3648 | { |
3338 | AbsolutePosition = pos; | 3649 | if(!IsAttachment && ScriptCount() == 0) |
3339 | m_rootPart.SendTerseUpdateToAllClients(); | 3650 | UpdateGroupPosition(pos); |
3340 | } | 3651 | } |
3341 | 3652 | ||
3342 | /// <summary> | 3653 | /// <summary> |
@@ -3432,17 +3743,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
3432 | } | 3743 | } |
3433 | else | 3744 | else |
3434 | { | 3745 | { |
3435 | //NonPhysicalSpinMovement(pos); | 3746 | NonPhysicalSpinMovement(newOrientation); |
3436 | } | 3747 | } |
3437 | } | 3748 | } |
3438 | else | 3749 | else |
3439 | { | 3750 | { |
3440 | //NonPhysicalSpinMovement(pos); | 3751 | NonPhysicalSpinMovement(newOrientation); |
3441 | } | 3752 | } |
3442 | } | 3753 | } |
3443 | } | 3754 | } |
3444 | 3755 | ||
3445 | /// <summary> | 3756 | /// <summary> |
3757 | /// Apply rotation for spinning non-physical linksets (Ctrl+Shift+Drag) | ||
3758 | /// As with dragging, scripted objects must be blocked from spinning | ||
3759 | /// </summary> | ||
3760 | /// <param name="newOrientation">New Rotation</param> | ||
3761 | private void NonPhysicalSpinMovement(Quaternion newOrientation) | ||
3762 | { | ||
3763 | if(!IsAttachment && ScriptCount() == 0) | ||
3764 | UpdateGroupRotationR(newOrientation); | ||
3765 | } | ||
3766 | |||
3767 | /// <summary> | ||
3446 | /// Set the name of a prim | 3768 | /// Set the name of a prim |
3447 | /// </summary> | 3769 | /// </summary> |
3448 | /// <param name="name"></param> | 3770 | /// <param name="name"></param> |
@@ -3517,12 +3839,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3517 | 3839 | ||
3518 | SceneObjectPart selectionPart = GetPart(localID); | 3840 | SceneObjectPart selectionPart = GetPart(localID); |
3519 | 3841 | ||
3520 | if (SetTemporary && Scene != null) | 3842 | if (Scene != null) |
3521 | { | 3843 | { |
3522 | DetachFromBackup(); | 3844 | if (SetTemporary) |
3523 | // Remove from database and parcel prim count | 3845 | { |
3524 | // | 3846 | DetachFromBackup(); |
3525 | m_scene.DeleteFromStorage(UUID); | 3847 | // Remove from database and parcel prim count |
3848 | // | ||
3849 | m_scene.DeleteFromStorage(UUID); | ||
3850 | } | ||
3851 | else if (!Backup) | ||
3852 | { | ||
3853 | // Previously been temporary now switching back so make it | ||
3854 | // available for persisting again | ||
3855 | AttachToBackup(); | ||
3856 | } | ||
3857 | |||
3526 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | 3858 | m_scene.EventManager.TriggerParcelPrimCountTainted(); |
3527 | } | 3859 | } |
3528 | 3860 | ||
@@ -3611,7 +3943,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3611 | } | 3943 | } |
3612 | } | 3944 | } |
3613 | 3945 | ||
3614 | public void AdjustChildPrimPermissions() | 3946 | public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive) |
3615 | { | 3947 | { |
3616 | uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits | 3948 | uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits |
3617 | uint foldedPerms = RootPart.OwnerMask & 3; | 3949 | uint foldedPerms = RootPart.OwnerMask & 3; |
@@ -3621,11 +3953,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3621 | newOwnerMask &= part.BaseMask; | 3953 | newOwnerMask &= part.BaseMask; |
3622 | if (part != RootPart) | 3954 | if (part != RootPart) |
3623 | part.ClonePermissions(RootPart); | 3955 | part.ClonePermissions(RootPart); |
3956 | if (forceTaskInventoryPermissive) | ||
3957 | part.Inventory.ApplyGodPermissions(part.BaseMask); | ||
3624 | }); | 3958 | }); |
3625 | 3959 | ||
3626 | uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); | 3960 | uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); |
3627 | uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); | 3961 | uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); |
3628 | RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); | 3962 | RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); |
3963 | |||
3964 | // m_log.DebugFormat( | ||
3965 | // "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}", | ||
3966 | // (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name); | ||
3967 | |||
3629 | RootPart.ScheduleFullUpdate(); | 3968 | RootPart.ScheduleFullUpdate(); |
3630 | } | 3969 | } |
3631 | 3970 | ||
@@ -3634,6 +3973,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3634 | { | 3973 | { |
3635 | RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF); | 3974 | RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF); |
3636 | 3975 | ||
3976 | <<<<<<< HEAD | ||
3977 | AdjustChildPrimPermissions(Scene.Permissions.IsGod(AgentID)); | ||
3978 | ======= | ||
3637 | bool god = Scene.Permissions.IsGod(AgentID); | 3979 | bool god = Scene.Permissions.IsGod(AgentID); |
3638 | 3980 | ||
3639 | if (field == 1 && god) | 3981 | if (field == 1 && god) |
@@ -3645,6 +3987,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3645 | } | 3987 | } |
3646 | 3988 | ||
3647 | AdjustChildPrimPermissions(); | 3989 | AdjustChildPrimPermissions(); |
3990 | >>>>>>> avn/ubitvar | ||
3648 | 3991 | ||
3649 | if (field == 1 && god) // Base mask was set. Update all child part inventories | 3992 | if (field == 1 && god) // Base mask was set. Update all child part inventories |
3650 | { | 3993 | { |
@@ -4694,10 +5037,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4694 | /// down after it move one place down the list. | 5037 | /// down after it move one place down the list. |
4695 | /// </remarks> | 5038 | /// </remarks> |
4696 | /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns> | 5039 | /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns> |
4697 | public List<UUID> GetSittingAvatars() | 5040 | public List<ScenePresence> GetSittingAvatars() |
4698 | { | 5041 | { |
4699 | lock (m_sittingAvatars) | 5042 | lock (m_sittingAvatars) |
4700 | return new List<UUID>(m_sittingAvatars); | 5043 | return new List<ScenePresence>(m_sittingAvatars); |
4701 | } | 5044 | } |
4702 | 5045 | ||
4703 | /// <summary> | 5046 | /// <summary> |