aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMelanie2012-03-13 13:08:32 +0100
committerMelanie2012-03-13 13:08:32 +0100
commitebcd4910a21726c830796cfe14c0792007b766b7 (patch)
treebc62802ae47fad6f9cffd0ccb2e4e61af56befe8 /OpenSim/Region/Framework/Scenes
parentRestore duplication of the SL bug where linking phantom to solid lets the (diff)
downloadopensim-SC-ebcd4910a21726c830796cfe14c0792007b766b7.zip
opensim-SC-ebcd4910a21726c830796cfe14c0792007b766b7.tar.gz
opensim-SC-ebcd4910a21726c830796cfe14c0792007b766b7.tar.bz2
opensim-SC-ebcd4910a21726c830796cfe14c0792007b766b7.tar.xz
Refactor, move OjectChangeData into it's own file and rename
ObjectChnageWhat what into ObjectChangeType change. What is no name for a variable or type!
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs115
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/UndoState.cs43
4 files changed, 37 insertions, 149 deletions
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
47 47
48 public delegate void ChangedBackupDelegate(SceneObjectGroup sog); 48 public delegate void ChangedBackupDelegate(SceneObjectGroup sog);
49 49
50
51 public enum ObjectChangeWhat : uint
52 {
53 // bits definitions
54 Position = 0x01,
55 Rotation = 0x02,
56 Scale = 0x04,
57 Group = 0x08,
58 UniformScale = 0x10,
59
60 // macros from above
61 // single prim
62 primP = 0x01,
63 primR = 0x02,
64 primPR = 0x03,
65 primS = 0x04,
66 primPS = 0x05,
67 primRS = 0x06,
68 primPSR = 0x07,
69
70 primUS = 0x14,
71 primPUS = 0x15,
72 primRUS = 0x16,
73 primPUSR = 0x17,
74
75 // group
76 groupP = 0x09,
77 groupR = 0x0A,
78 groupPR = 0x0B,
79 groupS = 0x0C,
80 groupPS = 0x0D,
81 groupRS = 0x0E,
82 groupPSR = 0x0F,
83
84 groupUS = 0x1C,
85 groupPUS = 0x1D,
86 groupRUS = 0x1E,
87 groupPUSR = 0x1F,
88
89 PRSmask = 0x07
90 }
91
92 public struct ObjectChangeData
93 {
94 public Quaternion rotation;
95 public Vector3 position;
96 public Vector3 scale;
97 public ObjectChangeWhat what;
98 }
99
100
101 /// <summary> 50 /// <summary>
102 /// This class used to be called InnerScene and may not yet truly be a SceneGraph. The non scene graph components 51 /// This class used to be called InnerScene and may not yet truly be a SceneGraph. The non scene graph components
103 /// should be migrated out over time. 52 /// should be migrated out over time.
@@ -1352,75 +1301,13 @@ namespace OpenSim.Region.Framework.Scenes
1352 { 1301 {
1353 if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId)) 1302 if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId))
1354 { 1303 {
1355// part.StoreUndoState(data.what | ObjectChangeWhat.PRSmask); // for now save all to keep previus behavour ??? 1304 part.StoreUndoState(data.change); // lets test only saving what we changed
1356 part.StoreUndoState(data.what); // lets test only saving what we changed
1357 grp.doChangeObject(part, (ObjectChangeData)data); 1305 grp.doChangeObject(part, (ObjectChangeData)data);
1358 } 1306 }
1359 } 1307 }
1360 } 1308 }
1361 } 1309 }
1362 1310
1363/* moved to SOG
1364 protected internal void doChangeObject(SceneObjectPart part, ObjectChangeData data)
1365 {
1366 if (part != null && part.ParentGroup != null)
1367 {
1368 ObjectChangeWhat what = data.what;
1369 bool togroup = ((what & ObjectChangeWhat.Group) != 0);
1370// bool uniform = ((what & ObjectChangeWhat.UniformScale) != 0); not in use
1371
1372 SceneObjectGroup group = part.ParentGroup;
1373 PhysicsActor pha = group.RootPart.PhysActor;
1374
1375 if (togroup)
1376 {
1377 // related to group
1378 if ((what & ObjectChangeWhat.Position) != 0)
1379 group.AbsolutePosition = data.position;
1380 if ((what & ObjectChangeWhat.Rotation) != 0)
1381 group.RootPart.UpdateRotation(data.rotation);
1382 if ((what & ObjectChangeWhat.Scale) != 0)
1383 {
1384 if (pha != null)
1385 pha.Building = true;
1386 group.GroupResize(data.scale);
1387 if (pha != null)
1388 pha.Building = false;
1389 }
1390 }
1391 else
1392 {
1393 // related to single prim in a link-set ( ie group)
1394 if (pha != null)
1395 pha.Building = true;
1396
1397 // must deal with root part specially for position and rotation
1398 // so parts offset positions or rotations are fixed
1399
1400 if (part == group.RootPart)
1401 {
1402 if ((what & ObjectChangeWhat.Position) != 0)
1403 group.UpdateRootPosition(data.position);
1404 if ((what & ObjectChangeWhat.Rotation) != 0)
1405 group.UpdateRootRotation(data.rotation);
1406 }
1407 else
1408 {
1409 if ((what & ObjectChangeWhat.Position) != 0)
1410 part.OffsetPosition = data.position;
1411 if ((what & ObjectChangeWhat.Rotation) != 0)
1412 part.UpdateRotation(data.rotation);
1413 }
1414
1415 if ((what & ObjectChangeWhat.Scale) != 0)
1416 part.Resize(data.scale);
1417
1418 if (pha != null)
1419 pha.Building = false;
1420 }
1421 }
1422 }
1423*/
1424 /// <summary> 1311 /// <summary>
1425 /// Update the scale of an individual prim. 1312 /// Update the scale of an individual prim.
1426 /// </summary> 1313 /// </summary>
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
3521 3521
3522 if (part != null && part.ParentGroup != null) 3522 if (part != null && part.ParentGroup != null)
3523 { 3523 {
3524 ObjectChangeWhat what = data.what; 3524 ObjectChangeType change = data.change;
3525 bool togroup = ((what & ObjectChangeWhat.Group) != 0); 3525 bool togroup = ((change & ObjectChangeType.Group) != 0);
3526 // bool uniform = ((what & ObjectChangeWhat.UniformScale) != 0); not in use 3526 // bool uniform = ((what & ObjectChangeType.UniformScale) != 0); not in use
3527 3527
3528 SceneObjectGroup group = part.ParentGroup; 3528 SceneObjectGroup group = part.ParentGroup;
3529 PhysicsActor pha = group.RootPart.PhysActor; 3529 PhysicsActor pha = group.RootPart.PhysActor;
@@ -3533,17 +3533,17 @@ namespace OpenSim.Region.Framework.Scenes
3533 if (togroup) 3533 if (togroup)
3534 { 3534 {
3535 // related to group 3535 // related to group
3536 if ((what & ObjectChangeWhat.Position) != 0) 3536 if ((change & ObjectChangeType.Position) != 0)
3537 { 3537 {
3538 group.AbsolutePosition = data.position; 3538 group.AbsolutePosition = data.position;
3539 updateType = updatetype.groupterse; 3539 updateType = updatetype.groupterse;
3540 } 3540 }
3541 if ((what & ObjectChangeWhat.Rotation) != 0) 3541 if ((change & ObjectChangeType.Rotation) != 0)
3542 { 3542 {
3543 group.RootPart.UpdateRotation(data.rotation); 3543 group.RootPart.UpdateRotation(data.rotation);
3544 updateType = updatetype.none; 3544 updateType = updatetype.none;
3545 } 3545 }
3546 if ((what & ObjectChangeWhat.Scale) != 0) 3546 if ((change & ObjectChangeType.Scale) != 0)
3547 { 3547 {
3548 if (pha != null) 3548 if (pha != null)
3549 pha.Building = true; 3549 pha.Building = true;
@@ -3566,26 +3566,26 @@ namespace OpenSim.Region.Framework.Scenes
3566 3566
3567 if (part == group.RootPart) 3567 if (part == group.RootPart)
3568 { 3568 {
3569 if ((what & ObjectChangeWhat.Position) != 0) 3569 if ((change & ObjectChangeType.Position) != 0)
3570 group.UpdateRootPosition(data.position); 3570 group.UpdateRootPosition(data.position);
3571 if ((what & ObjectChangeWhat.Rotation) != 0) 3571 if ((change & ObjectChangeType.Rotation) != 0)
3572 group.UpdateRootRotation(data.rotation); 3572 group.UpdateRootRotation(data.rotation);
3573 if ((what & ObjectChangeWhat.Scale) != 0) 3573 if ((change & ObjectChangeType.Scale) != 0)
3574 part.Resize(data.scale); 3574 part.Resize(data.scale);
3575 } 3575 }
3576 else 3576 else
3577 { 3577 {
3578 if ((what & ObjectChangeWhat.Position) != 0) 3578 if ((change & ObjectChangeType.Position) != 0)
3579 { 3579 {
3580 part.OffsetPosition = data.position; 3580 part.OffsetPosition = data.position;
3581 updateType = updatetype.partterse; 3581 updateType = updatetype.partterse;
3582 } 3582 }
3583 if ((what & ObjectChangeWhat.Rotation) != 0) 3583 if ((change & ObjectChangeType.Rotation) != 0)
3584 { 3584 {
3585 part.UpdateRotation(data.rotation); 3585 part.UpdateRotation(data.rotation);
3586 updateType = updatetype.none; 3586 updateType = updatetype.none;
3587 } 3587 }
3588 if ((what & ObjectChangeWhat.Scale) != 0) 3588 if ((change & ObjectChangeType.Scale) != 0)
3589 { 3589 {
3590 part.Resize(data.scale); 3590 part.Resize(data.scale);
3591 updateType = updatetype.none; 3591 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
3644 //ParentGroup.ScheduleGroupForFullUpdate(); 3644 //ParentGroup.ScheduleGroupForFullUpdate();
3645 } 3645 }
3646 3646
3647 public void StoreUndoState(ObjectChangeWhat what) 3647 public void StoreUndoState(ObjectChangeType change)
3648 { 3648 {
3649 if (m_UndoRedo == null) 3649 if (m_UndoRedo == null)
3650 m_UndoRedo = new UndoRedoState(5); 3650 m_UndoRedo = new UndoRedoState(5);
@@ -3653,7 +3653,7 @@ namespace OpenSim.Region.Framework.Scenes
3653 { 3653 {
3654 if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended 3654 if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended
3655 { 3655 {
3656 m_UndoRedo.StoreUndo(this, what); 3656 m_UndoRedo.StoreUndo(this, change);
3657 } 3657 }
3658 } 3658 }
3659 } 3659 }
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;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using log4net; 31using log4net;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
34 35
35namespace OpenSim.Region.Framework.Scenes 36namespace OpenSim.Region.Framework.Scenes
@@ -44,30 +45,30 @@ namespace OpenSim.Region.Framework.Scenes
44 /// Constructor. 45 /// Constructor.
45 /// </summary> 46 /// </summary>
46 /// <param name="part"></param> 47 /// <param name="part"></param>
47 /// <param name="what">bit field with what is changed</param> 48 /// <param name="change">bit field with what is changed</param>
48 /// 49 ///
49 public UndoState(SceneObjectPart part, ObjectChangeWhat what) 50 public UndoState(SceneObjectPart part, ObjectChangeType change)
50 { 51 {
51 data = new ObjectChangeData(); 52 data = new ObjectChangeData();
52 data.what = what; 53 data.change = change;
53 creationtime = DateTime.UtcNow; 54 creationtime = DateTime.UtcNow;
54 55
55 if (part.ParentGroup.RootPart == part) 56 if (part.ParentGroup.RootPart == part)
56 { 57 {
57 if ((what & ObjectChangeWhat.Position) != 0) 58 if ((change & ObjectChangeType.Position) != 0)
58 data.position = part.ParentGroup.AbsolutePosition; 59 data.position = part.ParentGroup.AbsolutePosition;
59 if ((what & ObjectChangeWhat.Rotation) != 0) 60 if ((change & ObjectChangeType.Rotation) != 0)
60 data.rotation = part.RotationOffset; 61 data.rotation = part.RotationOffset;
61 if ((what & ObjectChangeWhat.Scale) != 0) 62 if ((change & ObjectChangeType.Scale) != 0)
62 data.scale = part.Shape.Scale; 63 data.scale = part.Shape.Scale;
63 } 64 }
64 else 65 else
65 { 66 {
66 if ((what & ObjectChangeWhat.Position) != 0) 67 if ((change & ObjectChangeType.Position) != 0)
67 data.position = part.OffsetPosition; 68 data.position = part.OffsetPosition;
68 if ((what & ObjectChangeWhat.Rotation) != 0) 69 if ((change & ObjectChangeType.Rotation) != 0)
69 data.rotation = part.RotationOffset; 70 data.rotation = part.RotationOffset;
70 if ((what & ObjectChangeWhat.Scale) != 0) 71 if ((change & ObjectChangeType.Scale) != 0)
71 data.scale = part.Shape.Scale; 72 data.scale = part.Shape.Scale;
72 } 73 }
73 } 74 }
@@ -97,27 +98,27 @@ namespace OpenSim.Region.Framework.Scenes
97 /// <param name="part"></param> 98 /// <param name="part"></param>
98 /// <returns>true what fiels and related data are equal, False otherwise.</returns> 99 /// <returns>true what fiels and related data are equal, False otherwise.</returns>
99 /// 100 ///
100 public bool Compare(SceneObjectPart part, ObjectChangeWhat what) 101 public bool Compare(SceneObjectPart part, ObjectChangeType change)
101 { 102 {
102 if (data.what != what) // if diferent targets, then they are diferent 103 if (data.change != change) // if diferent targets, then they are diferent
103 return false; 104 return false;
104 105
105 if (part != null) 106 if (part != null)
106 { 107 {
107 if (part.ParentID == 0) 108 if (part.ParentID == 0)
108 { 109 {
109 if ((what & ObjectChangeWhat.Position) != 0 && data.position != part.ParentGroup.AbsolutePosition) 110 if ((change & ObjectChangeType.Position) != 0 && data.position != part.ParentGroup.AbsolutePosition)
110 return false; 111 return false;
111 } 112 }
112 else 113 else
113 { 114 {
114 if ((what & ObjectChangeWhat.Position) != 0 && data.position != part.OffsetPosition) 115 if ((change & ObjectChangeType.Position) != 0 && data.position != part.OffsetPosition)
115 return false; 116 return false;
116 } 117 }
117 118
118 if ((what & ObjectChangeWhat.Rotation) != 0 && data.rotation != part.RotationOffset) 119 if ((change & ObjectChangeType.Rotation) != 0 && data.rotation != part.RotationOffset)
119 return false; 120 return false;
120 if ((what & ObjectChangeWhat.Rotation) != 0 && data.scale == part.Shape.Scale) 121 if ((change & ObjectChangeType.Rotation) != 0 && data.scale == part.Shape.Scale)
121 return false; 122 return false;
122 return true; 123 return true;
123 124
@@ -196,9 +197,9 @@ namespace OpenSim.Region.Framework.Scenes
196 /// adds a new state undo to part or its group, with changes indicated by what bits 197 /// adds a new state undo to part or its group, with changes indicated by what bits
197 /// </summary> 198 /// </summary>
198 /// <param name="part"></param> 199 /// <param name="part"></param>
199 /// <param name="what">bit field with what is changed</param> 200 /// <param name="change">bit field with what is changed</param>
200 201
201 public void StoreUndo(SceneObjectPart part, ObjectChangeWhat what) 202 public void StoreUndo(SceneObjectPart part, ObjectChangeType change)
202 { 203 {
203 lock (m_undo) 204 lock (m_undo)
204 { 205 {
@@ -220,7 +221,7 @@ namespace OpenSim.Region.Framework.Scenes
220 // see if we actually have a change 221 // see if we actually have a change
221 if (last != null) 222 if (last != null)
222 { 223 {
223 if (last.Compare(part, what)) 224 if (last.Compare(part, change))
224 return; 225 return;
225 } 226 }
226 } 227 }
@@ -230,7 +231,7 @@ namespace OpenSim.Region.Framework.Scenes
230 while (m_undo.Count >= size) 231 while (m_undo.Count >= size)
231 m_undo.RemoveLast(); 232 m_undo.RemoveLast();
232 233
233 UndoState nUndo = new UndoState(part, what); 234 UndoState nUndo = new UndoState(part, change);
234 m_undo.AddFirst(nUndo); 235 m_undo.AddFirst(nUndo);
235 } 236 }
236 } 237 }
@@ -273,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes
273 while (m_redo.Count >= size) 274 while (m_redo.Count >= size)
274 m_redo.RemoveLast(); 275 m_redo.RemoveLast();
275 276
276 nUndo = new UndoState(part, goback.data.what); // new value in part should it be full goback copy? 277 nUndo = new UndoState(part, goback.data.change); // new value in part should it be full goback copy?
277 m_redo.AddFirst(nUndo); 278 m_redo.AddFirst(nUndo);
278 279
279 goback.PlayState(part); 280 goback.PlayState(part);
@@ -320,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes
320 while (m_undo.Count >= size) 321 while (m_undo.Count >= size)
321 m_undo.RemoveLast(); 322 m_undo.RemoveLast();
322 323
323 nUndo = new UndoState(part, gofwd.data.what); // new value in part should it be full gofwd copy? 324 nUndo = new UndoState(part, gofwd.data.change); // new value in part should it be full gofwd copy?
324 m_undo.AddFirst(nUndo); 325 m_undo.AddFirst(nUndo);
325 326
326 gofwd.PlayState(part); 327 gofwd.PlayState(part);