From cda4cd6b551156ed503a5f284ad6c5a9a0e1c5a5 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 14 Sep 2011 18:46:42 -0700 Subject: Merge fixes, and fix the build --- .../Framework/Interfaces/IAttachmentsModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 87 ++++++----- .../Region/Framework/Scenes/SceneObjectGroup.cs | 166 ++++++++------------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 + OpenSim/Region/Framework/Scenes/ScenePresence.cs | 98 +----------- OpenSim/Region/Framework/Scenes/UndoState.cs | 127 +++++----------- 6 files changed, 161 insertions(+), 327 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 6bbdd7d..59c26e7 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -103,7 +103,7 @@ namespace OpenSim.Region.Framework.Interfaces IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus); // Same as above, but also load script states from a separate doc - UUID RezSingleAttachmentFromInventory( + ISceneEntity RezSingleAttachmentFromInventory( IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc); /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 345c2df..a661ab8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2695,9 +2695,9 @@ namespace OpenSim.Region.Framework.Scenes EventManager.TriggerOnClientLogin(client); // Send initial parcel data - Vector3 pos = presence.AbsolutePosition; + Vector3 pos = createdSp.AbsolutePosition; ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); - land.SendLandUpdateToClient(presence.ControllingClient); + land.SendLandUpdateToClient(client); } } } @@ -3500,7 +3500,7 @@ namespace OpenSim.Region.Framework.Scenes // check if banned regions are to be blacked out. if (vialogin || (!m_seeIntoBannedRegion)) { - if (!AuthorizeUser(agent.AgentID, out reason)) + if (!AuthorizeUser(agent, out reason)) return false; } } @@ -3696,47 +3696,31 @@ namespace OpenSim.Region.Framework.Scenes /// outputs the reason to this string /// True if the region accepts this agent. False if it does not. False will /// also return a reason. - protected virtual bool AuthorizeUser(UUID agentID, out string reason) + protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason) { reason = String.Empty; if (!m_strictAccessControl) return true; - if (Permissions.IsGod(agentID)) return true; - + if (Permissions.IsGod(agent.AgentID)) return true; + if (AuthorizationService != null) { if (!AuthorizationService.IsAuthorizedForRegion( agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) { - m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the region", - agentID, RegionInfo.RegionName); - + m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", + agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); + return false; } } if (m_regInfo.EstateSettings != null) { - int flags = GetUserFlags(agentID); - if (m_regInfo.EstateSettings.IsBanned(agentID, flags)) + if (m_regInfo.EstateSettings.IsBanned(agent.AgentID,0)) { - //Add some more info to help users - if (!m_regInfo.EstateSettings.IsBanned(agentID, 32)) - { - m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the region requires age verification", - agentID, RegionInfo.RegionName); - reason = String.Format("Denied access to region {0}: Region requires age verification", RegionInfo.RegionName); - return false; - } - if (!m_regInfo.EstateSettings.IsBanned(agentID, 4)) - { - m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} {1} because the region requires payment info on file", - agentID, RegionInfo.RegionName); - reason = String.Format("Denied access to region {0}: Region requires payment info on file", RegionInfo.RegionName); - return false; - } - m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {3} because the user is on the banlist", - agentID, RegionInfo.RegionName); + m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", + agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); reason = String.Format("Denied access to region {0}: You have been banned from that region.", RegionInfo.RegionName); return false; @@ -3753,7 +3737,7 @@ namespace OpenSim.Region.Framework.Scenes if (groupsModule != null) { GroupMembershipData[] GroupMembership = - groupsModule.GetMembershipData(agentID); + groupsModule.GetMembershipData(agent.AgentID); if (GroupMembership != null) { @@ -3782,16 +3766,44 @@ namespace OpenSim.Region.Framework.Scenes m_log.ErrorFormat("[CONNECTION BEGIN]: EstateGroups is null!"); if (!m_regInfo.EstateSettings.PublicAccess && - !m_regInfo.EstateSettings.HasAccess(agentID) && + !m_regInfo.EstateSettings.HasAccess(agent.AgentID) && !groupAccess) { - m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user does not have access to the estate", - agentID, RegionInfo.RegionName); + m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the estate", + agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", RegionInfo.RegionName); return false; } + // TODO: estate/region settings are not properly hooked up + // to ILandObject.isRestrictedFromLand() + // if (null != LandChannel) + // { + // // region seems to have local Id of 1 + // ILandObject land = LandChannel.GetLandObject(1); + // if (null != land) + // { + // if (land.isBannedFromLand(agent.AgentID)) + // { + // m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user has been banned from land", + // agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); + // reason = String.Format("Denied access to private region {0}: You are banned from that region.", + // RegionInfo.RegionName); + // return false; + // } + + // if (land.isRestrictedFromLand(agent.AgentID)) + // { + // m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", + // agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); + // reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", + // RegionInfo.RegionName); + // return false; + // } + // } + // } + return true; } @@ -5387,9 +5399,16 @@ namespace OpenSim.Region.Framework.Scenes } } - if (!AuthorizeUser(agentID, out reason)) + try + { + if (!AuthorizeUser(GetScenePresence(agentID).ControllingClient.RequestClientInfo(), out reason)) + { + // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); + return false; + } + } + catch { - // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); return false; } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 35684e0..ea6aab0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1245,7 +1245,7 @@ namespace OpenSim.Region.Framework.Scenes public void DetachToGround() { - ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); + ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); if (avatar == null) return; @@ -1259,14 +1259,14 @@ namespace OpenSim.Region.Framework.Scenes RootPart.FromItemID = UUID.Zero; AbsolutePosition = detachedpos; - m_rootPart.AttachedAvatar = UUID.Zero; + AttachedAvatar = UUID.Zero; - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].AttachedAvatar = UUID.Zero; + //SceneObjectPart[] parts = m_parts.GetArray(); + //for (int i = 0; i < parts.Length; i++) + // parts[i].AttachedAvatar = UUID.Zero; m_rootPart.SetParentLocalId(0); - SetAttachmentPoint((byte)0); + AttachmentPoint = (byte)0; m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_scene.m_physicalPrim); HasGroupChanged = true; RootPart.Rezzed = DateTime.Now; @@ -1279,7 +1279,7 @@ namespace OpenSim.Region.Framework.Scenes public void DetachToInventoryPrep() { - ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); + ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); //Vector3 detachedpos = new Vector3(127f, 127f, 127f); if (avatar != null) { @@ -1287,15 +1287,15 @@ namespace OpenSim.Region.Framework.Scenes avatar.RemoveAttachment(this); } - m_rootPart.AttachedAvatar = UUID.Zero; + AttachedAvatar = UUID.Zero; - SceneObjectPart[] parts = m_parts.GetArray(); + /*SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) - parts[i].AttachedAvatar = UUID.Zero; + parts[i].AttachedAvatar = UUID.Zero;*/ m_rootPart.SetParentLocalId(0); //m_rootPart.SetAttachmentPoint((byte)0); - m_rootPart.IsAttachment = false; + IsAttachment = false; AbsolutePosition = m_rootPart.AttachedPos; //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); //AttachToBackup(); @@ -1471,7 +1471,7 @@ namespace OpenSim.Region.Framework.Scenes public void DeleteGroupFromScene(bool silent) { // We need to keep track of this state in case this group is still queued for backup. - m_isDeleted = true; + IsDeleted = true; DetachFromBackup(); @@ -1746,97 +1746,63 @@ namespace OpenSim.Region.Framework.Scenes /// public SceneObjectGroup Copy(bool userExposed) { - SceneObjectGroup dupe; - try - { - m_dupeInProgress = true; - dupe = (SceneObjectGroup)MemberwiseClone(); - dupe.m_isBackedUp = false; - dupe.m_parts = new MapAndArray(); + SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); + dupe.m_isBackedUp = false; + dupe.m_parts = new MapAndArray(); - // Warning, The following code related to previousAttachmentStatus is needed so that clones of - // attachments do not bordercross while they're being duplicated. This is hacktastic! - // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! - // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state - // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, - // then restore it's attachment state + // Warning, The following code related to previousAttachmentStatus is needed so that clones of + // attachments do not bordercross while they're being duplicated. This is hacktastic! + // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! + // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state + // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, + // then restore it's attachment state - // This is only necessary when userExposed is false! + // This is only necessary when userExposed is false! - bool previousAttachmentStatus = dupe.IsAttachment; - - if (!userExposed) - dupe.IsAttachment = true; + bool previousAttachmentStatus = dupe.IsAttachment; - if (!userExposed) - dupe.RootPart.IsAttachment = true; + if (!userExposed) + dupe.IsAttachment = true; - dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); - if (!userExposed) - { - dupe.IsAttachment = previousAttachmentStatus; - } + dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); - if (!userExposed) - { - dupe.RootPart.IsAttachment = previousAttachmentStatus; - } + if (!userExposed) + { + dupe.IsAttachment = previousAttachmentStatus; + } - dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); - dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; + dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); + dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; - if (userExposed) - dupe.m_rootPart.TrimPermissions(); + if (userExposed) + dupe.m_rootPart.TrimPermissions(); - List partList = new List(m_parts.GetArray()); + List partList = new List(m_parts.GetArray()); - partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) - { - return p1.LinkNum.CompareTo(p2.LinkNum); - } - ); + partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) + { + return p1.LinkNum.CompareTo(p2.LinkNum); + } + ); - foreach (SceneObjectPart part in partList) + foreach (SceneObjectPart part in partList) + { + SceneObjectPart newPart; + if (part.UUID != m_rootPart.UUID) { - if (part.UUID != m_rootPart.UUID) - { - SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); - - newPart.LinkNum = part.LinkNum; - } - - // Need to duplicate the physics actor as well - if (part.PhysActor != null && userExposed) - { - PrimitiveBaseShape pbs = part.Shape; - - part.PhysActor - = m_scene.PhysicsScene.AddPrimShape( - string.Format("{0}/{1}", part.Name, part.UUID), - pbs, - part.AbsolutePosition, - part.Scale, - part.RotationOffset, - part.PhysActor.IsPhysical, - m_localId); - part.PhysActor.SetMaterial((int)part.Material); - - part.PhysActor.LocalID = part.LocalId; - part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); - } + newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); + newPart.LinkNum = part.LinkNum; } - if (userExposed) + else { - dupe.UpdateParentIDs(); - dupe.HasGroupChanged = true; - dupe.AttachToBackup(); + newPart = dupe.m_rootPart; } - ScheduleGroupForFullUpdate(); + // Need to duplicate the physics actor as well if (part.PhysActor != null && userExposed) { PrimitiveBaseShape pbs = newPart.Shape; - + newPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( string.Format("{0}/{1}", newPart.Name, newPart.UUID), @@ -1846,14 +1812,20 @@ namespace OpenSim.Region.Framework.Scenes newPart.RotationOffset, part.PhysActor.IsPhysical, newPart.LocalId); - + newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); } } - finally + + if (userExposed) { - m_dupeInProgress = false; + dupe.UpdateParentIDs(); + dupe.HasGroupChanged = true; + dupe.AttachToBackup(); + + ScheduleGroupForFullUpdate(); } + return dupe; } @@ -1983,22 +1955,8 @@ namespace OpenSim.Region.Framework.Scenes public void stopMoveToTarget() { - SceneObjectPart rootpart = m_rootPart; - if (rootpart != null) - { - if (IsAttachment) - { - ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); - if (avatar != null) avatar.StopMoveToPosition(); - } - else - { - if (rootpart.PhysActor != null) - { - rootpart.PhysActor.PIDActive = false; - } - } - } + if (RootPart.PhysActor != null) + RootPart.PhysActor.PIDActive = false; } public void rotLookAt(Quaternion target, float strength, float damping) @@ -3087,8 +3045,6 @@ namespace OpenSim.Region.Framework.Scenes prevScale.X *= x; prevScale.Y *= y; prevScale.Z *= z; - part.IgnoreUndoUpdate = false; - // RootPart.IgnoreUndoUpdate = true; RootPart.Resize(prevScale); // RootPart.IgnoreUndoUpdate = false; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6988718..0c3b404 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3243,6 +3243,14 @@ namespace OpenSim.Region.Framework.Scenes STATUS_ROTATE_Z = rotate; } + public void SetBuoyancy(float fvalue) + { + if (PhysActor != null) + { + PhysActor.Buoyancy = fvalue; + } + } + public void SetDieAtEdge(bool p) { if (m_parentGroup.IsDeleted) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8ee7d89..35a8df7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -131,6 +131,7 @@ namespace OpenSim.Region.Framework.Scenes // private SceneObjectGroup proxyObjectGroup; //private SceneObjectPart proxyObjectPart = null; public Vector3 lastKnownAllowedPosition; + public bool sentMessageAboutRestrictedParcelFlyingDown; public Vector4 CollisionPlane = Vector4.UnitW; private Vector3 m_avInitialPos; // used to calculate unscripted sit rotation @@ -4316,103 +4317,6 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju return flags; } - /// - /// RezAttachments. This should only be called upon login on the first region. - /// Attachment rezzings on crossings and TPs are done in a different way. - /// - public void RezAttachments() - { - if (null == m_appearance) - { - m_log.WarnFormat("[ATTACHMENT]: Appearance has not been initialized for agent {0}", UUID); - return; - } - - XmlDocument doc = new XmlDocument(); - string stateData = String.Empty; - - IAttachmentsService attServ = m_scene.RequestModuleInterface(); - if (attServ != null) - { - m_log.DebugFormat("[ATTACHMENT]: Loading attachment data from attachment service"); - stateData = attServ.Get(ControllingClient.AgentId.ToString()); - if (stateData != String.Empty) - { - try - { - doc.LoadXml(stateData); - } - catch { } - } - } - - Dictionary itemData = new Dictionary(); - - XmlNodeList nodes = doc.GetElementsByTagName("Attachment"); - if (nodes.Count > 0) - { - foreach (XmlNode n in nodes) - { - XmlElement elem = (XmlElement)n; - string itemID = elem.GetAttribute("ItemID"); - string xml = elem.InnerXml; - - itemData[new UUID(itemID)] = xml; - } - } - - List attachments = m_appearance.GetAttachments(); - foreach (AvatarAttachment attach in attachments) - { - if (IsDeleted) - return; - - int p = attach.AttachPoint; - UUID itemID = attach.ItemID; - - //UUID assetID = attach.AssetID; - // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down - // But they're not used anyway, the item is being looked up for now, so let's proceed. - //if (UUID.Zero == assetID) - //{ - // m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID); - // continue; - //} - - try - { - string xmlData; - XmlDocument d = new XmlDocument(); - UUID asset; - if (itemData.TryGetValue(itemID, out xmlData)) - { - d.LoadXml(xmlData); - m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", itemID); - - // Rez from inventory - asset - = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, d); - - } - else - { - // Rez from inventory (with a null doc to let - // CHANGED_OWNER happen) - asset - = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, null); - } - - m_log.InfoFormat( - "[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2}", - p, itemID, asset); - } - catch (Exception e) - { - m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}{1}", e.Message, e.StackTrace); - } - } - } - private void ReprioritizeUpdates() { if (Scene.IsReprioritizationEnabled && Scene.UpdatePrioritizationScheme != UpdatePrioritizationSchemes.Time) diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 81f41db..0a30f4b 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -50,16 +50,11 @@ namespace OpenSim.Region.Framework.Scenes public class UndoState { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public Vector3 Position = Vector3.Zero; public Vector3 Scale = Vector3.Zero; public Quaternion Rotation = Quaternion.Identity; - public Vector3 GroupPosition = Vector3.Zero; - public Quaternion GroupRotation = Quaternion.Identity; - public Vector3 GroupScale = Vector3.Zero; - public DateTime LastUpdated = DateTime.Now; - public UndoType Type; /// /// Is this undo state for an entire group? @@ -77,88 +72,40 @@ namespace OpenSim.Region.Framework.Scenes { ForGroup = forGroup; -// if (ForGroup) - GroupScale = part.ParentGroup.RootPart.Shape.Scale; + // if (ForGroup) + Position = part.ParentGroup.AbsolutePosition; + // else + // Position = part.OffsetPosition; - //FUBAR WARNING: Do NOT get the group's absoluteposition here - //or you'll experience a loop and/or a stack issue - GroupPosition = part.ParentGroup.RootPart.AbsolutePosition; - GroupRotation = part.ParentGroup.GroupRotation; - Position = part.ParentGroup.RootPart.AbsolutePosition; -// else -// Position = part.OffsetPosition; - -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo position {0} for root part", Position); + // m_log.DebugFormat( + // "[UNDO STATE]: Storing undo position {0} for root part", Position); Rotation = part.RotationOffset; -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); + // m_log.DebugFormat( + // "[UNDO STATE]: Storing undo rotation {0} for root part", Rotation); Scale = part.Shape.Scale; -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo scale {0} for root part", Scale); + // m_log.DebugFormat( + // "[UNDO STATE]: Storing undo scale {0} for root part", Scale); } else { Position = part.OffsetPosition; -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo position {0} for child part", Position); + // m_log.DebugFormat( + // "[UNDO STATE]: Storing undo position {0} for child part", Position); Rotation = part.RotationOffset; -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); + // m_log.DebugFormat( + // "[UNDO STATE]: Storing undo rotation {0} for child part", Rotation); Scale = part.Shape.Scale; -// m_log.DebugFormat( -// "[UNDO STATE]: Storing undo scale {0} for child part", Scale); - } - } - public void Merge(UndoState last) - { - if ((Type & UndoType.STATE_GROUP_POSITION) == 0 || ((last.Type & UndoType.STATE_GROUP_POSITION) >= (Type & UndoType.STATE_GROUP_POSITION))) - { - GroupPosition = last.GroupPosition; - Position = last.Position; - } - if ((Type & UndoType.STATE_GROUP_SCALE) == 0 || ((last.Type & UndoType.STATE_GROUP_SCALE) >= (Type & UndoType.STATE_GROUP_SCALE))) - { - GroupScale = last.GroupScale; - Scale = last.Scale; - } - if ((Type & UndoType.STATE_GROUP_ROTATION) == 0 || ((last.Type & UndoType.STATE_GROUP_ROTATION) >= (Type & UndoType.STATE_GROUP_ROTATION))) - { - GroupRotation = last.GroupRotation; - Rotation = last.Rotation; - } - if ((Type & UndoType.STATE_PRIM_POSITION) == 0 || ((last.Type & UndoType.STATE_PRIM_POSITION) >= (Type & UndoType.STATE_PRIM_POSITION))) - { - Position = last.Position; - } - if ((Type & UndoType.STATE_PRIM_SCALE) == 0 || ((last.Type & UndoType.STATE_PRIM_SCALE) >= (Type & UndoType.STATE_PRIM_SCALE))) - { - Scale = last.Scale; - } - if ((Type & UndoType.STATE_PRIM_ROTATION) == 0 || ((last.Type & UndoType.STATE_PRIM_ROTATION) >= (Type & UndoType.STATE_PRIM_ROTATION))) - { - Rotation = last.Rotation; - } - Type = Type | last.Type; - } - public bool Compare(UndoState undo) - { - if (undo == null || Position == null) return false; - if (undo.Position == Position && undo.Rotation == Rotation && undo.Scale == Scale && undo.GroupPosition == GroupPosition && undo.GroupScale == GroupScale && undo.GroupRotation == GroupRotation) - { - return true; - } - else - { - return false; + // m_log.DebugFormat( + // "[UNDO STATE]: Storing undo scale {0} for child part", Scale); } } + /// /// Compare the relevant state in the given part to this state. /// @@ -183,15 +130,15 @@ namespace OpenSim.Region.Framework.Scenes return false; } - private void RestoreState(SceneObjectPart part) + public void PlaybackState(SceneObjectPart part) { part.Undoing = true; if (part.ParentID == 0) { -// m_log.DebugFormat( -// "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", -// Position, part.Name, part.LocalId); + // m_log.DebugFormat( + // "[UNDO STATE]: Undoing position to {0} for root part {1} {2}", + // Position, part.Name, part.LocalId); if (Position != Vector3.Zero) { @@ -201,9 +148,9 @@ namespace OpenSim.Region.Framework.Scenes part.ParentGroup.UpdateRootPosition(Position); } -// m_log.DebugFormat( -// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", -// part.RotationOffset, Rotation, part.Name, part.LocalId); + // m_log.DebugFormat( + // "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}", + // part.RotationOffset, Rotation, part.Name, part.LocalId); if (ForGroup) part.UpdateRotation(Rotation); @@ -212,9 +159,9 @@ namespace OpenSim.Region.Framework.Scenes if (Scale != Vector3.Zero) { -// m_log.DebugFormat( -// "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", -// part.Shape.Scale, Scale, part.Name, part.LocalId); + // m_log.DebugFormat( + // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", + // part.Shape.Scale, Scale, part.Name, part.LocalId); if (ForGroup) part.ParentGroup.GroupResize(Scale); @@ -228,24 +175,24 @@ namespace OpenSim.Region.Framework.Scenes { if (Position != Vector3.Zero) { -// m_log.DebugFormat( -// "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", -// part.OffsetPosition, Position, part.Name, part.LocalId); + // m_log.DebugFormat( + // "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}", + // part.OffsetPosition, Position, part.Name, part.LocalId); part.OffsetPosition = Position; } -// m_log.DebugFormat( -// "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", -// part.RotationOffset, Rotation, part.Name, part.LocalId); + // m_log.DebugFormat( + // "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}", + // part.RotationOffset, Rotation, part.Name, part.LocalId); part.UpdateRotation(Rotation); if (Scale != Vector3.Zero) { -// m_log.DebugFormat( -// "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", -// part.Shape.Scale, Scale, part.Name, part.LocalId); + // m_log.DebugFormat( + // "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}", + // part.Shape.Scale, Scale, part.Name, part.LocalId); part.Resize(Scale); } -- cgit v1.1