diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 236bfe7e63..b8264ba72d 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -501,6 +501,7 @@ namespace OpenSim.Framework event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; event UpdateVector OnUpdatePrimScale; + event UpdateVector OnUpdatePrimGroupScale; event StatusChange OnChildAgentStatus; event GenericCall2 OnStopMovement; event Action OnRemoveAvatar; diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 89b0400064..292f7f6935 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -222,6 +222,7 @@ namespace OpenSim.Region.ClientStack private UpdateVector handlerUpdatePrimSinglePosition = null; //OnUpdatePrimSinglePosition; private UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = null; //OnUpdatePrimSingleRotation; private UpdateVector handlerUpdatePrimScale = null; //OnUpdatePrimScale; + private UpdateVector handlerUpdatePrimGroupScale = null; //OnUpdateGroupScale; private UpdateVector handlerUpdateVector = null; //OnUpdatePrimGroupPosition; private UpdatePrimRotation handlerUpdatePrimRotation = null; //OnUpdatePrimGroupRotation; private UpdatePrimGroupRotation handlerUpdatePrimGroupRotation = null; //OnUpdatePrimGroupMouseRotation; @@ -712,6 +713,7 @@ namespace OpenSim.Region.ClientStack public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; public event UpdateVector OnUpdatePrimScale; + public event UpdateVector OnUpdatePrimGroupScale; public event StatusChange OnChildAgentStatus; public event GenericCall2 OnStopMovement; public event Action OnRemoveAvatar; @@ -2590,6 +2592,7 @@ namespace OpenSim.Region.ClientStack case 5: LLVector3 scale1 = new LLVector3(block.Data, 12); + LLVector3 pos11 = new LLVector3(block.Data, 0); handlerUpdatePrimScale = OnUpdatePrimScale; if (handlerUpdatePrimScale != null) @@ -2597,6 +2600,13 @@ namespace OpenSim.Region.ClientStack // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); handlerUpdatePrimScale(localId, scale1, this); + + + handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; + if (handlerUpdatePrimSinglePosition != null) + { + handlerUpdatePrimSinglePosition(localId, pos11, this); + } } break; case 9: @@ -2661,27 +2671,35 @@ namespace OpenSim.Region.ClientStack LLVector3 scale5 = new LLVector3(block.Data, 12); LLVector3 pos5 = new LLVector3(block.Data, 0); - handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) + handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; + if (handlerUpdatePrimGroupScale != null) { // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); - handlerUpdatePrimScale(localId, scale5, this); + handlerUpdatePrimGroupScale(localId, scale5, this); + handlerUpdateVector = OnUpdatePrimGroupPosition; - handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; - if (handlerUpdatePrimSinglePosition != null) + if (handlerUpdateVector != null) { - handlerUpdatePrimSinglePosition(localId, pos5, this); + + handlerUpdateVector(localId, pos5, this); } } break; case 21: LLVector3 scale6 = new LLVector3(block.Data, 12); + LLVector3 pos6 = new LLVector3(block.Data, 0); + handlerUpdatePrimScale = OnUpdatePrimScale; if (handlerUpdatePrimScale != null) { // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); handlerUpdatePrimScale(localId, scale6, this); + handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; + if (handlerUpdatePrimSinglePosition != null) + { + handlerUpdatePrimSinglePosition(localId, pos6, this); + } } break; } diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index ea4283fe53..8894db028e 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -890,6 +890,17 @@ namespace OpenSim.Region.Environment.Scenes } } } + public void UpdatePrimGroupScale(uint localID, LLVector3 scale, IClientAPI remoteClient) + { + SceneObjectGroup group = GetGroupByPrim(localID); + if (group != null) + { + if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) + { + group.GroupResize(scale, localID); + } + } + } /// /// This handles the nifty little tool tip that you get when you drag your mouse over an object diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index b81b2d4a0c..c5ed958ebc 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1513,6 +1513,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnUpdatePrimGroupMouseRotation += m_innerScene.UpdatePrimRotation; client.OnUpdatePrimSingleRotation += m_innerScene.UpdatePrimSingleRotation; client.OnUpdatePrimScale += m_innerScene.UpdatePrimScale; + client.OnUpdatePrimGroupScale += m_innerScene.UpdatePrimGroupScale; client.OnUpdateExtraParams += m_innerScene.UpdateExtraParam; client.OnUpdatePrimShape += m_innerScene.UpdatePrimShape; client.OnRequestMapBlocks += RequestMapBlocks; diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 3a9e52a90e..1f38e4f498 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1520,7 +1520,7 @@ namespace OpenSim.Region.Environment.Scenes new PhysicsVector(scale.X, scale.Y, scale.Z); m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); } - if (part.UUID != m_rootPart.UUID) + //if (part.UUID != m_rootPart.UUID) ScheduleGroupForFullUpdate(); //if (part.UUID == m_rootPart.UUID) @@ -1534,6 +1534,48 @@ namespace OpenSim.Region.Environment.Scenes //} } } + public void GroupResize(LLVector3 scale, uint localID) + { + SceneObjectPart part = GetChildPart(localID); + if (part != null) + { + float x = (scale.X / part.Scale.X); + float y = (scale.Y / part.Scale.Y); + float z = (scale.Z / part.Scale.Z); + part.Resize(scale); + + lock (m_parts) + { + foreach (SceneObjectPart obPart in m_parts.Values) + { + if (obPart.UUID != m_rootPart.UUID) + { + + LLVector3 currentpos = new LLVector3(obPart.OffsetPosition); + currentpos.X *= x; + currentpos.Y *= y; + currentpos.Z *= z; + LLVector3 newSize = new LLVector3(obPart.Scale); + newSize.X *= x; + newSize.Y *= y; + newSize.Z *= z; + obPart.Resize(newSize); + obPart.UpdateOffSet(currentpos); + } + } + } + + if (part.PhysActor != null) + { + part.PhysActor.Size = + new PhysicsVector(scale.X, scale.Y, scale.Z); + m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); + } + + + ScheduleGroupForTerseUpdate(); + } + } #endregion diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index a9f7fb9085..4ce68dabb8 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -109,6 +109,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; public event UpdateVector OnUpdatePrimScale; + public event UpdateVector OnUpdatePrimGroupScale; public event StatusChange OnChildAgentStatus; public event GenericCall2 OnStopMovement; public event Action OnRemoveAvatar;