From 908abb1c3dded307e769abac71f660b835875975 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 10 Mar 2012 20:32:19 +0000
Subject: BIG MESS. changed Iclient interface so only one event is used to
inform scene about position scale or rotation change by client (others can be
added). Its served at SceneGraph that does permition checks, undostore and
sends down to SOG. changed values are stored in a class (ObjectChangeData)
and what is changed as a enum (ObjectChangeWhat) with bit fields and 'macros'
of this for better readability (at top of scenegraph.cs lasy to find better
place for now) this can be extended for other things clients changes and need
undo/redo. SOG process acording to what is changed. Changed UNDO/redo to use
this also (warning is only storing what is changed, previus stored all, this
must be checked for side efects. to save all PRS change commented line in
scenegraph). Still have excessive calls to ScheduleGroupForTerseUpdate. ****
UNTESTED ****
---
OpenSim/Region/Framework/Scenes/UndoState.cs | 113 ++++++++++++++++++++++++++-
1 file changed, 112 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes/UndoState.cs')
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs
index 38474de..eb76ca5 100644
--- a/OpenSim/Region/Framework/Scenes/UndoState.cs
+++ b/OpenSim/Region/Framework/Scenes/UndoState.cs
@@ -48,6 +48,7 @@ namespace OpenSim.Region.Framework.Scenes
STATE_ALL = 63
}
+/*
public class UndoState
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -121,9 +122,16 @@ namespace OpenSim.Region.Framework.Scenes
public void PlayState(SceneObjectPart part)
{
part.Undoing = true;
-
+ bool physbuilding = false;
+
if (part.ParentID == 0)
{
+ if (!ForGroup && part.PhysActor != null)
+ {
+ part.PhysActor.Building = true;
+ physbuilding = true;
+ }
+
if (Position != Vector3.Zero)
{
if (ForGroup)
@@ -139,17 +147,34 @@ namespace OpenSim.Region.Framework.Scenes
if (Scale != Vector3.Zero)
{
+ if (!physbuilding && part.PhysActor != null)
+ {
+ part.PhysActor.Building = true;
+ physbuilding = true;
+ }
+
if (ForGroup)
part.ParentGroup.GroupResize(Scale);
else
part.Resize(Scale);
}
+
+ if (physbuilding)
+ part.PhysActor.Building = false;
+
part.ParentGroup.ScheduleGroupForTerseUpdate();
}
else
{
if (ForGroup) // trap for group since seems parts can't do it
return;
+
+ // changing a part invalidates entire object physical rep
+ if (part.ParentGroup != null && part.ParentGroup.RootPart != null && part.ParentGroup.RootPart.PhysActor != null)
+ {
+ part.ParentGroup.RootPart.PhysActor.Building = true;
+ physbuilding = true;
+ }
// Note: Updating these properties on sop automatically schedules an update if needed
part.OffsetPosition = Position;
@@ -158,12 +183,98 @@ namespace OpenSim.Region.Framework.Scenes
{
part.Resize(Scale);
}
+
+ if (physbuilding)
+ part.ParentGroup.RootPart.PhysActor.Building = false;
+ }
+
+ part.Undoing = false;
+ }
+ }
+*/
+ public class UndoState
+ {
+ public ObjectChangeData data;
+ ///
+ /// Constructor.
+ ///
+ ///
+ /// True if the undo is for an entire group
+ /// only for root parts ????
+ public UndoState(SceneObjectPart part, ObjectChangeWhat what)
+ {
+ data = new ObjectChangeData();
+
+ data.what = what;
+
+ if (part.ParentGroup.RootPart == part)
+ {
+ if ((what & ObjectChangeWhat.Position) != 0)
+ data.position = part.ParentGroup.AbsolutePosition;
+ if ((what & ObjectChangeWhat.Rotation) != 0)
+ data.rotation = part.RotationOffset;
+ if ((what & ObjectChangeWhat.Scale) != 0)
+ data.scale = part.Shape.Scale;
+ }
+ else
+ {
+ if ((what & ObjectChangeWhat.Position) != 0)
+ data.position = part.OffsetPosition;
+ if ((what & ObjectChangeWhat.Rotation) != 0)
+ data.rotation = part.RotationOffset;
+ if ((what & ObjectChangeWhat.Scale) != 0)
+ data.scale = part.Shape.Scale;
+ }
+ }
+
+ ///
+ /// Compare the relevant state in the given part to this state.
+ ///
+ ///
+ /// true if both the part's position, rotation and scale match those in this undo state. False otherwise.
+ public bool Compare(SceneObjectPart part, ObjectChangeWhat what)
+ {
+ if (data.what != what) // if diferent targets, then they are diferent
+ return false;
+
+ if (part != null)
+ {
+ if (part.ParentID == 0)
+ {
+ if ((what & ObjectChangeWhat.Position) != 0 && data.position != part.ParentGroup.AbsolutePosition)
+ return false;
+ }
+ else
+ {
+ if ((what & ObjectChangeWhat.Position) != 0 && data.position != part.OffsetPosition)
+ return false;
+ }
+
+ if ((what & ObjectChangeWhat.Rotation) != 0 && data.rotation != part.RotationOffset)
+ return false;
+ if ((what & ObjectChangeWhat.Rotation) != 0 && data.scale == part.Shape.Scale)
+ return false;
+ return true;
+
}
+ return false;
+ }
+ public void PlayState(SceneObjectPart part)
+ {
+ part.Undoing = true;
+
+ SceneObjectGroup grp = part.ParentGroup;
+
+ if (grp != null)
+ {
+ grp.doChangeObject(part, data);
+ }
part.Undoing = false;
}
}
+
public class LandUndoState
{
public ITerrainModule m_terrainModule;
--
cgit v1.1