remove the need to supply SceneObjectGroup.GroupResize() with a localId.

This is utterly pointless scene we already know which sog we're dealing with.
bulletsim
Justin Clark-Casey (justincc) 2011-07-16 02:53:36 +01:00
parent 50bd48542c
commit 27fae36a21
3 changed files with 142 additions and 141 deletions

View File

@ -1234,7 +1234,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
{ {
group.GroupResize(scale, localID); group.GroupResize(scale);
} }
} }
} }

View File

@ -2658,15 +2658,16 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void GroupResize(Vector3 scale, uint localID) /// <summary>
{ /// Resize the entire group of prims.
SceneObjectPart part = GetChildPart(localID); /// </summary>
if (part != null) /// <param name="scale"></param>
public void GroupResize(Vector3 scale)
{ {
// m_log.DebugFormat( // 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);
part.IgnoreUndoUpdate = true; RootPart.IgnoreUndoUpdate = true;
if (scale.X > m_scene.m_maxNonphys) if (scale.X > m_scene.m_maxNonphys)
scale.X = m_scene.m_maxNonphys; scale.X = m_scene.m_maxNonphys;
@ -2675,7 +2676,7 @@ namespace OpenSim.Region.Framework.Scenes
if (scale.Z > m_scene.m_maxNonphys) if (scale.Z > m_scene.m_maxNonphys)
scale.Z = m_scene.m_maxNonphys; scale.Z = m_scene.m_maxNonphys;
if (part.PhysActor != null && part.PhysActor.IsPhysical) if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical)
{ {
if (scale.X > m_scene.m_maxPhys) if (scale.X > m_scene.m_maxPhys)
scale.X = m_scene.m_maxPhys; scale.X = m_scene.m_maxPhys;
@ -2684,9 +2685,10 @@ namespace OpenSim.Region.Framework.Scenes
if (scale.Z > m_scene.m_maxPhys) if (scale.Z > m_scene.m_maxPhys)
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 x = (scale.X / RootPart.Scale.X);
float z = (scale.Z / part.Scale.Z); float y = (scale.Y / RootPart.Scale.Y);
float z = (scale.Z / RootPart.Scale.Z);
SceneObjectPart[] parts; SceneObjectPart[] parts;
if (x > 1.0f || y > 1.0f || z > 1.0f) if (x > 1.0f || y > 1.0f || z > 1.0f)
@ -2703,7 +2705,7 @@ namespace OpenSim.Region.Framework.Scenes
float f = 1.0f; float f = 1.0f;
float a = 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)
{ {
@ -2763,11 +2765,11 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
Vector3 prevScale = part.Scale; Vector3 prevScale = RootPart.Scale;
prevScale.X *= x; prevScale.X *= x;
prevScale.Y *= y; prevScale.Y *= y;
prevScale.Z *= z; prevScale.Z *= z;
part.Resize(prevScale); RootPart.Resize(prevScale);
parts = m_parts.GetArray(); parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
@ -2801,22 +2803,21 @@ namespace OpenSim.Region.Framework.Scenes
obPart.StoreUndoState(); obPart.StoreUndoState();
} }
if (part.PhysActor != null) if (RootPart.PhysActor != null)
{ {
part.PhysActor.Size = prevScale; RootPart.PhysActor.Size = prevScale;
// If we're a sculpt wait for the trigger when the sculpt texture is retrieved. // If we're a sculpt wait for the trigger when the sculpt texture is retrieved.
if (((OpenMetaverse.SculptType)part.Shape.SculptType) != SculptType.Mesh) if (((OpenMetaverse.SculptType)RootPart.Shape.SculptType) != SculptType.Mesh)
m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); m_scene.PhysicsScene.AddPhysicsActorTaint(RootPart.PhysActor);
} }
part.IgnoreUndoUpdate = false; RootPart.IgnoreUndoUpdate = false;
part.StoreUndoState(); RootPart.StoreUndoState();
HasGroupChanged = true; HasGroupChanged = true;
m_rootPart.TriggerScriptChangedEvent(Changed.SCALE); RootPart.TriggerScriptChangedEvent(Changed.SCALE);
ScheduleGroupForTerseUpdate(); ScheduleGroupForTerseUpdate();
} }
}
#endregion #endregion

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Scene scene = SceneSetupHelpers.SetupScene(); Scene scene = SceneSetupHelpers.SetupScene();
SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup; SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup;
g1.GroupResize(new Vector3(2, 3, 4), g1.LocalId); g1.GroupResize(new Vector3(2, 3, 4));
SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID); SceneObjectGroup g1Post = scene.GetSceneObjectGroup(g1.UUID);