aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorMelanie2010-03-03 02:07:03 +0000
committerMelanie2010-03-03 02:07:03 +0000
commit028a87fe37002e7a0611f66babf1deee46c83804 (patch)
tree387aec499fd60c2012bed8148e6a2ddc847c3d95 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
parentRevert "test" (diff)
parentFixes Region.Framework tests. Although these tests don't fail, they need to b... (diff)
downloadopensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.zip
opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.gz
opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.bz2
opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.xz
Merge branch 'master' into careminster-presence-refactor
This brings careminster on the level of master. To be tested
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs183
1 files changed, 134 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4676a30..2a4e5a2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -369,14 +369,22 @@ namespace OpenSim.Region.Framework.Scenes
369 } 369 }
370 370
371 lockPartsForRead(true); 371 lockPartsForRead(true);
372
373 if (RootPart.GetStatusSandbox())
372 { 374 {
373 foreach (SceneObjectPart part in m_parts.Values) 375 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
374 { 376 {
375 377 RootPart.ScriptSetPhysicsStatus(false);
376 part.GroupPosition = val; 378 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
377 379 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
380 lockPartsForRead(false);
381 return;
378 } 382 }
379 } 383 }
384
385 foreach (SceneObjectPart part in m_parts.Values)
386 part.GroupPosition = val;
387
380 lockPartsForRead(false); 388 lockPartsForRead(false);
381 389
382 //if (m_rootPart.PhysActor != null) 390 //if (m_rootPart.PhysActor != null)
@@ -470,6 +478,34 @@ namespace OpenSim.Region.Framework.Scenes
470 } 478 }
471 } 479 }
472 480
481 private SceneObjectPart m_PlaySoundMasterPrim = null;
482 public SceneObjectPart PlaySoundMasterPrim
483 {
484 get { return m_PlaySoundMasterPrim; }
485 set { m_PlaySoundMasterPrim = value; }
486 }
487
488 private List<SceneObjectPart> m_PlaySoundSlavePrims = new List<SceneObjectPart>();
489 public List<SceneObjectPart> PlaySoundSlavePrims
490 {
491 get { return m_LoopSoundSlavePrims; }
492 set { m_LoopSoundSlavePrims = value; }
493 }
494
495 private SceneObjectPart m_LoopSoundMasterPrim = null;
496 public SceneObjectPart LoopSoundMasterPrim
497 {
498 get { return m_LoopSoundMasterPrim; }
499 set { m_LoopSoundMasterPrim = value; }
500 }
501
502 private List<SceneObjectPart> m_LoopSoundSlavePrims = new List<SceneObjectPart>();
503 public List<SceneObjectPart> LoopSoundSlavePrims
504 {
505 get { return m_LoopSoundSlavePrims; }
506 set { m_LoopSoundSlavePrims = value; }
507 }
508
473 // The UUID for the Region this Object is in. 509 // The UUID for the Region this Object is in.
474 public UUID RegionUUID 510 public UUID RegionUUID
475 { 511 {
@@ -584,7 +620,7 @@ namespace OpenSim.Region.Framework.Scenes
584 620
585 if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0) 621 if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0)
586 m_rootPart.ParentID = 0; 622 m_rootPart.ParentID = 0;
587 if (m_rootPart.LocalId==0) 623 if (m_rootPart.LocalId == 0)
588 m_rootPart.LocalId = m_scene.AllocateLocalId(); 624 m_rootPart.LocalId = m_scene.AllocateLocalId();
589 625
590 // No need to lock here since the object isn't yet in a scene 626 // No need to lock here since the object isn't yet in a scene
@@ -1586,6 +1622,9 @@ namespace OpenSim.Region.Framework.Scenes
1586 /// <param name="part"></param> 1622 /// <param name="part"></param>
1587 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) 1623 internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags)
1588 { 1624 {
1625// m_log.DebugFormat(
1626// "[SOG]: Sendinging part full update to {0} for {1} {2}", remoteClient.Name, part.Name, part.LocalId);
1627
1589 if (m_rootPart.UUID == part.UUID) 1628 if (m_rootPart.UUID == part.UUID)
1590 { 1629 {
1591 if (IsAttachment) 1630 if (IsAttachment)
@@ -1898,33 +1937,6 @@ namespace OpenSim.Region.Framework.Scenes
1898 } 1937 }
1899 } 1938 }
1900 1939
1901 public void rotLookAt(Quaternion target, float strength, float damping)
1902 {
1903 SceneObjectPart rootpart = m_rootPart;
1904 if (rootpart != null)
1905 {
1906 if (IsAttachment)
1907 {
1908 /*
1909 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
1910 if (avatar != null)
1911 {
1912 Rotate the Av?
1913 } */
1914 }
1915 else
1916 {
1917 if (rootpart.PhysActor != null)
1918 {
1919 rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W);
1920 rootpart.PhysActor.APIDStrength = strength;
1921 rootpart.PhysActor.APIDDamping = damping;
1922 rootpart.PhysActor.APIDActive = true;
1923 }
1924 }
1925 }
1926 }
1927
1928 public void stopLookAt() 1940 public void stopLookAt()
1929 { 1941 {
1930 SceneObjectPart rootpart = m_rootPart; 1942 SceneObjectPart rootpart = m_rootPart;
@@ -2084,7 +2096,9 @@ namespace OpenSim.Region.Framework.Scenes
2084 2096
2085 foreach (SceneObjectPart part in m_parts.Values) 2097 foreach (SceneObjectPart part in m_parts.Values)
2086 { 2098 {
2087 2099 if (!IsSelected)
2100 part.UpdateLookAt();
2101
2088 part.SendScheduledUpdates(); 2102 part.SendScheduledUpdates();
2089 2103
2090 } 2104 }
@@ -2434,7 +2448,6 @@ namespace OpenSim.Region.Framework.Scenes
2434 2448
2435 AttachToBackup(); 2449 AttachToBackup();
2436 2450
2437
2438 // Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the 2451 // Here's the deal, this is ABSOLUTELY CRITICAL so the physics scene gets the update about the
2439 // position of linkset prims. IF YOU CHANGE THIS, YOU MUST TEST colliding with just linked and 2452 // position of linkset prims. IF YOU CHANGE THIS, YOU MUST TEST colliding with just linked and
2440 // unmoved prims! 2453 // unmoved prims!
@@ -2449,9 +2462,10 @@ namespace OpenSim.Region.Framework.Scenes
2449 /// an independent SceneObjectGroup. 2462 /// an independent SceneObjectGroup.
2450 /// </summary> 2463 /// </summary>
2451 /// <param name="partID"></param> 2464 /// <param name="partID"></param>
2452 public void DelinkFromGroup(uint partID) 2465 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
2466 public SceneObjectGroup DelinkFromGroup(uint partID)
2453 { 2467 {
2454 DelinkFromGroup(partID, true); 2468 return DelinkFromGroup(partID, true);
2455 } 2469 }
2456 2470
2457 /// <summary> 2471 /// <summary>
@@ -2460,28 +2474,39 @@ namespace OpenSim.Region.Framework.Scenes
2460 /// </summary> 2474 /// </summary>
2461 /// <param name="partID"></param> 2475 /// <param name="partID"></param>
2462 /// <param name="sendEvents"></param> 2476 /// <param name="sendEvents"></param>
2463 public void DelinkFromGroup(uint partID, bool sendEvents) 2477 /// <returns>The object group of the newly delinked prim. Null if part could not be found</returns>
2478 public SceneObjectGroup DelinkFromGroup(uint partID, bool sendEvents)
2464 { 2479 {
2465 SceneObjectPart linkPart = GetChildPart(partID); 2480 SceneObjectPart linkPart = GetChildPart(partID);
2466 2481
2467 if (linkPart != null) 2482 if (linkPart != null)
2468 { 2483 {
2469 DelinkFromGroup(linkPart, sendEvents); 2484 return DelinkFromGroup(linkPart, sendEvents);
2470 } 2485 }
2471 else 2486 else
2472 { 2487 {
2473 m_log.InfoFormat("[SCENE OBJECT GROUP]: " + 2488 m_log.WarnFormat("[SCENE OBJECT GROUP]: " +
2474 "DelinkFromGroup(): Child prim {0} not found in object {1}, {2}", 2489 "DelinkFromGroup(): Child prim {0} not found in object {1}, {2}",
2475 partID, LocalId, UUID); 2490 partID, LocalId, UUID);
2491
2492 return null;
2476 } 2493 }
2477 } 2494 }
2478 2495
2479 public void DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents) 2496 /// <summary>
2497 /// Delink the given prim from this group. The delinked prim is established as
2498 /// an independent SceneObjectGroup.
2499 /// </summary>
2500 /// <param name="partID"></param>
2501 /// <param name="sendEvents"></param>
2502 /// <returns>The object group of the newly delinked prim.</returns>
2503 public SceneObjectGroup DelinkFromGroup(SceneObjectPart linkPart, bool sendEvents)
2480 { 2504 {
2481 linkPart.ClearUndoState();
2482// m_log.DebugFormat( 2505// m_log.DebugFormat(
2483// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", 2506// "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}",
2484// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); 2507// linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID);
2508
2509 linkPart.ClearUndoState();
2485 2510
2486 Quaternion worldRot = linkPart.GetWorldRotation(); 2511 Quaternion worldRot = linkPart.GetWorldRotation();
2487 2512
@@ -2536,6 +2561,8 @@ namespace OpenSim.Region.Framework.Scenes
2536 2561
2537 //HasGroupChanged = true; 2562 //HasGroupChanged = true;
2538 //ScheduleGroupForFullUpdate(); 2563 //ScheduleGroupForFullUpdate();
2564
2565 return objectGroup;
2539 } 2566 }
2540 2567
2541 /// <summary> 2568 /// <summary>
@@ -2574,7 +2601,6 @@ namespace OpenSim.Region.Framework.Scenes
2574 2601
2575 part.LinkNum = linkNum; 2602 part.LinkNum = linkNum;
2576 2603
2577
2578 part.OffsetPosition = part.GroupPosition - AbsolutePosition; 2604 part.OffsetPosition = part.GroupPosition - AbsolutePosition;
2579 2605
2580 Quaternion rootRotation = m_rootPart.RotationOffset; 2606 Quaternion rootRotation = m_rootPart.RotationOffset;
@@ -2604,11 +2630,14 @@ namespace OpenSim.Region.Framework.Scenes
2604 { 2630 {
2605 if (m_rootPart.PhysActor.IsPhysical) 2631 if (m_rootPart.PhysActor.IsPhysical)
2606 { 2632 {
2607 Vector3 llmoveforce = pos - AbsolutePosition; 2633 if (!m_rootPart.BlockGrab)
2608 Vector3 grabforce = llmoveforce; 2634 {
2609 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass; 2635 Vector3 llmoveforce = pos - AbsolutePosition;
2610 m_rootPart.PhysActor.AddForce(grabforce,true); 2636 Vector3 grabforce = llmoveforce;
2611 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 2637 grabforce = (grabforce / 10) * m_rootPart.PhysActor.Mass;
2638 m_rootPart.PhysActor.AddForce(grabforce, true);
2639 m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
2640 }
2612 } 2641 }
2613 else 2642 else
2614 { 2643 {
@@ -2966,6 +2995,7 @@ namespace OpenSim.Region.Framework.Scenes
2966 SceneObjectPart part = GetChildPart(localID); 2995 SceneObjectPart part = GetChildPart(localID);
2967 if (part != null) 2996 if (part != null)
2968 { 2997 {
2998 part.IgnoreUndoUpdate = true;
2969 if (scale.X > m_scene.m_maxNonphys) 2999 if (scale.X > m_scene.m_maxNonphys)
2970 scale.X = m_scene.m_maxNonphys; 3000 scale.X = m_scene.m_maxNonphys;
2971 if (scale.Y > m_scene.m_maxNonphys) 3001 if (scale.Y > m_scene.m_maxNonphys)
@@ -2993,6 +3023,7 @@ namespace OpenSim.Region.Framework.Scenes
2993 if (obPart.UUID != m_rootPart.UUID) 3023 if (obPart.UUID != m_rootPart.UUID)
2994 { 3024 {
2995 Vector3 oldSize = new Vector3(obPart.Scale); 3025 Vector3 oldSize = new Vector3(obPart.Scale);
3026 obPart.IgnoreUndoUpdate = true;
2996 3027
2997 float f = 1.0f; 3028 float f = 1.0f;
2998 float a = 1.0f; 3029 float a = 1.0f;
@@ -3050,6 +3081,8 @@ namespace OpenSim.Region.Framework.Scenes
3050 y *= a; 3081 y *= a;
3051 z *= a; 3082 z *= a;
3052 } 3083 }
3084 obPart.IgnoreUndoUpdate = false;
3085 obPart.StoreUndoState();
3053 } 3086 }
3054 } 3087 }
3055 } 3088 }
@@ -3066,6 +3099,7 @@ namespace OpenSim.Region.Framework.Scenes
3066 { 3099 {
3067 foreach (SceneObjectPart obPart in m_parts.Values) 3100 foreach (SceneObjectPart obPart in m_parts.Values)
3068 { 3101 {
3102 obPart.IgnoreUndoUpdate = true;
3069 if (obPart.UUID != m_rootPart.UUID) 3103 if (obPart.UUID != m_rootPart.UUID)
3070 { 3104 {
3071 Vector3 currentpos = new Vector3(obPart.OffsetPosition); 3105 Vector3 currentpos = new Vector3(obPart.OffsetPosition);
@@ -3079,6 +3113,8 @@ namespace OpenSim.Region.Framework.Scenes
3079 obPart.Resize(newSize); 3113 obPart.Resize(newSize);
3080 obPart.UpdateOffSet(currentpos); 3114 obPart.UpdateOffSet(currentpos);
3081 } 3115 }
3116 obPart.IgnoreUndoUpdate = false;
3117 obPart.StoreUndoState();
3082 } 3118 }
3083 } 3119 }
3084 lockPartsForRead(false); 3120 lockPartsForRead(false);
@@ -3089,6 +3125,8 @@ namespace OpenSim.Region.Framework.Scenes
3089 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); 3125 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
3090 } 3126 }
3091 3127
3128 part.IgnoreUndoUpdate = false;
3129 part.StoreUndoState();
3092 HasGroupChanged = true; 3130 HasGroupChanged = true;
3093 ScheduleGroupForTerseUpdate(); 3131 ScheduleGroupForTerseUpdate();
3094 } 3132 }
@@ -3104,13 +3142,26 @@ namespace OpenSim.Region.Framework.Scenes
3104 /// <param name="pos"></param> 3142 /// <param name="pos"></param>
3105 public void UpdateGroupPosition(Vector3 pos) 3143 public void UpdateGroupPosition(Vector3 pos)
3106 { 3144 {
3145 foreach (SceneObjectPart part in Children.Values)
3146 {
3147 part.StoreUndoState();
3148 }
3107 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 3149 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
3108 { 3150 {
3109 if (IsAttachment) 3151 if (IsAttachment)
3110 { 3152 {
3111 m_rootPart.AttachedPos = pos; 3153 m_rootPart.AttachedPos = pos;
3112 } 3154 }
3113 3155 if (RootPart.GetStatusSandbox())
3156 {
3157 if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10)
3158 {
3159 RootPart.ScriptSetPhysicsStatus(false);
3160 pos = AbsolutePosition;
3161 Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
3162 ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
3163 }
3164 }
3114 AbsolutePosition = pos; 3165 AbsolutePosition = pos;
3115 3166
3116 HasGroupChanged = true; 3167 HasGroupChanged = true;
@@ -3129,7 +3180,10 @@ namespace OpenSim.Region.Framework.Scenes
3129 public void UpdateSinglePosition(Vector3 pos, uint localID) 3180 public void UpdateSinglePosition(Vector3 pos, uint localID)
3130 { 3181 {
3131 SceneObjectPart part = GetChildPart(localID); 3182 SceneObjectPart part = GetChildPart(localID);
3132 3183 foreach (SceneObjectPart parts in Children.Values)
3184 {
3185 parts.StoreUndoState();
3186 }
3133 if (part != null) 3187 if (part != null)
3134 { 3188 {
3135 if (part.UUID == m_rootPart.UUID) 3189 if (part.UUID == m_rootPart.UUID)
@@ -3151,6 +3205,10 @@ namespace OpenSim.Region.Framework.Scenes
3151 /// <param name="pos"></param> 3205 /// <param name="pos"></param>
3152 private void UpdateRootPosition(Vector3 pos) 3206 private void UpdateRootPosition(Vector3 pos)
3153 { 3207 {
3208 foreach (SceneObjectPart part in Children.Values)
3209 {
3210 part.StoreUndoState();
3211 }
3154 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 3212 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
3155 Vector3 oldPos = 3213 Vector3 oldPos =
3156 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, 3214 new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
@@ -3195,6 +3253,10 @@ namespace OpenSim.Region.Framework.Scenes
3195 /// <param name="rot"></param> 3253 /// <param name="rot"></param>
3196 public void UpdateGroupRotationR(Quaternion rot) 3254 public void UpdateGroupRotationR(Quaternion rot)
3197 { 3255 {
3256 foreach (SceneObjectPart parts in Children.Values)
3257 {
3258 parts.StoreUndoState();
3259 }
3198 m_rootPart.UpdateRotation(rot); 3260 m_rootPart.UpdateRotation(rot);
3199 3261
3200 PhysicsActor actor = m_rootPart.PhysActor; 3262 PhysicsActor actor = m_rootPart.PhysActor;
@@ -3215,6 +3277,10 @@ namespace OpenSim.Region.Framework.Scenes
3215 /// <param name="rot"></param> 3277 /// <param name="rot"></param>
3216 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) 3278 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
3217 { 3279 {
3280 foreach (SceneObjectPart parts in Children.Values)
3281 {
3282 parts.StoreUndoState();
3283 }
3218 m_rootPart.UpdateRotation(rot); 3284 m_rootPart.UpdateRotation(rot);
3219 3285
3220 PhysicsActor actor = m_rootPart.PhysActor; 3286 PhysicsActor actor = m_rootPart.PhysActor;
@@ -3238,6 +3304,10 @@ namespace OpenSim.Region.Framework.Scenes
3238 public void UpdateSingleRotation(Quaternion rot, uint localID) 3304 public void UpdateSingleRotation(Quaternion rot, uint localID)
3239 { 3305 {
3240 SceneObjectPart part = GetChildPart(localID); 3306 SceneObjectPart part = GetChildPart(localID);
3307 foreach (SceneObjectPart parts in Children.Values)
3308 {
3309 parts.StoreUndoState();
3310 }
3241 if (part != null) 3311 if (part != null)
3242 { 3312 {
3243 if (part.UUID == m_rootPart.UUID) 3313 if (part.UUID == m_rootPart.UUID)
@@ -3268,8 +3338,11 @@ namespace OpenSim.Region.Framework.Scenes
3268 } 3338 }
3269 else 3339 else
3270 { 3340 {
3341 part.IgnoreUndoUpdate = true;
3271 part.UpdateRotation(rot); 3342 part.UpdateRotation(rot);
3272 part.OffsetPosition = pos; 3343 part.OffsetPosition = pos;
3344 part.IgnoreUndoUpdate = false;
3345 part.StoreUndoState();
3273 } 3346 }
3274 } 3347 }
3275 } 3348 }
@@ -3283,6 +3356,7 @@ namespace OpenSim.Region.Framework.Scenes
3283 Quaternion axRot = rot; 3356 Quaternion axRot = rot;
3284 Quaternion oldParentRot = m_rootPart.RotationOffset; 3357 Quaternion oldParentRot = m_rootPart.RotationOffset;
3285 3358
3359 m_rootPart.StoreUndoState();
3286 m_rootPart.UpdateRotation(rot); 3360 m_rootPart.UpdateRotation(rot);
3287 if (m_rootPart.PhysActor != null) 3361 if (m_rootPart.PhysActor != null)
3288 { 3362 {
@@ -3296,6 +3370,7 @@ namespace OpenSim.Region.Framework.Scenes
3296 { 3370 {
3297 if (prim.UUID != m_rootPart.UUID) 3371 if (prim.UUID != m_rootPart.UUID)
3298 { 3372 {
3373 prim.IgnoreUndoUpdate = true;
3299 Vector3 axPos = prim.OffsetPosition; 3374 Vector3 axPos = prim.OffsetPosition;
3300 axPos *= oldParentRot; 3375 axPos *= oldParentRot;
3301 axPos *= Quaternion.Inverse(axRot); 3376 axPos *= Quaternion.Inverse(axRot);
@@ -3308,6 +3383,16 @@ namespace OpenSim.Region.Framework.Scenes
3308 } 3383 }
3309 } 3384 }
3310 } 3385 }
3386
3387 foreach (SceneObjectPart childpart in Children.Values)
3388 {
3389 if (childpart != m_rootPart)
3390 {
3391 childpart.IgnoreUndoUpdate = false;
3392 childpart.StoreUndoState();
3393 }
3394 }
3395
3311 lockPartsForRead(false); 3396 lockPartsForRead(false);
3312 3397
3313 m_rootPart.ScheduleTerseUpdate(); 3398 m_rootPart.ScheduleTerseUpdate();