diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index df6908ab3b..00d25c2fe7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1217,12 +1217,13 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal void UpdatePrimScale(uint localID, Vector3 scale, IClientAPI remoteClient) { - SceneObjectGroup group = GetGroupByPrim(localID); - if (group != null) + SceneObjectPart part = GetSceneObjectPart(localID); + + if (part != null) { - if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) + if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)) { - group.Resize(scale, localID); + part.Resize(scale); } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7aa7831356..477b3e3192 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2611,56 +2611,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. /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5035317f31..ffde68e400 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2846,6 +2846,13 @@ namespace OpenSim.Region.Framework.Scenes /// public void Resize(Vector3 scale) { + if (scale.X > ParentGroup.Scene.m_maxNonphys) + scale.X = ParentGroup.Scene.m_maxNonphys; + if (scale.Y > ParentGroup.Scene.m_maxNonphys) + scale.Y = ParentGroup.Scene.m_maxNonphys; + if (scale.Z > ParentGroup.Scene.m_maxNonphys) + scale.Z = ParentGroup.Scene.m_maxNonphys; + // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); StoreUndoState(); @@ -2855,9 +2862,27 @@ namespace OpenSim.Region.Framework.Scenes // need to reinsert the sculpt data into the shape, since the physics engine deletes it when done to // save memory if (PhysActor != null) - CheckSculptAndLoad(); + { + if (PhysActor.IsPhysical) + { + if (scale.X > ParentGroup.Scene.m_maxPhys) + scale.X = ParentGroup.Scene.m_maxPhys; + if (scale.Y > ParentGroup.Scene.m_maxPhys) + scale.Y = ParentGroup.Scene.m_maxPhys; + if (scale.Z > ParentGroup.Scene.m_maxPhys) + scale.Z = ParentGroup.Scene.m_maxPhys; + } + + PhysActor.Size = scale; + + if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh) + CheckSculptAndLoad(); + else + ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + } ParentGroup.HasGroupChanged = true; + TriggerScriptChangedEvent(Changed.SCALE); ScheduleFullUpdate(); } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 95ecfc6a1e..7ec36b8d0d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID); - g1Post.Resize(new Vector3(8, 9, 10), g1Post.Parts[1].LocalId); + g1Post.Parts[1].Resize(new Vector3(8, 9, 10)); SceneObjectGroup g1PostPost = scene.GetSceneObjectGroup(g1.UUID);