Fix undo of prim group rotation.
This isn't that great since I think I broke it a few commits earlier. Undo of rotation of individual prims in a linkset is still brokenbulletsim
parent
4b9ef4f39c
commit
97f1edfd95
|
@ -2895,9 +2895,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE OBJECT GROUP]: Updating group rotation R of {0} {1} to {2}", Name, LocalId, rot);
|
// "[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();
|
||||||
|
|
||||||
|
m_rootPart.StoreUndoState(true);
|
||||||
|
|
||||||
m_rootPart.UpdateRotation(rot);
|
m_rootPart.UpdateRotation(rot);
|
||||||
|
|
||||||
|
@ -2922,9 +2924,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE OBJECT GROUP]: Updating group rotation PR of {0} {1} to {2}", Name, LocalId, rot);
|
// "[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();
|
||||||
|
|
||||||
|
RootPart.StoreUndoState(true);
|
||||||
|
RootPart.IgnoreUndoUpdate = true;
|
||||||
|
|
||||||
m_rootPart.UpdateRotation(rot);
|
m_rootPart.UpdateRotation(rot);
|
||||||
|
|
||||||
|
@ -2939,6 +2944,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
HasGroupChanged = true;
|
HasGroupChanged = true;
|
||||||
ScheduleGroupForTerseUpdate();
|
ScheduleGroupForTerseUpdate();
|
||||||
|
|
||||||
|
RootPart.IgnoreUndoUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -3706,8 +3706,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_undo.Push(nUndo);
|
m_undo.Push(nUndo);
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[SCENE OBJECT PART]: Stored undo state for {0} {1}, stack size now {2}",
|
"[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}",
|
||||||
Name, LocalId, m_undo.Count);
|
Name, LocalId, forGroup, m_undo.Count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
public class UndoState
|
public class UndoState
|
||||||
{
|
{
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
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;
|
||||||
|
@ -57,23 +57,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (part.ParentID == 0)
|
if (part.ParentID == 0)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
ForGroup = forGroup;
|
||||||
// "[UNDO STATE]: Storing undo position {0} for root part", part.ParentGroup.AbsolutePosition);
|
|
||||||
|
|
||||||
if (ForGroup)
|
if (ForGroup)
|
||||||
Position = part.ParentGroup.AbsolutePosition;
|
Position = part.ParentGroup.AbsolutePosition;
|
||||||
else
|
else
|
||||||
Position = part.OffsetPosition;
|
Position = part.OffsetPosition;
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
// "[UNDO STATE]: Storing undo rotation {0} for root part", part.RotationOffset);
|
"[UNDO STATE]: Storing undo position {0} for root part", Position);
|
||||||
|
|
||||||
Rotation = part.RotationOffset;
|
Rotation = part.RotationOffset;
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
// "[UNDO STATE]: Storing undo scale {0} for root part", part.Shape.Scale);
|
"[UNDO STATE]: Storing undo rotation {0} for root part", Rotation);
|
||||||
|
|
||||||
Scale = part.Shape.Scale;
|
Scale = part.Shape.Scale;
|
||||||
|
|
||||||
ForGroup = forGroup;
|
m_log.DebugFormat(
|
||||||
|
"[UNDO STATE]: Storing undo scale {0} for root part", Scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -132,23 +134,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (part.ParentID == 0)
|
if (part.ParentID == 0)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[UNDO STATE]: Undoing position to {0} for root part {1} {2}",
|
||||||
|
Position, part.Name, part.LocalId);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (ForGroup)
|
if (ForGroup)
|
||||||
part.ParentGroup.AbsolutePosition = Position;
|
part.ParentGroup.AbsolutePosition = Position;
|
||||||
else
|
else
|
||||||
part.OffsetPosition = Position;
|
part.OffsetPosition = Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}",
|
"[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}",
|
||||||
// part.RotationOffset, Rotation, part.Name, part.LocalId);
|
part.RotationOffset, Rotation, part.Name, part.LocalId);
|
||||||
|
|
||||||
part.RotationOffset = Rotation;
|
part.UpdateRotation(Rotation);
|
||||||
|
//part.RotationOffset = Rotation;
|
||||||
|
|
||||||
if (Scale != Vector3.Zero)
|
if (Scale != Vector3.Zero)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue