From ebcd4910a21726c830796cfe14c0792007b766b7 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 13 Mar 2012 13:08:32 +0100
Subject: Refactor, move OjectChangeData into it's own file and rename
ObjectChnageWhat what into ObjectChangeType change. What is no name for a
variable or type!
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 115 +--------------------
.../Region/Framework/Scenes/SceneObjectGroup.cs | 24 ++---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 +-
OpenSim/Region/Framework/Scenes/UndoState.cs | 43 ++++----
4 files changed, 37 insertions(+), 149 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 5e770ba..e6e3ad0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -47,57 +47,6 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void ChangedBackupDelegate(SceneObjectGroup sog);
-
- public enum ObjectChangeWhat : uint
- {
- // bits definitions
- Position = 0x01,
- Rotation = 0x02,
- Scale = 0x04,
- Group = 0x08,
- UniformScale = 0x10,
-
- // macros from above
- // single prim
- primP = 0x01,
- primR = 0x02,
- primPR = 0x03,
- primS = 0x04,
- primPS = 0x05,
- primRS = 0x06,
- primPSR = 0x07,
-
- primUS = 0x14,
- primPUS = 0x15,
- primRUS = 0x16,
- primPUSR = 0x17,
-
- // group
- groupP = 0x09,
- groupR = 0x0A,
- groupPR = 0x0B,
- groupS = 0x0C,
- groupPS = 0x0D,
- groupRS = 0x0E,
- groupPSR = 0x0F,
-
- groupUS = 0x1C,
- groupPUS = 0x1D,
- groupRUS = 0x1E,
- groupPUSR = 0x1F,
-
- PRSmask = 0x07
- }
-
- public struct ObjectChangeData
- {
- public Quaternion rotation;
- public Vector3 position;
- public Vector3 scale;
- public ObjectChangeWhat what;
- }
-
-
///
/// This class used to be called InnerScene and may not yet truly be a SceneGraph. The non scene graph components
/// should be migrated out over time.
@@ -1352,75 +1301,13 @@ namespace OpenSim.Region.Framework.Scenes
{
if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId))
{
-// part.StoreUndoState(data.what | ObjectChangeWhat.PRSmask); // for now save all to keep previus behavour ???
- part.StoreUndoState(data.what); // lets test only saving what we changed
+ part.StoreUndoState(data.change); // lets test only saving what we changed
grp.doChangeObject(part, (ObjectChangeData)data);
}
}
}
}
-/* moved to SOG
- protected internal void doChangeObject(SceneObjectPart part, ObjectChangeData data)
- {
- if (part != null && part.ParentGroup != null)
- {
- ObjectChangeWhat what = data.what;
- bool togroup = ((what & ObjectChangeWhat.Group) != 0);
-// bool uniform = ((what & ObjectChangeWhat.UniformScale) != 0); not in use
-
- SceneObjectGroup group = part.ParentGroup;
- PhysicsActor pha = group.RootPart.PhysActor;
-
- if (togroup)
- {
- // related to group
- if ((what & ObjectChangeWhat.Position) != 0)
- group.AbsolutePosition = data.position;
- if ((what & ObjectChangeWhat.Rotation) != 0)
- group.RootPart.UpdateRotation(data.rotation);
- if ((what & ObjectChangeWhat.Scale) != 0)
- {
- if (pha != null)
- pha.Building = true;
- group.GroupResize(data.scale);
- if (pha != null)
- pha.Building = false;
- }
- }
- else
- {
- // related to single prim in a link-set ( ie group)
- if (pha != null)
- pha.Building = true;
-
- // must deal with root part specially for position and rotation
- // so parts offset positions or rotations are fixed
-
- if (part == group.RootPart)
- {
- if ((what & ObjectChangeWhat.Position) != 0)
- group.UpdateRootPosition(data.position);
- if ((what & ObjectChangeWhat.Rotation) != 0)
- group.UpdateRootRotation(data.rotation);
- }
- else
- {
- if ((what & ObjectChangeWhat.Position) != 0)
- part.OffsetPosition = data.position;
- if ((what & ObjectChangeWhat.Rotation) != 0)
- part.UpdateRotation(data.rotation);
- }
-
- if ((what & ObjectChangeWhat.Scale) != 0)
- part.Resize(data.scale);
-
- if (pha != null)
- pha.Building = false;
- }
- }
- }
-*/
///
/// Update the scale of an individual prim.
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index e5cfed0..b2502e0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3521,9 +3521,9 @@ namespace OpenSim.Region.Framework.Scenes
if (part != null && part.ParentGroup != null)
{
- ObjectChangeWhat what = data.what;
- bool togroup = ((what & ObjectChangeWhat.Group) != 0);
- // bool uniform = ((what & ObjectChangeWhat.UniformScale) != 0); not in use
+ ObjectChangeType change = data.change;
+ bool togroup = ((change & ObjectChangeType.Group) != 0);
+ // bool uniform = ((what & ObjectChangeType.UniformScale) != 0); not in use
SceneObjectGroup group = part.ParentGroup;
PhysicsActor pha = group.RootPart.PhysActor;
@@ -3533,17 +3533,17 @@ namespace OpenSim.Region.Framework.Scenes
if (togroup)
{
// related to group
- if ((what & ObjectChangeWhat.Position) != 0)
+ if ((change & ObjectChangeType.Position) != 0)
{
group.AbsolutePosition = data.position;
updateType = updatetype.groupterse;
}
- if ((what & ObjectChangeWhat.Rotation) != 0)
+ if ((change & ObjectChangeType.Rotation) != 0)
{
group.RootPart.UpdateRotation(data.rotation);
updateType = updatetype.none;
}
- if ((what & ObjectChangeWhat.Scale) != 0)
+ if ((change & ObjectChangeType.Scale) != 0)
{
if (pha != null)
pha.Building = true;
@@ -3566,26 +3566,26 @@ namespace OpenSim.Region.Framework.Scenes
if (part == group.RootPart)
{
- if ((what & ObjectChangeWhat.Position) != 0)
+ if ((change & ObjectChangeType.Position) != 0)
group.UpdateRootPosition(data.position);
- if ((what & ObjectChangeWhat.Rotation) != 0)
+ if ((change & ObjectChangeType.Rotation) != 0)
group.UpdateRootRotation(data.rotation);
- if ((what & ObjectChangeWhat.Scale) != 0)
+ if ((change & ObjectChangeType.Scale) != 0)
part.Resize(data.scale);
}
else
{
- if ((what & ObjectChangeWhat.Position) != 0)
+ if ((change & ObjectChangeType.Position) != 0)
{
part.OffsetPosition = data.position;
updateType = updatetype.partterse;
}
- if ((what & ObjectChangeWhat.Rotation) != 0)
+ if ((change & ObjectChangeType.Rotation) != 0)
{
part.UpdateRotation(data.rotation);
updateType = updatetype.none;
}
- if ((what & ObjectChangeWhat.Scale) != 0)
+ if ((change & ObjectChangeType.Scale) != 0)
{
part.Resize(data.scale);
updateType = updatetype.none;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 94e4560..f647544 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3644,7 +3644,7 @@ namespace OpenSim.Region.Framework.Scenes
//ParentGroup.ScheduleGroupForFullUpdate();
}
- public void StoreUndoState(ObjectChangeWhat what)
+ public void StoreUndoState(ObjectChangeType change)
{
if (m_UndoRedo == null)
m_UndoRedo = new UndoRedoState(5);
@@ -3653,7 +3653,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended
{
- m_UndoRedo.StoreUndo(this, what);
+ m_UndoRedo.StoreUndo(this, change);
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs
index fd90714..7bbf1bd 100644
--- a/OpenSim/Region/Framework/Scenes/UndoState.cs
+++ b/OpenSim/Region/Framework/Scenes/UndoState.cs
@@ -30,6 +30,7 @@ using System.Reflection;
using System.Collections.Generic;
using log4net;
using OpenMetaverse;
+using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.Framework.Scenes
@@ -44,30 +45,30 @@ namespace OpenSim.Region.Framework.Scenes
/// Constructor.
///
///
- /// bit field with what is changed
+ /// bit field with what is changed
///
- public UndoState(SceneObjectPart part, ObjectChangeWhat what)
+ public UndoState(SceneObjectPart part, ObjectChangeType change)
{
data = new ObjectChangeData();
- data.what = what;
+ data.change = change;
creationtime = DateTime.UtcNow;
if (part.ParentGroup.RootPart == part)
{
- if ((what & ObjectChangeWhat.Position) != 0)
+ if ((change & ObjectChangeType.Position) != 0)
data.position = part.ParentGroup.AbsolutePosition;
- if ((what & ObjectChangeWhat.Rotation) != 0)
+ if ((change & ObjectChangeType.Rotation) != 0)
data.rotation = part.RotationOffset;
- if ((what & ObjectChangeWhat.Scale) != 0)
+ if ((change & ObjectChangeType.Scale) != 0)
data.scale = part.Shape.Scale;
}
else
{
- if ((what & ObjectChangeWhat.Position) != 0)
+ if ((change & ObjectChangeType.Position) != 0)
data.position = part.OffsetPosition;
- if ((what & ObjectChangeWhat.Rotation) != 0)
+ if ((change & ObjectChangeType.Rotation) != 0)
data.rotation = part.RotationOffset;
- if ((what & ObjectChangeWhat.Scale) != 0)
+ if ((change & ObjectChangeType.Scale) != 0)
data.scale = part.Shape.Scale;
}
}
@@ -97,27 +98,27 @@ namespace OpenSim.Region.Framework.Scenes
///
/// true what fiels and related data are equal, False otherwise.
///
- public bool Compare(SceneObjectPart part, ObjectChangeWhat what)
+ public bool Compare(SceneObjectPart part, ObjectChangeType change)
{
- if (data.what != what) // if diferent targets, then they are diferent
+ if (data.change != change) // 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)
+ if ((change & ObjectChangeType.Position) != 0 && data.position != part.ParentGroup.AbsolutePosition)
return false;
}
else
{
- if ((what & ObjectChangeWhat.Position) != 0 && data.position != part.OffsetPosition)
+ if ((change & ObjectChangeType.Position) != 0 && data.position != part.OffsetPosition)
return false;
}
- if ((what & ObjectChangeWhat.Rotation) != 0 && data.rotation != part.RotationOffset)
+ if ((change & ObjectChangeType.Rotation) != 0 && data.rotation != part.RotationOffset)
return false;
- if ((what & ObjectChangeWhat.Rotation) != 0 && data.scale == part.Shape.Scale)
+ if ((change & ObjectChangeType.Rotation) != 0 && data.scale == part.Shape.Scale)
return false;
return true;
@@ -196,9 +197,9 @@ namespace OpenSim.Region.Framework.Scenes
/// adds a new state undo to part or its group, with changes indicated by what bits
///
///
- /// bit field with what is changed
+ /// bit field with what is changed
- public void StoreUndo(SceneObjectPart part, ObjectChangeWhat what)
+ public void StoreUndo(SceneObjectPart part, ObjectChangeType change)
{
lock (m_undo)
{
@@ -220,7 +221,7 @@ namespace OpenSim.Region.Framework.Scenes
// see if we actually have a change
if (last != null)
{
- if (last.Compare(part, what))
+ if (last.Compare(part, change))
return;
}
}
@@ -230,7 +231,7 @@ namespace OpenSim.Region.Framework.Scenes
while (m_undo.Count >= size)
m_undo.RemoveLast();
- UndoState nUndo = new UndoState(part, what);
+ UndoState nUndo = new UndoState(part, change);
m_undo.AddFirst(nUndo);
}
}
@@ -273,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes
while (m_redo.Count >= size)
m_redo.RemoveLast();
- nUndo = new UndoState(part, goback.data.what); // new value in part should it be full goback copy?
+ nUndo = new UndoState(part, goback.data.change); // new value in part should it be full goback copy?
m_redo.AddFirst(nUndo);
goback.PlayState(part);
@@ -320,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes
while (m_undo.Count >= size)
m_undo.RemoveLast();
- nUndo = new UndoState(part, gofwd.data.what); // new value in part should it be full gofwd copy?
+ nUndo = new UndoState(part, gofwd.data.change); // new value in part should it be full gofwd copy?
m_undo.AddFirst(nUndo);
gofwd.PlayState(part);
--
cgit v1.1