diff options
author | Justin Clark-Casey (justincc) | 2011-07-18 04:54:21 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-07-18 04:54:21 +0100 |
commit | 6fc74b36d1d0f7dcd6f013893c3189a3f989431c (patch) | |
tree | a82bdd3fe6f15298624a142a3705f2739a8ee031 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | use standard sdk stack in terrain model rather than OpenSim.Framework.UndoStack. (diff) | |
download | opensim-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/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 58 |
1 files changed, 45 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ce5db5f..7254992 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1145,6 +1145,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1145 | 1145 | ||
1146 | public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) | 1146 | public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) |
1147 | { | 1147 | { |
1148 | // m_log.DebugFormat( | ||
1149 | // "[SCENE OBJECT GROUP]: Processing OnGrabPart for {0} on {1} {2}, offsetPos {3}", | ||
1150 | // remoteClient.Name, part.Name, part.LocalId, offsetPos); | ||
1151 | |||
1148 | part.StoreUndoState(); | 1152 | part.StoreUndoState(); |
1149 | part.OnGrab(offsetPos, remoteClient); | 1153 | part.OnGrab(offsetPos, remoteClient); |
1150 | } | 1154 | } |
@@ -2611,17 +2615,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2611 | 2615 | ||
2612 | #region Resize | 2616 | #region Resize |
2613 | 2617 | ||
2614 | |||
2615 | /// <summary> | 2618 | /// <summary> |
2616 | /// Resize the entire group of prims. | 2619 | /// Resize the entire group of prims. |
2617 | /// </summary> | 2620 | /// </summary> |
2618 | /// <param name="scale"></param> | 2621 | /// <param name="scale"></param> |
2619 | public void GroupResize(Vector3 scale) | 2622 | public void GroupResize(Vector3 scale) |
2620 | { | 2623 | { |
2621 | // m_log.DebugFormat( | 2624 | // m_log.DebugFormat( |
2622 | // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, localID, RootPart.Scale, scale); | 2625 | // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); |
2623 | |||
2624 | RootPart.IgnoreUndoUpdate = true; | ||
2625 | 2626 | ||
2626 | scale.X = Math.Min(scale.X, Scene.m_maxNonphys); | 2627 | scale.X = Math.Min(scale.X, Scene.m_maxNonphys); |
2627 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); | 2628 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); |
@@ -2647,7 +2648,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2647 | SceneObjectPart obPart = parts[i]; | 2648 | SceneObjectPart obPart = parts[i]; |
2648 | if (obPart.UUID != m_rootPart.UUID) | 2649 | if (obPart.UUID != m_rootPart.UUID) |
2649 | { | 2650 | { |
2650 | obPart.IgnoreUndoUpdate = true; | 2651 | // obPart.IgnoreUndoUpdate = true; |
2651 | Vector3 oldSize = new Vector3(obPart.Scale); | 2652 | Vector3 oldSize = new Vector3(obPart.Scale); |
2652 | 2653 | ||
2653 | float f = 1.0f; | 2654 | float f = 1.0f; |
@@ -2663,6 +2664,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2663 | y *= a; | 2664 | y *= a; |
2664 | z *= a; | 2665 | z *= a; |
2665 | } | 2666 | } |
2667 | |||
2666 | if (oldSize.Y * y > m_scene.m_maxPhys) | 2668 | if (oldSize.Y * y > m_scene.m_maxPhys) |
2667 | { | 2669 | { |
2668 | f = m_scene.m_maxPhys / oldSize.Y; | 2670 | f = m_scene.m_maxPhys / oldSize.Y; |
@@ -2671,6 +2673,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2671 | y *= a; | 2673 | y *= a; |
2672 | z *= a; | 2674 | z *= a; |
2673 | } | 2675 | } |
2676 | |||
2674 | if (oldSize.Z * z > m_scene.m_maxPhys) | 2677 | if (oldSize.Z * z > m_scene.m_maxPhys) |
2675 | { | 2678 | { |
2676 | f = m_scene.m_maxPhys / oldSize.Z; | 2679 | f = m_scene.m_maxPhys / oldSize.Z; |
@@ -2690,6 +2693,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2690 | y *= a; | 2693 | y *= a; |
2691 | z *= a; | 2694 | z *= a; |
2692 | } | 2695 | } |
2696 | |||
2693 | if (oldSize.Y * y > m_scene.m_maxNonphys) | 2697 | if (oldSize.Y * y > m_scene.m_maxNonphys) |
2694 | { | 2698 | { |
2695 | f = m_scene.m_maxNonphys / oldSize.Y; | 2699 | f = m_scene.m_maxNonphys / oldSize.Y; |
@@ -2698,6 +2702,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2698 | y *= a; | 2702 | y *= a; |
2699 | z *= a; | 2703 | z *= a; |
2700 | } | 2704 | } |
2705 | |||
2701 | if (oldSize.Z * z > m_scene.m_maxNonphys) | 2706 | if (oldSize.Z * z > m_scene.m_maxNonphys) |
2702 | { | 2707 | { |
2703 | f = m_scene.m_maxNonphys / oldSize.Z; | 2708 | f = m_scene.m_maxNonphys / oldSize.Z; |
@@ -2708,7 +2713,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2708 | } | 2713 | } |
2709 | } | 2714 | } |
2710 | 2715 | ||
2711 | obPart.IgnoreUndoUpdate = false; | 2716 | // obPart.IgnoreUndoUpdate = false; |
2712 | } | 2717 | } |
2713 | } | 2718 | } |
2714 | } | 2719 | } |
@@ -2723,7 +2728,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2723 | for (int i = 0; i < parts.Length; i++) | 2728 | for (int i = 0; i < parts.Length; i++) |
2724 | { | 2729 | { |
2725 | SceneObjectPart obPart = parts[i]; | 2730 | SceneObjectPart obPart = parts[i]; |
2726 | obPart.IgnoreUndoUpdate = true; | 2731 | // obPart.IgnoreUndoUpdate = true; |
2727 | 2732 | ||
2728 | if (obPart.UUID != m_rootPart.UUID) | 2733 | if (obPart.UUID != m_rootPart.UUID) |
2729 | { | 2734 | { |
@@ -2738,16 +2743,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2738 | newSize.Z *= z; | 2743 | newSize.Z *= z; |
2739 | 2744 | ||
2740 | obPart.Resize(newSize); | 2745 | obPart.Resize(newSize); |
2746 | |||
2747 | obPart.IgnoreUndoUpdate = true; | ||
2741 | obPart.UpdateOffSet(currentpos); | 2748 | obPart.UpdateOffSet(currentpos); |
2749 | obPart.IgnoreUndoUpdate = false; | ||
2742 | } | 2750 | } |
2743 | 2751 | ||
2744 | obPart.IgnoreUndoUpdate = false; | 2752 | // obPart.IgnoreUndoUpdate = false; |
2745 | obPart.StoreUndoState(); | 2753 | // obPart.StoreUndoState(); |
2746 | } | 2754 | } |
2747 | 2755 | ||
2748 | RootPart.IgnoreUndoUpdate = false; | 2756 | // m_log.DebugFormat( |
2749 | 2757 | // "[SCENE OBJECT GROUP]: Finished group resizing {0} {1} to {2}", Name, LocalId, RootPart.Scale); | |
2750 | RootPart.StoreUndoState(); | ||
2751 | } | 2758 | } |
2752 | 2759 | ||
2753 | #endregion | 2760 | #endregion |
@@ -2760,6 +2767,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2760 | /// <param name="pos"></param> | 2767 | /// <param name="pos"></param> |
2761 | public void UpdateGroupPosition(Vector3 pos) | 2768 | public void UpdateGroupPosition(Vector3 pos) |
2762 | { | 2769 | { |
2770 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Updating group position on {0} {1} to {2}", Name, LocalId, pos); | ||
2771 | |||
2763 | SceneObjectPart[] parts = m_parts.GetArray(); | 2772 | SceneObjectPart[] parts = m_parts.GetArray(); |
2764 | for (int i = 0; i < parts.Length; i++) | 2773 | for (int i = 0; i < parts.Length; i++) |
2765 | parts[i].StoreUndoState(); | 2774 | parts[i].StoreUndoState(); |
@@ -2805,6 +2814,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2805 | 2814 | ||
2806 | if (part != null) | 2815 | if (part != null) |
2807 | { | 2816 | { |
2817 | // m_log.DebugFormat( | ||
2818 | // "[SCENE OBJECT GROUP]: Updating single position of {0} {1} to {2}", part.Name, part.LocalId, pos); | ||
2819 | |||
2808 | if (part.UUID == m_rootPart.UUID) | 2820 | if (part.UUID == m_rootPart.UUID) |
2809 | { | 2821 | { |
2810 | UpdateRootPosition(pos); | 2822 | UpdateRootPosition(pos); |
@@ -2824,6 +2836,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2824 | /// <param name="pos"></param> | 2836 | /// <param name="pos"></param> |
2825 | private void UpdateRootPosition(Vector3 pos) | 2837 | private void UpdateRootPosition(Vector3 pos) |
2826 | { | 2838 | { |
2839 | // m_log.DebugFormat( | ||
2840 | // "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos); | ||
2841 | |||
2827 | SceneObjectPart[] parts = m_parts.GetArray(); | 2842 | SceneObjectPart[] parts = m_parts.GetArray(); |
2828 | for (int i = 0; i < parts.Length; i++) | 2843 | for (int i = 0; i < parts.Length; i++) |
2829 | parts[i].StoreUndoState(); | 2844 | parts[i].StoreUndoState(); |
@@ -2868,6 +2883,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2868 | /// <param name="rot"></param> | 2883 | /// <param name="rot"></param> |
2869 | public void UpdateGroupRotationR(Quaternion rot) | 2884 | public void UpdateGroupRotationR(Quaternion rot) |
2870 | { | 2885 | { |
2886 | // m_log.DebugFormat( | ||
2887 | // "[SCENE OBJECT GROUP]: Updating group rotation R of {0} {1} to {2}", Name, LocalId, rot); | ||
2888 | |||
2871 | SceneObjectPart[] parts = m_parts.GetArray(); | 2889 | SceneObjectPart[] parts = m_parts.GetArray(); |
2872 | for (int i = 0; i < parts.Length; i++) | 2890 | for (int i = 0; i < parts.Length; i++) |
2873 | parts[i].StoreUndoState(); | 2891 | parts[i].StoreUndoState(); |
@@ -2892,6 +2910,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2892 | /// <param name="rot"></param> | 2910 | /// <param name="rot"></param> |
2893 | public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) | 2911 | public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) |
2894 | { | 2912 | { |
2913 | // m_log.DebugFormat( | ||
2914 | // "[SCENE OBJECT GROUP]: Updating group rotation PR of {0} {1} to {2}", Name, LocalId, rot); | ||
2915 | |||
2895 | SceneObjectPart[] parts = m_parts.GetArray(); | 2916 | SceneObjectPart[] parts = m_parts.GetArray(); |
2896 | for (int i = 0; i < parts.Length; i++) | 2917 | for (int i = 0; i < parts.Length; i++) |
2897 | parts[i].StoreUndoState(); | 2918 | parts[i].StoreUndoState(); |
@@ -2926,6 +2947,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2926 | 2947 | ||
2927 | if (part != null) | 2948 | if (part != null) |
2928 | { | 2949 | { |
2950 | // m_log.DebugFormat( | ||
2951 | // "[SCENE OBJECT GROUP]: Updating single rotation of {0} {1} to {2}", part.Name, part.LocalId, rot); | ||
2952 | |||
2929 | if (part.UUID == m_rootPart.UUID) | 2953 | if (part.UUID == m_rootPart.UUID) |
2930 | { | 2954 | { |
2931 | UpdateRootRotation(rot); | 2955 | UpdateRootRotation(rot); |
@@ -2947,6 +2971,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2947 | SceneObjectPart part = GetChildPart(localID); | 2971 | SceneObjectPart part = GetChildPart(localID); |
2948 | if (part != null) | 2972 | if (part != null) |
2949 | { | 2973 | { |
2974 | // m_log.DebugFormat( | ||
2975 | // "[SCENE OBJECT GROUP]: Updating single position and rotation of {0} {1} to {2}", | ||
2976 | // part.Name, part.LocalId, rot); | ||
2977 | |||
2950 | if (part.UUID == m_rootPart.UUID) | 2978 | if (part.UUID == m_rootPart.UUID) |
2951 | { | 2979 | { |
2952 | UpdateRootRotation(rot); | 2980 | UpdateRootRotation(rot); |
@@ -2969,6 +2997,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2969 | /// <param name="rot"></param> | 2997 | /// <param name="rot"></param> |
2970 | private void UpdateRootRotation(Quaternion rot) | 2998 | private void UpdateRootRotation(Quaternion rot) |
2971 | { | 2999 | { |
3000 | // m_log.DebugFormat( | ||
3001 | // "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}", | ||
3002 | // Name, LocalId, rot); | ||
3003 | |||
2972 | Quaternion axRot = rot; | 3004 | Quaternion axRot = rot; |
2973 | Quaternion oldParentRot = m_rootPart.RotationOffset; | 3005 | Quaternion oldParentRot = m_rootPart.RotationOffset; |
2974 | 3006 | ||