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.bulletsim
parent
aec3b58a57
commit
6fc74b36d1
|
@ -11242,6 +11242,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Do this once since fetch parts creates a new array.
|
||||||
|
SceneObjectPart[] parts = part.ParentGroup.Parts;
|
||||||
|
for (int j = 0; j < parts.Length; j++)
|
||||||
|
{
|
||||||
|
part.StoreUndoState();
|
||||||
|
parts[j].IgnoreUndoUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
// UUID partId = part.UUID;
|
// UUID partId = part.UUID;
|
||||||
UpdatePrimGroupRotation handlerUpdatePrimGroupRotation;
|
UpdatePrimGroupRotation handlerUpdatePrimGroupRotation;
|
||||||
|
|
||||||
|
@ -11257,6 +11265,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
handlerUpdatePrimSinglePosition(localId, pos1, this);
|
handlerUpdatePrimSinglePosition(localId, pos1, this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
Quaternion rot1 = new Quaternion(block.Data, 0, true);
|
Quaternion rot1 = new Quaternion(block.Data, 0, true);
|
||||||
|
|
||||||
|
@ -11267,6 +11276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
handlerUpdatePrimSingleRotation(localId, rot1, this);
|
handlerUpdatePrimSingleRotation(localId, rot1, this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
Vector3 rotPos = new Vector3(block.Data, 0);
|
Vector3 rotPos = new Vector3(block.Data, 0);
|
||||||
Quaternion rot2 = new Quaternion(block.Data, 12, true);
|
Quaternion rot2 = new Quaternion(block.Data, 12, true);
|
||||||
|
@ -11279,6 +11289,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
|
handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
case 20:
|
case 20:
|
||||||
Vector3 scale4 = new Vector3(block.Data, 0);
|
Vector3 scale4 = new Vector3(block.Data, 0);
|
||||||
|
@ -11290,8 +11301,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
handlerUpdatePrimScale(localId, scale4, this);
|
handlerUpdatePrimScale(localId, scale4, this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
|
||||||
|
|
||||||
|
case 5:
|
||||||
Vector3 scale1 = new Vector3(block.Data, 12);
|
Vector3 scale1 = new Vector3(block.Data, 12);
|
||||||
Vector3 pos11 = new Vector3(block.Data, 0);
|
Vector3 pos11 = new Vector3(block.Data, 0);
|
||||||
|
|
||||||
|
@ -11308,6 +11319,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
Vector3 pos2 = new Vector3(block.Data, 0);
|
Vector3 pos2 = new Vector3(block.Data, 0);
|
||||||
|
|
||||||
|
@ -11315,10 +11327,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
if (handlerUpdateVector != null)
|
if (handlerUpdateVector != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
handlerUpdateVector(localId, pos2, this);
|
handlerUpdateVector(localId, pos2, this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
Quaternion rot3 = new Quaternion(block.Data, 0, true);
|
Quaternion rot3 = new Quaternion(block.Data, 0, true);
|
||||||
|
|
||||||
|
@ -11329,6 +11341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
handlerUpdatePrimRotation(localId, rot3, this);
|
handlerUpdatePrimRotation(localId, rot3, this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
Vector3 pos3 = new Vector3(block.Data, 0);
|
Vector3 pos3 = new Vector3(block.Data, 0);
|
||||||
Quaternion rot4 = new Quaternion(block.Data, 12, true);
|
Quaternion rot4 = new Quaternion(block.Data, 12, true);
|
||||||
|
@ -11352,6 +11365,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
handlerUpdatePrimGroupScale(localId, scale7, this);
|
handlerUpdatePrimGroupScale(localId, scale7, this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 13:
|
case 13:
|
||||||
Vector3 scale2 = new Vector3(block.Data, 12);
|
Vector3 scale2 = new Vector3(block.Data, 12);
|
||||||
Vector3 pos4 = new Vector3(block.Data, 0);
|
Vector3 pos4 = new Vector3(block.Data, 0);
|
||||||
|
@ -11371,6 +11385,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 29:
|
case 29:
|
||||||
Vector3 scale5 = new Vector3(block.Data, 12);
|
Vector3 scale5 = new Vector3(block.Data, 12);
|
||||||
Vector3 pos5 = new Vector3(block.Data, 0);
|
Vector3 pos5 = new Vector3(block.Data, 0);
|
||||||
|
@ -11388,6 +11403,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 21:
|
case 21:
|
||||||
Vector3 scale6 = new Vector3(block.Data, 12);
|
Vector3 scale6 = new Vector3(block.Data, 12);
|
||||||
Vector3 pos6 = new Vector3(block.Data, 0);
|
Vector3 pos6 = new Vector3(block.Data, 0);
|
||||||
|
@ -11404,13 +11420,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
m_log.Debug("[CLIENT] MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
|
m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < parts.Length; j++)
|
||||||
|
parts[j].IgnoreUndoUpdate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -564,6 +564,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.Undo();
|
part.Undo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal void HandleRedo(IClientAPI remoteClient, UUID primId)
|
protected internal void HandleRedo(IClientAPI remoteClient, UUID primId)
|
||||||
{
|
{
|
||||||
if (primId != UUID.Zero)
|
if (primId != UUID.Zero)
|
||||||
|
|
|
@ -1145,6 +1145,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient)
|
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.StoreUndoState();
|
||||||
part.OnGrab(offsetPos, remoteClient);
|
part.OnGrab(offsetPos, remoteClient);
|
||||||
}
|
}
|
||||||
|
@ -2611,17 +2615,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#region Resize
|
#region Resize
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resize the entire group of prims.
|
/// Resize the entire group of prims.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scale"></param>
|
/// <param name="scale"></param>
|
||||||
public void GroupResize(Vector3 scale)
|
public void GroupResize(Vector3 scale)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, localID, RootPart.Scale, scale);
|
// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale);
|
||||||
|
|
||||||
RootPart.IgnoreUndoUpdate = true;
|
|
||||||
|
|
||||||
scale.X = Math.Min(scale.X, Scene.m_maxNonphys);
|
scale.X = Math.Min(scale.X, Scene.m_maxNonphys);
|
||||||
scale.Y = Math.Min(scale.Y, 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];
|
SceneObjectPart obPart = parts[i];
|
||||||
if (obPart.UUID != m_rootPart.UUID)
|
if (obPart.UUID != m_rootPart.UUID)
|
||||||
{
|
{
|
||||||
obPart.IgnoreUndoUpdate = true;
|
// obPart.IgnoreUndoUpdate = true;
|
||||||
Vector3 oldSize = new Vector3(obPart.Scale);
|
Vector3 oldSize = new Vector3(obPart.Scale);
|
||||||
|
|
||||||
float f = 1.0f;
|
float f = 1.0f;
|
||||||
|
@ -2663,6 +2664,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
y *= a;
|
y *= a;
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldSize.Y * y > m_scene.m_maxPhys)
|
if (oldSize.Y * y > m_scene.m_maxPhys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_maxPhys / oldSize.Y;
|
f = m_scene.m_maxPhys / oldSize.Y;
|
||||||
|
@ -2671,6 +2673,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
y *= a;
|
y *= a;
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldSize.Z * z > m_scene.m_maxPhys)
|
if (oldSize.Z * z > m_scene.m_maxPhys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_maxPhys / oldSize.Z;
|
f = m_scene.m_maxPhys / oldSize.Z;
|
||||||
|
@ -2690,6 +2693,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
y *= a;
|
y *= a;
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldSize.Y * y > m_scene.m_maxNonphys)
|
if (oldSize.Y * y > m_scene.m_maxNonphys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_maxNonphys / oldSize.Y;
|
f = m_scene.m_maxNonphys / oldSize.Y;
|
||||||
|
@ -2698,6 +2702,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
y *= a;
|
y *= a;
|
||||||
z *= a;
|
z *= a;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldSize.Z * z > m_scene.m_maxNonphys)
|
if (oldSize.Z * z > m_scene.m_maxNonphys)
|
||||||
{
|
{
|
||||||
f = m_scene.m_maxNonphys / oldSize.Z;
|
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++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
SceneObjectPart obPart = parts[i];
|
SceneObjectPart obPart = parts[i];
|
||||||
obPart.IgnoreUndoUpdate = true;
|
// obPart.IgnoreUndoUpdate = true;
|
||||||
|
|
||||||
if (obPart.UUID != m_rootPart.UUID)
|
if (obPart.UUID != m_rootPart.UUID)
|
||||||
{
|
{
|
||||||
|
@ -2738,16 +2743,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
newSize.Z *= z;
|
newSize.Z *= z;
|
||||||
|
|
||||||
obPart.Resize(newSize);
|
obPart.Resize(newSize);
|
||||||
|
|
||||||
|
obPart.IgnoreUndoUpdate = true;
|
||||||
obPart.UpdateOffSet(currentpos);
|
obPart.UpdateOffSet(currentpos);
|
||||||
|
obPart.IgnoreUndoUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
obPart.IgnoreUndoUpdate = false;
|
// obPart.IgnoreUndoUpdate = false;
|
||||||
obPart.StoreUndoState();
|
// obPart.StoreUndoState();
|
||||||
}
|
}
|
||||||
|
|
||||||
RootPart.IgnoreUndoUpdate = false;
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE OBJECT GROUP]: Finished group resizing {0} {1} to {2}", Name, LocalId, RootPart.Scale);
|
||||||
RootPart.StoreUndoState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -2760,6 +2767,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
public void UpdateGroupPosition(Vector3 pos)
|
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();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
parts[i].StoreUndoState();
|
parts[i].StoreUndoState();
|
||||||
|
@ -2805,6 +2814,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (part != null)
|
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)
|
if (part.UUID == m_rootPart.UUID)
|
||||||
{
|
{
|
||||||
UpdateRootPosition(pos);
|
UpdateRootPosition(pos);
|
||||||
|
@ -2824,6 +2836,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="pos"></param>
|
/// <param name="pos"></param>
|
||||||
private void UpdateRootPosition(Vector3 pos)
|
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();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
parts[i].StoreUndoState();
|
parts[i].StoreUndoState();
|
||||||
|
@ -2868,6 +2883,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="rot"></param>
|
/// <param name="rot"></param>
|
||||||
public void UpdateGroupRotationR(Quaternion rot)
|
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();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
parts[i].StoreUndoState();
|
parts[i].StoreUndoState();
|
||||||
|
@ -2892,6 +2910,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="rot"></param>
|
/// <param name="rot"></param>
|
||||||
public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
|
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();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
parts[i].StoreUndoState();
|
parts[i].StoreUndoState();
|
||||||
|
@ -2926,6 +2947,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (part != null)
|
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)
|
if (part.UUID == m_rootPart.UUID)
|
||||||
{
|
{
|
||||||
UpdateRootRotation(rot);
|
UpdateRootRotation(rot);
|
||||||
|
@ -2947,6 +2971,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectPart part = GetChildPart(localID);
|
SceneObjectPart part = GetChildPart(localID);
|
||||||
if (part != null)
|
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)
|
if (part.UUID == m_rootPart.UUID)
|
||||||
{
|
{
|
||||||
UpdateRootRotation(rot);
|
UpdateRootRotation(rot);
|
||||||
|
@ -2969,6 +2997,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="rot"></param>
|
/// <param name="rot"></param>
|
||||||
private void UpdateRootRotation(Quaternion rot)
|
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 axRot = rot;
|
||||||
Quaternion oldParentRot = m_rootPart.RotationOffset;
|
Quaternion oldParentRot = m_rootPart.RotationOffset;
|
||||||
|
|
||||||
|
|
|
@ -1014,15 +1014,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return m_shape; }
|
get { return m_shape; }
|
||||||
set { m_shape = value; }
|
set { m_shape = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change the scale of this part.
|
||||||
|
/// </summary>
|
||||||
public Vector3 Scale
|
public Vector3 Scale
|
||||||
{
|
{
|
||||||
get { return m_shape.Scale; }
|
get { return m_shape.Scale; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
StoreUndoState();
|
|
||||||
if (m_shape != null)
|
if (m_shape != null)
|
||||||
{
|
{
|
||||||
|
StoreUndoState();
|
||||||
|
|
||||||
m_shape.Scale = value;
|
m_shape.Scale = value;
|
||||||
|
|
||||||
PhysicsActor actor = PhysActor;
|
PhysicsActor actor = PhysActor;
|
||||||
|
@ -1033,11 +1037,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (m_parentGroup.Scene.PhysicsScene != null)
|
if (m_parentGroup.Scene.PhysicsScene != null)
|
||||||
{
|
{
|
||||||
actor.Size = m_shape.Scale;
|
actor.Size = m_shape.Scale;
|
||||||
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
|
|
||||||
|
if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh)
|
||||||
|
CheckSculptAndLoad();
|
||||||
|
else
|
||||||
|
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TriggerScriptChangedEvent(Changed.SCALE);
|
TriggerScriptChangedEvent(Changed.SCALE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2827,8 +2836,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resize this part.
|
/// Set the scale of this part.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Unlike the scale property, this checks the new size against scene limits and schedules a full property
|
||||||
|
/// update to viewers.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="scale"></param>
|
/// <param name="scale"></param>
|
||||||
public void Resize(Vector3 scale)
|
public void Resize(Vector3 scale)
|
||||||
{
|
{
|
||||||
|
@ -2836,33 +2849,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys);
|
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys);
|
||||||
scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys);
|
scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys);
|
||||||
|
|
||||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
|
if (PhysActor != null && PhysActor.IsPhysical)
|
||||||
|
|
||||||
StoreUndoState();
|
|
||||||
m_shape.Scale = scale;
|
|
||||||
|
|
||||||
// If we're a mesh/sculpt, then we need to tell the physics engine about our new size. To do this, we
|
|
||||||
// need to reinsert the sculpt data into the shape, since the physics engine deletes it when done to
|
|
||||||
// save memory
|
|
||||||
if (PhysActor != null)
|
|
||||||
{
|
{
|
||||||
if (PhysActor.IsPhysical)
|
scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys);
|
||||||
{
|
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys);
|
||||||
scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys);
|
scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys);
|
||||||
scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys);
|
|
||||||
scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys);
|
|
||||||
}
|
|
||||||
|
|
||||||
PhysActor.Size = scale;
|
|
||||||
|
|
||||||
if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh)
|
|
||||||
CheckSculptAndLoad();
|
|
||||||
else
|
|
||||||
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
|
||||||
|
|
||||||
|
Scale = scale;
|
||||||
|
|
||||||
ParentGroup.HasGroupChanged = true;
|
ParentGroup.HasGroupChanged = true;
|
||||||
TriggerScriptChangedEvent(Changed.SCALE);
|
|
||||||
ScheduleFullUpdate();
|
ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3673,8 +3671,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (m_parentGroup != null)
|
if (m_parentGroup != null)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Storing undo state for {0} {1}", Name, LocalId);
|
|
||||||
|
|
||||||
lock (m_undo)
|
lock (m_undo)
|
||||||
{
|
{
|
||||||
if (m_undo.Count > 0)
|
if (m_undo.Count > 0)
|
||||||
|
@ -3683,15 +3679,29 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (last != null)
|
if (last != null)
|
||||||
{
|
{
|
||||||
if (last.Compare(this))
|
if (last.Compare(this))
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
|
||||||
|
// Name, LocalId, m_undo.Count);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, initial stack size {2}",
|
||||||
|
// Name, LocalId, m_undo.Count);
|
||||||
|
|
||||||
if (m_parentGroup.GetSceneMaxUndo() > 0)
|
if (m_parentGroup.GetSceneMaxUndo() > 0)
|
||||||
{
|
{
|
||||||
UndoState nUndo = new UndoState(this);
|
UndoState nUndo = new UndoState(this);
|
||||||
|
|
||||||
m_undo.Push(nUndo);
|
m_undo.Push(nUndo);
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, stack size now {2}",
|
||||||
|
// Name, LocalId, m_undo.Count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3703,7 +3713,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3721,10 +3732,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void Undo()
|
public void Undo()
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Handling undo request for {0} {1}", Name, LocalId);
|
|
||||||
|
|
||||||
lock (m_undo)
|
lock (m_undo)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}",
|
||||||
|
// Name, LocalId, m_undo.Count);
|
||||||
|
|
||||||
if (m_undo.Count > 0)
|
if (m_undo.Count > 0)
|
||||||
{
|
{
|
||||||
UndoState nUndo = null;
|
UndoState nUndo = null;
|
||||||
|
@ -3739,19 +3752,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (goback != null)
|
if (goback != null)
|
||||||
{
|
{
|
||||||
goback.PlaybackState(this);
|
goback.PlaybackState(this);
|
||||||
|
|
||||||
if (nUndo != null)
|
if (nUndo != null)
|
||||||
m_redo.Push(nUndo);
|
m_redo.Push(nUndo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE OBJECT PART]: Handled undo request for {0} {1}, stack size now {2}",
|
||||||
|
// Name, LocalId, m_undo.Count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Redo()
|
public void Redo()
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId);
|
|
||||||
|
|
||||||
lock (m_redo)
|
lock (m_redo)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}",
|
||||||
|
// Name, LocalId, m_redo.Count);
|
||||||
|
|
||||||
if (m_parentGroup.GetSceneMaxUndo() > 0)
|
if (m_parentGroup.GetSceneMaxUndo() > 0)
|
||||||
{
|
{
|
||||||
UndoState nUndo = new UndoState(this);
|
UndoState nUndo = new UndoState(this);
|
||||||
|
@ -3763,11 +3783,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (gofwd != null)
|
if (gofwd != null)
|
||||||
gofwd.PlayfwdState(this);
|
gofwd.PlayfwdState(this);
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}",
|
||||||
|
// Name, LocalId, m_redo.Count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearUndoState()
|
public void ClearUndoState()
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[SCENE OBJECT PART]: Clearing undo and redo stacks in {0} {1}", Name, LocalId);
|
||||||
|
|
||||||
lock (m_undo)
|
lock (m_undo)
|
||||||
{
|
{
|
||||||
m_undo.Clear();
|
m_undo.Clear();
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
public void TestResizeSceneObject()
|
public void TestResizeSceneObject()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
//log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
Scene scene = SceneSetupHelpers.SetupScene();
|
Scene scene = SceneSetupHelpers.SetupScene();
|
||||||
SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup;
|
SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup;
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
|
||||||
|
@ -32,49 +35,80 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
public class UndoState
|
public class UndoState
|
||||||
{
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public Vector3 Position = Vector3.Zero;
|
public Vector3 Position = Vector3.Zero;
|
||||||
public Vector3 Scale = Vector3.Zero;
|
public Vector3 Scale = Vector3.Zero;
|
||||||
public Quaternion Rotation = Quaternion.Identity;
|
public Quaternion Rotation = Quaternion.Identity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="part"></param>
|
||||||
public UndoState(SceneObjectPart part)
|
public UndoState(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
if (part.ParentID == 0)
|
if (part.ParentID == 0)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[UNDO STATE]: Storing undo position {0} for root part", part.ParentGroup.AbsolutePosition);
|
||||||
Position = part.ParentGroup.AbsolutePosition;
|
Position = part.ParentGroup.AbsolutePosition;
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[UNDO STATE]: Storing undo rotation {0} for root part", part.RotationOffset);
|
||||||
Rotation = part.RotationOffset;
|
Rotation = part.RotationOffset;
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[UNDO STATE]: Storing undo scale {0} for root part", part.Shape.Scale);
|
||||||
Scale = part.Shape.Scale;
|
Scale = part.Shape.Scale;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[UNDO STATE]: Storing undo position {0} for child part", part.OffsetPosition);
|
||||||
Position = part.OffsetPosition;
|
Position = part.OffsetPosition;
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[UNDO STATE]: Storing undo rotation {0} for child part", part.RotationOffset);
|
||||||
Rotation = part.RotationOffset;
|
Rotation = part.RotationOffset;
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[UNDO STATE]: Storing undo scale {0} for child part", part.Shape.Scale);
|
||||||
Scale = part.Shape.Scale;
|
Scale = part.Shape.Scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compare the relevant state in the given part to this state.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="part"></param>
|
||||||
|
/// <returns>true if both the part's position, rotation and scale match those in this undo state. False otherwise.</returns>
|
||||||
public bool Compare(SceneObjectPart part)
|
public bool Compare(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
if (part.ParentID == 0)
|
if (part.ParentID == 0)
|
||||||
{
|
{
|
||||||
if (Position == part.ParentGroup.AbsolutePosition && Rotation == part.ParentGroup.Rotation)
|
if (Position == part.ParentGroup.AbsolutePosition
|
||||||
|
&& Rotation == part.RotationOffset
|
||||||
|
&& Scale == part.Shape.Scale)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Position == part.OffsetPosition && Rotation == part.RotationOffset && Scale == part.Shape.Scale)
|
if (Position == part.OffsetPosition
|
||||||
|
&& Rotation == part.RotationOffset
|
||||||
|
&& Scale == part.Shape.Scale)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,24 +121,64 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (part.ParentID == 0)
|
if (part.ParentID == 0)
|
||||||
{
|
{
|
||||||
if (Position != Vector3.Zero)
|
if (Position != Vector3.Zero)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[UNDO STATE]: Undoing position {0} to {1} for root part {2} {3}",
|
||||||
|
// part.ParentGroup.AbsolutePosition, Position, part.Name, part.LocalId);
|
||||||
|
|
||||||
part.ParentGroup.AbsolutePosition = Position;
|
part.ParentGroup.AbsolutePosition = Position;
|
||||||
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}",
|
||||||
|
// part.RotationOffset, Rotation, part.Name, part.LocalId);
|
||||||
|
|
||||||
part.RotationOffset = Rotation;
|
part.RotationOffset = Rotation;
|
||||||
|
|
||||||
if (Scale != Vector3.Zero)
|
if (Scale != Vector3.Zero)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}",
|
||||||
|
// part.Shape.Scale, Scale, part.Name, part.LocalId);
|
||||||
|
|
||||||
part.Resize(Scale);
|
part.Resize(Scale);
|
||||||
|
}
|
||||||
|
|
||||||
part.ParentGroup.ScheduleGroupForTerseUpdate();
|
part.ParentGroup.ScheduleGroupForTerseUpdate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Position != Vector3.Zero)
|
if (Position != Vector3.Zero)
|
||||||
part.OffsetPosition = Position;
|
{
|
||||||
part.UpdateRotation(Rotation);
|
// m_log.DebugFormat(
|
||||||
if (Scale != Vector3.Zero)
|
// "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}",
|
||||||
part.Resize(Scale); part.ScheduleTerseUpdate();
|
// part.OffsetPosition, Position, part.Name, part.LocalId);
|
||||||
}
|
|
||||||
part.Undoing = false;
|
|
||||||
|
|
||||||
|
part.OffsetPosition = Position;
|
||||||
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}",
|
||||||
|
// part.RotationOffset, Rotation, part.Name, part.LocalId);
|
||||||
|
|
||||||
|
part.UpdateRotation(Rotation);
|
||||||
|
|
||||||
|
if (Scale != Vector3.Zero)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}",
|
||||||
|
// part.Shape.Scale, Scale, part.Name, part.LocalId);
|
||||||
|
|
||||||
|
part.Resize(Scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
part.ScheduleTerseUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
part.Undoing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayfwdState(SceneObjectPart part)
|
public void PlayfwdState(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
if (part != null)
|
if (part != null)
|
||||||
|
@ -115,27 +189,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (Position != Vector3.Zero)
|
if (Position != Vector3.Zero)
|
||||||
part.ParentGroup.AbsolutePosition = Position;
|
part.ParentGroup.AbsolutePosition = Position;
|
||||||
|
|
||||||
if (Rotation != Quaternion.Identity)
|
if (Rotation != Quaternion.Identity)
|
||||||
part.UpdateRotation(Rotation);
|
part.UpdateRotation(Rotation);
|
||||||
|
|
||||||
if (Scale != Vector3.Zero)
|
if (Scale != Vector3.Zero)
|
||||||
part.Resize(Scale);
|
part.Resize(Scale);
|
||||||
|
|
||||||
part.ParentGroup.ScheduleGroupForTerseUpdate();
|
part.ParentGroup.ScheduleGroupForTerseUpdate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Position != Vector3.Zero)
|
if (Position != Vector3.Zero)
|
||||||
part.OffsetPosition = Position;
|
part.OffsetPosition = Position;
|
||||||
|
|
||||||
if (Rotation != Quaternion.Identity)
|
if (Rotation != Quaternion.Identity)
|
||||||
part.UpdateRotation(Rotation);
|
part.UpdateRotation(Rotation);
|
||||||
|
|
||||||
if (Scale != Vector3.Zero)
|
if (Scale != Vector3.Zero)
|
||||||
part.Resize(Scale);
|
part.Resize(Scale);
|
||||||
|
|
||||||
part.ScheduleTerseUpdate();
|
part.ScheduleTerseUpdate();
|
||||||
}
|
}
|
||||||
part.Undoing = false;
|
|
||||||
|
|
||||||
|
part.Undoing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LandUndoState
|
public class LandUndoState
|
||||||
{
|
{
|
||||||
public ITerrainModule m_terrainModule;
|
public ITerrainModule m_terrainModule;
|
||||||
|
|
Loading…
Reference in New Issue