diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/UndoState.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UndoState.cs | 79 |
1 files changed, 63 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 713ff69..55e407e 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenMetaverse; | 28 | using OpenMetaverse; |
29 | using OpenSim.Region.Framework.Interfaces; | ||
29 | 30 | ||
30 | namespace OpenSim.Region.Framework.Scenes | 31 | namespace OpenSim.Region.Framework.Scenes |
31 | { | 32 | { |
@@ -35,29 +36,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
35 | public Vector3 Scale = Vector3.Zero; | 36 | public Vector3 Scale = Vector3.Zero; |
36 | public Quaternion Rotation = Quaternion.Identity; | 37 | public Quaternion Rotation = Quaternion.Identity; |
37 | 38 | ||
38 | public UndoState(Vector3 pos, Quaternion rot, Vector3 scale) | ||
39 | { | ||
40 | Position = pos; | ||
41 | Rotation = rot; | ||
42 | Scale = scale; | ||
43 | } | ||
44 | |||
45 | public UndoState(SceneObjectPart part) | 39 | public UndoState(SceneObjectPart part) |
46 | { | 40 | { |
47 | if (part != null) | 41 | if (part != null) |
48 | { | 42 | { |
49 | if (part.ParentID == 0) | 43 | if (part.ParentID == 0) |
50 | { | 44 | { |
51 | Position = part.AbsolutePosition; | 45 | Position = part.ParentGroup.AbsolutePosition; |
52 | Rotation = part.RotationOffset; | 46 | Rotation = part.RotationOffset; |
53 | 47 | Scale = part.Shape.Scale; | |
54 | } | 48 | } |
55 | else | 49 | else |
56 | { | 50 | { |
57 | Position = part.OffsetPosition; | 51 | Position = part.OffsetPosition; |
58 | Rotation = part.RotationOffset; | 52 | Rotation = part.RotationOffset; |
59 | Scale = part.Shape.Scale; | 53 | Scale = part.Shape.Scale; |
60 | |||
61 | } | 54 | } |
62 | } | 55 | } |
63 | } | 56 | } |
@@ -68,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
68 | { | 61 | { |
69 | if (part.ParentID == 0) | 62 | if (part.ParentID == 0) |
70 | { | 63 | { |
71 | if (Position == part.AbsolutePosition && Rotation == part.RotationOffset) | 64 | if (Position == part.ParentGroup.AbsolutePosition && Rotation == part.ParentGroup.Rotation) |
72 | return true; | 65 | return true; |
73 | else | 66 | else |
74 | return false; | 67 | return false; |
@@ -93,24 +86,78 @@ namespace OpenSim.Region.Framework.Scenes | |||
93 | 86 | ||
94 | if (part.ParentID == 0) | 87 | if (part.ParentID == 0) |
95 | { | 88 | { |
96 | part.ParentGroup.AbsolutePosition = Position; | 89 | if (Position != Vector3.Zero) |
97 | part.UpdateRotation(Rotation); | 90 | part.ParentGroup.AbsolutePosition = Position; |
91 | part.RotationOffset = Rotation; | ||
92 | if (Scale != Vector3.Zero) | ||
93 | part.Resize(Scale); | ||
98 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | 94 | part.ParentGroup.ScheduleGroupForTerseUpdate(); |
99 | } | 95 | } |
100 | else | 96 | else |
101 | { | 97 | { |
102 | part.OffsetPosition = Position; | 98 | if (Position != Vector3.Zero) |
99 | part.OffsetPosition = Position; | ||
103 | part.UpdateRotation(Rotation); | 100 | part.UpdateRotation(Rotation); |
104 | part.Resize(Scale); | 101 | if (Scale != Vector3.Zero) |
102 | part.Resize(Scale); part.ScheduleTerseUpdate(); | ||
103 | } | ||
104 | part.Undoing = false; | ||
105 | |||
106 | } | ||
107 | } | ||
108 | public void PlayfwdState(SceneObjectPart part) | ||
109 | { | ||
110 | if (part != null) | ||
111 | { | ||
112 | part.Undoing = true; | ||
113 | |||
114 | if (part.ParentID == 0) | ||
115 | { | ||
116 | if (Position != Vector3.Zero) | ||
117 | part.ParentGroup.AbsolutePosition = Position; | ||
118 | if (Rotation != Quaternion.Identity) | ||
119 | part.UpdateRotation(Rotation); | ||
120 | if (Scale != Vector3.Zero) | ||
121 | part.Resize(Scale); | ||
122 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | if (Position != Vector3.Zero) | ||
127 | part.OffsetPosition = Position; | ||
128 | if (Rotation != Quaternion.Identity) | ||
129 | part.UpdateRotation(Rotation); | ||
130 | if (Scale != Vector3.Zero) | ||
131 | part.Resize(Scale); | ||
105 | part.ScheduleTerseUpdate(); | 132 | part.ScheduleTerseUpdate(); |
106 | } | 133 | } |
107 | part.Undoing = false; | 134 | part.Undoing = false; |
108 | 135 | ||
109 | } | 136 | } |
110 | } | 137 | } |
138 | } | ||
139 | public class LandUndoState | ||
140 | { | ||
141 | public ITerrainModule m_terrainModule; | ||
142 | public ITerrainChannel m_terrainChannel; | ||
143 | |||
144 | public LandUndoState(ITerrainModule terrainModule, ITerrainChannel terrainChannel) | ||
145 | { | ||
146 | m_terrainModule = terrainModule; | ||
147 | m_terrainChannel = terrainChannel; | ||
148 | } | ||
149 | |||
150 | public bool Compare(ITerrainChannel terrainChannel) | ||
151 | { | ||
152 | if (m_terrainChannel != terrainChannel) | ||
153 | return false; | ||
154 | else | ||
155 | return false; | ||
156 | } | ||
111 | 157 | ||
112 | public UndoState() | 158 | public void PlaybackState() |
113 | { | 159 | { |
160 | m_terrainModule.UndoTerrain(m_terrainChannel); | ||
114 | } | 161 | } |
115 | } | 162 | } |
116 | } | 163 | } |