From df0e5cc9fe9b0851ae5442bdeeb49ab7778d5fe1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 12 Jul 2011 02:33:09 +0100 Subject: When a mesh object is added to a scene, delay adding the physics actor until the sculpt data has been added to the shape (possibly via an async asset service request) This prevents spurious 'no asset data' for meshes added on startup. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fa23fcd..905acd6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -584,7 +584,7 @@ namespace OpenSim.Region.Framework.Scenes part.ParentID = m_rootPart.LocalId; //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } - + ApplyPhysics(m_scene.m_physicalPrim); // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled -- cgit v1.1 From b55076990c3ba27bc9a0ca716031928fae887deb Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 14 Jul 2011 12:38:35 -0700 Subject: fix duplication of physical objects for physics engines that care about the initial value of localID --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 905acd6..343a8fd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1463,16 +1463,16 @@ namespace OpenSim.Region.Framework.Scenes // Need to duplicate the physics actor as well if (part.PhysActor != null && userExposed) { - PrimitiveBaseShape pbs = part.Shape; + PrimitiveBaseShape pbs = newPart.Shape; newPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( - part.LocalId, - string.Format("{0}/{1}", part.Name, part.UUID), + newPart.LocalId, + string.Format("{0}/{1}", newPart.Name, newPart.UUID), pbs, - part.AbsolutePosition, - part.Scale, - part.RotationOffset, + newPart.AbsolutePosition, + newPart.Scale, + newPart.RotationOffset, part.PhysActor.IsPhysical); newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); -- cgit v1.1 From e9dbe54ab1217e4310b0e7e014516363237e2a21 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 15 Jul 2011 20:07:59 +0100 Subject: Fix some local id issues in physics glue --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 343a8fd..0fbd746 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1467,13 +1467,13 @@ namespace OpenSim.Region.Framework.Scenes newPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( - newPart.LocalId, string.Format("{0}/{1}", newPart.Name, newPart.UUID), pbs, newPart.AbsolutePosition, newPart.Scale, newPart.RotationOffset, - part.PhysActor.IsPhysical); + part.PhysActor.IsPhysical, + newPart.LocalId); newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); } -- cgit v1.1 From 18652eb87ef0613b66664059581f991448d76af4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 01:36:27 +0100 Subject: Fix physics proxy regeneration when a mesh with more than one submesh is resized Addresses http://opensimulator.org/mantis/view.php?id=5584 --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0fbd746..fd5f1b0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2662,13 +2662,18 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart part = GetChildPart(localID); if (part != null) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, localID, part.Scale, scale); + part.IgnoreUndoUpdate = true; + if (scale.X > m_scene.m_maxNonphys) scale.X = m_scene.m_maxNonphys; if (scale.Y > m_scene.m_maxNonphys) scale.Y = m_scene.m_maxNonphys; if (scale.Z > m_scene.m_maxNonphys) scale.Z = m_scene.m_maxNonphys; + if (part.PhysActor != null && part.PhysActor.IsPhysical) { if (scale.X > m_scene.m_maxPhys) @@ -2780,7 +2785,14 @@ namespace OpenSim.Region.Framework.Scenes newSize.Z *= z; obPart.Resize(newSize); obPart.UpdateOffSet(currentpos); + + if (obPart.PhysActor != null) + { + obPart.PhysActor.Size = newSize; + m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); + } } + obPart.IgnoreUndoUpdate = false; obPart.StoreUndoState(); } -- cgit v1.1 From da7340b9fb6a6f4468310958671f429f133e8424 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 01:42:56 +0100 Subject: If resized shape is a mesh/sculpt, leave it to the mesh asset callback to trigger the physics actor taint. In the last commit, the fix was made by updating all the child prim physics actors with the new size rather than just the root part. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fd5f1b0..9c307a3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2789,7 +2789,10 @@ namespace OpenSim.Region.Framework.Scenes if (obPart.PhysActor != null) { obPart.PhysActor.Size = newSize; - m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); + + // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. + if (((OpenMetaverse.SculptType)obPart.Shape.SculptType) != SculptType.Mesh) + m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); } } @@ -2800,7 +2803,10 @@ namespace OpenSim.Region.Framework.Scenes if (part.PhysActor != null) { part.PhysActor.Size = prevScale; - m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); + + // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. + if (((OpenMetaverse.SculptType)part.Shape.SculptType) != SculptType.Mesh) + m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); } part.IgnoreUndoUpdate = false; -- cgit v1.1 From 50bd48542c379f0ce0cec85eb412ded16c819434 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 02:44:00 +0100 Subject: Add very basic test for resizing a scene object with one prim --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9c307a3..34e44e5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -617,9 +617,10 @@ namespace OpenSim.Region.Framework.Scenes finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X; finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y; finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z; - return finalScale; + return finalScale; } + public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) { // We got a request from the inner_scene to raytrace along the Ray hRay -- cgit v1.1 From 27fae36a21ff39e9bd413a3f4a4bb544f40bb4e1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 02:53:36 +0100 Subject: remove the need to supply SceneObjectGroup.GroupResize() with a localId. This is utterly pointless scene we already know which sog we're dealing with. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 261 +++++++++++---------- 1 file changed, 131 insertions(+), 130 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 34e44e5..f7ef0b4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2658,164 +2658,165 @@ namespace OpenSim.Region.Framework.Scenes } } - public void GroupResize(Vector3 scale, uint localID) + /// + /// Resize the entire group of prims. + /// + /// + public void GroupResize(Vector3 scale) { - SceneObjectPart part = GetChildPart(localID); - if (part != null) - { // m_log.DebugFormat( -// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, localID, part.Scale, scale); +// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, localID, RootPart.Scale, scale); + + RootPart.IgnoreUndoUpdate = true; - part.IgnoreUndoUpdate = true; + if (scale.X > m_scene.m_maxNonphys) + scale.X = m_scene.m_maxNonphys; + if (scale.Y > m_scene.m_maxNonphys) + scale.Y = m_scene.m_maxNonphys; + if (scale.Z > m_scene.m_maxNonphys) + scale.Z = m_scene.m_maxNonphys; - if (scale.X > m_scene.m_maxNonphys) - scale.X = m_scene.m_maxNonphys; - if (scale.Y > m_scene.m_maxNonphys) - scale.Y = m_scene.m_maxNonphys; - if (scale.Z > m_scene.m_maxNonphys) - scale.Z = m_scene.m_maxNonphys; + if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) + { + if (scale.X > m_scene.m_maxPhys) + scale.X = m_scene.m_maxPhys; + if (scale.Y > m_scene.m_maxPhys) + scale.Y = m_scene.m_maxPhys; + if (scale.Z > m_scene.m_maxPhys) + scale.Z = m_scene.m_maxPhys; + } - if (part.PhysActor != null && part.PhysActor.IsPhysical) - { - if (scale.X > m_scene.m_maxPhys) - scale.X = m_scene.m_maxPhys; - if (scale.Y > m_scene.m_maxPhys) - scale.Y = m_scene.m_maxPhys; - if (scale.Z > m_scene.m_maxPhys) - scale.Z = m_scene.m_maxPhys; - } - float x = (scale.X / part.Scale.X); - float y = (scale.Y / part.Scale.Y); - float z = (scale.Z / part.Scale.Z); + float x = (scale.X / RootPart.Scale.X); + float y = (scale.Y / RootPart.Scale.Y); + float z = (scale.Z / RootPart.Scale.Z); - SceneObjectPart[] parts; - if (x > 1.0f || y > 1.0f || z > 1.0f) + SceneObjectPart[] parts; + if (x > 1.0f || y > 1.0f || z > 1.0f) + { + parts = m_parts.GetArray(); + for (int i = 0; i < parts.Length; i++) { - parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) + SceneObjectPart obPart = parts[i]; + if (obPart.UUID != m_rootPart.UUID) { - SceneObjectPart obPart = parts[i]; - if (obPart.UUID != m_rootPart.UUID) - { - obPart.IgnoreUndoUpdate = true; - Vector3 oldSize = new Vector3(obPart.Scale); + obPart.IgnoreUndoUpdate = true; + Vector3 oldSize = new Vector3(obPart.Scale); - float f = 1.0f; - float a = 1.0f; + float f = 1.0f; + float a = 1.0f; - if (part.PhysActor != null && part.PhysActor.IsPhysical) + if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) + { + if (oldSize.X * x > m_scene.m_maxPhys) { - if (oldSize.X * x > m_scene.m_maxPhys) - { - f = m_scene.m_maxPhys / oldSize.X; - a = f / x; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Y * y > m_scene.m_maxPhys) - { - f = m_scene.m_maxPhys / oldSize.Y; - a = f / y; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Z * z > m_scene.m_maxPhys) - { - f = m_scene.m_maxPhys / oldSize.Z; - a = f / z; - x *= a; - y *= a; - z *= a; - } + f = m_scene.m_maxPhys / oldSize.X; + a = f / x; + x *= a; + y *= a; + z *= a; } - else + if (oldSize.Y * y > m_scene.m_maxPhys) { - if (oldSize.X * x > m_scene.m_maxNonphys) - { - f = m_scene.m_maxNonphys / oldSize.X; - a = f / x; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Y * y > m_scene.m_maxNonphys) - { - f = m_scene.m_maxNonphys / oldSize.Y; - a = f / y; - x *= a; - y *= a; - z *= a; - } - if (oldSize.Z * z > m_scene.m_maxNonphys) - { - f = m_scene.m_maxNonphys / oldSize.Z; - a = f / z; - x *= a; - y *= a; - z *= a; - } + f = m_scene.m_maxPhys / oldSize.Y; + a = f / y; + x *= a; + y *= a; + z *= a; + } + if (oldSize.Z * z > m_scene.m_maxPhys) + { + f = m_scene.m_maxPhys / oldSize.Z; + a = f / z; + x *= a; + y *= a; + z *= a; + } + } + else + { + if (oldSize.X * x > m_scene.m_maxNonphys) + { + f = m_scene.m_maxNonphys / oldSize.X; + a = f / x; + x *= a; + y *= a; + z *= a; + } + if (oldSize.Y * y > m_scene.m_maxNonphys) + { + f = m_scene.m_maxNonphys / oldSize.Y; + a = f / y; + x *= a; + y *= a; + z *= a; + } + if (oldSize.Z * z > m_scene.m_maxNonphys) + { + f = m_scene.m_maxNonphys / oldSize.Z; + a = f / z; + x *= a; + y *= a; + z *= a; } - obPart.IgnoreUndoUpdate = false; - obPart.StoreUndoState(); } + obPart.IgnoreUndoUpdate = false; + obPart.StoreUndoState(); } } + } - Vector3 prevScale = part.Scale; - prevScale.X *= x; - prevScale.Y *= y; - prevScale.Z *= z; - part.Resize(prevScale); + Vector3 prevScale = RootPart.Scale; + prevScale.X *= x; + prevScale.Y *= y; + prevScale.Z *= z; + RootPart.Resize(prevScale); - parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) + parts = m_parts.GetArray(); + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart obPart = parts[i]; + obPart.IgnoreUndoUpdate = true; + if (obPart.UUID != m_rootPart.UUID) { - SceneObjectPart obPart = parts[i]; - obPart.IgnoreUndoUpdate = true; - if (obPart.UUID != m_rootPart.UUID) + Vector3 currentpos = new Vector3(obPart.OffsetPosition); + currentpos.X *= x; + currentpos.Y *= y; + currentpos.Z *= z; + Vector3 newSize = new Vector3(obPart.Scale); + newSize.X *= x; + newSize.Y *= y; + newSize.Z *= z; + obPart.Resize(newSize); + obPart.UpdateOffSet(currentpos); + + if (obPart.PhysActor != null) { - Vector3 currentpos = new Vector3(obPart.OffsetPosition); - currentpos.X *= x; - currentpos.Y *= y; - currentpos.Z *= z; - Vector3 newSize = new Vector3(obPart.Scale); - newSize.X *= x; - newSize.Y *= y; - newSize.Z *= z; - obPart.Resize(newSize); - obPart.UpdateOffSet(currentpos); - - if (obPart.PhysActor != null) - { - obPart.PhysActor.Size = newSize; + obPart.PhysActor.Size = newSize; - // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. - if (((OpenMetaverse.SculptType)obPart.Shape.SculptType) != SculptType.Mesh) - m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); - } + // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. + if (((OpenMetaverse.SculptType)obPart.Shape.SculptType) != SculptType.Mesh) + m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); } - - obPart.IgnoreUndoUpdate = false; - obPart.StoreUndoState(); } - if (part.PhysActor != null) - { - part.PhysActor.Size = prevScale; + obPart.IgnoreUndoUpdate = false; + obPart.StoreUndoState(); + } - // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. - if (((OpenMetaverse.SculptType)part.Shape.SculptType) != SculptType.Mesh) - m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); - } + if (RootPart.PhysActor != null) + { + RootPart.PhysActor.Size = prevScale; - part.IgnoreUndoUpdate = false; - part.StoreUndoState(); - HasGroupChanged = true; - m_rootPart.TriggerScriptChangedEvent(Changed.SCALE); - ScheduleGroupForTerseUpdate(); + // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. + if (((OpenMetaverse.SculptType)RootPart.Shape.SculptType) != SculptType.Mesh) + m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); } + + RootPart.IgnoreUndoUpdate = false; + RootPart.StoreUndoState(); + HasGroupChanged = true; + RootPart.TriggerScriptChangedEvent(Changed.SCALE); + ScheduleGroupForTerseUpdate(); } #endregion -- cgit v1.1 From c82f19e41cbfcf4eb8bb3691d1653eeceaa6a8ad Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 03:06:30 +0100 Subject: fix build break from last commit --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f7ef0b4..0b474b5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3345,7 +3345,7 @@ namespace OpenSim.Region.Framework.Scenes if (sop != null) { if (asset != null) - sop.SculptTextureCallback(asset.FullID, asset); + sop.SculptTextureCallback(asset); } } -- cgit v1.1 From 982e71b6b88ccbb884044d4b1c350b27c4877060 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 03:08:28 +0100 Subject: eliminate unused and redundant SceneObjectGroup.AssetReceived() --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0b474b5..8ffe84b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3333,23 +3333,6 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Handle an asset received asynchronously from the asset service. - /// - /// - /// - /// - protected void AssetReceived(string id, Object sender, AssetBase asset) - { - SceneObjectPart sop = (SceneObjectPart)sender; - - if (sop != null) - { - if (asset != null) - sop.SculptTextureCallback(asset); - } - } - - /// /// Set the user group to which this scene object belongs. /// /// -- cgit v1.1 From df2a59d31b1ae21f99c1b18976b8d799b935a762 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 03:30:14 +0100 Subject: refactor: make SceneObjectGroup.GroupScale() a property rather than a mehod --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 61 ++++++++++++---------- 1 file changed, 32 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 8ffe84b..7aa7831 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -236,6 +236,38 @@ namespace OpenSim.Region.Framework.Scenes get { return m_rootPart.RotationOffset; } } + public Vector3 GroupScale + { + get + { + Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); + Vector3 maxScale = Vector3.Zero; + Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); + + SceneObjectPart[] parts = m_parts.GetArray(); + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart part = parts[i]; + Vector3 partscale = part.Scale; + Vector3 partoffset = part.OffsetPosition; + + minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X; + minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y; + minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z; + + maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X; + maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y; + maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z; + } + + finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X; + finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y; + finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z; + + return finalScale; + } + } + public UUID GroupID { get { return m_rootPart.GroupID; } @@ -592,35 +624,6 @@ namespace OpenSim.Region.Framework.Scenes //ScheduleGroupForFullUpdate(); } - public Vector3 GroupScale() - { - Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); - Vector3 maxScale = Vector3.Zero; - Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); - - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - { - SceneObjectPart part = parts[i]; - Vector3 partscale = part.Scale; - Vector3 partoffset = part.OffsetPosition; - - minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X; - minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y; - minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z; - - maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X; - maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y; - maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z; - } - - finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X; - finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y; - finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z; - - return finalScale; - } - public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) { // We got a request from the inner_scene to raytrace along the Ray hRay -- cgit v1.1 From 2b68ac4ba31205a55f53f1b69629dd9ebbd66ef6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 04:22:57 +0100 Subject: refactor: Push all part resize code down into SceneObjectPart.Resize() --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 50 ---------------------- 1 file changed, 50 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7aa7831..477b3e3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2612,56 +2612,6 @@ namespace OpenSim.Region.Framework.Scenes #region Resize /// - /// Resize the given part - /// - /// - /// - public void Resize(Vector3 scale, uint localID) - { - if (scale.X > m_scene.m_maxNonphys) - scale.X = m_scene.m_maxNonphys; - if (scale.Y > m_scene.m_maxNonphys) - scale.Y = m_scene.m_maxNonphys; - if (scale.Z > m_scene.m_maxNonphys) - scale.Z = m_scene.m_maxNonphys; - - SceneObjectPart part = GetChildPart(localID); - if (part != null) - { - part.Resize(scale); - if (part.PhysActor != null) - { - if (part.PhysActor.IsPhysical) - { - if (scale.X > m_scene.m_maxPhys) - scale.X = m_scene.m_maxPhys; - if (scale.Y > m_scene.m_maxPhys) - scale.Y = m_scene.m_maxPhys; - if (scale.Z > m_scene.m_maxPhys) - scale.Z = m_scene.m_maxPhys; - } - part.PhysActor.Size = scale; - m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); - } - //if (part.UUID != m_rootPart.UUID) - - HasGroupChanged = true; - part.TriggerScriptChangedEvent(Changed.SCALE); - ScheduleGroupForFullUpdate(); - - //if (part.UUID == m_rootPart.UUID) - //{ - //if (m_rootPart.PhysActor != null) - //{ - //m_rootPart.PhysActor.Size = - //new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z); - //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); - //} - //} - } - } - - /// /// Resize the entire group of prims. /// /// -- cgit v1.1 From 9a80adf33ae0d255d923d33f5b6abac540efcd52 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 04:49:21 +0100 Subject: remove now unncessary parts of SceneObjectGroup.Resize() --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 26 +++++----------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 477b3e3..7662874 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2611,6 +2611,7 @@ namespace OpenSim.Region.Framework.Scenes #region Resize + /// /// Resize the entire group of prims. /// @@ -2712,6 +2713,7 @@ namespace OpenSim.Region.Framework.Scenes z *= a; } } + obPart.IgnoreUndoUpdate = false; obPart.StoreUndoState(); } @@ -2729,47 +2731,29 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart obPart = parts[i]; obPart.IgnoreUndoUpdate = true; + if (obPart.UUID != m_rootPart.UUID) { Vector3 currentpos = new Vector3(obPart.OffsetPosition); currentpos.X *= x; currentpos.Y *= y; currentpos.Z *= z; + Vector3 newSize = new Vector3(obPart.Scale); newSize.X *= x; newSize.Y *= y; newSize.Z *= z; + obPart.Resize(newSize); obPart.UpdateOffSet(currentpos); - - if (obPart.PhysActor != null) - { - obPart.PhysActor.Size = newSize; - - // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. - if (((OpenMetaverse.SculptType)obPart.Shape.SculptType) != SculptType.Mesh) - m_scene.PhysicsScene.AddPhysicsActorTaint(obPart.PhysActor); - } } obPart.IgnoreUndoUpdate = false; obPart.StoreUndoState(); } - if (RootPart.PhysActor != null) - { - RootPart.PhysActor.Size = prevScale; - - // If we're a sculpt wait for the trigger when the sculpt texture is retrieved. - if (((OpenMetaverse.SculptType)RootPart.Shape.SculptType) != SculptType.Mesh) - m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor); - } - RootPart.IgnoreUndoUpdate = false; RootPart.StoreUndoState(); - HasGroupChanged = true; - RootPart.TriggerScriptChangedEvent(Changed.SCALE); - ScheduleGroupForTerseUpdate(); } #endregion -- cgit v1.1 From f5ddf37112d4881243e3350d5df898c6b2bb02ae Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Jul 2011 05:23:21 +0100 Subject: Replace ifs in SOG.GroupResize() with Math.Min() Also fiddle a bit with undo. This is not currently working properly, though to be fair it also didn't appear to work in 0.7.1.1 either (at least for resize). Will get some more attention soon. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7662874..ce5db5f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2623,21 +2623,15 @@ namespace OpenSim.Region.Framework.Scenes RootPart.IgnoreUndoUpdate = true; - if (scale.X > m_scene.m_maxNonphys) - scale.X = m_scene.m_maxNonphys; - if (scale.Y > m_scene.m_maxNonphys) - scale.Y = m_scene.m_maxNonphys; - if (scale.Z > m_scene.m_maxNonphys) - scale.Z = m_scene.m_maxNonphys; + scale.X = Math.Min(scale.X, Scene.m_maxNonphys); + scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); + scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical) { - if (scale.X > m_scene.m_maxPhys) - scale.X = m_scene.m_maxPhys; - if (scale.Y > m_scene.m_maxPhys) - scale.Y = m_scene.m_maxPhys; - if (scale.Z > m_scene.m_maxPhys) - scale.Z = m_scene.m_maxPhys; + scale.X = Math.Min(scale.X, Scene.m_maxPhys); + scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); + scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); } float x = (scale.X / RootPart.Scale.X); @@ -2715,7 +2709,6 @@ namespace OpenSim.Region.Framework.Scenes } obPart.IgnoreUndoUpdate = false; - obPart.StoreUndoState(); } } } @@ -2753,6 +2746,7 @@ namespace OpenSim.Region.Framework.Scenes } RootPart.IgnoreUndoUpdate = false; + RootPart.StoreUndoState(); } -- cgit v1.1 From 6fc74b36d1d0f7dcd6f013893c3189a3f989431c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 18 Jul 2011 04:54:21 +0100 Subject: Make various tweaks to undo code in an effort to get things working better. Undo rotation and position appear to be working. Resizing a single prim appears to be working, though the undo has to be done twice. Resizing a group of prims still does not work properly - possibly because in the UndoState we don't store a knowledge of when we're resizing a whole group rather than individual prims. This needs to be addressed. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 58 +++++++++++++++++----- 1 file changed, 45 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ce5db5f..7254992 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1145,6 +1145,10 @@ namespace OpenSim.Region.Framework.Scenes public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Processing OnGrabPart for {0} on {1} {2}, offsetPos {3}", +// remoteClient.Name, part.Name, part.LocalId, offsetPos); + part.StoreUndoState(); part.OnGrab(offsetPos, remoteClient); } @@ -2611,17 +2615,14 @@ namespace OpenSim.Region.Framework.Scenes #region Resize - /// /// Resize the entire group of prims. /// /// public void GroupResize(Vector3 scale) { -// m_log.DebugFormat( -// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, localID, RootPart.Scale, scale); - - RootPart.IgnoreUndoUpdate = true; +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); scale.X = Math.Min(scale.X, Scene.m_maxNonphys); scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); @@ -2647,7 +2648,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart obPart = parts[i]; if (obPart.UUID != m_rootPart.UUID) { - obPart.IgnoreUndoUpdate = true; +// obPart.IgnoreUndoUpdate = true; Vector3 oldSize = new Vector3(obPart.Scale); float f = 1.0f; @@ -2663,6 +2664,7 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } + if (oldSize.Y * y > m_scene.m_maxPhys) { f = m_scene.m_maxPhys / oldSize.Y; @@ -2671,6 +2673,7 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } + if (oldSize.Z * z > m_scene.m_maxPhys) { f = m_scene.m_maxPhys / oldSize.Z; @@ -2690,6 +2693,7 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } + if (oldSize.Y * y > m_scene.m_maxNonphys) { f = m_scene.m_maxNonphys / oldSize.Y; @@ -2698,6 +2702,7 @@ namespace OpenSim.Region.Framework.Scenes y *= a; z *= a; } + if (oldSize.Z * z > m_scene.m_maxNonphys) { f = m_scene.m_maxNonphys / oldSize.Z; @@ -2708,7 +2713,7 @@ namespace OpenSim.Region.Framework.Scenes } } - obPart.IgnoreUndoUpdate = false; +// obPart.IgnoreUndoUpdate = false; } } } @@ -2723,7 +2728,7 @@ namespace OpenSim.Region.Framework.Scenes for (int i = 0; i < parts.Length; i++) { SceneObjectPart obPart = parts[i]; - obPart.IgnoreUndoUpdate = true; +// obPart.IgnoreUndoUpdate = true; if (obPart.UUID != m_rootPart.UUID) { @@ -2738,16 +2743,18 @@ namespace OpenSim.Region.Framework.Scenes newSize.Z *= z; obPart.Resize(newSize); + + obPart.IgnoreUndoUpdate = true; obPart.UpdateOffSet(currentpos); + obPart.IgnoreUndoUpdate = false; } - obPart.IgnoreUndoUpdate = false; - obPart.StoreUndoState(); +// obPart.IgnoreUndoUpdate = false; +// obPart.StoreUndoState(); } - RootPart.IgnoreUndoUpdate = false; - - RootPart.StoreUndoState(); +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Finished group resizing {0} {1} to {2}", Name, LocalId, RootPart.Scale); } #endregion @@ -2760,6 +2767,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateGroupPosition(Vector3 pos) { +// m_log.DebugFormat("[SCENE OBJECT GROUP]: Updating group position on {0} {1} to {2}", Name, LocalId, pos); + SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) parts[i].StoreUndoState(); @@ -2805,6 +2814,9 @@ namespace OpenSim.Region.Framework.Scenes if (part != null) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating single position of {0} {1} to {2}", part.Name, part.LocalId, pos); + if (part.UUID == m_rootPart.UUID) { UpdateRootPosition(pos); @@ -2824,6 +2836,9 @@ namespace OpenSim.Region.Framework.Scenes /// private void UpdateRootPosition(Vector3 pos) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos); + SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) parts[i].StoreUndoState(); @@ -2868,6 +2883,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateGroupRotationR(Quaternion rot) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating group rotation R of {0} {1} to {2}", Name, LocalId, rot); + SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) parts[i].StoreUndoState(); @@ -2892,6 +2910,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating group rotation PR of {0} {1} to {2}", Name, LocalId, rot); + SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) parts[i].StoreUndoState(); @@ -2926,6 +2947,9 @@ namespace OpenSim.Region.Framework.Scenes if (part != null) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating single rotation of {0} {1} to {2}", part.Name, part.LocalId, rot); + if (part.UUID == m_rootPart.UUID) { UpdateRootRotation(rot); @@ -2947,6 +2971,10 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart part = GetChildPart(localID); if (part != null) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating single position and rotation of {0} {1} to {2}", +// part.Name, part.LocalId, rot); + if (part.UUID == m_rootPart.UUID) { UpdateRootRotation(rot); @@ -2969,6 +2997,10 @@ namespace OpenSim.Region.Framework.Scenes /// private void UpdateRootRotation(Quaternion rot) { +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", +// Name, LocalId, rot); + Quaternion axRot = rot; Quaternion oldParentRot = m_rootPart.RotationOffset; -- cgit v1.1 From 430a4aeba8e98b8285ea3ebdf264baf429a55e22 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 03:01:54 +0100 Subject: Fix undo for resizing linksets This involves implementing a boolean in UndoState to signal whether the undo needs to be done for an entire group/linkset or just a single prim Resizing individual components of linksets is still dodgy. Resizing still has to be down twice, since for some reason the client is sending two multiobjectupdate packets on every resize except the very first. This applies to single prims and linksets. Need to look into this. --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7254992..3bbf76c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2624,6 +2624,8 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); + RootPart.StoreUndoState(true); + scale.X = Math.Min(scale.X, Scene.m_maxNonphys); scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); @@ -2722,16 +2724,20 @@ namespace OpenSim.Region.Framework.Scenes prevScale.X *= x; prevScale.Y *= y; prevScale.Z *= z; + +// RootPart.IgnoreUndoUpdate = true; RootPart.Resize(prevScale); +// RootPart.IgnoreUndoUpdate = false; parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { SceneObjectPart obPart = parts[i]; -// obPart.IgnoreUndoUpdate = true; if (obPart.UUID != m_rootPart.UUID) { + obPart.IgnoreUndoUpdate = true; + Vector3 currentpos = new Vector3(obPart.OffsetPosition); currentpos.X *= x; currentpos.Y *= y; @@ -2741,12 +2747,11 @@ namespace OpenSim.Region.Framework.Scenes newSize.X *= x; newSize.Y *= y; newSize.Z *= z; - - obPart.Resize(newSize); - obPart.IgnoreUndoUpdate = true; + obPart.Resize(newSize); obPart.UpdateOffSet(currentpos); - obPart.IgnoreUndoUpdate = false; + + obPart.IgnoreUndoUpdate = false; } // obPart.IgnoreUndoUpdate = false; @@ -2769,9 +2774,11 @@ namespace OpenSim.Region.Framework.Scenes { // m_log.DebugFormat("[SCENE OBJECT GROUP]: Updating group position on {0} {1} to {2}", Name, LocalId, pos); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].StoreUndoState(); + RootPart.StoreUndoState(true); + +// SceneObjectPart[] parts = m_parts.GetArray(); +// for (int i = 0; i < parts.Length; i++) +// parts[i].StoreUndoState(); if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) { -- cgit v1.1 From c94dc95844c5a43483a30807353aaebf658b015e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 03:27:16 +0100 Subject: fix undo when resizing of non-root individual prims in a linkset undo resize, rotation and position still needs fixing when only editing root prim of a linkset --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3bbf76c..3adeef1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2815,15 +2815,17 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart part = GetChildPart(localID); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].StoreUndoState(); +// SceneObjectPart[] parts = m_parts.GetArray(); +// for (int i = 0; i < parts.Length; i++) +// parts[i].StoreUndoState(); if (part != null) { // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Updating single position of {0} {1} to {2}", part.Name, part.LocalId, pos); + part.StoreUndoState(false); + if (part.UUID == m_rootPart.UUID) { UpdateRootPosition(pos); -- cgit v1.1 From 97f1edfd95176415d0e0b3169467655522334804 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 04:15:27 +0100 Subject: Fix undo of prim group rotation. This isn't that great since I think I broke it a few commits earlier. Undo of rotation of individual prims in a linkset is still broken --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3adeef1..aa1f7bc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2895,9 +2895,11 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Updating group rotation R of {0} {1} to {2}", Name, LocalId, rot); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].StoreUndoState(); +// SceneObjectPart[] parts = m_parts.GetArray(); +// for (int i = 0; i < parts.Length; i++) +// parts[i].StoreUndoState(); + + m_rootPart.StoreUndoState(true); m_rootPart.UpdateRotation(rot); @@ -2922,9 +2924,12 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Updating group rotation PR of {0} {1} to {2}", Name, LocalId, rot); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].StoreUndoState(); +// SceneObjectPart[] parts = m_parts.GetArray(); +// for (int i = 0; i < parts.Length; i++) +// parts[i].StoreUndoState(); + + RootPart.StoreUndoState(true); + RootPart.IgnoreUndoUpdate = true; m_rootPart.UpdateRotation(rot); @@ -2939,6 +2944,8 @@ namespace OpenSim.Region.Framework.Scenes HasGroupChanged = true; ScheduleGroupForTerseUpdate(); + + RootPart.IgnoreUndoUpdate = false; } /// -- cgit v1.1 From b2722e984ab99deb01d55cd4c4e9f1a7cb563709 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 04:40:02 +0100 Subject: Fix undo of rotation of single prims in a linkset --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index aa1f7bc..9076d73 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2991,6 +2991,9 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT GROUP]: Updating single position and rotation of {0} {1} to {2}", // part.Name, part.LocalId, rot); + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + if (part.UUID == m_rootPart.UUID) { UpdateRootRotation(rot); @@ -2998,12 +3001,11 @@ namespace OpenSim.Region.Framework.Scenes } else { - part.IgnoreUndoUpdate = true; part.UpdateRotation(rot); part.OffsetPosition = pos; - part.IgnoreUndoUpdate = false; - part.StoreUndoState(); } + + part.IgnoreUndoUpdate = false; } } -- cgit v1.1 From 1fdb16f1cdf6e2722a763cdc0e9b7af9fed27a29 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 05:05:50 +0100 Subject: Fix undo for rotation of the root prim in a linkset on its own. The only obviously broken things right now are the undo of the position of just a root prim (stays in place) and the fact that resizes need two undoes. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9076d73..d653e66 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3013,11 +3013,11 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - private void UpdateRootRotation(Quaternion rot) + public void UpdateRootRotation(Quaternion rot) { -// m_log.DebugFormat( -// "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", -// Name, LocalId, rot); + m_log.DebugFormat( + "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", + Name, LocalId, rot); Quaternion axRot = rot; Quaternion oldParentRot = m_rootPart.RotationOffset; @@ -3046,6 +3046,7 @@ namespace OpenSim.Region.Framework.Scenes newRot *= Quaternion.Inverse(axRot); prim.RotationOffset = newRot; prim.ScheduleTerseUpdate(); + prim.IgnoreUndoUpdate = false; } } @@ -3054,12 +3055,16 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart childpart = parts[i]; if (childpart != m_rootPart) { - childpart.IgnoreUndoUpdate = false; - childpart.StoreUndoState(); +// childpart.IgnoreUndoUpdate = false; +// childpart.StoreUndoState(); } } m_rootPart.ScheduleTerseUpdate(); + + m_log.DebugFormat( + "[SCENE OBJECT GROUP]: Updated root rotation of {0} {1} to {2}", + Name, LocalId, rot); } #endregion -- cgit v1.1 From 62325829ecab7d956416ff0450faa3f90f267e6c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 05:14:58 +0100 Subject: comment out all kinds of debugging guff --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d653e66..0eaed91 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3015,9 +3015,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void UpdateRootRotation(Quaternion rot) { - m_log.DebugFormat( - "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", - Name, LocalId, rot); +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", +// Name, LocalId, rot); Quaternion axRot = rot; Quaternion oldParentRot = m_rootPart.RotationOffset; @@ -3050,21 +3050,21 @@ namespace OpenSim.Region.Framework.Scenes } } - for (int i = 0; i < parts.Length; i++) - { - SceneObjectPart childpart = parts[i]; - if (childpart != m_rootPart) - { -// childpart.IgnoreUndoUpdate = false; -// childpart.StoreUndoState(); - } - } +// for (int i = 0; i < parts.Length; i++) +// { +// SceneObjectPart childpart = parts[i]; +// if (childpart != m_rootPart) +// { +//// childpart.IgnoreUndoUpdate = false; +//// childpart.StoreUndoState(); +// } +// } m_rootPart.ScheduleTerseUpdate(); - m_log.DebugFormat( - "[SCENE OBJECT GROUP]: Updated root rotation of {0} {1} to {2}", - Name, LocalId, rot); +// m_log.DebugFormat( +// "[SCENE OBJECT GROUP]: Updated root rotation of {0} {1} to {2}", +// Name, LocalId, rot); } #endregion -- cgit v1.1 From 0ef29da9b2844e567928fe6fe5e13da3ee1a37ad Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 05:20:04 +0100 Subject: refactor: rename UpdatePrimPosition() to UpdatePrimGroupPosition() for consistency --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0eaed91..26b35a3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2840,10 +2840,10 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Update just the root prim position in a linkset /// /// - private void UpdateRootPosition(Vector3 pos) + public void UpdateRootPosition(Vector3 pos) { // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos); -- cgit v1.1 From bc3679b67dc074a9ef1e0e6ffb07bca844eb93c9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Jul 2011 05:46:17 +0100 Subject: Fix undo when changing just the root prim's position in a linkset. I think (ha ha) this largely fixes undo, except for the fact that rotation a set of prims with 'edit linked parts' selected doesn't quite work properly (though this works fine if the checkbox isn't selected). Also, the double undo bug for resize is still present. Redo might be incredibly buggy, haven't even looked at that yet. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 26b35a3..b6fb5a4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2825,6 +2825,7 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT GROUP]: Updating single position of {0} {1} to {2}", part.Name, part.LocalId, pos); part.StoreUndoState(false); + part.IgnoreUndoUpdate = true; if (part.UUID == m_rootPart.UUID) { @@ -2836,6 +2837,7 @@ namespace OpenSim.Region.Framework.Scenes } HasGroupChanged = true; + part.IgnoreUndoUpdate = false; } } @@ -2848,9 +2850,9 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos); - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].StoreUndoState(); +// SceneObjectPart[] parts = m_parts.GetArray(); +// for (int i = 0; i < parts.Length; i++) +// parts[i].StoreUndoState(); Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); Vector3 oldPos = @@ -2863,7 +2865,7 @@ namespace OpenSim.Region.Framework.Scenes axDiff *= Quaternion.Inverse(partRotation); diff = axDiff; - parts = m_parts.GetArray(); + SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { SceneObjectPart obPart = parts[i]; -- cgit v1.1