aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2012-07-11 14:27:33 +0100
committerMelanie2012-07-11 14:27:33 +0100
commit89c9528e38b4e06a2af6231ced4ed733bbafa174 (patch)
treeaed380f4bc51d9102e593446762f476694b9d87c /OpenSim/Region/Framework
parentMerge branch 'master' into careminster (diff)
parent remove expensive and leaked ( in Xengine at least) SayShout timer and (diff)
downloadopensim-SC-89c9528e38b4e06a2af6231ced4ed733bbafa174.zip
opensim-SC-89c9528e38b4e06a2af6231ced4ed733bbafa174.tar.gz
opensim-SC-89c9528e38b4e06a2af6231ced4ed733bbafa174.tar.bz2
opensim-SC-89c9528e38b4e06a2af6231ced4ed733bbafa174.tar.xz
Merge branch 'avination' into careminster
Conflicts: OpenSim/Data/MySQL/MySQLSimulationData.cs
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SOPVehicle.cs54
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs79
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs17
4 files changed, 119 insertions, 33 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
index d3c2d27..41e8944 100644
--- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
+++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
@@ -30,6 +30,8 @@ using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.Physics.Manager;
33using System.Text;
34using System.IO;
33using System.Xml; 35using System.Xml;
34using OpenSim.Framework.Serialization; 36using OpenSim.Framework.Serialization;
35using OpenSim.Framework.Serialization.External; 37using OpenSim.Framework.Serialization.External;
@@ -561,8 +563,56 @@ namespace OpenSim.Region.Framework.Scenes
561 } 563 }
562 564
563 565
566 public string ToXml2()
567 {
568 MemoryStream ms = new MemoryStream(512);
569 UTF8Encoding enc = new UTF8Encoding();
570 XmlTextWriter xwriter = new XmlTextWriter(ms, enc);
571 ToXml2(xwriter);
572 xwriter.Flush();
573 string s = ms.GetStreamString();
574 xwriter.Close();
575 return s;
576 }
577
578 public static SOPVehicle FromXml2(string text)
579 {
580 if (text == String.Empty)
581 return null;
582
583 UTF8Encoding enc = new UTF8Encoding();
584 MemoryStream ms = new MemoryStream(enc.GetBytes(text));
585 XmlTextReader xreader = new XmlTextReader(ms);
586
587 SOPVehicle v = new SOPVehicle();
588 bool error;
589
590 v.FromXml2(xreader, out error);
591
592 xreader.Close();
593
594 if (error)
595 {
596 v = null;
597 return null;
598 }
599 return v;
600 }
601
602 public static SOPVehicle FromXml2(XmlTextReader reader)
603 {
604 SOPVehicle vehicle = new SOPVehicle();
605
606 bool errors = false;
607
608 vehicle.FromXml2(reader, out errors);
609 if (errors)
610 return null;
611
612 return vehicle;
613 }
564 614
565 public void FromXml2(XmlTextReader _reader, out bool errors) 615 private void FromXml2(XmlTextReader _reader, out bool errors)
566 { 616 {
567 errors = false; 617 errors = false;
568 reader = _reader; 618 reader = _reader;
@@ -739,4 +789,4 @@ namespace OpenSim.Region.Framework.Scenes
739 vd.m_referenceFrame = XRquat(); 789 vd.m_referenceFrame = XRquat();
740 } 790 }
741 } 791 }
742} \ No newline at end of file 792}
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index b23d2e5..c3d66eb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1824,6 +1824,8 @@ namespace OpenSim.Region.Framework.Scenes
1824 { 1824 {
1825 parentGroup.LinkToGroup(child); 1825 parentGroup.LinkToGroup(child);
1826 1826
1827 child.DetachFromBackup();
1828
1827 // this is here so physics gets updated! 1829 // this is here so physics gets updated!
1828 // Don't remove! Bad juju! Stay away! or fix physics! 1830 // Don't remove! Bad juju! Stay away! or fix physics!
1829 child.AbsolutePosition = child.AbsolutePosition; 1831 child.AbsolutePosition = child.AbsolutePosition;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 1f1caca..2410970 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -353,7 +353,7 @@ namespace OpenSim.Region.Framework.Scenes
353 private int LastColSoundSentTime; 353 private int LastColSoundSentTime;
354 354
355 355
356 private SOPVehicle m_vehicle = null; 356 private SOPVehicle m_vehicleParams = null;
357 357
358 private KeyframeMotion m_keyframeMotion = null; 358 private KeyframeMotion m_keyframeMotion = null;
359 359
@@ -973,7 +973,15 @@ namespace OpenSim.Region.Framework.Scenes
973 } 973 }
974 return m_angularVelocity; 974 return m_angularVelocity;
975 } 975 }
976 set { m_angularVelocity = value; } 976 set
977 {
978 m_angularVelocity = value;
979 PhysicsActor actor = PhysActor;
980 if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE)
981 {
982 actor.RotationalVelocity = m_angularVelocity;
983 }
984 }
977 } 985 }
978 986
979 /// <summary></summary> 987 /// <summary></summary>
@@ -1877,7 +1885,7 @@ namespace OpenSim.Region.Framework.Scenes
1877 } 1885 }
1878 } 1886 }
1879 1887
1880// SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future 1888 // SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future
1881 public void SetVelocity(Vector3 pVel, bool localGlobalTF) 1889 public void SetVelocity(Vector3 pVel, bool localGlobalTF)
1882 { 1890 {
1883 if (ParentGroup == null || ParentGroup.IsDeleted) 1891 if (ParentGroup == null || ParentGroup.IsDeleted)
@@ -1903,6 +1911,33 @@ namespace OpenSim.Region.Framework.Scenes
1903 1911
1904 ParentGroup.Velocity = pVel; 1912 ParentGroup.Velocity = pVel;
1905 } 1913 }
1914
1915 // SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future
1916 public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF)
1917 {
1918 if (ParentGroup == null || ParentGroup.IsDeleted)
1919 return;
1920
1921 if (ParentGroup.IsAttachment)
1922 return; // don't work on attachments (for now ??)
1923
1924 SceneObjectPart root = ParentGroup.RootPart;
1925
1926 if (root.VehicleType != (int)Vehicle.TYPE_NONE) // don't mess with vehicles
1927 return;
1928
1929 PhysicsActor pa = root.PhysActor;
1930
1931 if (pa == null || !pa.IsPhysical)
1932 return;
1933
1934 if (localGlobalTF)
1935 {
1936 pAngVel = pAngVel * GetWorldRotation();
1937 }
1938
1939 root.AngularVelocity = pAngVel;
1940 }
1906 1941
1907 1942
1908 /// <summary> 1943 /// <summary>
@@ -3415,15 +3450,15 @@ namespace OpenSim.Region.Framework.Scenes
3415 Force = force; 3450 Force = force;
3416 } 3451 }
3417 3452
3418 public SOPVehicle sopVehicle 3453 public SOPVehicle VehicleParams
3419 { 3454 {
3420 get 3455 get
3421 { 3456 {
3422 return m_vehicle; 3457 return m_vehicleParams;
3423 } 3458 }
3424 set 3459 set
3425 { 3460 {
3426 m_vehicle = value; 3461 m_vehicleParams = value;
3427 } 3462 }
3428 } 3463 }
3429 3464
@@ -3432,10 +3467,10 @@ namespace OpenSim.Region.Framework.Scenes
3432 { 3467 {
3433 get 3468 get
3434 { 3469 {
3435 if (m_vehicle == null) 3470 if (m_vehicleParams == null)
3436 return (int)Vehicle.TYPE_NONE; 3471 return (int)Vehicle.TYPE_NONE;
3437 else 3472 else
3438 return (int)m_vehicle.Type; 3473 return (int)m_vehicleParams.Type;
3439 } 3474 }
3440 set 3475 set
3441 { 3476 {
@@ -3445,7 +3480,7 @@ namespace OpenSim.Region.Framework.Scenes
3445 3480
3446 public void SetVehicleType(int type) 3481 public void SetVehicleType(int type)
3447 { 3482 {
3448 m_vehicle = null; 3483 m_vehicleParams = null;
3449 3484
3450 if (type == (int)Vehicle.TYPE_NONE) 3485 if (type == (int)Vehicle.TYPE_NONE)
3451 { 3486 {
@@ -3453,8 +3488,8 @@ namespace OpenSim.Region.Framework.Scenes
3453 PhysActor.VehicleType = (int)Vehicle.TYPE_NONE; 3488 PhysActor.VehicleType = (int)Vehicle.TYPE_NONE;
3454 return; 3489 return;
3455 } 3490 }
3456 m_vehicle = new SOPVehicle(); 3491 m_vehicleParams = new SOPVehicle();
3457 m_vehicle.ProcessTypeChange((Vehicle)type); 3492 m_vehicleParams.ProcessTypeChange((Vehicle)type);
3458 { 3493 {
3459 if (_parentID ==0 && PhysActor != null) 3494 if (_parentID ==0 && PhysActor != null)
3460 PhysActor.VehicleType = type; 3495 PhysActor.VehicleType = type;
@@ -3464,10 +3499,10 @@ namespace OpenSim.Region.Framework.Scenes
3464 3499
3465 public void SetVehicleFlags(int param, bool remove) 3500 public void SetVehicleFlags(int param, bool remove)
3466 { 3501 {
3467 if (m_vehicle == null) 3502 if (m_vehicleParams == null)
3468 return; 3503 return;
3469 3504
3470 m_vehicle.ProcessVehicleFlags(param, remove); 3505 m_vehicleParams.ProcessVehicleFlags(param, remove);
3471 3506
3472 if (_parentID ==0 && PhysActor != null) 3507 if (_parentID ==0 && PhysActor != null)
3473 { 3508 {
@@ -3477,10 +3512,10 @@ namespace OpenSim.Region.Framework.Scenes
3477 3512
3478 public void SetVehicleFloatParam(int param, float value) 3513 public void SetVehicleFloatParam(int param, float value)
3479 { 3514 {
3480 if (m_vehicle == null) 3515 if (m_vehicleParams == null)
3481 return; 3516 return;
3482 3517
3483 m_vehicle.ProcessFloatVehicleParam((Vehicle)param, value); 3518 m_vehicleParams.ProcessFloatVehicleParam((Vehicle)param, value);
3484 3519
3485 if (_parentID == 0 && PhysActor != null) 3520 if (_parentID == 0 && PhysActor != null)
3486 { 3521 {
@@ -3490,10 +3525,10 @@ namespace OpenSim.Region.Framework.Scenes
3490 3525
3491 public void SetVehicleVectorParam(int param, Vector3 value) 3526 public void SetVehicleVectorParam(int param, Vector3 value)
3492 { 3527 {
3493 if (m_vehicle == null) 3528 if (m_vehicleParams == null)
3494 return; 3529 return;
3495 3530
3496 m_vehicle.ProcessVectorVehicleParam((Vehicle)param, value); 3531 m_vehicleParams.ProcessVectorVehicleParam((Vehicle)param, value);
3497 3532
3498 if (_parentID == 0 && PhysActor != null) 3533 if (_parentID == 0 && PhysActor != null)
3499 { 3534 {
@@ -3503,10 +3538,10 @@ namespace OpenSim.Region.Framework.Scenes
3503 3538
3504 public void SetVehicleRotationParam(int param, Quaternion rotation) 3539 public void SetVehicleRotationParam(int param, Quaternion rotation)
3505 { 3540 {
3506 if (m_vehicle == null) 3541 if (m_vehicleParams == null)
3507 return; 3542 return;
3508 3543
3509 m_vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); 3544 m_vehicleParams.ProcessRotationVehicleParam((Vehicle)param, rotation);
3510 3545
3511 if (_parentID == 0 && PhysActor != null) 3546 if (_parentID == 0 && PhysActor != null)
3512 { 3547 {
@@ -4673,8 +4708,8 @@ namespace OpenSim.Region.Framework.Scenes
4673 if (VolumeDetectActive) // change if not the default only 4708 if (VolumeDetectActive) // change if not the default only
4674 pa.SetVolumeDetect(1); 4709 pa.SetVolumeDetect(1);
4675 4710
4676 if (m_vehicle != null && LocalId == ParentGroup.RootPart.LocalId) 4711 if (m_vehicleParams != null && LocalId == ParentGroup.RootPart.LocalId)
4677 m_vehicle.SetVehicle(pa); 4712 m_vehicleParams.SetVehicle(pa);
4678 4713
4679 // we are going to tell rest of code about physics so better have this here 4714 // we are going to tell rest of code about physics so better have this here
4680 PhysActor = pa; 4715 PhysActor = pa;
@@ -4712,7 +4747,7 @@ namespace OpenSim.Region.Framework.Scenes
4712 pa.RotationalVelocity = rotationalVelocity; 4747 pa.RotationalVelocity = rotationalVelocity;
4713 4748
4714 // if not vehicle and root part apply force and torque 4749 // if not vehicle and root part apply force and torque
4715 if ((m_vehicle == null || m_vehicle.Type == Vehicle.TYPE_NONE) 4750 if ((m_vehicleParams == null || m_vehicleParams.Type == Vehicle.TYPE_NONE)
4716 && LocalId == ParentGroup.RootPart.LocalId) 4751 && LocalId == ParentGroup.RootPart.LocalId)
4717 { 4752 {
4718 pa.Force = Force; 4753 pa.Force = Force;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index e223f47..2372d6b 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -623,20 +623,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
623 623
624 private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader) 624 private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader)
625 { 625 {
626 bool errors = false; 626 SOPVehicle vehicle = SOPVehicle.FromXml2(reader);
627 SOPVehicle _vehicle = new SOPVehicle();
628 627
629 _vehicle.FromXml2(reader, out errors); 628 if (vehicle == null)
630
631 if (errors)
632 { 629 {
633 obj.sopVehicle = null; 630 obj.VehicleParams = null;
634 m_log.DebugFormat( 631 m_log.DebugFormat(
635 "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.", 632 "[SceneObjectSerializer]: Parsing Vehicle for object part {0} {1} encountered errors. Please see earlier log entries.",
636 obj.Name, obj.UUID); 633 obj.Name, obj.UUID);
637 } 634 }
638 else 635 else
639 obj.sopVehicle = _vehicle; 636 {
637 obj.VehicleParams = vehicle;
638 }
640 } 639 }
641 640
642 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 641 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
@@ -1325,8 +1324,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1325 1324
1326 writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower()); 1325 writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower());
1327 1326
1328 if (sop.sopVehicle != null) 1327 if (sop.VehicleParams != null)
1329 sop.sopVehicle.ToXml2(writer); 1328 sop.VehicleParams.ToXml2(writer);
1330 1329
1331 if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType()) 1330 if(sop.PhysicsShapeType != sop.DefaultPhysicsShapeType())
1332 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower()); 1331 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());