aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-02-16 19:08:06 +0000
committerJustin Clark-Casey (justincc)2010-02-16 19:08:06 +0000
commit4c90ee29432539efbf5942010dd574822235ed57 (patch)
treed159f72df97dfef5719221301009e90f375f2ef2 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
parentminor: Make SOG.DelinkFromGroup() return the newly delinked scene object inst... (diff)
parentFormatting cleanup. (diff)
downloadopensim-SC_OLD-4c90ee29432539efbf5942010dd574822235ed57.zip
opensim-SC_OLD-4c90ee29432539efbf5942010dd574822235ed57.tar.gz
opensim-SC_OLD-4c90ee29432539efbf5942010dd574822235ed57.tar.bz2
opensim-SC_OLD-4c90ee29432539efbf5942010dd574822235ed57.tar.xz
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs139
1 files changed, 104 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 94e64e4..6357192 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 {
@@ -1782,32 +1819,6 @@ namespace OpenSim.Region.Framework.Scenes
1782 } 1819 }
1783 } 1820 }
1784 1821
1785 public void rotLookAt(Quaternion target, float strength, float damping)
1786 {
1787 SceneObjectPart rootpart = m_rootPart;
1788 if (rootpart != null)
1789 {
1790 if (IsAttachment)
1791 {
1792 /*
1793 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
1794 if (avatar != null)
1795 {
1796 Rotate the Av?
1797 } */
1798 }
1799 else
1800 {
1801 if (rootpart.PhysActor != null)
1802 {
1803 rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W);
1804 rootpart.PhysActor.APIDStrength = strength;
1805 rootpart.PhysActor.APIDDamping = damping;
1806 rootpart.PhysActor.APIDActive = true;
1807 }
1808 }
1809 }
1810 }
1811 public void stopLookAt() 1822 public void stopLookAt()
1812 { 1823 {
1813 SceneObjectPart rootpart = m_rootPart; 1824 SceneObjectPart rootpart = m_rootPart;
@@ -1966,6 +1977,8 @@ namespace OpenSim.Region.Framework.Scenes
1966 1977
1967 foreach (SceneObjectPart part in m_parts.Values) 1978 foreach (SceneObjectPart part in m_parts.Values)
1968 { 1979 {
1980 if (!IsSelected)
1981 part.UpdateLookAt();
1969 part.SendScheduledUpdates(); 1982 part.SendScheduledUpdates();
1970 } 1983 }
1971 } 1984 }
@@ -2467,11 +2480,14 @@ namespace OpenSim.Region.Framework.Scenes
2467 { 2480 {
2468 if (m_rootPart.PhysActor.IsPhysical) 2481 if (m_rootPart.PhysActor.IsPhysical)
2469 { 2482 {
2470 Vector3 llmoveforce = pos - AbsolutePosition; 2483 if (!m_rootPart.BlockGrab)
2471 Vector3 grabforce = llmoveforce; 2484 {
2472 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; 2485 Vector3 llmoveforce = pos - AbsolutePosition;
2473 m_rootPart.PhysActor.AddForce(grabforce,true); 2486 Vector3 grabforce = llmoveforce;
2474 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2487 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
2488 m_rootPart.PhysActor.AddForce(grabforce, true);
2489 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
2490 }
2475 } 2491 }
2476 else 2492 else
2477 { 2493 {
@@ -2827,6 +2843,7 @@ namespace OpenSim.Region.Framework.Scenes
2827 SceneObjectPart part = GetChildPart(localID); 2843 SceneObjectPart part = GetChildPart(localID);
2828 if (part != null) 2844 if (part != null)
2829 { 2845 {
2846 part.IgnoreUndoUpdate = true;
2830 if (scale.X > m_scene.m_maxNonphys) 2847 if (scale.X > m_scene.m_maxNonphys)
2831 scale.X = m_scene.m_maxNonphys; 2848 scale.X = m_scene.m_maxNonphys;
2832 if (scale.Y > m_scene.m_maxNonphys) 2849 if (scale.Y > m_scene.m_maxNonphys)
@@ -2854,6 +2871,7 @@ namespace OpenSim.Region.Framework.Scenes
2854 { 2871 {
2855 if (obPart.UUID != m_rootPart.UUID) 2872 if (obPart.UUID != m_rootPart.UUID)
2856 { 2873 {
2874 obPart.IgnoreUndoUpdate = true;
2857 Vector3 oldSize = new Vector3(obPart.Scale); 2875 Vector3 oldSize = new Vector3(obPart.Scale);
2858 2876
2859 float f = 1.0f; 2877 float f = 1.0f;
@@ -2913,6 +2931,8 @@ namespace OpenSim.Region.Framework.Scenes
2913 z *= a; 2931 z *= a;
2914 } 2932 }
2915 } 2933 }
2934 obPart.IgnoreUndoUpdate = false;
2935 obPart.StoreUndoState();
2916 } 2936 }
2917 } 2937 }
2918 } 2938 }
@@ -2928,6 +2948,7 @@ namespace OpenSim.Region.Framework.Scenes
2928 { 2948 {
2929 foreach (SceneObjectPart obPart in m_parts.Values) 2949 foreach (SceneObjectPart obPart in m_parts.Values)
2930 { 2950 {
2951 obPart.IgnoreUndoUpdate = true;
2931 if (obPart.UUID != m_rootPart.UUID) 2952 if (obPart.UUID != m_rootPart.UUID)
2932 { 2953 {
2933 Vector3 currentpos = new Vector3(obPart.OffsetPosition); 2954 Vector3 currentpos = new Vector3(obPart.OffsetPosition);
@@ -2941,6 +2962,8 @@ namespace OpenSim.Region.Framework.Scenes
2941 obPart.Resize(newSize); 2962 obPart.Resize(newSize);
2942 obPart.UpdateOffSet(currentpos); 2963 obPart.UpdateOffSet(currentpos);
2943 } 2964 }
2965 obPart.IgnoreUndoUpdate = false;
2966 obPart.StoreUndoState();
2944 } 2967 }
2945 } 2968 }
2946 2969
@@ -2950,6 +2973,8 @@ namespace OpenSim.Region.Framework.Scenes
2950 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); 2973 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
2951 } 2974 }
2952 2975
2976 part.IgnoreUndoUpdate = false;
2977 part.StoreUndoState();
2953 HasGroupChanged = true; 2978 HasGroupChanged = true;
2954 ScheduleGroupForTerseUpdate(); 2979 ScheduleGroupForTerseUpdate();
2955 } 2980 }
@@ -2965,13 +2990,26 @@ namespace OpenSim.Region.Framework.Scenes
2965 /// <param name="pos"></param> 2990 /// <param name="pos"></param>
2966 public void UpdateGroupPosition(Vector3 pos) 2991 public void UpdateGroupPosition(Vector3 pos)
2967 { 2992 {
2993 foreach (SceneObjectPart part in Children.Values)
2994 {
2995 part.StoreUndoState();
2996 }
2968 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 2997 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
2969 { 2998 {
2970 if (IsAttachment) 2999 if (IsAttachment)
2971 { 3000 {
2972 m_rootPart.AttachedPos = pos; 3001 m_rootPart.AttachedPos = pos;
2973 } 3002 }
2974 3003 if (RootPart.GetStatusSandbox())
3004 {
3005 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
3006 {
3007 RootPart.ScriptSetPhysicsStatus(false);
3008 pos = AbsolutePosition;
3009 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
3010 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
3011 }
3012 }
2975 AbsolutePosition = pos; 3013 AbsolutePosition = pos;
2976 3014
2977 HasGroupChanged = true; 3015 HasGroupChanged = true;
@@ -2990,7 +3028,10 @@ namespace OpenSim.Region.Framework.Scenes
2990 public void UpdateSinglePosition(Vector3 pos, uint localID) 3028 public void UpdateSinglePosition(Vector3 pos, uint localID)
2991 { 3029 {
2992 SceneObjectPart part = GetChildPart(localID); 3030 SceneObjectPart part = GetChildPart(localID);
2993 3031 foreach (SceneObjectPart parts in Children.Values)
3032 {
3033 parts.StoreUndoState();
3034 }
2994 if (part != null) 3035 if (part != null)
2995 { 3036 {
2996 if (part.UUID == m_rootPart.UUID) 3037 if (part.UUID == m_rootPart.UUID)
@@ -3012,6 +3053,10 @@ namespace OpenSim.Region.Framework.Scenes
3012 /// <param name="pos"></param> 3053 /// <param name="pos"></param>
3013 private void UpdateRootPosition(Vector3 pos) 3054 private void UpdateRootPosition(Vector3 pos)
3014 { 3055 {
3056 foreach (SceneObjectPart part in Children.Values)
3057 {
3058 part.StoreUndoState();
3059 }
3015 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 3060 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
3016 Vector3 oldPos = 3061 Vector3 oldPos =
3017 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, 3062 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
@@ -3055,6 +3100,10 @@ namespace OpenSim.Region.Framework.Scenes
3055 /// <param name="rot"></param> 3100 /// <param name="rot"></param>
3056 public void UpdateGroupRotationR(Quaternion rot) 3101 public void UpdateGroupRotationR(Quaternion rot)
3057 { 3102 {
3103 foreach (SceneObjectPart parts in Children.Values)
3104 {
3105 parts.StoreUndoState();
3106 }
3058 m_rootPart.UpdateRotation(rot); 3107 m_rootPart.UpdateRotation(rot);
3059 3108
3060 PhysicsActor actor = m_rootPart.PhysActor; 3109 PhysicsActor actor = m_rootPart.PhysActor;
@@ -3075,6 +3124,10 @@ namespace OpenSim.Region.Framework.Scenes
3075 /// <param name="rot"></param> 3124 /// <param name="rot"></param>
3076 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) 3125 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
3077 { 3126 {
3127 foreach (SceneObjectPart parts in Children.Values)
3128 {
3129 parts.StoreUndoState();
3130 }
3078 m_rootPart.UpdateRotation(rot); 3131 m_rootPart.UpdateRotation(rot);
3079 3132
3080 PhysicsActor actor = m_rootPart.PhysActor; 3133 PhysicsActor actor = m_rootPart.PhysActor;
@@ -3098,6 +3151,10 @@ namespace OpenSim.Region.Framework.Scenes
3098 public void UpdateSingleRotation(Quaternion rot, uint localID) 3151 public void UpdateSingleRotation(Quaternion rot, uint localID)
3099 { 3152 {
3100 SceneObjectPart part = GetChildPart(localID); 3153 SceneObjectPart part = GetChildPart(localID);
3154 foreach (SceneObjectPart parts in Children.Values)
3155 {
3156 parts.StoreUndoState();
3157 }
3101 if (part != null) 3158 if (part != null)
3102 { 3159 {
3103 if (part.UUID == m_rootPart.UUID) 3160 if (part.UUID == m_rootPart.UUID)
@@ -3128,8 +3185,11 @@ namespace OpenSim.Region.Framework.Scenes
3128 } 3185 }
3129 else 3186 else
3130 { 3187 {
3188 part.IgnoreUndoUpdate = true;
3131 part.UpdateRotation(rot); 3189 part.UpdateRotation(rot);
3132 part.OffsetPosition = pos; 3190 part.OffsetPosition = pos;
3191 part.IgnoreUndoUpdate = false;
3192 part.StoreUndoState();
3133 } 3193 }
3134 } 3194 }
3135 } 3195 }
@@ -3143,6 +3203,7 @@ namespace OpenSim.Region.Framework.Scenes
3143 Quaternion axRot = rot; 3203 Quaternion axRot = rot;
3144 Quaternion oldParentRot = m_rootPart.RotationOffset; 3204 Quaternion oldParentRot = m_rootPart.RotationOffset;
3145 3205
3206 m_rootPart.StoreUndoState();
3146 m_rootPart.UpdateRotation(rot); 3207 m_rootPart.UpdateRotation(rot);
3147 if (m_rootPart.PhysActor != null) 3208 if (m_rootPart.PhysActor != null)
3148 { 3209 {
@@ -3156,6 +3217,7 @@ namespace OpenSim.Region.Framework.Scenes
3156 { 3217 {
3157 if (prim.UUID != m_rootPart.UUID) 3218 if (prim.UUID != m_rootPart.UUID)
3158 { 3219 {
3220 prim.IgnoreUndoUpdate = true;
3159 Vector3 axPos = prim.OffsetPosition; 3221 Vector3 axPos = prim.OffsetPosition;
3160 axPos *= oldParentRot; 3222 axPos *= oldParentRot;
3161 axPos *= Quaternion.Inverse(axRot); 3223 axPos *= Quaternion.Inverse(axRot);
@@ -3168,7 +3230,14 @@ namespace OpenSim.Region.Framework.Scenes
3168 } 3230 }
3169 } 3231 }
3170 } 3232 }
3171 3233 foreach (SceneObjectPart childpart in Children.Values)
3234 {
3235 if (childpart != m_rootPart)
3236 {
3237 childpart.IgnoreUndoUpdate = false;
3238 childpart.StoreUndoState();
3239 }
3240 }
3172 m_rootPart.ScheduleTerseUpdate(); 3241 m_rootPart.ScheduleTerseUpdate();
3173 } 3242 }
3174 3243