diff options
Diffstat (limited to '')
16 files changed, 475 insertions, 373 deletions
diff --git a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs index f9c3fa6..3809749 100644 --- a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs +++ b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs | |||
@@ -73,10 +73,6 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
73 | base.UpdateMovement(); | 73 | base.UpdateMovement(); |
74 | } | 74 | } |
75 | 75 | ||
76 | public ComplexObject() | ||
77 | { | ||
78 | } | ||
79 | |||
80 | public ComplexObject(Scene scene, ulong regionHandle, UUID ownerID, uint localID, Vector3 pos) | 76 | public ComplexObject(Scene scene, ulong regionHandle, UUID ownerID, uint localID, Vector3 pos) |
81 | : base(ownerID, pos, PrimitiveBaseShape.Default) | 77 | : base(ownerID, pos, PrimitiveBaseShape.Default) |
82 | { | 78 | { |
diff --git a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs b/OpenSim/Region/Framework/Interfaces/IVoiceModule.cs index c6958de..2e555fa 100644 --- a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs +++ b/OpenSim/Region/Framework/Interfaces/IVoiceModule.cs | |||
@@ -25,39 +25,21 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using System.Text.RegularExpressions; | ||
33 | using System.Xml; | ||
34 | using System.Xml.Serialization; | ||
35 | using log4net; | ||
36 | using OpenMetaverse; | 30 | using OpenMetaverse; |
37 | using OpenSim.Data; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Servers; | ||
40 | using OpenSim.Framework.Servers.HttpServer; | ||
41 | using OpenSim.Framework.Statistics; | ||
42 | using System.Net; | ||
43 | 31 | ||
44 | namespace OpenSim.Framework.Servers | 32 | namespace OpenSim.Region.Framework.Interfaces |
45 | { | 33 | { |
46 | public class GetAssetStreamHandler : BaseGetAssetStreamHandler | 34 | public interface IVoiceModule |
47 | { | 35 | { |
48 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private readonly IAssetDataPlugin m_assetProvider; | ||
51 | |||
52 | public GetAssetStreamHandler(IAssetDataPlugin assetProvider) | ||
53 | : base("GET", "/assets") | ||
54 | { | ||
55 | m_assetProvider = assetProvider; | ||
56 | } | ||
57 | 36 | ||
58 | protected override AssetBase GetAsset(UUID assetID) | 37 | /// <summary> |
59 | { | 38 | /// Set the SIP url to be used by a parcel, this will allow manual setting of a SIP address |
60 | return m_assetProvider.GetAsset(assetID); | 39 | /// for a particular piece of land, allowing region owners to use preconfigured SIP conference channels. |
61 | } | 40 | /// This is used by osSetParcelSIPAddress |
41 | /// </summary> | ||
42 | void setLandSIPAddress(string SIPAddress,UUID GlobalID); | ||
43 | |||
62 | } | 44 | } |
63 | } | 45 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6ba7e41..3c17bbe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -250,16 +250,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
250 | /// </summary> | 250 | /// </summary> |
251 | public override Vector3 AbsolutePosition | 251 | public override Vector3 AbsolutePosition |
252 | { | 252 | { |
253 | get | 253 | get { return m_rootPart.GroupPosition; } |
254 | { | ||
255 | if (m_rootPart == null) | ||
256 | { | ||
257 | throw new NullReferenceException( | ||
258 | string.Format("[SCENE OBJECT GROUP]: Object {0} has no root part.", m_uuid)); | ||
259 | } | ||
260 | |||
261 | return m_rootPart.GroupPosition; | ||
262 | } | ||
263 | set | 254 | set |
264 | { | 255 | { |
265 | Vector3 val = value; | 256 | Vector3 val = value; |
@@ -291,41 +282,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
291 | 282 | ||
292 | public override uint LocalId | 283 | public override uint LocalId |
293 | { | 284 | { |
294 | get | 285 | get { return m_rootPart.LocalId; } |
295 | { | ||
296 | if (m_rootPart == null) | ||
297 | { | ||
298 | m_log.Error("[SCENE OBJECT GROUP]: Unable to find the rootpart for a LocalId Request!"); | ||
299 | return 0; | ||
300 | } | ||
301 | |||
302 | return m_rootPart.LocalId; | ||
303 | } | ||
304 | set { m_rootPart.LocalId = value; } | 286 | set { m_rootPart.LocalId = value; } |
305 | } | 287 | } |
306 | 288 | ||
307 | public override UUID UUID | 289 | public override UUID UUID |
308 | { | 290 | { |
309 | get { | 291 | get { return m_rootPart.UUID; } |
310 | if (m_rootPart == null) | ||
311 | { | ||
312 | m_log.Error("Got a null rootpart while requesting UUID. Called from: ", new Exception()); | ||
313 | return UUID.Zero; | ||
314 | } | ||
315 | else return m_rootPart.UUID; | ||
316 | } | ||
317 | set { m_rootPart.UUID = value; } | 292 | set { m_rootPart.UUID = value; } |
318 | } | 293 | } |
319 | 294 | ||
320 | public UUID OwnerID | 295 | public UUID OwnerID |
321 | { | 296 | { |
322 | get | 297 | get { return m_rootPart.OwnerID; } |
323 | { | ||
324 | if (m_rootPart == null) | ||
325 | return UUID.Zero; | ||
326 | |||
327 | return m_rootPart.OwnerID; | ||
328 | } | ||
329 | set { m_rootPart.OwnerID = value; } | 298 | set { m_rootPart.OwnerID = value; } |
330 | } | 299 | } |
331 | 300 | ||
@@ -366,7 +335,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
366 | { | 335 | { |
367 | m_isSelected = value; | 336 | m_isSelected = value; |
368 | // Tell physics engine that group is selected | 337 | // Tell physics engine that group is selected |
369 | if (m_rootPart != null && m_rootPart.PhysActor != null) | 338 | if (m_rootPart.PhysActor != null) |
370 | { | 339 | { |
371 | m_rootPart.PhysActor.Selected = value; | 340 | m_rootPart.PhysActor.Selected = value; |
372 | // Pass it on to the children. | 341 | // Pass it on to the children. |
@@ -399,13 +368,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
399 | #region Constructors | 368 | #region Constructors |
400 | 369 | ||
401 | /// <summary> | 370 | /// <summary> |
402 | /// Constructor | ||
403 | /// </summary> | ||
404 | public SceneObjectGroup() | ||
405 | { | ||
406 | } | ||
407 | |||
408 | /// <summary> | ||
409 | /// This constructor creates a SceneObjectGroup using a pre-existing SceneObjectPart. | 371 | /// This constructor creates a SceneObjectGroup using a pre-existing SceneObjectPart. |
410 | /// The original SceneObjectPart will be used rather than a copy, preserving | 372 | /// The original SceneObjectPart will be used rather than a copy, preserving |
411 | /// its existing localID and UUID. | 373 | /// its existing localID and UUID. |
@@ -419,9 +381,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
419 | /// Constructor. This object is added to the scene later via AttachToScene() | 381 | /// Constructor. This object is added to the scene later via AttachToScene() |
420 | /// </summary> | 382 | /// </summary> |
421 | public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) | 383 | public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) |
422 | { | 384 | { |
423 | Vector3 rootOffset = new Vector3(0, 0, 0); | 385 | SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, Vector3.Zero)); |
424 | SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, rootOffset)); | ||
425 | } | 386 | } |
426 | 387 | ||
427 | /// <summary> | 388 | /// <summary> |
@@ -462,11 +423,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
462 | 423 | ||
463 | public UUID GetFromItemID() | 424 | public UUID GetFromItemID() |
464 | { | 425 | { |
465 | if (m_rootPart != null) | 426 | return m_rootPart.FromItemID; |
466 | { | ||
467 | return m_rootPart.FromItemID; | ||
468 | } | ||
469 | return UUID.Zero; | ||
470 | } | 427 | } |
471 | 428 | ||
472 | /// <summary> | 429 | /// <summary> |
@@ -958,11 +915,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
958 | 915 | ||
959 | public byte GetAttachmentPoint() | 916 | public byte GetAttachmentPoint() |
960 | { | 917 | { |
961 | if (m_rootPart != null) | 918 | return m_rootPart.Shape.State; |
962 | { | ||
963 | return m_rootPart.Shape.State; | ||
964 | } | ||
965 | return (byte)0; | ||
966 | } | 919 | } |
967 | 920 | ||
968 | public void ClearPartAttachmentData() | 921 | public void ClearPartAttachmentData() |
@@ -1071,7 +1024,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1071 | /// </summary> | 1024 | /// </summary> |
1072 | /// <param name="part"></param> | 1025 | /// <param name="part"></param> |
1073 | public void SetRootPart(SceneObjectPart part) | 1026 | public void SetRootPart(SceneObjectPart part) |
1074 | { | 1027 | { |
1028 | if (part == null) | ||
1029 | throw new ArgumentNullException("Cannot give SceneObjectGroup a null root SceneObjectPart"); | ||
1030 | |||
1075 | part.SetParent(this); | 1031 | part.SetParent(this); |
1076 | m_rootPart = part; | 1032 | m_rootPart = part; |
1077 | if (!IsAttachment) | 1033 | if (!IsAttachment) |
@@ -1224,7 +1180,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1224 | 1180 | ||
1225 | if (!silent) | 1181 | if (!silent) |
1226 | { | 1182 | { |
1227 | if (m_rootPart != null && part == m_rootPart) | 1183 | if (part == m_rootPart) |
1228 | avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); | 1184 | avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalId); |
1229 | } | 1185 | } |
1230 | } | 1186 | } |
@@ -1447,7 +1403,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1447 | /// <param name="part"></param> | 1403 | /// <param name="part"></param> |
1448 | internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) | 1404 | internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) |
1449 | { | 1405 | { |
1450 | if (m_rootPart != null && m_rootPart.UUID == part.UUID) | 1406 | if (m_rootPart.UUID == part.UUID) |
1451 | { | 1407 | { |
1452 | if (IsAttachment) | 1408 | if (IsAttachment) |
1453 | { | 1409 | { |
@@ -1881,12 +1837,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1881 | if (m_isDeleted) | 1837 | if (m_isDeleted) |
1882 | return; | 1838 | return; |
1883 | 1839 | ||
1884 | // This is what happens when an orphanced link set child prim's | ||
1885 | // group was queued when it was linked | ||
1886 | // | ||
1887 | if (m_rootPart == null) | ||
1888 | return; | ||
1889 | |||
1890 | // Even temporary objects take part in physics (e.g. temp-on-rez bullets) | 1840 | // Even temporary objects take part in physics (e.g. temp-on-rez bullets) |
1891 | //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) | 1841 | //if ((RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) |
1892 | // return; | 1842 | // return; |
@@ -3129,26 +3079,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3129 | int yaxis = 4; | 3079 | int yaxis = 4; |
3130 | int zaxis = 8; | 3080 | int zaxis = 8; |
3131 | 3081 | ||
3132 | if (m_rootPart != null) | 3082 | setX = ((axis & xaxis) != 0) ? true : false; |
3133 | { | 3083 | setY = ((axis & yaxis) != 0) ? true : false; |
3134 | setX = ((axis & xaxis) != 0) ? true : false; | 3084 | setZ = ((axis & zaxis) != 0) ? true : false; |
3135 | setY = ((axis & yaxis) != 0) ? true : false; | ||
3136 | setZ = ((axis & zaxis) != 0) ? true : false; | ||
3137 | 3085 | ||
3138 | float setval = (rotate10 > 0) ? 1f : 0f; | 3086 | float setval = (rotate10 > 0) ? 1f : 0f; |
3139 | 3087 | ||
3140 | if (setX) | 3088 | if (setX) |
3141 | m_rootPart.RotationAxis.X = setval; | 3089 | m_rootPart.RotationAxis.X = setval; |
3142 | if (setY) | 3090 | if (setY) |
3143 | m_rootPart.RotationAxis.Y = setval; | 3091 | m_rootPart.RotationAxis.Y = setval; |
3144 | if (setZ) | 3092 | if (setZ) |
3145 | m_rootPart.RotationAxis.Z = setval; | 3093 | m_rootPart.RotationAxis.Z = setval; |
3146 | |||
3147 | if (setX || setY || setZ) | ||
3148 | { | ||
3149 | m_rootPart.SetPhysicsAxisRotation(); | ||
3150 | } | ||
3151 | 3094 | ||
3095 | if (setX || setY || setZ) | ||
3096 | { | ||
3097 | m_rootPart.SetPhysicsAxisRotation(); | ||
3152 | } | 3098 | } |
3153 | } | 3099 | } |
3154 | 3100 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b0d279c..51bb114 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -415,9 +415,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
415 | set | 415 | set |
416 | { | 416 | { |
417 | m_name = value; | 417 | m_name = value; |
418 | if (PhysActor != null) | 418 | PhysicsActor pa = PhysActor; |
419 | if (pa != null) | ||
419 | { | 420 | { |
420 | PhysActor.SOPName = value; | 421 | pa.SOPName = value; |
421 | } | 422 | } |
422 | } | 423 | } |
423 | } | 424 | } |
@@ -427,10 +428,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
427 | get { return (byte) m_material; } | 428 | get { return (byte) m_material; } |
428 | set | 429 | set |
429 | { | 430 | { |
431 | PhysicsActor pa = PhysActor; | ||
430 | m_material = (Material)value; | 432 | m_material = (Material)value; |
431 | if (PhysActor != null) | 433 | if (pa != null) |
432 | { | 434 | { |
433 | PhysActor.SetMaterial((int)value); | 435 | pa.SetMaterial((int)value); |
434 | } | 436 | } |
435 | } | 437 | } |
436 | } | 438 | } |
@@ -501,11 +503,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
501 | get | 503 | get |
502 | { | 504 | { |
503 | // If this is a linkset, we don't want the physics engine mucking up our group position here. | 505 | // If this is a linkset, we don't want the physics engine mucking up our group position here. |
504 | if (PhysActor != null && _parentID == 0) | 506 | PhysicsActor pa = PhysActor; |
507 | if (pa != null && _parentID == 0) | ||
505 | { | 508 | { |
506 | m_groupPosition.X = PhysActor.Position.X; | 509 | m_groupPosition.X = pa.Position.X; |
507 | m_groupPosition.Y = PhysActor.Position.Y; | 510 | m_groupPosition.Y = pa.Position.Y; |
508 | m_groupPosition.Z = PhysActor.Position.Z; | 511 | m_groupPosition.Z = pa.Position.Z; |
509 | } | 512 | } |
510 | 513 | ||
511 | if (IsAttachment) | 514 | if (IsAttachment) |
@@ -525,26 +528,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
525 | 528 | ||
526 | m_groupPosition = value; | 529 | m_groupPosition = value; |
527 | 530 | ||
528 | if (PhysActor != null) | 531 | PhysicsActor pa = PhysActor; |
532 | if (pa != null) | ||
529 | { | 533 | { |
530 | try | 534 | try |
531 | { | 535 | { |
532 | // Root prim actually goes at Position | 536 | // Root prim actually goes at Position |
533 | if (_parentID == 0) | 537 | if (_parentID == 0) |
534 | { | 538 | { |
535 | PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); | 539 | pa.Position = new PhysicsVector(value.X, value.Y, value.Z); |
536 | } | 540 | } |
537 | else | 541 | else |
538 | { | 542 | { |
539 | // To move the child prim in respect to the group position and rotation we have to calculate | 543 | // To move the child prim in respect to the group position and rotation we have to calculate |
540 | Vector3 resultingposition = GetWorldPosition(); | 544 | Vector3 resultingposition = GetWorldPosition(); |
541 | PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); | 545 | pa.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); |
542 | Quaternion resultingrot = GetWorldRotation(); | 546 | Quaternion resultingrot = GetWorldRotation(); |
543 | PhysActor.Orientation = resultingrot; | 547 | pa.Orientation = resultingrot; |
544 | } | 548 | } |
545 | 549 | ||
546 | // Tell the physics engines that this prim changed. | 550 | // Tell the physics engines that this prim changed. |
547 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 551 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
548 | } | 552 | } |
549 | catch (Exception e) | 553 | catch (Exception e) |
550 | { | 554 | { |
@@ -577,15 +581,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
577 | 581 | ||
578 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 582 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
579 | { | 583 | { |
580 | if (_parentID != 0 && PhysActor != null) | 584 | PhysicsActor pa = PhysActor; |
585 | if (_parentID != 0 && pa != null) | ||
581 | { | 586 | { |
582 | Vector3 resultingposition = GetWorldPosition(); | 587 | Vector3 resultingposition = GetWorldPosition(); |
583 | PhysActor.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); | 588 | pa.Position = new PhysicsVector(resultingposition.X, resultingposition.Y, resultingposition.Z); |
584 | Quaternion resultingrot = GetWorldRotation(); | 589 | Quaternion resultingrot = GetWorldRotation(); |
585 | PhysActor.Orientation = resultingrot; | 590 | pa.Orientation = resultingrot; |
586 | 591 | ||
587 | // Tell the physics engines that this prim changed. | 592 | // Tell the physics engines that this prim changed. |
588 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 593 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
589 | } | 594 | } |
590 | } | 595 | } |
591 | } | 596 | } |
@@ -595,13 +600,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
595 | { | 600 | { |
596 | get | 601 | get |
597 | { | 602 | { |
603 | PhysicsActor pa = PhysActor; | ||
598 | // We don't want the physics engine mucking up the rotations in a linkset | 604 | // We don't want the physics engine mucking up the rotations in a linkset |
599 | if ((_parentID == 0) && (Shape.PCode != 9 || Shape.State == 0) && (PhysActor != null)) | 605 | if ((_parentID == 0) && (Shape.PCode != 9 || Shape.State == 0) && (pa != null)) |
600 | { | 606 | { |
601 | if (PhysActor.Orientation.X != 0 || PhysActor.Orientation.Y != 0 | 607 | if (pa.Orientation.X != 0 || pa.Orientation.Y != 0 |
602 | || PhysActor.Orientation.Z != 0 || PhysActor.Orientation.W != 0) | 608 | || pa.Orientation.Z != 0 || pa.Orientation.W != 0) |
603 | { | 609 | { |
604 | m_rotationOffset = PhysActor.Orientation; | 610 | m_rotationOffset = pa.Orientation; |
605 | } | 611 | } |
606 | } | 612 | } |
607 | 613 | ||
@@ -610,27 +616,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
610 | 616 | ||
611 | set | 617 | set |
612 | { | 618 | { |
619 | PhysicsActor pa = PhysActor; | ||
613 | StoreUndoState(); | 620 | StoreUndoState(); |
614 | m_rotationOffset = value; | 621 | m_rotationOffset = value; |
615 | 622 | ||
616 | if (PhysActor != null) | 623 | if (pa != null) |
617 | { | 624 | { |
618 | try | 625 | try |
619 | { | 626 | { |
620 | // Root prim gets value directly | 627 | // Root prim gets value directly |
621 | if (_parentID == 0) | 628 | if (_parentID == 0) |
622 | { | 629 | { |
623 | PhysActor.Orientation = value; | 630 | pa.Orientation = value; |
624 | //m_log.Info("[PART]: RO1:" + PhysActor.Orientation.ToString()); | 631 | //m_log.Info("[PART]: RO1:" + PhysActor.Orientation.ToString()); |
625 | } | 632 | } |
626 | else | 633 | else |
627 | { | 634 | { |
628 | // Child prim we have to calculate it's world rotationwel | 635 | // Child prim we have to calculate it's world rotationwel |
629 | Quaternion resultingrotation = GetWorldRotation(); | 636 | Quaternion resultingrotation = GetWorldRotation(); |
630 | PhysActor.Orientation = resultingrotation; | 637 | pa.Orientation = resultingrotation; |
631 | //m_log.Info("[PART]: RO2:" + PhysActor.Orientation.ToString()); | 638 | //m_log.Info("[PART]: RO2:" + PhysActor.Orientation.ToString()); |
632 | } | 639 | } |
633 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 640 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
634 | //} | 641 | //} |
635 | } | 642 | } |
636 | catch (Exception ex) | 643 | catch (Exception ex) |
@@ -650,13 +657,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
650 | //if (PhysActor.Velocity.X != 0 || PhysActor.Velocity.Y != 0 | 657 | //if (PhysActor.Velocity.X != 0 || PhysActor.Velocity.Y != 0 |
651 | //|| PhysActor.Velocity.Z != 0) | 658 | //|| PhysActor.Velocity.Z != 0) |
652 | //{ | 659 | //{ |
653 | if (PhysActor != null) | 660 | PhysicsActor pa = PhysActor; |
661 | if (pa != null) | ||
654 | { | 662 | { |
655 | if (PhysActor.IsPhysical) | 663 | if (pa.IsPhysical) |
656 | { | 664 | { |
657 | m_velocity.X = PhysActor.Velocity.X; | 665 | m_velocity.X = pa.Velocity.X; |
658 | m_velocity.Y = PhysActor.Velocity.Y; | 666 | m_velocity.Y = pa.Velocity.Y; |
659 | m_velocity.Z = PhysActor.Velocity.Z; | 667 | m_velocity.Z = pa.Velocity.Z; |
660 | } | 668 | } |
661 | } | 669 | } |
662 | 670 | ||
@@ -666,12 +674,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
666 | set | 674 | set |
667 | { | 675 | { |
668 | m_velocity = value; | 676 | m_velocity = value; |
669 | if (PhysActor != null) | 677 | PhysicsActor pa = PhysActor; |
678 | if (pa != null) | ||
670 | { | 679 | { |
671 | if (PhysActor.IsPhysical) | 680 | if (pa.IsPhysical) |
672 | { | 681 | { |
673 | PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); | 682 | pa.Velocity = new PhysicsVector(value.X, value.Y, value.Z); |
674 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 683 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
675 | } | 684 | } |
676 | } | 685 | } |
677 | } | 686 | } |
@@ -688,9 +697,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
688 | { | 697 | { |
689 | get | 698 | get |
690 | { | 699 | { |
691 | if ((PhysActor != null) && PhysActor.IsPhysical) | 700 | PhysicsActor pa = PhysActor; |
701 | if ((pa != null) && pa.IsPhysical) | ||
692 | { | 702 | { |
693 | m_angularVelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(), 0); | 703 | m_angularVelocity.FromBytes(pa.RotationalVelocity.GetBytes(), 0); |
694 | } | 704 | } |
695 | return m_angularVelocity; | 705 | return m_angularVelocity; |
696 | } | 706 | } |
@@ -709,10 +719,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
709 | get { return m_description; } | 719 | get { return m_description; } |
710 | set | 720 | set |
711 | { | 721 | { |
722 | PhysicsActor pa = PhysActor; | ||
712 | m_description = value; | 723 | m_description = value; |
713 | if (PhysActor != null) | 724 | if (pa != null) |
714 | { | 725 | { |
715 | PhysActor.SOPDescription = value; | 726 | pa.SOPDescription = value; |
716 | } | 727 | } |
717 | } | 728 | } |
718 | } | 729 | } |
@@ -806,14 +817,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
806 | if (m_shape != null) { | 817 | if (m_shape != null) { |
807 | m_shape.Scale = value; | 818 | m_shape.Scale = value; |
808 | 819 | ||
809 | if (PhysActor != null && m_parentGroup != null) | 820 | PhysicsActor pa = PhysActor; |
821 | if (pa != null && m_parentGroup != null) | ||
810 | { | 822 | { |
811 | if (m_parentGroup.Scene != null) | 823 | if (m_parentGroup.Scene != null) |
812 | { | 824 | { |
813 | if (m_parentGroup.Scene.PhysicsScene != null) | 825 | if (m_parentGroup.Scene.PhysicsScene != null) |
814 | { | 826 | { |
815 | PhysActor.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z); | 827 | pa.Size = new PhysicsVector(m_shape.Scale.X, m_shape.Scale.Y, m_shape.Scale.Z); |
816 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 828 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
817 | } | 829 | } |
818 | } | 830 | } |
819 | } | 831 | } |
@@ -1343,13 +1355,14 @@ if (m_shape != null) { | |||
1343 | RigidBody); | 1355 | RigidBody); |
1344 | 1356 | ||
1345 | // Basic Physics returns null.. joy joy joy. | 1357 | // Basic Physics returns null.. joy joy joy. |
1346 | if (PhysActor != null) | 1358 | PhysicsActor pa = PhysActor; |
1359 | if (pa != null) | ||
1347 | { | 1360 | { |
1348 | PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info | 1361 | pa.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info |
1349 | PhysActor.SOPDescription = this.Description; | 1362 | pa.SOPDescription = this.Description; |
1350 | PhysActor.LocalID = LocalId; | 1363 | pa.LocalID = LocalId; |
1351 | DoPhysicsPropertyUpdate(RigidBody, true); | 1364 | DoPhysicsPropertyUpdate(RigidBody, true); |
1352 | PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); | 1365 | pa.SetVolumeDetect(VolumeDetectActive ? 1 : 0); |
1353 | } | 1366 | } |
1354 | } | 1367 | } |
1355 | } | 1368 | } |
@@ -1563,23 +1576,24 @@ if (m_shape != null) { | |||
1563 | } | 1576 | } |
1564 | else | 1577 | else |
1565 | { | 1578 | { |
1566 | if (PhysActor != null) | 1579 | PhysicsActor pa = PhysActor; |
1580 | if (pa != null) | ||
1567 | { | 1581 | { |
1568 | if (UsePhysics != PhysActor.IsPhysical || isNew) | 1582 | if (UsePhysics != pa.IsPhysical || isNew) |
1569 | { | 1583 | { |
1570 | if (PhysActor.IsPhysical) // implies UsePhysics==false for this block | 1584 | if (pa.IsPhysical) // implies UsePhysics==false for this block |
1571 | { | 1585 | { |
1572 | if (!isNew) | 1586 | if (!isNew) |
1573 | ParentGroup.Scene.RemovePhysicalPrim(1); | 1587 | ParentGroup.Scene.RemovePhysicalPrim(1); |
1574 | 1588 | ||
1575 | PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; | 1589 | pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; |
1576 | PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; | 1590 | pa.OnOutOfBounds -= PhysicsOutOfBounds; |
1577 | PhysActor.delink(); | 1591 | pa.delink(); |
1578 | 1592 | ||
1579 | if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints && (!isNew)) | 1593 | if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints && (!isNew)) |
1580 | { | 1594 | { |
1581 | // destroy all joints connected to this now deactivated body | 1595 | // destroy all joints connected to this now deactivated body |
1582 | m_parentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(PhysActor); | 1596 | m_parentGroup.Scene.PhysicsScene.RemoveAllJointsConnectedToActorThreadLocked(pa); |
1583 | } | 1597 | } |
1584 | 1598 | ||
1585 | // stop client-side interpolation of all joint proxy objects that have just been deleted | 1599 | // stop client-side interpolation of all joint proxy objects that have just been deleted |
@@ -1598,7 +1612,7 @@ if (m_shape != null) { | |||
1598 | //RotationalVelocity = new Vector3(0, 0, 0); | 1612 | //RotationalVelocity = new Vector3(0, 0, 0); |
1599 | } | 1613 | } |
1600 | 1614 | ||
1601 | PhysActor.IsPhysical = UsePhysics; | 1615 | pa.IsPhysical = UsePhysics; |
1602 | 1616 | ||
1603 | 1617 | ||
1604 | // If we're not what we're supposed to be in the physics scene, recreate ourselves. | 1618 | // If we're not what we're supposed to be in the physics scene, recreate ourselves. |
@@ -1612,19 +1626,19 @@ if (m_shape != null) { | |||
1612 | { | 1626 | { |
1613 | ParentGroup.Scene.AddPhysicalPrim(1); | 1627 | ParentGroup.Scene.AddPhysicalPrim(1); |
1614 | 1628 | ||
1615 | PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; | 1629 | pa.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; |
1616 | PhysActor.OnOutOfBounds += PhysicsOutOfBounds; | 1630 | pa.OnOutOfBounds += PhysicsOutOfBounds; |
1617 | if (_parentID != 0 && _parentID != LocalId) | 1631 | if (_parentID != 0 && _parentID != LocalId) |
1618 | { | 1632 | { |
1619 | if (ParentGroup.RootPart.PhysActor != null) | 1633 | if (ParentGroup.RootPart.PhysActor != null) |
1620 | { | 1634 | { |
1621 | PhysActor.link(ParentGroup.RootPart.PhysActor); | 1635 | pa.link(ParentGroup.RootPart.PhysActor); |
1622 | } | 1636 | } |
1623 | } | 1637 | } |
1624 | } | 1638 | } |
1625 | } | 1639 | } |
1626 | } | 1640 | } |
1627 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 1641 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
1628 | } | 1642 | } |
1629 | } | 1643 | } |
1630 | } | 1644 | } |
@@ -1690,9 +1704,10 @@ if (m_shape != null) { | |||
1690 | 1704 | ||
1691 | public Vector3 GetGeometricCenter() | 1705 | public Vector3 GetGeometricCenter() |
1692 | { | 1706 | { |
1693 | if (PhysActor != null) | 1707 | PhysicsActor pa = PhysActor; |
1708 | if (pa != null) | ||
1694 | { | 1709 | { |
1695 | return new Vector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z); | 1710 | return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); |
1696 | } | 1711 | } |
1697 | else | 1712 | else |
1698 | { | 1713 | { |
@@ -1702,9 +1717,10 @@ if (m_shape != null) { | |||
1702 | 1717 | ||
1703 | public float GetMass() | 1718 | public float GetMass() |
1704 | { | 1719 | { |
1705 | if (PhysActor != null) | 1720 | PhysicsActor pa = PhysActor; |
1721 | if (pa != null) | ||
1706 | { | 1722 | { |
1707 | return PhysActor.Mass; | 1723 | return pa.Mass; |
1708 | } | 1724 | } |
1709 | else | 1725 | else |
1710 | { | 1726 | { |
@@ -1714,8 +1730,9 @@ if (m_shape != null) { | |||
1714 | 1730 | ||
1715 | public PhysicsVector GetForce() | 1731 | public PhysicsVector GetForce() |
1716 | { | 1732 | { |
1717 | if (PhysActor != null) | 1733 | PhysicsActor pa = PhysActor; |
1718 | return PhysActor.Force; | 1734 | if (pa != null) |
1735 | return pa.Force; | ||
1719 | else | 1736 | else |
1720 | return new PhysicsVector(); | 1737 | return new PhysicsVector(); |
1721 | } | 1738 | } |
@@ -2094,11 +2111,15 @@ if (m_shape != null) { | |||
2094 | 2111 | ||
2095 | public void PhysicsRequestingTerseUpdate() | 2112 | public void PhysicsRequestingTerseUpdate() |
2096 | { | 2113 | { |
2097 | if (PhysActor != null) | 2114 | PhysicsActor pa = PhysActor; |
2115 | if (pa != null) | ||
2098 | { | 2116 | { |
2099 | Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); | 2117 | Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0); |
2100 | 2118 | ||
2101 | if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) | 2119 | if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | |
2120 | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | | ||
2121 | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | | ||
2122 | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) | ||
2102 | { | 2123 | { |
2103 | m_parentGroup.AbsolutePosition = newpos; | 2124 | m_parentGroup.AbsolutePosition = newpos; |
2104 | return; | 2125 | return; |
@@ -2294,14 +2315,15 @@ if (m_shape != null) { | |||
2294 | if (texture != null) | 2315 | if (texture != null) |
2295 | m_shape.SculptData = texture.Data; | 2316 | m_shape.SculptData = texture.Data; |
2296 | 2317 | ||
2297 | if (PhysActor != null) | 2318 | PhysicsActor pa = PhysActor; |
2319 | if (pa != null) | ||
2298 | { | 2320 | { |
2299 | // Tricks physics engine into thinking we've changed the part shape. | 2321 | // Tricks physics engine into thinking we've changed the part shape. |
2300 | PrimitiveBaseShape m_newshape = m_shape.Copy(); | 2322 | PrimitiveBaseShape m_newshape = m_shape.Copy(); |
2301 | PhysActor.Shape = m_newshape; | 2323 | pa.Shape = m_newshape; |
2302 | m_shape = m_newshape; | 2324 | m_shape = m_newshape; |
2303 | 2325 | ||
2304 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 2326 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
2305 | } | 2327 | } |
2306 | } | 2328 | } |
2307 | } | 2329 | } |
@@ -2520,9 +2542,10 @@ if (m_shape != null) { | |||
2520 | 2542 | ||
2521 | public void SetBuoyancy(float fvalue) | 2543 | public void SetBuoyancy(float fvalue) |
2522 | { | 2544 | { |
2523 | if (PhysActor != null) | 2545 | PhysicsActor pa = PhysActor; |
2546 | if (pa != null) | ||
2524 | { | 2547 | { |
2525 | PhysActor.Buoyancy = fvalue; | 2548 | pa.Buoyancy = fvalue; |
2526 | } | 2549 | } |
2527 | } | 2550 | } |
2528 | 2551 | ||
@@ -2538,56 +2561,62 @@ if (m_shape != null) { | |||
2538 | 2561 | ||
2539 | public void SetFloatOnWater(int floatYN) | 2562 | public void SetFloatOnWater(int floatYN) |
2540 | { | 2563 | { |
2541 | if (PhysActor != null) | 2564 | PhysicsActor pa = PhysActor; |
2565 | if (pa != null) | ||
2542 | { | 2566 | { |
2543 | if (floatYN == 1) | 2567 | if (floatYN == 1) |
2544 | { | 2568 | { |
2545 | PhysActor.FloatOnWater = true; | 2569 | pa.FloatOnWater = true; |
2546 | } | 2570 | } |
2547 | else | 2571 | else |
2548 | { | 2572 | { |
2549 | PhysActor.FloatOnWater = false; | 2573 | pa.FloatOnWater = false; |
2550 | } | 2574 | } |
2551 | } | 2575 | } |
2552 | } | 2576 | } |
2553 | 2577 | ||
2554 | public void SetForce(PhysicsVector force) | 2578 | public void SetForce(PhysicsVector force) |
2555 | { | 2579 | { |
2556 | if (PhysActor != null) | 2580 | PhysicsActor pa = PhysActor; |
2581 | if (pa != null) | ||
2557 | { | 2582 | { |
2558 | PhysActor.Force = force; | 2583 | pa.Force = force; |
2559 | } | 2584 | } |
2560 | } | 2585 | } |
2561 | 2586 | ||
2562 | public void SetVehicleType(int type) | 2587 | public void SetVehicleType(int type) |
2563 | { | 2588 | { |
2564 | if (PhysActor != null) | 2589 | PhysicsActor pa = PhysActor; |
2590 | if (pa != null) | ||
2565 | { | 2591 | { |
2566 | PhysActor.VehicleType = type; | 2592 | pa.VehicleType = type; |
2567 | } | 2593 | } |
2568 | } | 2594 | } |
2569 | 2595 | ||
2570 | public void SetVehicleFloatParam(int param, float value) | 2596 | public void SetVehicleFloatParam(int param, float value) |
2571 | { | 2597 | { |
2572 | if (PhysActor != null) | 2598 | PhysicsActor pa = PhysActor; |
2599 | if (pa != null) | ||
2573 | { | 2600 | { |
2574 | PhysActor.VehicleFloatParam(param, value); | 2601 | pa.VehicleFloatParam(param, value); |
2575 | } | 2602 | } |
2576 | } | 2603 | } |
2577 | 2604 | ||
2578 | public void SetVehicleVectorParam(int param, PhysicsVector value) | 2605 | public void SetVehicleVectorParam(int param, PhysicsVector value) |
2579 | { | 2606 | { |
2580 | if (PhysActor != null) | 2607 | PhysicsActor pa = PhysActor; |
2608 | if (pa != null) | ||
2581 | { | 2609 | { |
2582 | PhysActor.VehicleVectorParam(param, value); | 2610 | pa.VehicleVectorParam(param, value); |
2583 | } | 2611 | } |
2584 | } | 2612 | } |
2585 | 2613 | ||
2586 | public void SetVehicleRotationParam(int param, Quaternion rotation) | 2614 | public void SetVehicleRotationParam(int param, Quaternion rotation) |
2587 | { | 2615 | { |
2588 | if (PhysActor != null) | 2616 | PhysicsActor pa = PhysActor; |
2617 | if (pa != null) | ||
2589 | { | 2618 | { |
2590 | PhysActor.VehicleRotationParam(param, rotation); | 2619 | pa.VehicleRotationParam(param, rotation); |
2591 | } | 2620 | } |
2592 | } | 2621 | } |
2593 | 2622 | ||
@@ -2615,10 +2644,11 @@ if (m_shape != null) { | |||
2615 | 2644 | ||
2616 | public void SetPhysicsAxisRotation() | 2645 | public void SetPhysicsAxisRotation() |
2617 | { | 2646 | { |
2618 | if (PhysActor != null) | 2647 | PhysicsActor pa = PhysActor; |
2648 | if (pa != null) | ||
2619 | { | 2649 | { |
2620 | PhysActor.LockAngularMotion(RotationAxis); | 2650 | pa.LockAngularMotion(RotationAxis); |
2621 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 2651 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
2622 | } | 2652 | } |
2623 | } | 2653 | } |
2624 | 2654 | ||
@@ -3350,8 +3380,9 @@ if (m_shape != null) { | |||
3350 | { | 3380 | { |
3351 | IsVD = false; // Switch it of for the course of this routine | 3381 | IsVD = false; // Switch it of for the course of this routine |
3352 | VolumeDetectActive = false; // and also permanently | 3382 | VolumeDetectActive = false; // and also permanently |
3353 | if (PhysActor != null) | 3383 | PhysicsActor pa = PhysActor; |
3354 | PhysActor.SetVolumeDetect(0); // Let physics know about it too | 3384 | if (pa != null) |
3385 | pa.SetVolumeDetect(0); // Let physics know about it too | ||
3355 | } | 3386 | } |
3356 | else | 3387 | else |
3357 | { | 3388 | { |
@@ -3399,18 +3430,21 @@ if (m_shape != null) { | |||
3399 | if (IsPhantom || IsAttachment) // note: this may have been changed above in the case of joints | 3430 | if (IsPhantom || IsAttachment) // note: this may have been changed above in the case of joints |
3400 | { | 3431 | { |
3401 | AddFlag(PrimFlags.Phantom); | 3432 | AddFlag(PrimFlags.Phantom); |
3402 | if (PhysActor != null) | 3433 | PhysicsActor pa = PhysActor; |
3434 | if (pa != null) | ||
3403 | { | 3435 | { |
3404 | m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); | 3436 | m_parentGroup.Scene.PhysicsScene.RemovePrim(pa); |
3405 | /// that's not wholesome. Had to make Scene public | 3437 | /// that's not wholesome. Had to make Scene public |
3406 | PhysActor = null; | 3438 | pa = null; |
3407 | } | 3439 | } |
3408 | } | 3440 | } |
3409 | else // Not phantom | 3441 | else // Not phantom |
3410 | { | 3442 | { |
3411 | RemFlag(PrimFlags.Phantom); | 3443 | RemFlag(PrimFlags.Phantom); |
3412 | 3444 | ||
3413 | if (PhysActor == null) | 3445 | // This is NOT safe!! |
3446 | PhysicsActor pa = PhysActor; | ||
3447 | if (pa == null) | ||
3414 | { | 3448 | { |
3415 | // It's not phantom anymore. So make sure the physics engine get's knowledge of it | 3449 | // It's not phantom anymore. So make sure the physics engine get's knowledge of it |
3416 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 3450 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
@@ -3421,9 +3455,9 @@ if (m_shape != null) { | |||
3421 | RotationOffset, | 3455 | RotationOffset, |
3422 | UsePhysics); | 3456 | UsePhysics); |
3423 | 3457 | ||
3424 | if (PhysActor != null) | 3458 | if (pa != null) |
3425 | { | 3459 | { |
3426 | PhysActor.LocalID = LocalId; | 3460 | pa.LocalID = LocalId; |
3427 | DoPhysicsPropertyUpdate(UsePhysics, true); | 3461 | DoPhysicsPropertyUpdate(UsePhysics, true); |
3428 | if (m_parentGroup != null) | 3462 | if (m_parentGroup != null) |
3429 | { | 3463 | { |
@@ -3442,14 +3476,14 @@ if (m_shape != null) { | |||
3442 | (CollisionSound != UUID.Zero) | 3476 | (CollisionSound != UUID.Zero) |
3443 | ) | 3477 | ) |
3444 | { | 3478 | { |
3445 | PhysActor.OnCollisionUpdate += PhysicsCollision; | 3479 | pa.OnCollisionUpdate += PhysicsCollision; |
3446 | PhysActor.SubscribeEvents(1000); | 3480 | pa.SubscribeEvents(1000); |
3447 | } | 3481 | } |
3448 | } | 3482 | } |
3449 | } | 3483 | } |
3450 | else // it already has a physical representation | 3484 | else // it already has a physical representation |
3451 | { | 3485 | { |
3452 | PhysActor.IsPhysical = UsePhysics; | 3486 | pa.IsPhysical = UsePhysics; |
3453 | 3487 | ||
3454 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim | 3488 | DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim |
3455 | if (m_parentGroup != null) | 3489 | if (m_parentGroup != null) |
@@ -3472,9 +3506,10 @@ if (m_shape != null) { | |||
3472 | // Defensive programming calls for a check here. | 3506 | // Defensive programming calls for a check here. |
3473 | // Better would be throwing an exception that could be catched by a unit test as the internal | 3507 | // Better would be throwing an exception that could be catched by a unit test as the internal |
3474 | // logic should make sure, this Physactor is always here. | 3508 | // logic should make sure, this Physactor is always here. |
3475 | if (this.PhysActor != null) | 3509 | PhysicsActor pa = this.PhysActor; |
3510 | if (pa != null) | ||
3476 | { | 3511 | { |
3477 | PhysActor.SetVolumeDetect(1); | 3512 | pa.SetVolumeDetect(1); |
3478 | AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active | 3513 | AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active |
3479 | this.VolumeDetectActive = true; | 3514 | this.VolumeDetectActive = true; |
3480 | } | 3515 | } |
@@ -3482,10 +3517,11 @@ if (m_shape != null) { | |||
3482 | } | 3517 | } |
3483 | else | 3518 | else |
3484 | { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like | 3519 | { // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like |
3485 | // (mumbles, well, at least if you have infinte CPU powers :-)) | 3520 | // (mumbles, well, at least if you have infinte CPU powers :-) ) |
3486 | if (this.PhysActor != null) | 3521 | PhysicsActor pa = this.PhysActor; |
3522 | if (pa != null) | ||
3487 | { | 3523 | { |
3488 | PhysActor.SetVolumeDetect(0); | 3524 | pa.SetVolumeDetect(0); |
3489 | } | 3525 | } |
3490 | this.VolumeDetectActive = false; | 3526 | this.VolumeDetectActive = false; |
3491 | } | 3527 | } |
@@ -3543,10 +3579,11 @@ if (m_shape != null) { | |||
3543 | m_shape.PathTaperY = shapeBlock.PathTaperY; | 3579 | m_shape.PathTaperY = shapeBlock.PathTaperY; |
3544 | m_shape.PathTwist = shapeBlock.PathTwist; | 3580 | m_shape.PathTwist = shapeBlock.PathTwist; |
3545 | m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; | 3581 | m_shape.PathTwistBegin = shapeBlock.PathTwistBegin; |
3546 | if (PhysActor != null) | 3582 | PhysicsActor pa = PhysActor; |
3583 | if (pa != null) | ||
3547 | { | 3584 | { |
3548 | PhysActor.Shape = m_shape; | 3585 | pa.Shape = m_shape; |
3549 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 3586 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(pa); |
3550 | } | 3587 | } |
3551 | 3588 | ||
3552 | // This is what makes vehicle trailers work | 3589 | // This is what makes vehicle trailers work |
@@ -3647,19 +3684,21 @@ if (m_shape != null) { | |||
3647 | ) | 3684 | ) |
3648 | { | 3685 | { |
3649 | // subscribe to physics updates. | 3686 | // subscribe to physics updates. |
3650 | if (PhysActor != null) | 3687 | PhysicsActor pa = PhysActor; |
3688 | if (pa != null) | ||
3651 | { | 3689 | { |
3652 | PhysActor.OnCollisionUpdate += PhysicsCollision; | 3690 | pa.OnCollisionUpdate += PhysicsCollision; |
3653 | PhysActor.SubscribeEvents(1000); | 3691 | pa.SubscribeEvents(1000); |
3654 | 3692 | ||
3655 | } | 3693 | } |
3656 | } | 3694 | } |
3657 | else | 3695 | else |
3658 | { | 3696 | { |
3659 | if (PhysActor != null) | 3697 | PhysicsActor pa = PhysActor; |
3698 | if (pa != null) | ||
3660 | { | 3699 | { |
3661 | PhysActor.UnSubscribeEvents(); | 3700 | pa.UnSubscribeEvents(); |
3662 | PhysActor.OnCollisionUpdate -= PhysicsCollision; | 3701 | pa.OnCollisionUpdate -= PhysicsCollision; |
3663 | } | 3702 | } |
3664 | } | 3703 | } |
3665 | 3704 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 23fe2d3..6772f75 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2269,7 +2269,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2269 | { | 2269 | { |
2270 | //Record the time we enter this state so we know whether to "land" or not | 2270 | //Record the time we enter this state so we know whether to "land" or not |
2271 | m_animPersistUntil = DateTime.Now.Ticks; | 2271 | m_animPersistUntil = DateTime.Now.Ticks; |
2272 | return "FALLDOWN"; | 2272 | return "FALLDOWN"; // this falling animation is invoked too frequently when capsule tilt correction is used - why? |
2273 | } | 2273 | } |
2274 | } | 2274 | } |
2275 | } | 2275 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 5ae81cd..fe74158 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -65,8 +65,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
65 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | 65 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); |
66 | //int time = System.Environment.TickCount; | 66 | //int time = System.Environment.TickCount; |
67 | 67 | ||
68 | SceneObjectGroup sceneObject = new SceneObjectGroup(); | ||
69 | |||
70 | // libomv.types changes UUID to Guid | 68 | // libomv.types changes UUID to Guid |
71 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); | 69 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); |
72 | xmlData = xmlData.Replace("</UUID>", "</Guid>"); | 70 | xmlData = xmlData.Replace("</UUID>", "</Guid>"); |
@@ -88,17 +86,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
88 | parts = doc.GetElementsByTagName("RootPart"); | 86 | parts = doc.GetElementsByTagName("RootPart"); |
89 | 87 | ||
90 | if (parts.Count == 0) | 88 | if (parts.Count == 0) |
91 | { | ||
92 | throw new Exception("Invalid Xml format - no root part"); | 89 | throw new Exception("Invalid Xml format - no root part"); |
93 | } | 90 | |
94 | else | 91 | sr = new StringReader(parts[0].InnerXml); |
95 | { | 92 | reader = new XmlTextReader(sr); |
96 | sr = new StringReader(parts[0].InnerXml); | 93 | SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(fromUserInventoryItemID, reader)); |
97 | reader = new XmlTextReader(sr); | 94 | reader.Close(); |
98 | sceneObject.SetRootPart(SceneObjectPart.FromXml(fromUserInventoryItemID, reader)); | 95 | sr.Close(); |
99 | reader.Close(); | ||
100 | sr.Close(); | ||
101 | } | ||
102 | 96 | ||
103 | parts = doc.GetElementsByTagName("Part"); | 97 | parts = doc.GetElementsByTagName("Part"); |
104 | 98 | ||
@@ -119,16 +113,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
119 | // Script state may, or may not, exist. Not having any, is NOT | 113 | // Script state may, or may not, exist. Not having any, is NOT |
120 | // ever a problem. | 114 | // ever a problem. |
121 | sceneObject.LoadScriptState(doc); | 115 | sceneObject.LoadScriptState(doc); |
116 | |||
117 | return sceneObject; | ||
122 | } | 118 | } |
123 | catch (Exception e) | 119 | catch (Exception e) |
124 | { | 120 | { |
125 | m_log.ErrorFormat( | 121 | m_log.ErrorFormat( |
126 | "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); | 122 | "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); |
123 | return null; | ||
127 | } | 124 | } |
128 | |||
129 | //m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); | ||
130 | |||
131 | return sceneObject; | ||
132 | } | 125 | } |
133 | 126 | ||
134 | /// <summary> | 127 | /// <summary> |
@@ -194,8 +187,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
194 | { | 187 | { |
195 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); | 188 | //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); |
196 | //int time = System.Environment.TickCount; | 189 | //int time = System.Environment.TickCount; |
197 | |||
198 | SceneObjectGroup sceneObject = new SceneObjectGroup(); | ||
199 | 190 | ||
200 | // libomv.types changes UUID to Guid | 191 | // libomv.types changes UUID to Guid |
201 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); | 192 | xmlData = xmlData.Replace("<UUID>", "<Guid>"); |
@@ -212,21 +203,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
212 | 203 | ||
213 | XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); | 204 | XmlNodeList parts = doc.GetElementsByTagName("SceneObjectPart"); |
214 | 205 | ||
215 | // Process the root part first | 206 | if (parts.Count == 0) |
216 | if (parts.Count > 0) | ||
217 | { | 207 | { |
218 | StringReader sr = new StringReader(parts[0].OuterXml); | 208 | m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes. xml was " + xmlData); |
219 | XmlTextReader reader = new XmlTextReader(sr); | 209 | return null; |
220 | sceneObject.SetRootPart(SceneObjectPart.FromXml(reader)); | ||
221 | reader.Close(); | ||
222 | sr.Close(); | ||
223 | } | 210 | } |
224 | 211 | ||
212 | StringReader sr = new StringReader(parts[0].OuterXml); | ||
213 | XmlTextReader reader = new XmlTextReader(sr); | ||
214 | SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader)); | ||
215 | reader.Close(); | ||
216 | sr.Close(); | ||
217 | |||
225 | // Then deal with the rest | 218 | // Then deal with the rest |
226 | for (int i = 1; i < parts.Count; i++) | 219 | for (int i = 1; i < parts.Count; i++) |
227 | { | 220 | { |
228 | StringReader sr = new StringReader(parts[i].OuterXml); | 221 | sr = new StringReader(parts[i].OuterXml); |
229 | XmlTextReader reader = new XmlTextReader(sr); | 222 | reader = new XmlTextReader(sr); |
230 | SceneObjectPart part = SceneObjectPart.FromXml(reader); | 223 | SceneObjectPart part = SceneObjectPart.FromXml(reader); |
231 | sceneObject.AddPart(part); | 224 | sceneObject.AddPart(part); |
232 | part.StoreUndoState(); | 225 | part.StoreUndoState(); |
@@ -238,15 +231,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
238 | // ever a problem. | 231 | // ever a problem. |
239 | 232 | ||
240 | sceneObject.LoadScriptState(doc); | 233 | sceneObject.LoadScriptState(doc); |
234 | return sceneObject; | ||
241 | } | 235 | } |
242 | catch (Exception e) | 236 | catch (Exception e) |
243 | { | 237 | { |
244 | m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); | 238 | m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); |
239 | return null; | ||
245 | } | 240 | } |
246 | |||
247 | //m_log.DebugFormat("[SERIALIZER]: Finished deserialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); | ||
248 | |||
249 | return sceneObject; | ||
250 | } | 241 | } |
251 | 242 | ||
252 | /// <summary> | 243 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index bb8f27d..3b0e77f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs | |||
@@ -128,7 +128,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
128 | 128 | ||
129 | private SceneObjectGroup NewSOG() | 129 | private SceneObjectGroup NewSOG() |
130 | { | 130 | { |
131 | SceneObjectGroup sog = new SceneObjectGroup(); | ||
132 | SceneObjectPart sop = new SceneObjectPart(UUID.Random(), PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); | 131 | SceneObjectPart sop = new SceneObjectPart(UUID.Random(), PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); |
133 | sop.Name = RandomName(); | 132 | sop.Name = RandomName(); |
134 | sop.Description = sop.Name; | 133 | sop.Description = sop.Name; |
@@ -136,9 +135,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
136 | sop.SitName = RandomName(); | 135 | sop.SitName = RandomName(); |
137 | sop.TouchName = RandomName(); | 136 | sop.TouchName = RandomName(); |
138 | sop.ObjectFlags |= (uint)PrimFlags.Phantom; | 137 | sop.ObjectFlags |= (uint)PrimFlags.Phantom; |
139 | |||
140 | sog.SetRootPart(sop); | ||
141 | 138 | ||
139 | SceneObjectGroup sog = new SceneObjectGroup(sop); | ||
142 | scene.AddNewSceneObject(sog, false); | 140 | scene.AddNewSceneObject(sog, false); |
143 | 141 | ||
144 | return sog; | 142 | return sog; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 7fb2d25..19c0fea 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -407,9 +407,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
407 | sop.Shape.State = 1; | 407 | sop.Shape.State = 1; |
408 | sop.OwnerID = agent; | 408 | sop.OwnerID = agent; |
409 | 409 | ||
410 | SceneObjectGroup sog = new SceneObjectGroup(); | 410 | SceneObjectGroup sog = new SceneObjectGroup(sop); |
411 | sog.SetScene(scene); | 411 | sog.SetScene(scene); |
412 | sog.SetRootPart(sop); | ||
413 | 412 | ||
414 | return sog; | 413 | return sog; |
415 | } | 414 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 65c5274..6b30959 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | |||
@@ -53,7 +53,7 @@ using System.Text.RegularExpressions; | |||
53 | 53 | ||
54 | namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | 54 | namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice |
55 | { | 55 | { |
56 | public class FreeSwitchVoiceModule : IRegionModule | 56 | public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule |
57 | { | 57 | { |
58 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 58 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
59 | 59 | ||
@@ -101,13 +101,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
101 | private FreeSwitchDialplan m_FreeSwitchDialplan; | 101 | private FreeSwitchDialplan m_FreeSwitchDialplan; |
102 | 102 | ||
103 | private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>(); | 103 | private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>(); |
104 | private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>(); | ||
105 | |||
106 | private Scene m_scene; | ||
104 | 107 | ||
105 | 108 | ||
106 | private IConfig m_config; | 109 | private IConfig m_config; |
107 | 110 | ||
108 | public void Initialise(Scene scene, IConfigSource config) | 111 | public void Initialise(Scene scene, IConfigSource config) |
109 | { | 112 | { |
110 | 113 | m_scene = scene; | |
111 | m_config = config.Configs["FreeSwitchVoice"]; | 114 | m_config = config.Configs["FreeSwitchVoice"]; |
112 | 115 | ||
113 | if (null == m_config) | 116 | if (null == m_config) |
@@ -230,6 +233,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
230 | { | 233 | { |
231 | OnRegisterCaps(scene, agentID, caps); | 234 | OnRegisterCaps(scene, agentID, caps); |
232 | }; | 235 | }; |
236 | |||
237 | |||
233 | 238 | ||
234 | try | 239 | try |
235 | { | 240 | { |
@@ -255,6 +260,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
255 | 260 | ||
256 | public void PostInitialise() | 261 | public void PostInitialise() |
257 | { | 262 | { |
263 | if(m_pluginEnabled) | ||
264 | { | ||
265 | m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); | ||
266 | |||
267 | // register the voice interface for this module, so the script engine can call us | ||
268 | m_scene.RegisterModuleInterface<IVoiceModule>(this); | ||
269 | } | ||
258 | } | 270 | } |
259 | 271 | ||
260 | public void Close() | 272 | public void Close() |
@@ -270,7 +282,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
270 | { | 282 | { |
271 | get { return true; } | 283 | get { return true; } |
272 | } | 284 | } |
273 | 285 | ||
286 | // <summary> | ||
287 | // implementation of IVoiceModule, called by osSetParcelSIPAddress script function | ||
288 | // </summary> | ||
289 | public void setLandSIPAddress(string SIPAddress,UUID GlobalID) | ||
290 | { | ||
291 | m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}", | ||
292 | GlobalID, SIPAddress); | ||
293 | |||
294 | lock (m_ParcelAddress) | ||
295 | { | ||
296 | if (m_ParcelAddress.ContainsKey(GlobalID.ToString())) | ||
297 | { | ||
298 | m_ParcelAddress[GlobalID.ToString()] = SIPAddress; | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | m_ParcelAddress.Add(GlobalID.ToString(), SIPAddress); | ||
303 | } | ||
304 | } | ||
305 | } | ||
274 | 306 | ||
275 | // <summary> | 307 | // <summary> |
276 | // OnRegisterCaps is invoked via the scene.EventManager | 308 | // OnRegisterCaps is invoked via the scene.EventManager |
@@ -776,6 +808,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
776 | 808 | ||
777 | // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same | 809 | // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same |
778 | // as the directory ID. Otherwise, it reflects the parcel's ID. | 810 | // as the directory ID. Otherwise, it reflects the parcel's ID. |
811 | |||
812 | lock (m_ParcelAddress) | ||
813 | { | ||
814 | if (m_ParcelAddress.ContainsKey( land.GlobalID.ToString() )) | ||
815 | { | ||
816 | m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}", | ||
817 | land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]); | ||
818 | return m_ParcelAddress[land.GlobalID.ToString()]; | ||
819 | } | ||
820 | } | ||
779 | 821 | ||
780 | if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0) | 822 | if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0) |
781 | { | 823 | { |
@@ -797,6 +839,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
797 | // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator. | 839 | // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator. |
798 | channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm); | 840 | channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm); |
799 | 841 | ||
842 | lock (m_ParcelAddress) | ||
843 | { | ||
844 | if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString())) | ||
845 | { | ||
846 | m_ParcelAddress.Add(land.GlobalID.ToString(),channelUri); | ||
847 | } | ||
848 | } | ||
800 | 849 | ||
801 | return channelUri; | 850 | return channelUri; |
802 | } | 851 | } |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 37e1ed4..d5cbfd4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -281,7 +281,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
281 | 281 | ||
282 | private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) | 282 | private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) |
283 | { | 283 | { |
284 | GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); | 284 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
285 | |||
286 | //GroupMembershipData[] avatarGroups = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), avatarID).ToArray(); | ||
287 | GroupMembershipData[] avatarGroups = GetProfileListedGroupMemberships(remoteClient, avatarID); | ||
285 | remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); | 288 | remoteClient.SendAvatarGroupsReply(avatarID, avatarGroups); |
286 | } | 289 | } |
287 | 290 | ||
@@ -485,6 +488,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
485 | bucket[18] = 0; //dunno | 488 | bucket[18] = 0; //dunno |
486 | } | 489 | } |
487 | 490 | ||
491 | |||
488 | m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); | 492 | m_groupData.AddGroupNotice(GetClientGroupRequestID(remoteClient), GroupID, NoticeID, im.fromAgentName, Subject, Message, bucket); |
489 | if (OnNewGroupNotice != null) | 493 | if (OnNewGroupNotice != null) |
490 | { | 494 | { |
@@ -494,7 +498,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
494 | // Send notice out to everyone that wants notices | 498 | // Send notice out to everyone that wants notices |
495 | foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID)) | 499 | foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), GroupID)) |
496 | { | 500 | { |
497 | if (member.AcceptNotices) | 501 | if (m_debugEnabled) |
502 | { | ||
503 | UserProfileData targetUserProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(member.AgentID); | ||
504 | if (targetUserProfile != null) | ||
505 | { | ||
506 | m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUserProfile.Name, member.AcceptNotices); | ||
507 | } | ||
508 | else | ||
509 | { | ||
510 | m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices); | ||
511 | } | ||
512 | } | ||
513 | |||
514 | if (member.AcceptNotices) | ||
498 | { | 515 | { |
499 | // Build notice IIM | 516 | // Build notice IIM |
500 | GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); | 517 | GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice); |
@@ -614,13 +631,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
614 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 631 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
615 | 632 | ||
616 | List<GroupMembersData> data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID); | 633 | List<GroupMembersData> data = m_groupData.GetGroupMembers(GetClientGroupRequestID(remoteClient), groupID); |
617 | if (m_debugEnabled) | ||
618 | { | ||
619 | foreach (GroupMembersData member in data) | ||
620 | { | ||
621 | m_log.DebugFormat("[GROUPS]: {0} {1}", member.AgentID, member.Title); | ||
622 | } | ||
623 | } | ||
624 | 634 | ||
625 | return data; | 635 | return data; |
626 | 636 | ||
@@ -632,14 +642,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
632 | 642 | ||
633 | List<GroupRolesData> data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); | 643 | List<GroupRolesData> data = m_groupData.GetGroupRoles(GetClientGroupRequestID(remoteClient), groupID); |
634 | 644 | ||
635 | if (m_debugEnabled) | ||
636 | { | ||
637 | foreach (GroupRolesData member in data) | ||
638 | { | ||
639 | m_log.DebugFormat("[GROUPS]: {0} {1}", member.Title, member.Members); | ||
640 | } | ||
641 | } | ||
642 | |||
643 | return data; | 645 | return data; |
644 | 646 | ||
645 | } | 647 | } |
@@ -650,14 +652,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
650 | 652 | ||
651 | List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); | 653 | List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetClientGroupRequestID(remoteClient), groupID); |
652 | 654 | ||
653 | if (m_debugEnabled) | ||
654 | { | ||
655 | foreach (GroupRoleMembersData member in data) | ||
656 | { | ||
657 | m_log.DebugFormat("[GROUPS]: Av: {0} Role: {1}", member.MemberID, member.RoleID); | ||
658 | } | ||
659 | } | ||
660 | |||
661 | return data; | 655 | return data; |
662 | 656 | ||
663 | 657 | ||
@@ -808,7 +802,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
808 | { | 802 | { |
809 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); | 803 | if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); |
810 | 804 | ||
811 | // TODO: Security Checks? | 805 | // Security Checks are handled in the Groups Service. |
812 | 806 | ||
813 | GroupRequestID grID = GetClientGroupRequestID(remoteClient); | 807 | GroupRequestID grID = GetClientGroupRequestID(remoteClient); |
814 | 808 | ||
@@ -825,6 +819,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
825 | case OpenMetaverse.GroupRoleUpdate.UpdateAll: | 819 | case OpenMetaverse.GroupRoleUpdate.UpdateAll: |
826 | case OpenMetaverse.GroupRoleUpdate.UpdateData: | 820 | case OpenMetaverse.GroupRoleUpdate.UpdateData: |
827 | case OpenMetaverse.GroupRoleUpdate.UpdatePowers: | 821 | case OpenMetaverse.GroupRoleUpdate.UpdatePowers: |
822 | if (m_debugEnabled) | ||
823 | { | ||
824 | GroupPowers gp = (GroupPowers)powers; | ||
825 | m_log.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name, powers.ToString(), gp.ToString()); | ||
826 | } | ||
828 | m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers); | 827 | m_groupData.UpdateGroupRole(grID, groupID, roleID, name, description, title, powers); |
829 | break; | 828 | break; |
830 | 829 | ||
@@ -1195,6 +1194,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1195 | 1194 | ||
1196 | foreach (GroupMembershipData membership in data) | 1195 | foreach (GroupMembershipData membership in data) |
1197 | { | 1196 | { |
1197 | if (remoteClient.AgentId != dataForAgentID) | ||
1198 | { | ||
1199 | if (!membership.ListInProfile) | ||
1200 | { | ||
1201 | // If we're sending group info to remoteclient about another agent, | ||
1202 | // filter out groups the other agent doesn't want to share. | ||
1203 | continue; | ||
1204 | } | ||
1205 | } | ||
1206 | |||
1198 | OSDMap GroupDataMap = new OSDMap(6); | 1207 | OSDMap GroupDataMap = new OSDMap(6); |
1199 | OSDMap NewGroupDataMap = new OSDMap(1); | 1208 | OSDMap NewGroupDataMap = new OSDMap(1); |
1200 | 1209 | ||
@@ -1281,11 +1290,46 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1281 | // to the core Groups Stub | 1290 | // to the core Groups Stub |
1282 | remoteClient.SendGroupMembership(new GroupMembershipData[0]); | 1291 | remoteClient.SendGroupMembership(new GroupMembershipData[0]); |
1283 | 1292 | ||
1284 | GroupMembershipData[] membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(remoteClient), dataForAgentID).ToArray(); | 1293 | GroupMembershipData[] membershipArray = GetProfileListedGroupMemberships(remoteClient, dataForAgentID); |
1294 | SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); | ||
1295 | remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); | ||
1285 | 1296 | ||
1286 | SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipData); | 1297 | } |
1287 | remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipData); | 1298 | |
1299 | /// <summary> | ||
1300 | /// Get a list of groups memberships for the agent that are marked "ListInProfile" | ||
1301 | /// </summary> | ||
1302 | /// <param name="dataForAgentID"></param> | ||
1303 | /// <returns></returns> | ||
1304 | private GroupMembershipData[] GetProfileListedGroupMemberships(IClientAPI requestingClient, UUID dataForAgentID) | ||
1305 | { | ||
1306 | List<GroupMembershipData> membershipData = m_groupData.GetAgentGroupMemberships(GetClientGroupRequestID(requestingClient), dataForAgentID); | ||
1307 | GroupMembershipData[] membershipArray; | ||
1308 | |||
1309 | if (requestingClient.AgentId != dataForAgentID) | ||
1310 | { | ||
1311 | Predicate<GroupMembershipData> showInProfile = delegate(GroupMembershipData membership) | ||
1312 | { | ||
1313 | return membership.ListInProfile; | ||
1314 | }; | ||
1315 | |||
1316 | membershipArray = membershipData.FindAll(showInProfile).ToArray(); | ||
1317 | } | ||
1318 | else | ||
1319 | { | ||
1320 | membershipArray = membershipData.ToArray(); | ||
1321 | } | ||
1322 | |||
1323 | if (m_debugEnabled) | ||
1324 | { | ||
1325 | m_log.InfoFormat("[GROUPS]: Get group membership information for {0} requested by {1}", dataForAgentID, requestingClient.AgentId); | ||
1326 | foreach (GroupMembershipData membership in membershipArray) | ||
1327 | { | ||
1328 | m_log.InfoFormat("[GROUPS]: {0} :: {1} - {2}", dataForAgentID, membership.GroupName, membership.GroupTitle); | ||
1329 | } | ||
1330 | } | ||
1288 | 1331 | ||
1332 | return membershipArray; | ||
1289 | } | 1333 | } |
1290 | 1334 | ||
1291 | private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) | 1335 | private void SendAgentDataUpdate(IClientAPI remoteClient, UUID dataForAgentID, UUID activeGroupID, string activeGroupName, ulong activeGroupPowers, string activeGroupTitle) |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index b3eaa37..805c3d4 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -855,16 +855,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
855 | IList parameters = new ArrayList(); | 855 | IList parameters = new ArrayList(); |
856 | parameters.Add(param); | 856 | parameters.Add(param); |
857 | 857 | ||
858 | XmlRpcRequest req; | 858 | ConfigurableKeepAliveXmlRpcRequest req; |
859 | if (!m_disableKeepAlive) | 859 | req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); |
860 | { | ||
861 | req = new XmlRpcRequest(function, parameters); | ||
862 | } | ||
863 | else | ||
864 | { | ||
865 | // This seems to solve a major problem on some windows servers | ||
866 | req = new NoKeepAliveXmlRpcRequest(function, parameters); | ||
867 | } | ||
868 | 860 | ||
869 | XmlRpcResponse resp = null; | 861 | XmlRpcResponse resp = null; |
870 | 862 | ||
@@ -874,10 +866,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
874 | } | 866 | } |
875 | catch (Exception e) | 867 | catch (Exception e) |
876 | { | 868 | { |
869 | |||
870 | |||
877 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); | 871 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); |
878 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); | 872 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); |
879 | 873 | ||
880 | 874 | foreach( string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) | |
875 | { | ||
876 | m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); | ||
877 | } | ||
878 | |||
881 | foreach (string key in param.Keys) | 879 | foreach (string key in param.Keys) |
882 | { | 880 | { |
883 | m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); | 881 | m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); |
@@ -961,20 +959,24 @@ namespace Nwc.XmlRpc | |||
961 | using System.Reflection; | 959 | using System.Reflection; |
962 | 960 | ||
963 | /// <summary>Class supporting the request side of an XML-RPC transaction.</summary> | 961 | /// <summary>Class supporting the request side of an XML-RPC transaction.</summary> |
964 | public class NoKeepAliveXmlRpcRequest : XmlRpcRequest | 962 | public class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest |
965 | { | 963 | { |
966 | private Encoding _encoding = new ASCIIEncoding(); | 964 | private Encoding _encoding = new ASCIIEncoding(); |
967 | private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); | 965 | private XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer(); |
968 | private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); | 966 | private XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer(); |
967 | private bool _disableKeepAlive = true; | ||
968 | |||
969 | public string RequestResponse = String.Empty; | ||
969 | 970 | ||
970 | /// <summary>Instantiate an <c>XmlRpcRequest</c> for a specified method and parameters.</summary> | 971 | /// <summary>Instantiate an <c>XmlRpcRequest</c> for a specified method and parameters.</summary> |
971 | /// <param name="methodName"><c>String</c> designating the <i>object.method</i> on the server the request | 972 | /// <param name="methodName"><c>String</c> designating the <i>object.method</i> on the server the request |
972 | /// should be directed to.</param> | 973 | /// should be directed to.</param> |
973 | /// <param name="parameters"><c>ArrayList</c> of XML-RPC type parameters to invoke the request with.</param> | 974 | /// <param name="parameters"><c>ArrayList</c> of XML-RPC type parameters to invoke the request with.</param> |
974 | public NoKeepAliveXmlRpcRequest(String methodName, IList parameters) | 975 | public ConfigurableKeepAliveXmlRpcRequest(String methodName, IList parameters, bool disableKeepAlive) |
975 | { | 976 | { |
976 | MethodName = methodName; | 977 | MethodName = methodName; |
977 | _params = parameters; | 978 | _params = parameters; |
979 | _disableKeepAlive = disableKeepAlive; | ||
978 | } | 980 | } |
979 | 981 | ||
980 | /// <summary>Send the request to the server.</summary> | 982 | /// <summary>Send the request to the server.</summary> |
@@ -989,7 +991,7 @@ namespace Nwc.XmlRpc | |||
989 | request.Method = "POST"; | 991 | request.Method = "POST"; |
990 | request.ContentType = "text/xml"; | 992 | request.ContentType = "text/xml"; |
991 | request.AllowWriteStreamBuffering = true; | 993 | request.AllowWriteStreamBuffering = true; |
992 | request.KeepAlive = false; | 994 | request.KeepAlive = !_disableKeepAlive; |
993 | 995 | ||
994 | Stream stream = request.GetRequestStream(); | 996 | Stream stream = request.GetRequestStream(); |
995 | XmlTextWriter xml = new XmlTextWriter(stream, _encoding); | 997 | XmlTextWriter xml = new XmlTextWriter(stream, _encoding); |
@@ -1000,7 +1002,17 @@ namespace Nwc.XmlRpc | |||
1000 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | 1002 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); |
1001 | StreamReader input = new StreamReader(response.GetResponseStream()); | 1003 | StreamReader input = new StreamReader(response.GetResponseStream()); |
1002 | 1004 | ||
1003 | XmlRpcResponse resp = (XmlRpcResponse)_deserializer.Deserialize(input); | 1005 | string inputXml = input.ReadToEnd(); |
1006 | XmlRpcResponse resp; | ||
1007 | try | ||
1008 | { | ||
1009 | resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); | ||
1010 | } | ||
1011 | catch (Exception e) | ||
1012 | { | ||
1013 | RequestResponse = inputXml; | ||
1014 | throw e; | ||
1015 | } | ||
1004 | input.Close(); | 1016 | input.Close(); |
1005 | response.Close(); | 1017 | response.Close(); |
1006 | return resp; | 1018 | return resp; |
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs index 59b7289..fbe43d6 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs | |||
@@ -66,7 +66,6 @@ namespace OpenSim.Region.OptionalModules.ContentManagement | |||
66 | 66 | ||
67 | private void CreatePointEntity(Scene scene, UUID uuid, Vector3 groupPos) | 67 | private void CreatePointEntity(Scene scene, UUID uuid, Vector3 groupPos) |
68 | { | 68 | { |
69 | SceneObjectGroup x = new SceneObjectGroup(); | ||
70 | SceneObjectPart y = new SceneObjectPart(); | 69 | SceneObjectPart y = new SceneObjectPart(); |
71 | 70 | ||
72 | //Initialize part | 71 | //Initialize part |
@@ -93,8 +92,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement | |||
93 | y.TrimPermissions(); | 92 | y.TrimPermissions(); |
94 | 93 | ||
95 | //Initialize group and add part as root part | 94 | //Initialize group and add part as root part |
95 | SceneObjectGroup x = new SceneObjectGroup(y); | ||
96 | x.SetScene(scene); | 96 | x.SetScene(scene); |
97 | x.SetRootPart(y); | ||
98 | x.RegionHandle = scene.RegionInfo.RegionHandle; | 97 | x.RegionHandle = scene.RegionInfo.RegionHandle; |
99 | x.SetScene(scene); | 98 | x.SetScene(scene); |
100 | 99 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index dd58a4e..a00ba11 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -107,6 +107,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
107 | public float MinimumGroundFlightOffset = 3f; | 107 | public float MinimumGroundFlightOffset = 3f; |
108 | 108 | ||
109 | private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. | 109 | private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. |
110 | private float m_tiltMagnitudeWhenProjectedOnXYPlane = 0.1131371f; // used to introduce a fixed tilt because a straight-up capsule falls through terrain, probably a bug in terrain collider | ||
110 | 111 | ||
111 | 112 | ||
112 | private float m_buoyancy = 0f; | 113 | private float m_buoyancy = 0f; |
@@ -477,7 +478,71 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
477 | } | 478 | } |
478 | } | 479 | } |
479 | } | 480 | } |
480 | 481 | ||
482 | private void AlignAvatarTiltWithCurrentDirectionOfMovement(PhysicsVector movementVector) | ||
483 | { | ||
484 | movementVector.Z = 0f; | ||
485 | float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y)); | ||
486 | if (magnitude < 0.1f) return; | ||
487 | |||
488 | // normalize the velocity vector | ||
489 | float invMagnitude = 1.0f / magnitude; | ||
490 | movementVector.X *= invMagnitude; | ||
491 | movementVector.Y *= invMagnitude; | ||
492 | |||
493 | // if we change the capsule heading too often, the capsule can fall down | ||
494 | // therefore we snap movement vector to just 1 of 4 predefined directions (ne, nw, se, sw), | ||
495 | // meaning only 4 possible capsule tilt orientations | ||
496 | if (movementVector.X > 0) | ||
497 | { | ||
498 | // east | ||
499 | if (movementVector.Y > 0) | ||
500 | { | ||
501 | // northeast | ||
502 | movementVector.X = (float)Math.Sqrt(2.0); | ||
503 | movementVector.Y = (float)Math.Sqrt(2.0); | ||
504 | } | ||
505 | else | ||
506 | { | ||
507 | // southeast | ||
508 | movementVector.X = (float)Math.Sqrt(2.0); | ||
509 | movementVector.Y = -(float)Math.Sqrt(2.0); | ||
510 | } | ||
511 | } | ||
512 | else | ||
513 | { | ||
514 | // west | ||
515 | if (movementVector.Y > 0) | ||
516 | { | ||
517 | // northwest | ||
518 | movementVector.X = -(float)Math.Sqrt(2.0); | ||
519 | movementVector.Y = (float)Math.Sqrt(2.0); | ||
520 | } | ||
521 | else | ||
522 | { | ||
523 | // southwest | ||
524 | movementVector.X = -(float)Math.Sqrt(2.0); | ||
525 | movementVector.Y = -(float)Math.Sqrt(2.0); | ||
526 | } | ||
527 | } | ||
528 | |||
529 | |||
530 | // movementVector.Z is zero | ||
531 | |||
532 | // calculate tilt components based on desired amount of tilt and current (snapped) heading. | ||
533 | // the "-" sign is to force the tilt to be OPPOSITE the direction of movement. | ||
534 | float xTiltComponent = -movementVector.X * m_tiltMagnitudeWhenProjectedOnXYPlane; | ||
535 | float yTiltComponent = -movementVector.Y * m_tiltMagnitudeWhenProjectedOnXYPlane; | ||
536 | |||
537 | //m_log.Debug("[PHYSICS] changing avatar tilt"); | ||
538 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, xTiltComponent); | ||
539 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, xTiltComponent); // must be same as lowstop, else a different, spurious tilt is introduced | ||
540 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, yTiltComponent); | ||
541 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, yTiltComponent); // same as lowstop | ||
542 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, 0f); | ||
543 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop | ||
544 | } | ||
545 | |||
481 | /// <summary> | 546 | /// <summary> |
482 | /// This creates the Avatar's physical Surrogate at the position supplied | 547 | /// This creates the Avatar's physical Surrogate at the position supplied |
483 | /// </summary> | 548 | /// </summary> |
@@ -576,71 +641,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
576 | // (with -0..0 motor stops) falls into the terrain for reasons yet | 641 | // (with -0..0 motor stops) falls into the terrain for reasons yet |
577 | // to be comprehended in their entirety. | 642 | // to be comprehended in their entirety. |
578 | #endregion | 643 | #endregion |
644 | AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(0,0,0)); | ||
579 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f); | 645 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f); |
580 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f); | 646 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f); |
581 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f); | 647 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f); |
582 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced | 648 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced |
583 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop | 649 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop |
584 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop | 650 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop |
585 | #region Documentation of capsule motor StopERP and StopCFM parameters | ||
586 | // In addition to the above tilt, we allow a dynamic tilt, or | ||
587 | // wobble, to emerge as the capsule is pushed around the environment. | ||
588 | // We do this with an experimentally determined combination of | ||
589 | // StopERP and StopCFM which make the above motor stops soft. | ||
590 | // The softness of the stops should be tweaked according to two | ||
591 | // requirements: | ||
592 | // | ||
593 | // 1. Motor stops should be weak enough to allow enough wobble such | ||
594 | // that the capsule can tilt slightly more when moving, to allow | ||
595 | // "gliding" over obstacles: | ||
596 | // | ||
597 | // | ||
598 | // .-. | ||
599 | // / / | ||
600 | // / / | ||
601 | // _ / / _ | ||
602 | // / \ .-. / / / \ | ||
603 | // | | ----> / / / / | | | ||
604 | // | | / / `-' | | | ||
605 | // | | / / +------+ | | | ||
606 | // | | / / | | | | | ||
607 | // | | / / | | | | | ||
608 | // \_/ `-' +------+ \_/ | ||
609 | // ---------------------------------------------------------- | ||
610 | // | ||
611 | // Note that requirement 1 is made complicated by the ever-present | ||
612 | // slight avatar tilt (assigned in the above code to prevent avatar | ||
613 | // from falling through terrain), which introduces a direction-dependent | ||
614 | // bias into the wobble (wobbling against the existing tilt is harder | ||
615 | // than wobbling with the tilt), which makes it easier to walk over | ||
616 | // prims from some directions. I have tried to minimize this effect by | ||
617 | // minimizing the avatar tilt to the minimum that prevents the avatar from | ||
618 | // falling through the terrain. | ||
619 | // | ||
620 | // 2. Motor stops should be strong enough to prevent the capsule | ||
621 | // from being forced all the way to the ground; otherwise the | ||
622 | // capsule could slip underneath obstacles like this: | ||
623 | // _ _ | ||
624 | // / \ +------+ / \ | ||
625 | // | | ----> | | | | | ||
626 | // | | | | | | | ||
627 | // | | .--.___ +------+ | | | ||
628 | // | | `--.__`--.__ | | | ||
629 | // | | `--.__`--. | | | ||
630 | // \_/ `--' \_/ | ||
631 | // ---------------------------------------------------------- | ||
632 | // | ||
633 | // | ||
634 | // It is strongly recommended you enable USE_DRAWSTUFF if you want to | ||
635 | // tweak these values, to see how the capsule is reacting in various | ||
636 | // situations. | ||
637 | #endregion | ||
638 | d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM, 0.0035f); | ||
639 | d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM2, 0.0035f); | ||
640 | d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM3, 0.0035f); | ||
641 | d.JointSetAMotorParam(Amotor, (int)dParam.StopERP, 0.8f); | ||
642 | d.JointSetAMotorParam(Amotor, (int)dParam.StopERP2, 0.8f); | ||
643 | d.JointSetAMotorParam(Amotor, (int)dParam.StopERP3, 0.8f); | ||
644 | } | 651 | } |
645 | 652 | ||
646 | // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the | 653 | // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the |
@@ -939,6 +946,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
939 | 946 | ||
940 | PhysicsVector vec = new PhysicsVector(); | 947 | PhysicsVector vec = new PhysicsVector(); |
941 | d.Vector3 vel = d.BodyGetLinearVel(Body); | 948 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
949 | |||
942 | float movementdivisor = 1f; | 950 | float movementdivisor = 1f; |
943 | 951 | ||
944 | if (!m_alwaysRun) | 952 | if (!m_alwaysRun) |
@@ -1052,6 +1060,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1052 | if (PhysicsVector.isFinite(vec)) | 1060 | if (PhysicsVector.isFinite(vec)) |
1053 | { | 1061 | { |
1054 | doForce(vec); | 1062 | doForce(vec); |
1063 | if (!_zeroFlag) | ||
1064 | { | ||
1065 | AlignAvatarTiltWithCurrentDirectionOfMovement(new PhysicsVector(vec.X, vec.Y, vec.Z)); | ||
1066 | } | ||
1055 | } | 1067 | } |
1056 | else | 1068 | else |
1057 | { | 1069 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 726b37a..ccdd4c5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1164,6 +1164,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1164 | 1164 | ||
1165 | land.SetMediaUrl(url); | 1165 | land.SetMediaUrl(url); |
1166 | } | 1166 | } |
1167 | |||
1168 | public void osSetParcelSIPAddress(string SIPAddress) | ||
1169 | { | ||
1170 | // What actually is the difference to the LL function? | ||
1171 | // | ||
1172 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); | ||
1173 | |||
1174 | m_host.AddScriptLPS(1); | ||
1175 | |||
1176 | |||
1177 | ILandObject land | ||
1178 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
1179 | |||
1180 | if (land.landData.OwnerID != m_host.ObjectOwner) | ||
1181 | { | ||
1182 | OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function"); | ||
1183 | return; | ||
1184 | } | ||
1185 | |||
1186 | // get the voice module | ||
1187 | IVoiceModule voiceModule = World.RequestModuleInterface<IVoiceModule>(); | ||
1188 | |||
1189 | if (voiceModule != null) | ||
1190 | voiceModule.setLandSIPAddress(SIPAddress,land.landData.GlobalID); | ||
1191 | else | ||
1192 | OSSLError("osSetParcelSIPAddress: No voice module enabled for this land"); | ||
1193 | |||
1194 | |||
1195 | } | ||
1167 | 1196 | ||
1168 | public string osGetScriptEngineName() | 1197 | public string osGetScriptEngineName() |
1169 | { | 1198 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 49aa45a..d8d3c31 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -75,6 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
75 | bool osConsoleCommand(string Command); | 75 | bool osConsoleCommand(string Command); |
76 | void osSetParcelMediaURL(string url); | 76 | void osSetParcelMediaURL(string url); |
77 | void osSetPrimFloatOnWater(int floatYN); | 77 | void osSetPrimFloatOnWater(int floatYN); |
78 | void osSetParcelSIPAddress(string SIPAddress); | ||
78 | 79 | ||
79 | // Avatar Info Commands | 80 | // Avatar Info Commands |
80 | string osGetAgentIP(string agent); | 81 | string osGetAgentIP(string agent); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 8f52d99..d0df390 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -183,6 +183,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
183 | { | 183 | { |
184 | m_OSSL_Functions.osSetParcelMediaURL(url); | 184 | m_OSSL_Functions.osSetParcelMediaURL(url); |
185 | } | 185 | } |
186 | |||
187 | public void osSetParcelSIPAddress(string SIPAddress) | ||
188 | { | ||
189 | m_OSSL_Functions.osSetParcelSIPAddress(SIPAddress); | ||
190 | } | ||
186 | 191 | ||
187 | public void osSetPrimFloatOnWater(int floatYN) | 192 | public void osSetPrimFloatOnWater(int floatYN) |
188 | { | 193 | { |