Thank you kindly krtaylor for a patch to solve:

Linked objects won't scale together properly, only the root object scales. 
This happens with scaling both up and down or inputting numbers in the edit dialog.
0.6.0-stable
Charles Krinke 2008-04-19 21:01:26 +00:00
parent b6f8777dde
commit 6865f1c67d
6 changed files with 81 additions and 7 deletions

View File

@ -501,6 +501,7 @@ namespace OpenSim.Framework
event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
event UpdateVector OnUpdatePrimScale; event UpdateVector OnUpdatePrimScale;
event UpdateVector OnUpdatePrimGroupScale;
event StatusChange OnChildAgentStatus; event StatusChange OnChildAgentStatus;
event GenericCall2 OnStopMovement; event GenericCall2 OnStopMovement;
event Action<LLUUID> OnRemoveAvatar; event Action<LLUUID> OnRemoveAvatar;

View File

@ -222,6 +222,7 @@ namespace OpenSim.Region.ClientStack
private UpdateVector handlerUpdatePrimSinglePosition = null; //OnUpdatePrimSinglePosition; private UpdateVector handlerUpdatePrimSinglePosition = null; //OnUpdatePrimSinglePosition;
private UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = null; //OnUpdatePrimSingleRotation; private UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = null; //OnUpdatePrimSingleRotation;
private UpdateVector handlerUpdatePrimScale = null; //OnUpdatePrimScale; private UpdateVector handlerUpdatePrimScale = null; //OnUpdatePrimScale;
private UpdateVector handlerUpdatePrimGroupScale = null; //OnUpdateGroupScale;
private UpdateVector handlerUpdateVector = null; //OnUpdatePrimGroupPosition; private UpdateVector handlerUpdateVector = null; //OnUpdatePrimGroupPosition;
private UpdatePrimRotation handlerUpdatePrimRotation = null; //OnUpdatePrimGroupRotation; private UpdatePrimRotation handlerUpdatePrimRotation = null; //OnUpdatePrimGroupRotation;
private UpdatePrimGroupRotation handlerUpdatePrimGroupRotation = null; //OnUpdatePrimGroupMouseRotation; private UpdatePrimGroupRotation handlerUpdatePrimGroupRotation = null; //OnUpdatePrimGroupMouseRotation;
@ -712,6 +713,7 @@ namespace OpenSim.Region.ClientStack
public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
public event UpdateVector OnUpdatePrimScale; public event UpdateVector OnUpdatePrimScale;
public event UpdateVector OnUpdatePrimGroupScale;
public event StatusChange OnChildAgentStatus; public event StatusChange OnChildAgentStatus;
public event GenericCall2 OnStopMovement; public event GenericCall2 OnStopMovement;
public event Action<LLUUID> OnRemoveAvatar; public event Action<LLUUID> OnRemoveAvatar;
@ -2590,6 +2592,7 @@ namespace OpenSim.Region.ClientStack
case 5: case 5:
LLVector3 scale1 = new LLVector3(block.Data, 12); LLVector3 scale1 = new LLVector3(block.Data, 12);
LLVector3 pos11 = new LLVector3(block.Data, 0);
handlerUpdatePrimScale = OnUpdatePrimScale; handlerUpdatePrimScale = OnUpdatePrimScale;
if (handlerUpdatePrimScale != null) if (handlerUpdatePrimScale != null)
@ -2597,6 +2600,13 @@ namespace OpenSim.Region.ClientStack
// Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
handlerUpdatePrimScale(localId, scale1, this); handlerUpdatePrimScale(localId, scale1, this);
handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition;
if (handlerUpdatePrimSinglePosition != null)
{
handlerUpdatePrimSinglePosition(localId, pos11, this);
}
} }
break; break;
case 9: case 9:
@ -2661,27 +2671,35 @@ namespace OpenSim.Region.ClientStack
LLVector3 scale5 = new LLVector3(block.Data, 12); LLVector3 scale5 = new LLVector3(block.Data, 12);
LLVector3 pos5 = new LLVector3(block.Data, 0); LLVector3 pos5 = new LLVector3(block.Data, 0);
handlerUpdatePrimScale = OnUpdatePrimScale; handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale;
if (handlerUpdatePrimScale != null) if (handlerUpdatePrimGroupScale != null)
{ {
// Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z );
handlerUpdatePrimScale(localId, scale5, this); handlerUpdatePrimGroupScale(localId, scale5, this);
handlerUpdateVector = OnUpdatePrimGroupPosition;
handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; if (handlerUpdateVector != null)
if (handlerUpdatePrimSinglePosition != null)
{ {
handlerUpdatePrimSinglePosition(localId, pos5, this);
handlerUpdateVector(localId, pos5, this);
} }
} }
break; break;
case 21: case 21:
LLVector3 scale6 = new LLVector3(block.Data, 12); LLVector3 scale6 = new LLVector3(block.Data, 12);
LLVector3 pos6 = new LLVector3(block.Data, 0);
handlerUpdatePrimScale = OnUpdatePrimScale; handlerUpdatePrimScale = OnUpdatePrimScale;
if (handlerUpdatePrimScale != null) if (handlerUpdatePrimScale != null)
{ {
// Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
handlerUpdatePrimScale(localId, scale6, this); handlerUpdatePrimScale(localId, scale6, this);
handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition;
if (handlerUpdatePrimSinglePosition != null)
{
handlerUpdatePrimSinglePosition(localId, pos6, this);
}
} }
break; break;
} }

View File

@ -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);
}
}
}
/// <summary> /// <summary>
/// This handles the nifty little tool tip that you get when you drag your mouse over an object /// This handles the nifty little tool tip that you get when you drag your mouse over an object

View File

@ -1513,6 +1513,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnUpdatePrimGroupMouseRotation += m_innerScene.UpdatePrimRotation; client.OnUpdatePrimGroupMouseRotation += m_innerScene.UpdatePrimRotation;
client.OnUpdatePrimSingleRotation += m_innerScene.UpdatePrimSingleRotation; client.OnUpdatePrimSingleRotation += m_innerScene.UpdatePrimSingleRotation;
client.OnUpdatePrimScale += m_innerScene.UpdatePrimScale; client.OnUpdatePrimScale += m_innerScene.UpdatePrimScale;
client.OnUpdatePrimGroupScale += m_innerScene.UpdatePrimGroupScale;
client.OnUpdateExtraParams += m_innerScene.UpdateExtraParam; client.OnUpdateExtraParams += m_innerScene.UpdateExtraParam;
client.OnUpdatePrimShape += m_innerScene.UpdatePrimShape; client.OnUpdatePrimShape += m_innerScene.UpdatePrimShape;
client.OnRequestMapBlocks += RequestMapBlocks; client.OnRequestMapBlocks += RequestMapBlocks;

View File

@ -1520,7 +1520,7 @@ namespace OpenSim.Region.Environment.Scenes
new PhysicsVector(scale.X, scale.Y, scale.Z); new PhysicsVector(scale.X, scale.Y, scale.Z);
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
} }
if (part.UUID != m_rootPart.UUID) //if (part.UUID != m_rootPart.UUID)
ScheduleGroupForFullUpdate(); ScheduleGroupForFullUpdate();
//if (part.UUID == m_rootPart.UUID) //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 #endregion

View File

@ -109,6 +109,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
public event UpdateVector OnUpdatePrimScale; public event UpdateVector OnUpdatePrimScale;
public event UpdateVector OnUpdatePrimGroupScale;
public event StatusChange OnChildAgentStatus; public event StatusChange OnChildAgentStatus;
public event GenericCall2 OnStopMovement; public event GenericCall2 OnStopMovement;
public event Action<LLUUID> OnRemoveAvatar; public event Action<LLUUID> OnRemoveAvatar;