aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-07-18 04:54:21 +0100
committerJustin Clark-Casey (justincc)2011-07-18 04:54:21 +0100
commit6fc74b36d1d0f7dcd6f013893c3189a3f989431c (patch)
treea82bdd3fe6f15298624a142a3705f2739a8ee031 /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
parentuse standard sdk stack in terrain model rather than OpenSim.Framework.UndoStack. (diff)
downloadopensim-SC_OLD-6fc74b36d1d0f7dcd6f013893c3189a3f989431c.zip
opensim-SC_OLD-6fc74b36d1d0f7dcd6f013893c3189a3f989431c.tar.gz
opensim-SC_OLD-6fc74b36d1d0f7dcd6f013893c3189a3f989431c.tar.bz2
opensim-SC_OLD-6fc74b36d1d0f7dcd6f013893c3189a3f989431c.tar.xz
Make various tweaks to undo code in an effort to get things working better.
Undo rotation and position appear to be working. Resizing a single prim appears to be working, though the undo has to be done twice. Resizing a group of prims still does not work properly - possibly because in the UndoState we don't store a knowledge of when we're resizing a whole group rather than individual prims. This needs to be addressed.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs92
1 files changed, 59 insertions, 33 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index a1200ee..aab83b8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1014,15 +1014,19 @@ namespace OpenSim.Region.Framework.Scenes
1014 get { return m_shape; } 1014 get { return m_shape; }
1015 set { m_shape = value; } 1015 set { m_shape = value; }
1016 } 1016 }
1017 1017
1018 /// <summary>
1019 /// Change the scale of this part.
1020 /// </summary>
1018 public Vector3 Scale 1021 public Vector3 Scale
1019 { 1022 {
1020 get { return m_shape.Scale; } 1023 get { return m_shape.Scale; }
1021 set 1024 set
1022 { 1025 {
1023 StoreUndoState();
1024 if (m_shape != null) 1026 if (m_shape != null)
1025 { 1027 {
1028 StoreUndoState();
1029
1026 m_shape.Scale = value; 1030 m_shape.Scale = value;
1027 1031
1028 PhysicsActor actor = PhysActor; 1032 PhysicsActor actor = PhysActor;
@@ -1033,11 +1037,16 @@ namespace OpenSim.Region.Framework.Scenes
1033 if (m_parentGroup.Scene.PhysicsScene != null) 1037 if (m_parentGroup.Scene.PhysicsScene != null)
1034 { 1038 {
1035 actor.Size = m_shape.Scale; 1039 actor.Size = m_shape.Scale;
1036 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 1040
1041 if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh)
1042 CheckSculptAndLoad();
1043 else
1044 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
1037 } 1045 }
1038 } 1046 }
1039 } 1047 }
1040 } 1048 }
1049
1041 TriggerScriptChangedEvent(Changed.SCALE); 1050 TriggerScriptChangedEvent(Changed.SCALE);
1042 } 1051 }
1043 } 1052 }
@@ -2827,8 +2836,12 @@ namespace OpenSim.Region.Framework.Scenes
2827 } 2836 }
2828 2837
2829 /// <summary> 2838 /// <summary>
2830 /// Resize this part. 2839 /// Set the scale of this part.
2831 /// </summary> 2840 /// </summary>
2841 /// <remarks>
2842 /// Unlike the scale property, this checks the new size against scene limits and schedules a full property
2843 /// update to viewers.
2844 /// </remarks>
2832 /// <param name="scale"></param> 2845 /// <param name="scale"></param>
2833 public void Resize(Vector3 scale) 2846 public void Resize(Vector3 scale)
2834 { 2847 {
@@ -2836,33 +2849,18 @@ namespace OpenSim.Region.Framework.Scenes
2836 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); 2849 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys);
2837 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); 2850 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys);
2838 2851
2839// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); 2852 if (PhysActor != null && PhysActor.IsPhysical)
2840
2841 StoreUndoState();
2842 m_shape.Scale = scale;
2843
2844 // If we're a mesh/sculpt, then we need to tell the physics engine about our new size. To do this, we
2845 // need to reinsert the sculpt data into the shape, since the physics engine deletes it when done to
2846 // save memory
2847 if (PhysActor != null)
2848 { 2853 {
2849 if (PhysActor.IsPhysical) 2854 scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys);
2850 { 2855 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys);
2851 scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); 2856 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys);
2852 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); 2857 }
2853 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys);
2854 }
2855 2858
2856 PhysActor.Size = scale; 2859// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
2857 2860
2858 if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh) 2861 Scale = scale;
2859 CheckSculptAndLoad();
2860 else
2861 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
2862 }
2863 2862
2864 ParentGroup.HasGroupChanged = true; 2863 ParentGroup.HasGroupChanged = true;
2865 TriggerScriptChangedEvent(Changed.SCALE);
2866 ScheduleFullUpdate(); 2864 ScheduleFullUpdate();
2867 } 2865 }
2868 2866
@@ -3673,8 +3671,6 @@ namespace OpenSim.Region.Framework.Scenes
3673 { 3671 {
3674 if (m_parentGroup != null) 3672 if (m_parentGroup != null)
3675 { 3673 {
3676// m_log.DebugFormat("[SCENE OBJECT PART]: Storing undo state for {0} {1}", Name, LocalId);
3677
3678 lock (m_undo) 3674 lock (m_undo)
3679 { 3675 {
3680 if (m_undo.Count > 0) 3676 if (m_undo.Count > 0)
@@ -3683,15 +3679,29 @@ namespace OpenSim.Region.Framework.Scenes
3683 if (last != null) 3679 if (last != null)
3684 { 3680 {
3685 if (last.Compare(this)) 3681 if (last.Compare(this))
3682 {
3683// m_log.DebugFormat(
3684// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
3685// Name, LocalId, m_undo.Count);
3686
3686 return; 3687 return;
3688 }
3687 } 3689 }
3688 } 3690 }
3689 3691
3692// m_log.DebugFormat(
3693// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, initial stack size {2}",
3694// Name, LocalId, m_undo.Count);
3695
3690 if (m_parentGroup.GetSceneMaxUndo() > 0) 3696 if (m_parentGroup.GetSceneMaxUndo() > 0)
3691 { 3697 {
3692 UndoState nUndo = new UndoState(this); 3698 UndoState nUndo = new UndoState(this);
3693 3699
3694 m_undo.Push(nUndo); 3700 m_undo.Push(nUndo);
3701
3702// m_log.DebugFormat(
3703// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, stack size now {2}",
3704// Name, LocalId, m_undo.Count);
3695 } 3705 }
3696 } 3706 }
3697 } 3707 }
@@ -3703,7 +3713,8 @@ namespace OpenSim.Region.Framework.Scenes
3703 } 3713 }
3704// else 3714// else
3705// { 3715// {
3706// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); 3716// m_log.DebugFormat(
3717// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
3707// } 3718// }
3708 } 3719 }
3709 3720
@@ -3721,10 +3732,12 @@ namespace OpenSim.Region.Framework.Scenes
3721 3732
3722 public void Undo() 3733 public void Undo()
3723 { 3734 {
3724// m_log.DebugFormat("[SCENE OBJECT PART]: Handling undo request for {0} {1}", Name, LocalId);
3725
3726 lock (m_undo) 3735 lock (m_undo)
3727 { 3736 {
3737// m_log.DebugFormat(
3738// "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}",
3739// Name, LocalId, m_undo.Count);
3740
3728 if (m_undo.Count > 0) 3741 if (m_undo.Count > 0)
3729 { 3742 {
3730 UndoState nUndo = null; 3743 UndoState nUndo = null;
@@ -3739,19 +3752,26 @@ namespace OpenSim.Region.Framework.Scenes
3739 if (goback != null) 3752 if (goback != null)
3740 { 3753 {
3741 goback.PlaybackState(this); 3754 goback.PlaybackState(this);
3755
3742 if (nUndo != null) 3756 if (nUndo != null)
3743 m_redo.Push(nUndo); 3757 m_redo.Push(nUndo);
3744 } 3758 }
3745 } 3759 }
3760
3761// m_log.DebugFormat(
3762// "[SCENE OBJECT PART]: Handled undo request for {0} {1}, stack size now {2}",
3763// Name, LocalId, m_undo.Count);
3746 } 3764 }
3747 } 3765 }
3748 3766
3749 public void Redo() 3767 public void Redo()
3750 { 3768 {
3751// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId);
3752
3753 lock (m_redo) 3769 lock (m_redo)
3754 { 3770 {
3771// m_log.DebugFormat(
3772// "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}",
3773// Name, LocalId, m_redo.Count);
3774
3755 if (m_parentGroup.GetSceneMaxUndo() > 0) 3775 if (m_parentGroup.GetSceneMaxUndo() > 0)
3756 { 3776 {
3757 UndoState nUndo = new UndoState(this); 3777 UndoState nUndo = new UndoState(this);
@@ -3763,11 +3783,17 @@ namespace OpenSim.Region.Framework.Scenes
3763 3783
3764 if (gofwd != null) 3784 if (gofwd != null)
3765 gofwd.PlayfwdState(this); 3785 gofwd.PlayfwdState(this);
3786
3787// m_log.DebugFormat(
3788// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}",
3789// Name, LocalId, m_redo.Count);
3766 } 3790 }
3767 } 3791 }
3768 3792
3769 public void ClearUndoState() 3793 public void ClearUndoState()
3770 { 3794 {
3795// m_log.DebugFormat("[SCENE OBJECT PART]: Clearing undo and redo stacks in {0} {1}", Name, LocalId);
3796
3771 lock (m_undo) 3797 lock (m_undo)
3772 { 3798 {
3773 m_undo.Clear(); 3799 m_undo.Clear();