aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs277
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs64
-rw-r--r--OpenSim/Region/Framework/Scenes/UndoState.cs219
3 files changed, 103 insertions, 457 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index fcca1bc..4c43c10 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -11481,21 +11481,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11481 } 11481 }
11482 else 11482 else
11483 { 11483 {
11484// m_log.DebugFormat(
11485// "[CLIENT]: Processing block {0} type {1} for {2} {3}",
11486// i, block.Type, part.Name, part.LocalId);
11487
11488// // Do this once since fetch parts creates a new array.
11489// SceneObjectPart[] parts = part.ParentGroup.Parts;
11490// for (int j = 0; j < parts.Length; j++)
11491// {
11492// part.StoreUndoState();
11493// parts[j].IgnoreUndoUpdate = true;
11494// }
11495
11496// UpdatePrimGroupRotation handlerUpdatePrimGroupRotation;
11497// UpdateVector handlerUpdatePrimGroupScale;
11498
11499 ClientChangeObject updatehandler = onClientChangeObject; 11484 ClientChangeObject updatehandler = onClientChangeObject;
11500 11485
11501 if (updatehandler != null) 11486 if (updatehandler != null)
@@ -11536,7 +11521,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11536 11521
11537 udata.what = ObjectChangeWhat.primPR; 11522 udata.what = ObjectChangeWhat.primPR;
11538 updatehandler(localId, udata, this); 11523 updatehandler(localId, udata, this);
11539
11540 break; 11524 break;
11541 11525
11542 case 4: // scale sp 11526 case 4: // scale sp
@@ -11637,270 +11621,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11637 } 11621 }
11638 } 11622 }
11639 11623
11640/*
11641 switch (block.Type)
11642 {
11643 case 1: //change position sp
11644 apos = new Vector3(block.Data, 0);
11645
11646 UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition;
11647 if (handlerUpdatePrimSinglePosition != null)
11648 {
11649 part.StoreUndoState();
11650 part.IgnoreUndoUpdate = true;
11651
11652 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
11653 handlerUpdatePrimSinglePosition(localId, apos, this);
11654
11655 part.IgnoreUndoUpdate = false;
11656 }
11657 break;
11658
11659 case 2: // rotation sp
11660 arot = new Quaternion(block.Data, 0, true);
11661
11662 UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation;
11663 if (handlerUpdatePrimSingleRotation != null)
11664 {
11665 part.StoreUndoState();
11666 part.IgnoreUndoUpdate = true;
11667
11668 handlerUpdatePrimSingleRotation(localId, arot, this);
11669
11670 part.IgnoreUndoUpdate = false;
11671 }
11672 break;
11673
11674 case 3: // position plus rotation
11675 apos = new Vector3(block.Data, 0);
11676 arot = new Quaternion(block.Data, 12, true);
11677
11678 UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition;
11679 if (handlerUpdatePrimSingleRotationPosition != null)
11680 {
11681 part.StoreUndoState();
11682 part.IgnoreUndoUpdate = true;
11683
11684 handlerUpdatePrimSingleRotationPosition(localId, arot, apos, this);
11685
11686 part.IgnoreUndoUpdate = false;
11687 }
11688 break;
11689
11690 case 4: // scale sp
11691 case 0x14: // uniform scale sp
11692 ascale = new Vector3(block.Data, 0);
11693
11694 UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale;
11695 if (handlerUpdatePrimScale != null)
11696 {
11697 part.StoreUndoState();
11698 part.IgnoreUndoUpdate = true;
11699
11700 handlerUpdatePrimScale(localId, ascale, this);
11701
11702 part.IgnoreUndoUpdate = false;
11703 }
11704 break;
11705
11706 case 5: // scale and position sp
11707 apos = new Vector3(block.Data, 0);
11708 ascale = new Vector3(block.Data, 12);
11709
11710
11711 handlerUpdatePrimScale = OnUpdatePrimScale;
11712 if (handlerUpdatePrimScale != null)
11713 {
11714 part.StoreUndoState();
11715 part.IgnoreUndoUpdate = true;
11716
11717 handlerUpdatePrimScale(localId, ascale, this);
11718
11719 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition;
11720
11721 if (handlerUpdatePrimSinglePosition != null)
11722 {
11723 handlerUpdatePrimSinglePosition(localId, apos, this);
11724 }
11725 part.IgnoreUndoUpdate = false;
11726 }
11727 break;
11728
11729 case 0x15: //uniform scale and position
11730 apos = new Vector3(block.Data, 0);
11731 ascale = new Vector3(block.Data, 12);
11732
11733
11734 handlerUpdatePrimScale = OnUpdatePrimScale;
11735 if (handlerUpdatePrimScale != null)
11736 {
11737 part.StoreUndoState(false);
11738 part.IgnoreUndoUpdate = true;
11739
11740 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11741 handlerUpdatePrimScale(localId, ascale, this);
11742 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition;
11743 if (handlerUpdatePrimSinglePosition != null)
11744 {
11745 handlerUpdatePrimSinglePosition(localId, apos, this);
11746 }
11747
11748 part.IgnoreUndoUpdate = false;
11749 }
11750 break;
11751
11752// now group related (bit 4)
11753 case 9: //( 8 + 1 )group position
11754 apos = new Vector3(block.Data, 0);
11755
11756 UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition;
11757
11758 if (handlerUpdateVector != null)
11759 {
11760 part.StoreUndoState(true);
11761 part.IgnoreUndoUpdate = true;
11762
11763 handlerUpdateVector(localId, apos, this);
11764
11765 part.IgnoreUndoUpdate = false;
11766 }
11767 break;
11768
11769 case 0x0A: // (8 + 2) group rotation
11770 arot = new Quaternion(block.Data, 0, true);
11771
11772 UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation;
11773 if (handlerUpdatePrimRotation != null)
11774 {
11775 // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W);
11776 part.StoreUndoState(true);
11777 part.IgnoreUndoUpdate = true;
11778
11779 handlerUpdatePrimRotation(localId, arot, this);
11780
11781 part.IgnoreUndoUpdate = false;
11782 }
11783 break;
11784
11785 case 0x0B: //( 8 + 2 + 1) group rotation and position
11786 apos = new Vector3(block.Data, 0);
11787 arot = new Quaternion(block.Data, 12, true);
11788
11789 handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation;
11790 if (handlerUpdatePrimGroupRotation != null)
11791 {
11792 // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
11793 // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W);
11794 part.StoreUndoState(true);
11795 part.IgnoreUndoUpdate = true;
11796
11797 handlerUpdatePrimGroupRotation(localId, apos, arot, this);
11798
11799 part.IgnoreUndoUpdate = false;
11800 }
11801 break;
11802
11803 case 0x0C: // (8 + 4) group scale
11804 // only afects root prim and only sent by viewer editor object tab scaling
11805 // mouse edition only allows uniform scaling
11806 // SL MAY CHANGE THIS in viewers
11807
11808 ascale = new Vector3(block.Data, 0);
11809
11810 handlerUpdatePrimScale = OnUpdatePrimScale;
11811 if (handlerUpdatePrimScale != null)
11812 {
11813 // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z);
11814 part.StoreUndoState(false); // <- SL Exception make it apply to root prim and not group
11815 part.IgnoreUndoUpdate = true;
11816
11817 handlerUpdatePrimScale(localId, ascale, this);
11818
11819 part.IgnoreUndoUpdate = false;
11820 }
11821 break;
11822
11823 case 0x0D: //(8 + 4 + 1) group scale and position
11824 // exception as above
11825
11826 apos = new Vector3(block.Data, 0);
11827 ascale = new Vector3(block.Data, 12);
11828
11829 handlerUpdatePrimScale = OnUpdatePrimScale;
11830 if (handlerUpdatePrimScale != null)
11831 {
11832 //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11833 part.StoreUndoState(false); // <- make it apply to root prim and not group
11834 part.IgnoreUndoUpdate = true;
11835
11836 handlerUpdatePrimScale(localId, ascale, this);
11837
11838 // Change the position based on scale (for bug number 246)
11839 handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition;
11840 // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
11841 if (handlerUpdatePrimSinglePosition != null)
11842 {
11843 handlerUpdatePrimSinglePosition(localId, apos, this);
11844 }
11845
11846 part.IgnoreUndoUpdate = false;
11847 }
11848 break;
11849
11850 case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM
11851 ascale = new Vector3(block.Data, 0);
11852
11853 handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale;
11854 if (handlerUpdatePrimGroupScale != null)
11855 {
11856 // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z);
11857 part.StoreUndoState(true);
11858 part.IgnoreUndoUpdate = true;
11859
11860 handlerUpdatePrimGroupScale(localId, ascale, this);
11861
11862 part.IgnoreUndoUpdate = false;
11863 }
11864 break;
11865
11866 case 0x1D: // (UNIFORM + GROUP + SCALE + POS)
11867 apos = new Vector3(block.Data, 0);
11868 ascale = new Vector3(block.Data, 12);
11869
11870
11871 handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale;
11872 if (handlerUpdatePrimGroupScale != null)
11873 {
11874 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11875 part.StoreUndoState(true);
11876 part.IgnoreUndoUpdate = true;
11877
11878 handlerUpdatePrimGroupScale(localId, ascale, this);
11879
11880 handlerUpdateVector = OnUpdatePrimGroupPosition;
11881
11882 if (handlerUpdateVector != null)
11883 {
11884 handlerUpdateVector(localId, apos, this);
11885 }
11886
11887 part.IgnoreUndoUpdate = false;
11888 }
11889
11890 break;
11891
11892 default:
11893 m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
11894 break;
11895 }
11896*/
11897// for (int j = 0; j < parts.Length; j++)
11898// parts[j].IgnoreUndoUpdate = false;
11899
11900 } 11624 }
11901 } 11625 }
11902 } 11626 }
11903
11904 return true; 11627 return true;
11905 } 11628 }
11906 11629
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 92f2d54..bb554e1 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3498,9 +3498,18 @@ namespace OpenSim.Region.Framework.Scenes
3498 ScheduleGroupForFullUpdate(); 3498 ScheduleGroupForFullUpdate();
3499 } 3499 }
3500 3500
3501 private enum updatetype :int
3502 {
3503 none = 0,
3504 partterse = 1,
3505 partfull = 2,
3506 groupterse = 3,
3507 groupfull = 4
3508 }
3509
3501 public void doChangeObject(SceneObjectPart part, ObjectChangeData data) 3510 public void doChangeObject(SceneObjectPart part, ObjectChangeData data)
3502 { 3511 {
3503 // TODO this still as excessive ScheduleGroupForTerseUpdate()s 3512 // TODO this still as excessive *.Schedule*Update()s
3504 3513
3505 if (part != null && part.ParentGroup != null) 3514 if (part != null && part.ParentGroup != null)
3506 { 3515 {
@@ -3511,7 +3520,7 @@ namespace OpenSim.Region.Framework.Scenes
3511 SceneObjectGroup group = part.ParentGroup; 3520 SceneObjectGroup group = part.ParentGroup;
3512 PhysicsActor pha = group.RootPart.PhysActor; 3521 PhysicsActor pha = group.RootPart.PhysActor;
3513 3522
3514 bool needgrpUpdate = false; 3523 updatetype updateType = updatetype.none;
3515 3524
3516 if (togroup) 3525 if (togroup)
3517 { 3526 {
@@ -3519,15 +3528,21 @@ namespace OpenSim.Region.Framework.Scenes
3519 if ((what & ObjectChangeWhat.Position) != 0) 3528 if ((what & ObjectChangeWhat.Position) != 0)
3520 { 3529 {
3521 group.AbsolutePosition = data.position; 3530 group.AbsolutePosition = data.position;
3522 needgrpUpdate = true; 3531 updateType = updatetype.groupterse;
3523 } 3532 }
3524 if ((what & ObjectChangeWhat.Rotation) != 0) 3533 if ((what & ObjectChangeWhat.Rotation) != 0)
3534 {
3525 group.RootPart.UpdateRotation(data.rotation); 3535 group.RootPart.UpdateRotation(data.rotation);
3536 updateType = updatetype.none;
3537 }
3526 if ((what & ObjectChangeWhat.Scale) != 0) 3538 if ((what & ObjectChangeWhat.Scale) != 0)
3527 { 3539 {
3528 if (pha != null) 3540 if (pha != null)
3529 pha.Building = true; 3541 pha.Building = true;
3542
3530 group.GroupResize(data.scale); 3543 group.GroupResize(data.scale);
3544 updateType = updatetype.none;
3545
3531 if (pha != null) 3546 if (pha != null)
3532 pha.Building = false; 3547 pha.Building = false;
3533 } 3548 }
@@ -3538,8 +3553,8 @@ namespace OpenSim.Region.Framework.Scenes
3538 if (pha != null) 3553 if (pha != null)
3539 pha.Building = true; 3554 pha.Building = true;
3540 3555
3541 // must deal with root part specially for position and rotation 3556 // root part is special
3542 // so parts offset positions or rotations are fixed 3557 // parts offset positions or rotations need to change also
3543 3558
3544 if (part == group.RootPart) 3559 if (part == group.RootPart)
3545 { 3560 {
@@ -3547,30 +3562,53 @@ namespace OpenSim.Region.Framework.Scenes
3547 group.UpdateRootPosition(data.position); 3562 group.UpdateRootPosition(data.position);
3548 if ((what & ObjectChangeWhat.Rotation) != 0) 3563 if ((what & ObjectChangeWhat.Rotation) != 0)
3549 group.UpdateRootRotation(data.rotation); 3564 group.UpdateRootRotation(data.rotation);
3565 if ((what & ObjectChangeWhat.Scale) != 0)
3566 part.Resize(data.scale);
3550 } 3567 }
3551 else 3568 else
3552 { 3569 {
3553
3554 if ((what & ObjectChangeWhat.Position) != 0) 3570 if ((what & ObjectChangeWhat.Position) != 0)
3555 { 3571 {
3556 part.OffsetPosition = data.position; 3572 part.OffsetPosition = data.position;
3557 needgrpUpdate = true; 3573 updateType = updatetype.partterse;
3558 } 3574 }
3559 if ((what & ObjectChangeWhat.Rotation) != 0) 3575 if ((what & ObjectChangeWhat.Rotation) != 0)
3576 {
3560 part.UpdateRotation(data.rotation); 3577 part.UpdateRotation(data.rotation);
3578 updateType = updatetype.none;
3579 }
3580 if ((what & ObjectChangeWhat.Scale) != 0)
3581 {
3582 part.Resize(data.scale);
3583 updateType = updatetype.none;
3584 }
3561 } 3585 }
3562 3586
3563 if ((what & ObjectChangeWhat.Scale) != 0)
3564 part.Resize(data.scale);
3565
3566 if (pha != null) 3587 if (pha != null)
3567 pha.Building = false; 3588 pha.Building = false;
3568 } 3589 }
3569 3590
3570 if (needgrpUpdate) 3591 if (updateType != updatetype.none)
3571 { 3592 {
3572 HasGroupChanged = true; 3593 group.HasGroupChanged = true;
3573 ScheduleGroupForTerseUpdate(); 3594
3595 switch (updateType)
3596 {
3597 case updatetype.partterse:
3598 part.ScheduleTerseUpdate();
3599 break;
3600 case updatetype.partfull:
3601 part.ScheduleFullUpdate();
3602 break;
3603 case updatetype.groupterse:
3604 group.ScheduleGroupForTerseUpdate();
3605 break;
3606 case updatetype.groupfull:
3607 group.ScheduleGroupForFullUpdate();
3608 break;
3609 default:
3610 break;
3611 }
3574 } 3612 }
3575 } 3613 }
3576 } 3614 }
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs
index 668b53b..fd90714 100644
--- a/OpenSim/Region/Framework/Scenes/UndoState.cs
+++ b/OpenSim/Region/Framework/Scenes/UndoState.cs
@@ -31,170 +31,9 @@ using System.Collections.Generic;
31using log4net; 31using log4net;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
34using System;
35 34
36namespace OpenSim.Region.Framework.Scenes 35namespace OpenSim.Region.Framework.Scenes
37{ 36{
38
39/*
40 [Flags]
41 public enum UndoType
42 {
43 STATE_PRIM_POSITION = 1,
44 STATE_PRIM_ROTATION = 2,
45 STATE_PRIM_SCALE = 4,
46 STATE_PRIM_ALL = 7,
47 STATE_GROUP_POSITION = 8,
48 STATE_GROUP_ROTATION = 16,
49 STATE_GROUP_SCALE = 32,
50 STATE_GROUP_ALL = 56,
51 STATE_ALL = 63
52 }
53
54
55 public class UndoState
56 {
57 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58
59 public Vector3 Position = Vector3.Zero;
60 public Vector3 Scale = Vector3.Zero;
61 public Quaternion Rotation = Quaternion.Identity;
62
63 /// <summary>
64 /// Is this undo state for an entire group?
65 /// </summary>
66 public bool ForGroup;
67
68 /// <summary>
69 /// Constructor.
70 /// </summary>
71 /// <param name="part"></param>
72 /// <param name="forGroup">True if the undo is for an entire group</param>
73 /// only for root parts ????
74 public UndoState(SceneObjectPart part, bool forGroup)
75 {
76 if (part.ParentID == 0)
77 {
78 ForGroup = forGroup;
79 Position = part.ParentGroup.AbsolutePosition;
80 Rotation = part.RotationOffset;
81 Scale = part.Shape.Scale;
82 }
83 else
84 {
85 ForGroup = false; // only root parts can undo grp
86 Position = part.OffsetPosition;
87 Rotation = part.RotationOffset;
88 Scale = part.Shape.Scale;
89 }
90 }
91
92 /// <summary>
93 /// Compare the relevant state in the given part to this state.
94 /// </summary>
95 /// <param name="part"></param>
96 /// <returns>true if both the part's position, rotation and scale match those in this undo state. False otherwise.</returns>
97 public bool Compare(SceneObjectPart part, bool forgrp)
98 {
99 if (ForGroup != forgrp) // if diferent targets, then they are diferent
100 return false;
101
102 if (part != null)
103 {
104 if (part.ParentID == 0)
105 {
106 // root part
107 // grp position is same as part
108 if (Position != part.ParentGroup.AbsolutePosition)
109 return false;
110 if (Rotation != part.RotationOffset)
111 return false;
112 return Scale == part.Shape.Scale;
113 }
114 else
115 {
116 return (Position == part.OffsetPosition
117 && Rotation == part.RotationOffset
118 && Scale == part.Shape.Scale);
119 }
120 }
121
122 return false;
123 }
124
125 public void PlayState(SceneObjectPart part)
126 {
127 part.Undoing = true;
128 bool physbuilding = false;
129
130 if (part.ParentID == 0)
131 {
132 if (!ForGroup && part.PhysActor != null)
133 {
134 part.PhysActor.Building = true;
135 physbuilding = true;
136 }
137
138 if (Position != Vector3.Zero)
139 {
140 if (ForGroup)
141 part.ParentGroup.AbsolutePosition = Position;
142 else
143 part.ParentGroup.UpdateRootPosition(Position);
144 }
145
146 if (ForGroup)
147 part.UpdateRotation(Rotation);
148 else
149 part.ParentGroup.UpdateRootRotation(Rotation);
150
151 if (Scale != Vector3.Zero)
152 {
153 if (!physbuilding && part.PhysActor != null)
154 {
155 part.PhysActor.Building = true;
156 physbuilding = true;
157 }
158
159 if (ForGroup)
160 part.ParentGroup.GroupResize(Scale);
161 else
162 part.Resize(Scale);
163 }
164
165 if (physbuilding)
166 part.PhysActor.Building = false;
167
168 part.ParentGroup.ScheduleGroupForTerseUpdate();
169 }
170 else
171 {
172 if (ForGroup) // trap for group since seems parts can't do it
173 return;
174
175 // changing a part invalidates entire object physical rep
176 if (part.ParentGroup != null && part.ParentGroup.RootPart != null && part.ParentGroup.RootPart.PhysActor != null)
177 {
178 part.ParentGroup.RootPart.PhysActor.Building = true;
179 physbuilding = true;
180 }
181
182 // Note: Updating these properties on sop automatically schedules an update if needed
183 part.OffsetPosition = Position;
184 part.UpdateRotation(Rotation);
185 if (Scale != Vector3.Zero)
186 {
187 part.Resize(Scale);
188 }
189
190 if (physbuilding)
191 part.ParentGroup.RootPart.PhysActor.Building = false;
192 }
193
194 part.Undoing = false;
195 }
196 }
197*/
198 public class UndoState 37 public class UndoState
199 { 38 {
200 const int UNDOEXPIRESECONDS = 300; // undo expire time (nice to have it came from a ini later) 39 const int UNDOEXPIRESECONDS = 300; // undo expire time (nice to have it came from a ini later)
@@ -205,8 +44,8 @@ namespace OpenSim.Region.Framework.Scenes
205 /// Constructor. 44 /// Constructor.
206 /// </summary> 45 /// </summary>
207 /// <param name="part"></param> 46 /// <param name="part"></param>
208 /// <param name="forGroup">True if the undo is for an entire group</param> 47 /// <param name="what">bit field with what is changed</param>
209 /// only for root parts ???? 48 ///
210 public UndoState(SceneObjectPart part, ObjectChangeWhat what) 49 public UndoState(SceneObjectPart part, ObjectChangeWhat what)
211 { 50 {
212 data = new ObjectChangeData(); 51 data = new ObjectChangeData();
@@ -232,6 +71,9 @@ namespace OpenSim.Region.Framework.Scenes
232 data.scale = part.Shape.Scale; 71 data.scale = part.Shape.Scale;
233 } 72 }
234 } 73 }
74 /// <summary>
75 /// check if undo or redo is too old
76 /// </summary>
235 77
236 public bool checkExpire() 78 public bool checkExpire()
237 { 79 {
@@ -241,6 +83,9 @@ namespace OpenSim.Region.Framework.Scenes
241 return false; 83 return false;
242 } 84 }
243 85
86 /// <summary>
87 /// updates undo or redo creation time to now
88 /// </summary>
244 public void updateExpire() 89 public void updateExpire()
245 { 90 {
246 creationtime = DateTime.UtcNow; 91 creationtime = DateTime.UtcNow;
@@ -250,7 +95,8 @@ namespace OpenSim.Region.Framework.Scenes
250 /// Compare the relevant state in the given part to this state. 95 /// Compare the relevant state in the given part to this state.
251 /// </summary> 96 /// </summary>
252 /// <param name="part"></param> 97 /// <param name="part"></param>
253 /// <returns>true if both the part's position, rotation and scale match those in this undo state. False otherwise.</returns> 98 /// <returns>true what fiels and related data are equal, False otherwise.</returns>
99 ///
254 public bool Compare(SceneObjectPart part, ObjectChangeWhat what) 100 public bool Compare(SceneObjectPart part, ObjectChangeWhat what)
255 { 101 {
256 if (data.what != what) // if diferent targets, then they are diferent 102 if (data.what != what) // if diferent targets, then they are diferent
@@ -279,6 +125,12 @@ namespace OpenSim.Region.Framework.Scenes
279 return false; 125 return false;
280 } 126 }
281 127
128 /// <summary>
129 /// executes the undo or redo to a part or its group
130 /// </summary>
131 /// <param name="part"></param>
132 ///
133
282 public void PlayState(SceneObjectPart part) 134 public void PlayState(SceneObjectPart part)
283 { 135 {
284 part.Undoing = true; 136 part.Undoing = true;
@@ -298,12 +150,21 @@ namespace OpenSim.Region.Framework.Scenes
298 int size; 150 int size;
299 public LinkedList<UndoState> m_redo = new LinkedList<UndoState>(); 151 public LinkedList<UndoState> m_redo = new LinkedList<UndoState>();
300 public LinkedList<UndoState> m_undo = new LinkedList<UndoState>(); 152 public LinkedList<UndoState> m_undo = new LinkedList<UndoState>();
301 153
154 /// <summary>
155 /// creates a new UndoRedoState with default states memory size
156 /// </summary>
157
302 public UndoRedoState() 158 public UndoRedoState()
303 { 159 {
304 size = 5; 160 size = 5;
305 } 161 }
306 162
163 /// <summary>
164 /// creates a new UndoRedoState with states memory having indicated size
165 /// </summary>
166 /// <param name="size"></param>
167
307 public UndoRedoState(int _size) 168 public UndoRedoState(int _size)
308 { 169 {
309 if (_size < 3) 170 if (_size < 3)
@@ -312,17 +173,31 @@ namespace OpenSim.Region.Framework.Scenes
312 size = _size; 173 size = _size;
313 } 174 }
314 175
176 /// <summary>
177 /// returns number of undo entries in memory
178 /// </summary>
179
315 public int Count 180 public int Count
316 { 181 {
317 get { return m_undo.Count; } 182 get { return m_undo.Count; }
318 } 183 }
319 184
185 /// <summary>
186 /// clears all undo and redo entries
187 /// </summary>
188
320 public void Clear() 189 public void Clear()
321 { 190 {
322 m_undo.Clear(); 191 m_undo.Clear();
323 m_redo.Clear(); 192 m_redo.Clear();
324 } 193 }
325 194
195 /// <summary>
196 /// adds a new state undo to part or its group, with changes indicated by what bits
197 /// </summary>
198 /// <param name="part"></param>
199 /// <param name="what">bit field with what is changed</param>
200
326 public void StoreUndo(SceneObjectPart part, ObjectChangeWhat what) 201 public void StoreUndo(SceneObjectPart part, ObjectChangeWhat what)
327 { 202 {
328 lock (m_undo) 203 lock (m_undo)
@@ -360,6 +235,12 @@ namespace OpenSim.Region.Framework.Scenes
360 } 235 }
361 } 236 }
362 237
238 /// <summary>
239 /// executes last state undo to part or its group
240 /// current state is pushed into redo
241 /// </summary>
242 /// <param name="part"></param>
243
363 public void Undo(SceneObjectPart part) 244 public void Undo(SceneObjectPart part)
364 { 245 {
365 lock (m_undo) 246 lock (m_undo)
@@ -401,6 +282,12 @@ namespace OpenSim.Region.Framework.Scenes
401 } 282 }
402 } 283 }
403 284
285 /// <summary>
286 /// executes last state redo to part or its group
287 /// current state is pushed into undo
288 /// </summary>
289 /// <param name="part"></param>
290
404 public void Redo(SceneObjectPart part) 291 public void Redo(SceneObjectPart part)
405 { 292 {
406 lock (m_undo) 293 lock (m_undo)
@@ -441,8 +328,6 @@ namespace OpenSim.Region.Framework.Scenes
441 } 328 }
442 } 329 }
443 } 330 }
444
445
446 } 331 }
447 332
448 public class LandUndoState 333 public class LandUndoState