diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 139 |
1 files changed, 104 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index af46659..fe9dd9b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -298,7 +298,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
298 | { | 298 | { |
299 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | 299 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); |
300 | } | 300 | } |
301 | 301 | if (RootPart.GetStatusSandbox()) | |
302 | { | ||
303 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) | ||
304 | { | ||
305 | RootPart.ScriptSetPhysicsStatus(false); | ||
306 | Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), | ||
307 | ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); | ||
308 | return; | ||
309 | } | ||
310 | } | ||
302 | lock (m_parts) | 311 | lock (m_parts) |
303 | { | 312 | { |
304 | foreach (SceneObjectPart part in m_parts.Values) | 313 | foreach (SceneObjectPart part in m_parts.Values) |
@@ -398,6 +407,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
398 | } | 407 | } |
399 | } | 408 | } |
400 | 409 | ||
410 | private SceneObjectPart m_PlaySoundMasterPrim = null; | ||
411 | public SceneObjectPart PlaySoundMasterPrim | ||
412 | { | ||
413 | get { return m_PlaySoundMasterPrim; } | ||
414 | set { m_PlaySoundMasterPrim = value; } | ||
415 | } | ||
416 | |||
417 | private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>(); | ||
418 | public List<SceneObjectPart> PlaySoundSlavePrims | ||
419 | { | ||
420 | get { return m_LoopSoundSlavePrims; } | ||
421 | set { m_LoopSoundSlavePrims = value; } | ||
422 | } | ||
423 | |||
424 | private SceneObjectPart m_LoopSoundMasterPrim = null; | ||
425 | public SceneObjectPart LoopSoundMasterPrim | ||
426 | { | ||
427 | get { return m_LoopSoundMasterPrim; } | ||
428 | set { m_LoopSoundMasterPrim = value; } | ||
429 | } | ||
430 | |||
431 | private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>(); | ||
432 | public List<SceneObjectPart> LoopSoundSlavePrims | ||
433 | { | ||
434 | get { return m_LoopSoundSlavePrims; } | ||
435 | set { m_LoopSoundSlavePrims = value; } | ||
436 | } | ||
437 | |||
401 | // The UUID for the Region this Object is in. | 438 | // The UUID for the Region this Object is in. |
402 | public UUID RegionUUID | 439 | public UUID RegionUUID |
403 | { | 440 | { |
@@ -1779,32 +1816,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1779 | } | 1816 | } |
1780 | } | 1817 | } |
1781 | 1818 | ||
1782 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
1783 | { | ||
1784 | SceneObjectPart rootpart = m_rootPart; | ||
1785 | if (rootpart != null) | ||
1786 | { | ||
1787 | if (IsAttachment) | ||
1788 | { | ||
1789 | /* | ||
1790 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
1791 | if (avatar != null) | ||
1792 | { | ||
1793 | Rotate the Av? | ||
1794 | } */ | ||
1795 | } | ||
1796 | else | ||
1797 | { | ||
1798 | if (rootpart.PhysActor != null) | ||
1799 | { | ||
1800 | rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W); | ||
1801 | rootpart.PhysActor.APIDStrength = strength; | ||
1802 | rootpart.PhysActor.APIDDamping = damping; | ||
1803 | rootpart.PhysActor.APIDActive = true; | ||
1804 | } | ||
1805 | } | ||
1806 | } | ||
1807 | } | ||
1808 | public void stopLookAt() | 1819 | public void stopLookAt() |
1809 | { | 1820 | { |
1810 | SceneObjectPart rootpart = m_rootPart; | 1821 | SceneObjectPart rootpart = m_rootPart; |
@@ -1963,6 +1974,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1963 | 1974 | ||
1964 | foreach (SceneObjectPart part in m_parts.Values) | 1975 | foreach (SceneObjectPart part in m_parts.Values) |
1965 | { | 1976 | { |
1977 | if (!IsSelected) | ||
1978 | part.UpdateLookAt(); | ||
1966 | part.SendScheduledUpdates(); | 1979 | part.SendScheduledUpdates(); |
1967 | } | 1980 | } |
1968 | } | 1981 | } |
@@ -2452,11 +2465,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2452 | { | 2465 | { |
2453 | if (m_rootPart.PhysActor.IsPhysical) | 2466 | if (m_rootPart.PhysActor.IsPhysical) |
2454 | { | 2467 | { |
2455 | Vector3 llmoveforce = pos - AbsolutePosition; | 2468 | if (!m_rootPart.BlockGrab) |
2456 | Vector3 grabforce = llmoveforce; | 2469 | { |
2457 | grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; | 2470 | Vector3 llmoveforce = pos - AbsolutePosition; |
2458 | m_rootPart.PhysActor.AddForce(grabforce,true); | 2471 | Vector3 grabforce = llmoveforce; |
2459 | m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 2472 | grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; |
2473 | m_rootPart.PhysActor.AddForce(grabforce, true); | ||
2474 | m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | ||
2475 | } | ||
2460 | } | 2476 | } |
2461 | else | 2477 | else |
2462 | { | 2478 | { |
@@ -2812,6 +2828,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2812 | SceneObjectPart part = GetChildPart(localID); | 2828 | SceneObjectPart part = GetChildPart(localID); |
2813 | if (part != null) | 2829 | if (part != null) |
2814 | { | 2830 | { |
2831 | part.IgnoreUndoUpdate = true; | ||
2815 | if (scale.X > m_scene.m_maxNonphys) | 2832 | if (scale.X > m_scene.m_maxNonphys) |
2816 | scale.X = m_scene.m_maxNonphys; | 2833 | scale.X = m_scene.m_maxNonphys; |
2817 | if (scale.Y > m_scene.m_maxNonphys) | 2834 | if (scale.Y > m_scene.m_maxNonphys) |
@@ -2839,6 +2856,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2839 | { | 2856 | { |
2840 | if (obPart.UUID != m_rootPart.UUID) | 2857 | if (obPart.UUID != m_rootPart.UUID) |
2841 | { | 2858 | { |
2859 | obPart.IgnoreUndoUpdate = true; | ||
2842 | Vector3 oldSize = new Vector3(obPart.Scale); | 2860 | Vector3 oldSize = new Vector3(obPart.Scale); |
2843 | 2861 | ||
2844 | float f = 1.0f; | 2862 | float f = 1.0f; |
@@ -2898,6 +2916,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2898 | z *= a; | 2916 | z *= a; |
2899 | } | 2917 | } |
2900 | } | 2918 | } |
2919 | obPart.IgnoreUndoUpdate = false; | ||
2920 | obPart.StoreUndoState(); | ||
2901 | } | 2921 | } |
2902 | } | 2922 | } |
2903 | } | 2923 | } |
@@ -2913,6 +2933,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2913 | { | 2933 | { |
2914 | foreach (SceneObjectPart obPart in m_parts.Values) | 2934 | foreach (SceneObjectPart obPart in m_parts.Values) |
2915 | { | 2935 | { |
2936 | obPart.IgnoreUndoUpdate = true; | ||
2916 | if (obPart.UUID != m_rootPart.UUID) | 2937 | if (obPart.UUID != m_rootPart.UUID) |
2917 | { | 2938 | { |
2918 | Vector3 currentpos = new Vector3(obPart.OffsetPosition); | 2939 | Vector3 currentpos = new Vector3(obPart.OffsetPosition); |
@@ -2926,6 +2947,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2926 | obPart.Resize(newSize); | 2947 | obPart.Resize(newSize); |
2927 | obPart.UpdateOffSet(currentpos); | 2948 | obPart.UpdateOffSet(currentpos); |
2928 | } | 2949 | } |
2950 | obPart.IgnoreUndoUpdate = false; | ||
2951 | obPart.StoreUndoState(); | ||
2929 | } | 2952 | } |
2930 | } | 2953 | } |
2931 | 2954 | ||
@@ -2935,6 +2958,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2935 | m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); | 2958 | m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); |
2936 | } | 2959 | } |
2937 | 2960 | ||
2961 | part.IgnoreUndoUpdate = false; | ||
2962 | part.StoreUndoState(); | ||
2938 | HasGroupChanged = true; | 2963 | HasGroupChanged = true; |
2939 | ScheduleGroupForTerseUpdate(); | 2964 | ScheduleGroupForTerseUpdate(); |
2940 | } | 2965 | } |
@@ -2950,13 +2975,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
2950 | /// <param name="pos"></param> | 2975 | /// <param name="pos"></param> |
2951 | public void UpdateGroupPosition(Vector3 pos) | 2976 | public void UpdateGroupPosition(Vector3 pos) |
2952 | { | 2977 | { |
2978 | foreach (SceneObjectPart part in Children.Values) | ||
2979 | { | ||
2980 | part.StoreUndoState(); | ||
2981 | } | ||
2953 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) | 2982 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) |
2954 | { | 2983 | { |
2955 | if (IsAttachment) | 2984 | if (IsAttachment) |
2956 | { | 2985 | { |
2957 | m_rootPart.AttachedPos = pos; | 2986 | m_rootPart.AttachedPos = pos; |
2958 | } | 2987 | } |
2959 | 2988 | if (RootPart.GetStatusSandbox()) | |
2989 | { | ||
2990 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10) | ||
2991 | { | ||
2992 | RootPart.ScriptSetPhysicsStatus(false); | ||
2993 | pos = AbsolutePosition; | ||
2994 | Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), | ||
2995 | ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); | ||
2996 | } | ||
2997 | } | ||
2960 | AbsolutePosition = pos; | 2998 | AbsolutePosition = pos; |
2961 | 2999 | ||
2962 | HasGroupChanged = true; | 3000 | HasGroupChanged = true; |
@@ -2975,7 +3013,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2975 | public void UpdateSinglePosition(Vector3 pos, uint localID) | 3013 | public void UpdateSinglePosition(Vector3 pos, uint localID) |
2976 | { | 3014 | { |
2977 | SceneObjectPart part = GetChildPart(localID); | 3015 | SceneObjectPart part = GetChildPart(localID); |
2978 | 3016 | foreach (SceneObjectPart parts in Children.Values) | |
3017 | { | ||
3018 | parts.StoreUndoState(); | ||
3019 | } | ||
2979 | if (part != null) | 3020 | if (part != null) |
2980 | { | 3021 | { |
2981 | if (part.UUID == m_rootPart.UUID) | 3022 | if (part.UUID == m_rootPart.UUID) |
@@ -2997,6 +3038,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2997 | /// <param name="pos"></param> | 3038 | /// <param name="pos"></param> |
2998 | private void UpdateRootPosition(Vector3 pos) | 3039 | private void UpdateRootPosition(Vector3 pos) |
2999 | { | 3040 | { |
3041 | foreach (SceneObjectPart part in Children.Values) | ||
3042 | { | ||
3043 | part.StoreUndoState(); | ||
3044 | } | ||
3000 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); | 3045 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); |
3001 | Vector3 oldPos = | 3046 | Vector3 oldPos = |
3002 | new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, | 3047 | new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, |
@@ -3040,6 +3085,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3040 | /// <param name="rot"></param> | 3085 | /// <param name="rot"></param> |
3041 | public void UpdateGroupRotationR(Quaternion rot) | 3086 | public void UpdateGroupRotationR(Quaternion rot) |
3042 | { | 3087 | { |
3088 | foreach (SceneObjectPart parts in Children.Values) | ||
3089 | { | ||
3090 | parts.StoreUndoState(); | ||
3091 | } | ||
3043 | m_rootPart.UpdateRotation(rot); | 3092 | m_rootPart.UpdateRotation(rot); |
3044 | 3093 | ||
3045 | PhysicsActor actor = m_rootPart.PhysActor; | 3094 | PhysicsActor actor = m_rootPart.PhysActor; |
@@ -3060,6 +3109,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3060 | /// <param name="rot"></param> | 3109 | /// <param name="rot"></param> |
3061 | public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) | 3110 | public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) |
3062 | { | 3111 | { |
3112 | foreach (SceneObjectPart parts in Children.Values) | ||
3113 | { | ||
3114 | parts.StoreUndoState(); | ||
3115 | } | ||
3063 | m_rootPart.UpdateRotation(rot); | 3116 | m_rootPart.UpdateRotation(rot); |
3064 | 3117 | ||
3065 | PhysicsActor actor = m_rootPart.PhysActor; | 3118 | PhysicsActor actor = m_rootPart.PhysActor; |
@@ -3083,6 +3136,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3083 | public void UpdateSingleRotation(Quaternion rot, uint localID) | 3136 | public void UpdateSingleRotation(Quaternion rot, uint localID) |
3084 | { | 3137 | { |
3085 | SceneObjectPart part = GetChildPart(localID); | 3138 | SceneObjectPart part = GetChildPart(localID); |
3139 | foreach (SceneObjectPart parts in Children.Values) | ||
3140 | { | ||
3141 | parts.StoreUndoState(); | ||
3142 | } | ||
3086 | if (part != null) | 3143 | if (part != null) |
3087 | { | 3144 | { |
3088 | if (part.UUID == m_rootPart.UUID) | 3145 | if (part.UUID == m_rootPart.UUID) |
@@ -3113,8 +3170,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3113 | } | 3170 | } |
3114 | else | 3171 | else |
3115 | { | 3172 | { |
3173 | part.IgnoreUndoUpdate = true; | ||
3116 | part.UpdateRotation(rot); | 3174 | part.UpdateRotation(rot); |
3117 | part.OffsetPosition = pos; | 3175 | part.OffsetPosition = pos; |
3176 | part.IgnoreUndoUpdate = false; | ||
3177 | part.StoreUndoState(); | ||
3118 | } | 3178 | } |
3119 | } | 3179 | } |
3120 | } | 3180 | } |
@@ -3128,6 +3188,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3128 | Quaternion axRot = rot; | 3188 | Quaternion axRot = rot; |
3129 | Quaternion oldParentRot = m_rootPart.RotationOffset; | 3189 | Quaternion oldParentRot = m_rootPart.RotationOffset; |
3130 | 3190 | ||
3191 | m_rootPart.StoreUndoState(); | ||
3131 | m_rootPart.UpdateRotation(rot); | 3192 | m_rootPart.UpdateRotation(rot); |
3132 | if (m_rootPart.PhysActor != null) | 3193 | if (m_rootPart.PhysActor != null) |
3133 | { | 3194 | { |
@@ -3141,6 +3202,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3141 | { | 3202 | { |
3142 | if (prim.UUID != m_rootPart.UUID) | 3203 | if (prim.UUID != m_rootPart.UUID) |
3143 | { | 3204 | { |
3205 | prim.IgnoreUndoUpdate = true; | ||
3144 | Vector3 axPos = prim.OffsetPosition; | 3206 | Vector3 axPos = prim.OffsetPosition; |
3145 | axPos *= oldParentRot; | 3207 | axPos *= oldParentRot; |
3146 | axPos *= Quaternion.Inverse(axRot); | 3208 | axPos *= Quaternion.Inverse(axRot); |
@@ -3153,7 +3215,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3153 | } | 3215 | } |
3154 | } | 3216 | } |
3155 | } | 3217 | } |
3156 | 3218 | foreach (SceneObjectPart childpart in Children.Values) | |
3219 | { | ||
3220 | if (childpart != m_rootPart) | ||
3221 | { | ||
3222 | childpart.IgnoreUndoUpdate = false; | ||
3223 | childpart.StoreUndoState(); | ||
3224 | } | ||
3225 | } | ||
3157 | m_rootPart.ScheduleTerseUpdate(); | 3226 | m_rootPart.ScheduleTerseUpdate(); |
3158 | } | 3227 | } |
3159 | 3228 | ||