diff options
author | Tom | 2011-09-07 09:42:18 -0700 |
---|---|---|
committer | Tom | 2011-09-07 09:42:18 -0700 |
commit | 03f6734f4367b08e2b181ed68bc80b885e76148f (patch) | |
tree | fa8550771d3b5eb1a0315f107801b332f78bede5 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | Now merging the core changes. (diff) | |
download | opensim-SC-03f6734f4367b08e2b181ed68bc80b885e76148f.zip opensim-SC-03f6734f4367b08e2b181ed68bc80b885e76148f.tar.gz opensim-SC-03f6734f4367b08e2b181ed68bc80b885e76148f.tar.bz2 opensim-SC-03f6734f4367b08e2b181ed68bc80b885e76148f.tar.xz |
First set of merge fixes
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 87 |
1 files changed, 26 insertions, 61 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 88a6232..35684e0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -350,10 +350,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
350 | { | 350 | { |
351 | get { return m_rotation; } | 351 | get { return m_rotation; } |
352 | set { | 352 | set { |
353 | foreach(SceneObjectPart p in m_parts.GetArray()) | ||
354 | { | ||
355 | p.StoreUndoState(UndoType.STATE_GROUP_ROTATION); | ||
356 | } | ||
357 | m_rotation = value; | 353 | m_rotation = value; |
358 | } | 354 | } |
359 | } | 355 | } |
@@ -487,8 +483,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
487 | SceneObjectPart[] parts = m_parts.GetArray(); | 483 | SceneObjectPart[] parts = m_parts.GetArray(); |
488 | foreach (SceneObjectPart part in parts) | 484 | foreach (SceneObjectPart part in parts) |
489 | { | 485 | { |
490 | part.IgnoreUndoUpdate = false; | ||
491 | part.StoreUndoState(UndoType.STATE_GROUP_POSITION); | ||
492 | part.GroupPosition = val; | 486 | part.GroupPosition = val; |
493 | if (!m_dupeInProgress) | 487 | if (!m_dupeInProgress) |
494 | { | 488 | { |
@@ -1193,45 +1187,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
1193 | /// <param name="agentID"></param> | 1187 | /// <param name="agentID"></param> |
1194 | /// <param name="attachmentpoint"></param> | 1188 | /// <param name="attachmentpoint"></param> |
1195 | /// <param name="AttachOffset"></param> | 1189 | /// <param name="AttachOffset"></param> |
1196 | public void AttachToAgent(UUID agentID, uint attachmentpoint, Vector3 AttachOffset, bool silent) | 1190 | private void AttachToAgent( |
1191 | ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) | ||
1197 | { | 1192 | { |
1198 | ScenePresence avatar = m_scene.GetScenePresence(agentID); | ||
1199 | if (avatar != null) | 1193 | if (avatar != null) |
1200 | { | 1194 | { |
1201 | // don't attach attachments to child agents | 1195 | // don't attach attachments to child agents |
1202 | if (avatar.IsChildAgent) return; | 1196 | if (avatar.IsChildAgent) return; |
1203 | 1197 | ||
1204 | // m_log.DebugFormat("[SOG]: Adding attachment {0} to avatar {1}", Name, avatar.Name); | ||
1205 | |||
1206 | DetachFromBackup(); | ||
1207 | |||
1208 | // Remove from database and parcel prim count | 1198 | // Remove from database and parcel prim count |
1209 | m_scene.DeleteFromStorage(UUID); | 1199 | m_scene.DeleteFromStorage(so.UUID); |
1210 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | 1200 | m_scene.EventManager.TriggerParcelPrimCountTainted(); |
1211 | 1201 | ||
1212 | m_rootPart.AttachedAvatar = agentID; | 1202 | so.AttachedAvatar = avatar.UUID; |
1213 | 1203 | ||
1214 | //Anakin Lohner bug #3839 | 1204 | if (so.RootPart.PhysActor != null) |
1215 | lock (m_parts) | ||
1216 | { | 1205 | { |
1217 | foreach (SceneObjectPart p in m_parts.GetArray()) | 1206 | m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor); |
1218 | { | 1207 | so.RootPart.PhysActor = null; |
1219 | p.AttachedAvatar = agentID; | ||
1220 | } | ||
1221 | } | 1208 | } |
1222 | 1209 | ||
1223 | if (m_rootPart.PhysActor != null) | 1210 | so.AbsolutePosition = attachOffset; |
1224 | { | 1211 | so.RootPart.AttachedPos = attachOffset; |
1225 | m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor); | 1212 | so.IsAttachment = true; |
1226 | m_rootPart.PhysActor = null; | 1213 | so.RootPart.SetParentLocalId(avatar.LocalId); |
1227 | } | 1214 | so.AttachmentPoint = attachmentpoint; |
1228 | |||
1229 | AbsolutePosition = AttachOffset; | ||
1230 | m_rootPart.AttachedPos = AttachOffset; | ||
1231 | m_rootPart.IsAttachment = true; | ||
1232 | |||
1233 | m_rootPart.SetParentLocalId(avatar.LocalId); | ||
1234 | SetAttachmentPoint(Convert.ToByte(attachmentpoint)); | ||
1235 | 1215 | ||
1236 | avatar.AddAttachment(this); | 1216 | avatar.AddAttachment(this); |
1237 | 1217 | ||
@@ -1254,7 +1234,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1254 | { | 1234 | { |
1255 | m_log.WarnFormat( | 1235 | m_log.WarnFormat( |
1256 | "[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present", | 1236 | "[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present", |
1257 | UUID, agentID, Scene.RegionInfo.RegionName); | 1237 | UUID, avatar.ControllingClient.AgentId, Scene.RegionInfo.RegionName); |
1258 | } | 1238 | } |
1259 | } | 1239 | } |
1260 | 1240 | ||
@@ -1263,11 +1243,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1263 | return m_rootPart.Shape.State; | 1243 | return m_rootPart.Shape.State; |
1264 | } | 1244 | } |
1265 | 1245 | ||
1266 | public void ClearPartAttachmentData() | ||
1267 | { | ||
1268 | SetAttachmentPoint((Byte)0); | ||
1269 | } | ||
1270 | |||
1271 | public void DetachToGround() | 1246 | public void DetachToGround() |
1272 | { | 1247 | { |
1273 | ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); | 1248 | ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); |
@@ -1788,19 +1763,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1788 | 1763 | ||
1789 | // This is only necessary when userExposed is false! | 1764 | // This is only necessary when userExposed is false! |
1790 | 1765 | ||
1791 | bool previousAttachmentStatus = dupe.IsAttachment; | 1766 | bool previousAttachmentStatus = dupe.IsAttachment; |
1792 | 1767 | ||
1793 | if (!userExposed) | 1768 | if (!userExposed) |
1794 | dupe.IsAttachment = true; | 1769 | dupe.IsAttachment = true; |
1795 | 1770 | ||
1796 | if (!userExposed) | 1771 | if (!userExposed) |
1797 | dupe.RootPart.IsAttachment = true; | 1772 | dupe.RootPart.IsAttachment = true; |
1798 | 1773 | ||
1799 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); | 1774 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
1800 | if (!userExposed) | 1775 | if (!userExposed) |
1801 | { | 1776 | { |
1802 | dupe.IsAttachment = previousAttachmentStatus; | 1777 | dupe.IsAttachment = previousAttachmentStatus; |
1803 | } | 1778 | } |
1804 | 1779 | ||
1805 | if (!userExposed) | 1780 | if (!userExposed) |
1806 | { | 1781 | { |
@@ -1855,8 +1830,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1855 | dupe.UpdateParentIDs(); | 1830 | dupe.UpdateParentIDs(); |
1856 | dupe.HasGroupChanged = true; | 1831 | dupe.HasGroupChanged = true; |
1857 | dupe.AttachToBackup(); | 1832 | dupe.AttachToBackup(); |
1858 | 1833 | } | |
1859 | ScheduleGroupForFullUpdate(); | 1834 | ScheduleGroupForFullUpdate(); |
1860 | // Need to duplicate the physics actor as well | 1835 | // Need to duplicate the physics actor as well |
1861 | if (part.PhysActor != null && userExposed) | 1836 | if (part.PhysActor != null && userExposed) |
1862 | { | 1837 | { |
@@ -3175,7 +3150,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3175 | { | 3150 | { |
3176 | if (IsAttachment) | 3151 | if (IsAttachment) |
3177 | { | 3152 | { |
3178 | m_rootPart.StoreUndoState(UndoType.STATE_GROUP_POSITION); | ||
3179 | m_rootPart.AttachedPos = pos; | 3153 | m_rootPart.AttachedPos = pos; |
3180 | } | 3154 | } |
3181 | if (RootPart.GetStatusSandbox()) | 3155 | if (RootPart.GetStatusSandbox()) |
@@ -3207,9 +3181,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3207 | { | 3181 | { |
3208 | SceneObjectPart part = GetChildPart(localID); | 3182 | SceneObjectPart part = GetChildPart(localID); |
3209 | 3183 | ||
3210 | // SceneObjectPart[] parts = m_parts.GetArray(); | 3184 | SceneObjectPart[] parts = m_parts.GetArray(); |
3211 | // for (int i = 0; i < parts.Length; i++) | 3185 | for (int i = 0; i < parts.Length; i++) |
3212 | // parts[i].StoreUndoState(); | 3186 | parts[i].StoreUndoState(); |
3213 | 3187 | ||
3214 | if (part != null) | 3188 | if (part != null) |
3215 | { | 3189 | { |
@@ -3368,8 +3342,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3368 | { | 3342 | { |
3369 | SceneObjectPart part = GetChildPart(localID); | 3343 | SceneObjectPart part = GetChildPart(localID); |
3370 | SceneObjectPart[] parts = m_parts.GetArray(); | 3344 | SceneObjectPart[] parts = m_parts.GetArray(); |
3371 | for (int i = 0; i < parts.Length; i++) | ||
3372 | parts[i].StoreUndoState(UndoType.STATE_PRIM_ROTATION); | ||
3373 | 3345 | ||
3374 | if (part != null) | 3346 | if (part != null) |
3375 | { | 3347 | { |
@@ -3440,14 +3412,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3440 | 3412 | ||
3441 | Quaternion axRot = rot; | 3413 | Quaternion axRot = rot; |
3442 | Quaternion oldParentRot = m_rootPart.RotationOffset; | 3414 | Quaternion oldParentRot = m_rootPart.RotationOffset; |
3443 | 3415 | m_rootPart.StoreUndoState(); | |
3444 | m_rootPart.StoreUndoState(UndoType.STATE_PRIM_ROTATION); | ||
3445 | bool cancelUndo = false; | ||
3446 | if (!m_rootPart.Undoing) | ||
3447 | { | ||
3448 | m_rootPart.Undoing = true; | ||
3449 | cancelUndo = true; | ||
3450 | } | ||
3451 | 3416 | ||
3452 | //Don't use UpdateRotation because it schedules an update prematurely | 3417 | //Don't use UpdateRotation because it schedules an update prematurely |
3453 | m_rootPart.RotationOffset = rot; | 3418 | m_rootPart.RotationOffset = rot; |