aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IHttpRequests.cs7
-rw-r--r--OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs11
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs5
-rw-r--r--OpenSim/Region/Framework/Interfaces/ITerrainModule.cs10
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/KeyframeMotion.cs128
-rw-r--r--OpenSim/Region/Framework/Scenes/SOPVehicle.cs25
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs146
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs4
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs546
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs603
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SceneGraph.cs60
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs242
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs130
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs1019
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs48
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SimStatsReporter.cs182
-rw-r--r--OpenSim/Region/Framework/Scenes/TerrainChannel.cs32
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs41
25 files changed, 338 insertions, 2943 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs b/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs
index 570d31c..4d8409be 100644
--- a/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs
@@ -35,7 +35,9 @@ namespace OpenSim.Services.Interfaces
35 public interface IBakedTextureModule 35 public interface IBakedTextureModule
36 { 36 {
37 WearableCacheItem[] Get(UUID id); 37 WearableCacheItem[] Get(UUID id);
38
38 void Store(UUID id); 39 void Store(UUID id);
40 void Store(UUID id, WearableCacheItem[] WearableCache);
39 void UpdateMeshAvatar(UUID id); 41 void UpdateMeshAvatar(UUID id);
40 } 42 }
41} 43}
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index 50448b4..80f8244 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
@@ -93,15 +93,9 @@ namespace OpenSim.Region.Framework.Interfaces
93 93
94 void EnableChildAgent(ScenePresence agent, GridRegion region); 94 void EnableChildAgent(ScenePresence agent, GridRegion region);
95 95
96<<<<<<< HEAD
97 GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version,
98 out Vector3 newpos, out string reason);
99
100=======
101 GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos); 96 GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos);
102 GridRegion GetObjectDestination(SceneObjectGroup grp, Vector3 targetPosition, out Vector3 newpos); 97 GridRegion GetObjectDestination(SceneObjectGroup grp, Vector3 targetPosition, out Vector3 newpos);
103 bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason); 98 bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason);
104>>>>>>> avn/ubitvar
105 void Cross(SceneObjectGroup sog, Vector3 position, bool silent); 99 void Cross(SceneObjectGroup sog, Vector3 position, bool silent);
106 bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent); 100 bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent);
107 101
diff --git a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs
index 2f9b222..efc9ddc 100644
--- a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs
+++ b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs
@@ -58,8 +58,6 @@ namespace OpenSim.Region.Framework.Interfaces
58 public interface IHttpRequestModule 58 public interface IHttpRequestModule
59 { 59 {
60 UUID MakeHttpRequest(string url, string parameters, string body); 60 UUID MakeHttpRequest(string url, string parameters, string body);
61<<<<<<< HEAD
62
63 /// <summary> 61 /// <summary>
64 /// Starts the http request. 62 /// Starts the http request.
65 /// </summary> 63 /// </summary>
@@ -86,12 +84,7 @@ namespace OpenSim.Region.Framework.Interfaces
86 /// Stop and remove all http requests for the given script. 84 /// Stop and remove all http requests for the given script.
87 /// </summary> 85 /// </summary>
88 /// <param name='id'></param> 86 /// <param name='id'></param>
89 void StopHttpRequestsForScript(UUID id);
90
91=======
92 UUID StartHttpRequest(uint localID, UUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body);
93 void StopHttpRequest(uint m_localID, UUID m_itemID); 87 void StopHttpRequest(uint m_localID, UUID m_itemID);
94>>>>>>> avn/ubitvar
95 IServiceRequest GetNextCompletedRequest(); 88 IServiceRequest GetNextCompletedRequest();
96 void RemoveCompletedRequest(UUID id); 89 void RemoveCompletedRequest(UUID id);
97 } 90 }
diff --git a/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs b/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs
index eb79711..5151567 100644
--- a/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs
@@ -25,24 +25,14 @@
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<<<<<<< HEAD
29using System.Drawing;
30using OpenSim.Framework;
31=======
32using OpenMetaverse; 28using OpenMetaverse;
33using OpenSim.Framework; 29using OpenSim.Framework;
34using System.Drawing; 30using System.Drawing;
35>>>>>>> avn/ubitvar
36 31
37namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
38{ 33{
39 public interface IMapImageUploadModule 34 public interface IMapImageUploadModule
40 { 35 {
41<<<<<<< HEAD
42 void UploadMapTile(IScene scene, Bitmap mapTile);
43 }
44}
45=======
46 /// <summary> 36 /// <summary>
47 /// Upload a new maptile 37 /// Upload a new maptile
48 /// </summary> 38 /// </summary>
@@ -50,4 +40,3 @@ namespace OpenSim.Region.Framework.Interfaces
50 void UploadMapTile(IScene scene, Bitmap mapTile); 40 void UploadMapTile(IScene scene, Bitmap mapTile);
51 } 41 }
52} 42}
53>>>>>>> avn/ubitvar
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
index 445342d..99bc87d 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
@@ -127,12 +127,7 @@ namespace OpenSim.Region.Framework.Interfaces
127 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param> 127 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
128 /// <param name="options"> 128 /// <param name="options">
129 /// Dictionary of options. 129 /// Dictionary of options.
130<<<<<<< HEAD
131 /// </param> 130 /// </param>
132 void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string,object> options); 131 void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string,object> options);
133=======
134 /// </param>
135 void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options);
136>>>>>>> avn/ubitvar
137 } 132 }
138} 133}
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
index ff18519..472e5a5d 100644
--- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
@@ -28,11 +28,8 @@ using System.IO;
28 28
29using OpenSim.Framework; 29using OpenSim.Framework;
30 30
31<<<<<<< HEAD
32=======
33using System.IO; 31using System.IO;
34using OpenSim.Framework; 32using OpenSim.Framework;
35>>>>>>> avn/ubitvar
36using OpenMetaverse; 33using OpenMetaverse;
37 34
38namespace OpenSim.Region.Framework.Interfaces 35namespace OpenSim.Region.Framework.Interfaces
@@ -56,12 +53,6 @@ namespace OpenSim.Region.Framework.Interfaces
56 void PushTerrain(IClientAPI pClient); 53 void PushTerrain(IClientAPI pClient);
57 54
58 /// <summary> 55 /// <summary>
59 /// When a client initially connects, all the terrain must be pushed to the viewer.
60 /// This call causes all the terrain patches to be sent to the client.
61 /// </summary>
62 void PushTerrain(IClientAPI pClient);
63
64 /// <summary>
65 /// Load a terrain from a stream. 56 /// Load a terrain from a stream.
66 /// </summary> 57 /// </summary>
67 /// <param name="filename"> 58 /// <param name="filename">
@@ -69,7 +60,6 @@ namespace OpenSim.Region.Framework.Interfaces
69 /// </param> 60 /// </param>
70 /// <param name="stream"></param> 61 /// <param name="stream"></param>
71 void LoadFromStream(string filename, Stream stream); 62 void LoadFromStream(string filename, Stream stream);
72 void LoadFromStream(string filename, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement, Stream stream);
73 void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); 63 void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap);
74 void LoadFromStream(string filename, Vector3 displacement, 64 void LoadFromStream(string filename, Vector3 displacement,
75 float radianRotation, Vector2 rotationDisplacement, Stream stream); 65 float radianRotation, Vector2 rotationDisplacement, Stream stream);
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
index 08dc3e3..e9cf4ad 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
@@ -37,10 +37,6 @@ namespace OpenSim.Region.Framework.Interfaces
37 /// </summary> 37 /// </summary>
38 void GenerateMaptile(); 38 void GenerateMaptile();
39 List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag); 39 List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag);
40<<<<<<< HEAD
41 MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag);
42=======
43 void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag); 40 void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag);
44>>>>>>> avn/ubitvar
45 } 41 }
46} 42}
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
index 2b95a4c..c00190a 100644
--- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
+++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
@@ -351,26 +351,7 @@ namespace OpenSim.Region.Framework.Scenes
351 m_group = grp; 351 m_group = grp;
352 m_scene = grp.Scene; 352 m_scene = grp.Scene;
353 353
354<<<<<<< HEAD 354
355 Vector3 grppos = grp.AbsolutePosition;
356 Vector3 offset = grppos - m_serializedPosition;
357 // avoid doing it more than once
358 // current this will happen dragging a prim to other region
359 m_serializedPosition = grppos;
360
361 m_basePosition += offset;
362 m_nextPosition += offset;
363
364 m_currentFrame.StartPosition += offset;
365 m_currentFrame.Position += offset;
366
367 for (int i = 0; i < m_frames.Count; i++)
368 {
369 Keyframe k = m_frames[i];
370 k.StartPosition += offset;
371 k.Position += offset;
372 m_frames[i]=k;
373=======
374 lock (m_frames) 355 lock (m_frames)
375 { 356 {
376 Vector3 grppos = grp.AbsolutePosition; 357 Vector3 grppos = grp.AbsolutePosition;
@@ -390,7 +371,6 @@ namespace OpenSim.Region.Framework.Scenes
390 k.Position += offset; 371 k.Position += offset;
391 m_frames[i] = k; 372 m_frames[i] = k;
392 } 373 }
393>>>>>>> avn/ubitvar
394 } 374 }
395 375
396 if (m_running) 376 if (m_running)
@@ -708,29 +688,6 @@ namespace OpenSim.Region.Framework.Scenes
708 688
709 if (m_frames.Count == 0) 689 if (m_frames.Count == 0)
710 { 690 {
711<<<<<<< HEAD
712 if (!m_running) return;
713
714 GetNextList();
715
716 if (m_frames.Count == 0)
717 {
718 Stop();
719// Scene scene = m_group.Scene;
720//
721// IScriptModule[] scriptModules = scene.RequestModuleInterfaces<IScriptModule>();
722// foreach (IScriptModule m in scriptModules)
723// {
724// if (m == null)
725// continue;
726// m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]);
727// }
728
729 m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId);
730
731 return;
732 }
733=======
734 lock (m_frames) 691 lock (m_frames)
735 { 692 {
736 GetNextList(); 693 GetNextList();
@@ -738,17 +695,7 @@ namespace OpenSim.Region.Framework.Scenes
738 if (m_frames.Count == 0) 695 if (m_frames.Count == 0)
739 { 696 {
740 Done(); 697 Done();
741 Scene scene = m_group.Scene; 698 m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId);
742
743 IScriptModule[] scriptModules = scene.RequestModuleInterfaces<IScriptModule>();
744 foreach (IScriptModule m in scriptModules)
745 {
746 if (m == null)
747 continue;
748 m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]);
749 }
750>>>>>>> avn/ubitvar
751
752 return; 699 return;
753 } 700 }
754 701
@@ -792,21 +739,13 @@ namespace OpenSim.Region.Framework.Scenes
792 float completed = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal; 739 float completed = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal;
793 bool lastStep = m_currentFrame.TimeMS <= tickDuration; 740 bool lastStep = m_currentFrame.TimeMS <= tickDuration;
794 741
795 Vector3 positionThisStep = m_currentFrame.StartPosition + (m_currentFrame.Position.Value - m_currentFrame.StartPosition) * completed; 742 Vector3 v = (Vector3)m_currentFrame.Position - m_group.AbsolutePosition;
796 Vector3 motionThisStep = positionThisStep - m_group.AbsolutePosition; 743 Vector3 motionThisFrame = v / (float)remainingSteps;
744 v = v * 1000 / m_currentFrame.TimeMS;
797 745
798<<<<<<< HEAD
799 float mag = Vector3.Mag(motionThisStep);
800
801 if ((mag >= 0.02f) || lastStep)
802 {
803 m_nextPosition = m_group.AbsolutePosition + motionThisStep;
804 m_group.AbsolutePosition = m_nextPosition;
805=======
806 m_nextPosition = m_group.AbsolutePosition + motionThisFrame; 746 m_nextPosition = m_group.AbsolutePosition + motionThisFrame;
807 747
808 if (Vector3.Mag(motionThisFrame) >= 0.05f) 748 if (Vector3.Mag(motionThisFrame) >= 0.05f)
809>>>>>>> avn/ubitvar
810 update = true; 749 update = true;
811 750
812 //int totalSteps = m_currentFrame.TimeTotal / (int)tickDuration; 751 //int totalSteps = m_currentFrame.TimeTotal / (int)tickDuration;
@@ -819,45 +758,6 @@ namespace OpenSim.Region.Framework.Scenes
819 758
820 Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed); 759 Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed);
821 step.Normalize(); 760 step.Normalize();
822<<<<<<< HEAD
823/* use simpler change detection
824* float angle = 0;
825
826 float aa = current.X * current.X + current.Y * current.Y + current.Z * current.Z + current.W * current.W;
827 float bb = step.X * step.X + step.Y * step.Y + step.Z * step.Z + step.W * step.W;
828 float aa_bb = aa * bb;
829
830 if (aa_bb == 0)
831 {
832 angle = 0;
833 }
834 else
835 {
836 float ab = current.X * step.X +
837 current.Y * step.Y +
838 current.Z * step.Z +
839 current.W * step.W;
840 float q = (ab * ab) / aa_bb;
841
842 if (q > 1.0f)
843 {
844 angle = 0;
845 }
846 else
847 {
848 angle = (float)Math.Acos(2 * q - 1);
849 }
850 }
851
852 if (angle > 0.01f)
853*/
854 if(Math.Abs(step.X - current.X) > 0.001f
855 || Math.Abs(step.Y - current.Y) > 0.001f
856 || Math.Abs(step.Z - current.Z) > 0.001f
857 || lastStep)
858 // assuming w is a dependente var
859
860=======
861 /* use simpler change detection 761 /* use simpler change detection
862 * float angle = 0; 762 * float angle = 0;
863 763
@@ -893,9 +793,8 @@ namespace OpenSim.Region.Framework.Scenes
893 || Math.Abs(step.Y - current.Y) > 0.001f 793 || Math.Abs(step.Y - current.Y) > 0.001f
894 || Math.Abs(step.Z - current.Z) > 0.001f) 794 || Math.Abs(step.Z - current.Z) > 0.001f)
895 // assuming w is a dependente var 795 // assuming w is a dependente var
896>>>>>>> avn/ubitvar
897 { 796 {
898 // m_group.UpdateGroupRotationR(step); 797// m_group.UpdateGroupRotationR(step);
899 m_group.RootPart.RotationOffset = step; 798 m_group.RootPart.RotationOffset = step;
900 799
901 //m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2); 800 //m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2);
@@ -922,22 +821,15 @@ namespace OpenSim.Region.Framework.Scenes
922 821
923 SceneObjectGroup tmp = m_group; 822 SceneObjectGroup tmp = m_group;
924 m_group = null; 823 m_group = null;
925 if (!m_selected && tmp != null) 824
926 m_serializedPosition = tmp.AbsolutePosition;
927<<<<<<< HEAD
928=======
929 fmt.Serialize(ms, this);
930 m_group = tmp;
931 if (!timerWasStopped && m_running && !m_waitingCrossing)
932 StartTimer();
933>>>>>>> avn/ubitvar
934
935 using (MemoryStream ms = new MemoryStream()) 825 using (MemoryStream ms = new MemoryStream())
936 { 826 {
937 BinaryFormatter fmt = new BinaryFormatter(); 827 BinaryFormatter fmt = new BinaryFormatter();
828 if (!m_selected && tmp != null)
829 m_serializedPosition = tmp.AbsolutePosition;
938 fmt.Serialize(ms, this); 830 fmt.Serialize(ms, this);
939 m_group = tmp; 831 m_group = tmp;
940 if (m_running && !m_waitingCrossing) 832 if (!timerWasStopped && m_running && !m_waitingCrossing)
941 StartTimer(); 833 StartTimer();
942 834
943 return ms.ToArray(); 835 return ms.ToArray();
diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
index 9cb901a..b617f52 100644
--- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
+++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
@@ -487,7 +487,7 @@ namespace OpenSim.Region.Framework.Scenes
487 487
488 488
489 489
490 XmlTextReader reader; 490 XmlReader reader;
491 491
492 private int XRint() 492 private int XRint()
493 { 493 {
@@ -524,7 +524,7 @@ namespace OpenSim.Region.Framework.Scenes
524 524
525 public static bool EReadProcessors( 525 public static bool EReadProcessors(
526 Dictionary<string, Action> processors, 526 Dictionary<string, Action> processors,
527 XmlTextReader xtr) 527 XmlReader xtr)
528 { 528 {
529 bool errors = false; 529 bool errors = false;
530 530
@@ -564,14 +564,15 @@ namespace OpenSim.Region.Framework.Scenes
564 564
565 public string ToXml2() 565 public string ToXml2()
566 { 566 {
567 MemoryStream ms = new MemoryStream(512); 567 using (StringWriter sw = new StringWriter())
568 UTF8Encoding enc = new UTF8Encoding(); 568 {
569 XmlTextWriter xwriter = new XmlTextWriter(ms, enc); 569 using (XmlTextWriter xwriter = new XmlTextWriter(sw))
570 ToXml2(xwriter); 570 {
571 xwriter.Flush(); 571 ToXml2(xwriter);
572 string s = ms.GetStreamString(); 572 }
573 xwriter.Close(); 573
574 return s; 574 return sw.ToString();
575 }
575 } 576 }
576 577
577 public static SOPVehicle FromXml2(string text) 578 public static SOPVehicle FromXml2(string text)
@@ -598,7 +599,7 @@ namespace OpenSim.Region.Framework.Scenes
598 return v; 599 return v;
599 } 600 }
600 601
601 public static SOPVehicle FromXml2(XmlTextReader reader) 602 public static SOPVehicle FromXml2(XmlReader reader)
602 { 603 {
603 SOPVehicle vehicle = new SOPVehicle(); 604 SOPVehicle vehicle = new SOPVehicle();
604 605
@@ -611,7 +612,7 @@ namespace OpenSim.Region.Framework.Scenes
611 return vehicle; 612 return vehicle;
612 } 613 }
613 614
614 private void FromXml2(XmlTextReader _reader, out bool errors) 615 private void FromXml2(XmlReader _reader, out bool errors)
615 { 616 {
616 errors = false; 617 errors = false;
617 reader = _reader; 618 reader = _reader;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index e289666..edb881f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -881,14 +881,22 @@ namespace OpenSim.Region.Framework.Scenes
881 return; 881 return;
882 } 882 }
883 883
884<<<<<<< HEAD
885 if (newName == String.Empty) 884 if (newName == String.Empty)
886 newName = item.Name; 885 newName = item.Name;
887=======
888 if (newName == null) newName = item.Name;
889 886
890 AssetBase asset = AssetService.Get(item.AssetID.ToString()); 887 AssetBase asset = AssetService.Get(item.AssetID.ToString());
891>>>>>>> avn/ubitvar 888
889 if (asset != null)
890 {
891 if (newName != String.Empty)
892 {
893 asset.Name = newName;
894 }
895 else
896 {
897 newName = item.Name;
898 }
899
892 900
893 if (remoteClient.AgentId == oldAgentID 901 if (remoteClient.AgentId == oldAgentID
894 || (LibraryService != null 902 || (LibraryService != null
@@ -916,6 +924,13 @@ namespace OpenSim.Region.Framework.Scenes
916 } 924 }
917 } 925 }
918 } 926 }
927 else
928 {
929 m_log.ErrorFormat(
930 "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found",
931 item.Name, item.AssetID);
932 }
933 }
919 934
920 /// <summary> 935 /// <summary>
921 /// Create a new asset data structure. 936 /// Create a new asset data structure.
@@ -982,31 +997,12 @@ namespace OpenSim.Region.Framework.Scenes
982 public void CreateNewInventoryItem( 997 public void CreateNewInventoryItem(
983 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, 998 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
984 string name, string description, uint flags, uint callbackID, 999 string name, string description, uint flags, uint callbackID,
985<<<<<<< HEAD
986 UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask, int creationDate) 1000 UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask, int creationDate)
987 { 1001 {
988 CreateNewInventoryItem( 1002 CreateNewInventoryItem(
989 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, assetID, assetType, invType, 1003 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, assetID, assetType, invType,
990 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, 1004 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0,
991 creationDate, true); 1005 creationDate, true);
992=======
993 AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID)
994 {
995 CreateNewInventoryItem(
996 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType,
997 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate, transationID);
998 }
999
1000
1001 private void CreateNewInventoryItem(
1002 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
1003 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
1004 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
1005 {
1006 CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID,
1007 name, description, flags, callbackID, asset, invType,
1008 baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero);
1009>>>>>>> avn/ubitvar
1010 } 1006 }
1011 1007
1012 /// <summary> 1008 /// <summary>
@@ -1030,14 +1026,9 @@ namespace OpenSim.Region.Framework.Scenes
1030 /// <param name="creationDate">Unix timestamp at which this item was created.</param> 1026 /// <param name="creationDate">Unix timestamp at which this item was created.</param>
1031 private void CreateNewInventoryItem( 1027 private void CreateNewInventoryItem(
1032 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, 1028 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
1033<<<<<<< HEAD
1034 string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType, 1029 string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType,
1035 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate, 1030 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,
1036 bool assetUpload) 1031 bool assetUpload)
1037=======
1038 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
1039 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID)
1040>>>>>>> avn/ubitvar
1041 { 1032 {
1042 InventoryItemBase item = new InventoryItemBase(); 1033 InventoryItemBase item = new InventoryItemBase();
1043 item.Owner = remoteClient.AgentId; 1034 item.Owner = remoteClient.AgentId;
@@ -1058,17 +1049,13 @@ namespace OpenSim.Region.Framework.Scenes
1058 item.BasePermissions = baseMask; 1049 item.BasePermissions = baseMask;
1059 item.CreationDate = creationDate; 1050 item.CreationDate = creationDate;
1060 1051
1061<<<<<<< HEAD
1062 if (AddInventoryItem(item, assetUpload))
1063=======
1064 // special AnimationSet case 1052 // special AnimationSet case
1065 if (item.InvType == (int)CustomInventoryType.AnimationSet) 1053 if (item.InvType == (int)CustomInventoryType.AnimationSet)
1066 AnimationSet.enforceItemPermitions(item,true); 1054 AnimationSet.enforceItemPermitions(item,true);
1067 1055
1068 if (AddInventoryItem(item)) 1056 if (AddInventoryItem(item))
1069>>>>>>> avn/ubitvar
1070 { 1057 {
1071 remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID); 1058 remoteClient.SendInventoryItemCreateUpdate(item, callbackID);
1072 } 1059 }
1073 else 1060 else
1074 { 1061 {
@@ -1284,7 +1271,6 @@ namespace OpenSim.Region.Framework.Scenes
1284 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 1271 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
1285 if (taskItem.InvType == (int)InventoryType.Object) 1272 if (taskItem.InvType == (int)InventoryType.Object)
1286 { 1273 {
1287<<<<<<< HEAD
1288 // Bake the new base permissions from folded permissions 1274 // Bake the new base permissions from folded permissions
1289 // The folded perms are in the lowest 3 bits of the current perms 1275 // The folded perms are in the lowest 3 bits of the current perms
1290 // We use base permissions here to avoid baking the "Locked" status 1276 // We use base permissions here to avoid baking the "Locked" status
@@ -1296,13 +1282,6 @@ namespace OpenSim.Region.Framework.Scenes
1296 agentItem.BasePermissions = perms | (uint)PermissionMask.Move; 1282 agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
1297 // Newly given items cannot be "locked" on rez. Make sure by 1283 // Newly given items cannot be "locked" on rez. Make sure by
1298 // setting current equal to base. 1284 // setting current equal to base.
1299=======
1300 uint perms = taskItem.BasePermissions & taskItem.NextPermissions;
1301 PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms);
1302// agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
1303// agentItem.CurrentPermissions = agentItem.BasePermissions;
1304 agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
1305>>>>>>> avn/ubitvar
1306 } 1285 }
1307 1286
1308 agentItem.CurrentPermissions = agentItem.BasePermissions; 1287 agentItem.CurrentPermissions = agentItem.BasePermissions;
@@ -1577,12 +1556,12 @@ namespace OpenSim.Region.Framework.Scenes
1577 1556
1578 public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) 1557 public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items)
1579 { 1558 {
1580<<<<<<< HEAD 1559
1581 ScenePresence avatar; 1560 ScenePresence avatar;
1582 IClientAPI remoteClient = null; 1561 IClientAPI remoteClient = null;
1583 if (TryGetScenePresence(destID, out avatar)) 1562 if (TryGetScenePresence(destID, out avatar))
1584 remoteClient = avatar.ControllingClient; 1563 remoteClient = avatar.ControllingClient;
1585======= 1564// ????
1586 SceneObjectPart destPart = GetSceneObjectPart(destID); 1565 SceneObjectPart destPart = GetSceneObjectPart(destID);
1587 if (destPart != null) // Move into a prim 1566 if (destPart != null) // Move into a prim
1588 { 1567 {
@@ -1590,7 +1569,7 @@ namespace OpenSim.Region.Framework.Scenes
1590 MoveTaskInventoryItem(destID, host, itemID); 1569 MoveTaskInventoryItem(destID, host, itemID);
1591 return destID; // Prim folder ID == prim ID 1570 return destID; // Prim folder ID == prim ID
1592 } 1571 }
1593>>>>>>> avn/ubitvar 1572// /????
1594 1573
1595 InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); 1574 InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID);
1596 1575
@@ -2156,14 +2135,16 @@ namespace OpenSim.Region.Framework.Scenes
2156 List<uint> deleteIDs = new List<uint>(); 2135 List<uint> deleteIDs = new List<uint>();
2157 List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>(); 2136 List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>();
2158 List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); 2137 List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>();
2138
2139 // Start with true for both, then remove the flags if objects
2140 // that we can't derez are part of the selection
2141 bool permissionToTake = true;
2142 bool permissionToTakeCopy = true;
2143 bool permissionToDelete = true;
2159 2144
2160 foreach (uint localID in localIDs) 2145 foreach (uint localID in localIDs)
2161 { 2146 {
2162 // Start with true for both, then remove the flags if objects 2147
2163 // that we can't derez are part of the selection
2164 bool permissionToTake = true;
2165 bool permissionToTakeCopy = true;
2166 bool permissionToDelete = true;
2167 2148
2168 // Invalid id 2149 // Invalid id
2169 SceneObjectPart part = GetSceneObjectPart(localID); 2150 SceneObjectPart part = GetSceneObjectPart(localID);
@@ -2287,27 +2268,15 @@ namespace OpenSim.Region.Framework.Scenes
2287 } 2268 }
2288 } 2269 }
2289 2270
2290<<<<<<< HEAD 2271 SendKillObject(deleteIDs);
2291 // OK, we're done with permissions. Let's check if any part of the code prevents the objects from being deleted
2292 bool canDelete = EventManager.TriggerDeRezRequested(remoteClient, deleteGroups, action);
2293
2294 if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete))
2295=======
2296 SendKillObject(deleteIDs);
2297 2272
2298 if (deleteGroups.Count > 0) 2273 if (deleteGroups.Count > 0)
2299>>>>>>> avn/ubitvar
2300 { 2274 {
2301 foreach (SceneObjectGroup g in deleteGroups) 2275 foreach (SceneObjectGroup g in deleteGroups)
2302 deleteIDs.Remove(g.LocalId); 2276 deleteIDs.Remove(g.LocalId);
2303 2277
2304 m_asyncSceneObjectDeleter.DeleteToInventory( 2278 m_asyncSceneObjectDeleter.DeleteToInventory(
2305 action, destinationID, deleteGroups, remoteClient, 2279 action, destinationID, deleteGroups, remoteClient,
2306<<<<<<< HEAD
2307 permissionToDelete && canDelete);
2308 }
2309 else if (permissionToDelete && canDelete)
2310=======
2311 true); 2280 true);
2312 } 2281 }
2313 if (takeGroups.Count > 0) 2282 if (takeGroups.Count > 0)
@@ -2317,7 +2286,6 @@ namespace OpenSim.Region.Framework.Scenes
2317 false); 2286 false);
2318 } 2287 }
2319 if (deleteIDs.Count > 0) 2288 if (deleteIDs.Count > 0)
2320>>>>>>> avn/ubitvar
2321 { 2289 {
2322 foreach (SceneObjectGroup g in deleteGroups) 2290 foreach (SceneObjectGroup g in deleteGroups)
2323 DeleteSceneObject(g, true); 2291 DeleteSceneObject(g, true);
@@ -2361,7 +2329,7 @@ namespace OpenSim.Region.Framework.Scenes
2361 item.AssetType = asset.Type; 2329 item.AssetType = asset.Type;
2362 item.InvType = (int)InventoryType.Object; 2330 item.InvType = (int)InventoryType.Object;
2363 2331
2364 InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.Object); 2332 InventoryFolderBase folder = InventoryService.GetFolderForType(remoteClient.AgentId, FolderType.Object);
2365 if (folder != null) 2333 if (folder != null)
2366 item.Folder = folder.ID; 2334 item.Folder = folder.ID;
2367 else // oopsies 2335 else // oopsies
@@ -2435,34 +2403,10 @@ namespace OpenSim.Region.Framework.Scenes
2435 2403
2436 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(assetData)); 2404 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(assetData));
2437 2405
2438<<<<<<< HEAD
2439 try 2406 try
2440=======
2441 if (e == null || attachment) // Single
2442 {
2443 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
2444/*
2445 if (!attachment)
2446 {
2447 g.RootPart.AttachPoint = g.RootPart.Shape.State;
2448 g.RootPart.AttachedPos = g.AbsolutePosition;
2449 g.RootPart.AttachRotation = g.GroupRotation;
2450 if (g.RootPart.Shape.PCode != (byte)PCode.NewTree &&
2451 g.RootPart.Shape.PCode != (byte)PCode.Tree)
2452 g.RootPart.Shape.State = 0;
2453 }
2454*/
2455 objlist.Add(g);
2456 veclist.Add(new Vector3(0, 0, 0));
2457 bbox = g.GetAxisAlignedBoundingBox(out offsetHeight);
2458 return true;
2459 }
2460 else
2461>>>>>>> avn/ubitvar
2462 { 2407 {
2463 using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null)) 2408 using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null))
2464 { 2409 {
2465<<<<<<< HEAD
2466 using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment })) 2410 using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
2467 { 2411 {
2468 reader.Read(); 2412 reader.Read();
@@ -2481,7 +2425,7 @@ namespace OpenSim.Region.Framework.Scenes
2481 Util.LogFailedXML("[AGENT INVENTORY]:", xmlData); 2425 Util.LogFailedXML("[AGENT INVENTORY]:", xmlData);
2482 g = null; 2426 g = null;
2483 } 2427 }
2484 2428
2485 if (g != null) 2429 if (g != null)
2486 { 2430 {
2487 objlist.Add(g); 2431 objlist.Add(g);
@@ -2492,7 +2436,7 @@ namespace OpenSim.Region.Framework.Scenes
2492 return true; 2436 return true;
2493 } 2437 }
2494 else 2438 else
2495 { 2439 {
2496 XmlDocument doc = new XmlDocument(); 2440 XmlDocument doc = new XmlDocument();
2497 doc.LoadXml(xmlData); 2441 doc.LoadXml(xmlData);
2498 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); 2442 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
@@ -2526,28 +2470,6 @@ namespace OpenSim.Region.Framework.Scenes
2526 return false; 2470 return false;
2527 } 2471 }
2528 } 2472 }
2529=======
2530 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
2531/*
2532 g.RootPart.AttachPoint = g.RootPart.Shape.State;
2533 g.RootPart.AttachedPos = g.AbsolutePosition;
2534 g.RootPart.AttachRotation = g.GroupRotation;
2535 if (g.RootPart.Shape.PCode != (byte)PCode.NewTree &&
2536 g.RootPart.Shape.PCode != (byte)PCode.Tree)
2537 g.RootPart.Shape.State = 0;
2538*/
2539 objlist.Add(g);
2540
2541 XmlElement el = (XmlElement)n;
2542 string rawX = el.GetAttribute("offsetx");
2543 string rawY = el.GetAttribute("offsety");
2544 string rawZ = el.GetAttribute("offsetz");
2545
2546 float x = Convert.ToSingle(rawX);
2547 float y = Convert.ToSingle(rawY);
2548 float z = Convert.ToSingle(rawZ);
2549 veclist.Add(new Vector3(x, y, z));
2550>>>>>>> avn/ubitvar
2551 } 2473 }
2552 } 2474 }
2553 catch (Exception e) 2475 catch (Exception e)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 3d9c028..20767e5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -551,7 +551,6 @@ namespace OpenSim.Region.Framework.Scenes
551 551
552 void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) 552 void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
553 { 553 {
554<<<<<<< HEAD
555 try 554 try
556 { 555 {
557 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); 556 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
@@ -562,10 +561,7 @@ namespace OpenSim.Region.Framework.Scenes
562 string.Format( 561 string.Format(
563 "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e)); 562 "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e));
564 } 563 }
565=======
566 Thread.Sleep(20); 564 Thread.Sleep(20);
567 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
568>>>>>>> avn/ubitvar
569 } 565 }
570 566
571 void SendInventoryComplete(IAsyncResult iar) 567 void SendInventoryComplete(IAsyncResult iar)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index deb8d39..c1da7fa 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -61,8 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
61 { 61 {
62 private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; 62 private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L;
63 private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; 63 private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L;
64 64
65 public const int m_defaultNumberFramesStored = 10;
66 65
67 public delegate void SynchronizeSceneHandler(Scene scene); 66 public delegate void SynchronizeSceneHandler(Scene scene);
68 67
@@ -105,15 +104,10 @@ namespace OpenSim.Region.Framework.Scenes
105 /// <summary> 104 /// <summary>
106 /// If false then physical objects are disabled, though collisions will continue as normal. 105 /// If false then physical objects are disabled, though collisions will continue as normal.
107 /// </summary> 106 /// </summary>
108<<<<<<< HEAD 107
109 public bool PhysicsEnabled
110 {
111 get
112=======
113 public bool PhysicsEnabled 108 public bool PhysicsEnabled
114 { 109 {
115 get 110 get
116>>>>>>> avn/ubitvar
117 { 111 {
118 return m_physicsEnabled; 112 return m_physicsEnabled;
119 } 113 }
@@ -222,7 +216,7 @@ namespace OpenSim.Region.Framework.Scenes
222 /// <summary> 216 /// <summary>
223 /// Maximum value of the size of a physical prim in each axis 217 /// Maximum value of the size of a physical prim in each axis
224 /// </summary> 218 /// </summary>
225 public float m_maxPhys = 64; 219 public float m_maxPhys = 10;
226 220
227 /// <summary> 221 /// <summary>
228 /// Max prims an object will hold 222 /// Max prims an object will hold
@@ -234,16 +228,15 @@ namespace OpenSim.Region.Framework.Scenes
234 public bool m_allowScriptCrossings = true; 228 public bool m_allowScriptCrossings = true;
235 229
236 /// <summary> 230 /// <summary>
237<<<<<<< HEAD 231
238 /// Can avatars cross from and to this region? 232 /// Can avatars cross from and to this region?
239 /// </summary> 233 /// </summary>
240 public bool AllowAvatarCrossing { get; set; } 234 public bool AllowAvatarCrossing { get; set; }
241======= 235
242 /// Max prims an Physical object will hold 236 /// Max prims an Physical object will hold
243 /// </summary> 237 /// </summary>
244 /// 238 ///
245 public int m_linksetPhysCapacity = 0; 239 public int m_linksetPhysCapacity = 0;
246>>>>>>> avn/ubitvar
247 240
248 public bool m_useFlySlow; 241 public bool m_useFlySlow;
249 public bool m_useTrashOnDelete = true; 242 public bool m_useTrashOnDelete = true;
@@ -278,7 +271,7 @@ namespace OpenSim.Region.Framework.Scenes
278 /// </summary> 271 /// </summary>
279 public int ChildTerseUpdatePeriod { get; set; } 272 public int ChildTerseUpdatePeriod { get; set; }
280 273
281 protected float m_defaultDrawDistance = 255.0f; 274 protected float m_defaultDrawDistance = 255f;
282 public float DefaultDrawDistance 275 public float DefaultDrawDistance
283 { 276 {
284 // get { return m_defaultDrawDistance; } 277 // get { return m_defaultDrawDistance; }
@@ -361,17 +354,6 @@ namespace OpenSim.Region.Framework.Scenes
361 private Dictionary<string, string> m_extraSettings; 354 private Dictionary<string, string> m_extraSettings;
362 355
363 /// <summary> 356 /// <summary>
364 /// If true then the next time the scene loop is activated, updates will be performed by firing of a timer
365 /// rather than on a single thread that sleeps.
366 /// </summary>
367 public bool UpdateOnTimer { get; set; }
368
369 /// <summary>
370 /// Only used if we are updating scene on a timer rather than sleeping a thread.
371 /// </summary>
372 private Timer m_sceneUpdateTimer;
373
374 /// <summary>
375 /// Current scene frame number 357 /// Current scene frame number
376 /// </summary> 358 /// </summary>
377 public uint Frame 359 public uint Frame
@@ -386,23 +368,14 @@ namespace OpenSim.Region.Framework.Scenes
386 public uint MaintenanceRun { get; private set; } 368 public uint MaintenanceRun { get; private set; }
387 369
388 /// <summary> 370 /// <summary>
389 /// The minimum length of time in milliseconds that will be taken for a scene frame. If the frame takes less time then we 371 /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we
390 /// will sleep for the remaining period. 372 /// will sleep for the remaining period.
391 /// </summary> 373 /// </summary>
392 /// <remarks> 374 /// <remarks>
393 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations 375 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations
394 /// occur too quickly (viewer 1) or with even more slide (viewer 2). 376 /// occur too quickly (viewer 1) or with even more slide (viewer 2).
395 /// </remarks> 377 /// </remarks>
396 public int MinFrameTicks 378 public float MinFrameTime { get; private set; }
397 {
398 get { return m_minFrameTicks; }
399 private set
400 {
401 m_minFrameTicks = value;
402 MinFrameSeconds = (float)m_minFrameTicks / 1000;
403 }
404 }
405 private int m_minFrameTicks;
406 379
407 /// <summary> 380 /// <summary>
408 /// The minimum length of time in seconds that will be taken for a scene frame. 381 /// The minimum length of time in seconds that will be taken for a scene frame.
@@ -410,17 +383,7 @@ namespace OpenSim.Region.Framework.Scenes
410 /// <remarks> 383 /// <remarks>
411 /// Always derived from MinFrameTicks. 384 /// Always derived from MinFrameTicks.
412 /// </remarks> 385 /// </remarks>
413 public float MinFrameSeconds { get; private set; } 386 public float MinMaintenanceTime { get; private set; }
414
415 /// <summary>
416 /// The minimum length of time in milliseconds that will be taken for a scene frame. If the frame takes less time then we
417 /// will sleep for the remaining period.
418 /// </summary>
419 /// <remarks>
420 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations
421 /// occur too quickly (viewer 1) or with even more slide (viewer 2).
422 /// </remarks>
423 public int MinMaintenanceTicks { get; set; }
424 387
425 private int m_update_physics = 1; 388 private int m_update_physics = 1;
426 private int m_update_entitymovement = 1; 389 private int m_update_entitymovement = 1;
@@ -428,13 +391,10 @@ namespace OpenSim.Region.Framework.Scenes
428 private int m_update_presences = 1; // Update scene presence movements 391 private int m_update_presences = 1; // Update scene presence movements
429 private int m_update_events = 1; 392 private int m_update_events = 1;
430 private int m_update_backup = 200; 393 private int m_update_backup = 200;
431<<<<<<< HEAD 394
432 private int m_update_terrain = 50;
433 // private int m_update_land = 1;
434=======
435 private int m_update_terrain = 1000; 395 private int m_update_terrain = 1000;
436 private int m_update_land = 10; 396 private int m_update_land = 10;
437>>>>>>> avn/ubitvar 397
438 private int m_update_coarse_locations = 50; 398 private int m_update_coarse_locations = 50;
439 private int m_update_temp_cleaning = 180; 399 private int m_update_temp_cleaning = 180;
440 400
@@ -559,13 +519,12 @@ namespace OpenSim.Region.Framework.Scenes
559 } 519 }
560 private volatile bool m_active; 520 private volatile bool m_active;
561 521
562<<<<<<< HEAD
563 /// <summary> 522 /// <summary>
564 /// If true then updates are running. This may be true for a short period after a scene is de-activated. 523 /// If true then updates are running. This may be true for a short period after a scene is de-activated.
565 /// </summary> 524 /// </summary>
566 public bool IsRunning { get { return m_isRunning; } } 525 public bool IsRunning { get { return m_isRunning; } }
567 private volatile bool m_isRunning; 526 private volatile bool m_isRunning;
568======= 527
569// private int m_lastUpdate; 528// private int m_lastUpdate;
570 private bool m_firstHeartbeat = true; 529 private bool m_firstHeartbeat = true;
571 530
@@ -574,7 +533,7 @@ namespace OpenSim.Region.Framework.Scenes
574 private double m_reprioritizationInterval = 5000.0; 533 private double m_reprioritizationInterval = 5000.0;
575 private double m_rootReprioritizationDistance = 10.0; 534 private double m_rootReprioritizationDistance = 10.0;
576 private double m_childReprioritizationDistance = 20.0; 535 private double m_childReprioritizationDistance = 20.0;
577>>>>>>> avn/ubitvar 536
578 537
579 private Timer m_mapGenerationTimer = new Timer(); 538 private Timer m_mapGenerationTimer = new Timer();
580 private bool m_generateMaptiles; 539 private bool m_generateMaptiles;
@@ -913,8 +872,8 @@ namespace OpenSim.Region.Framework.Scenes
913 : this(regInfo, physicsScene) 872 : this(regInfo, physicsScene)
914 { 873 {
915 m_config = config; 874 m_config = config;
916 MinFrameTicks = 89; 875 MinFrameTime = 0.089f;
917 MinMaintenanceTicks = 1000; 876 MinMaintenanceTime = 1;
918 SeeIntoRegion = true; 877 SeeIntoRegion = true;
919 878
920 Random random = new Random(); 879 Random random = new Random();
@@ -924,12 +883,9 @@ namespace OpenSim.Region.Framework.Scenes
924 m_sceneGridService = sceneGridService; 883 m_sceneGridService = sceneGridService;
925 m_SimulationDataService = simDataService; 884 m_SimulationDataService = simDataService;
926 m_EstateDataService = estateDataService; 885 m_EstateDataService = estateDataService;
927<<<<<<< HEAD 886
928=======
929 m_regionHandle = RegionInfo.RegionHandle;
930 m_lastIncoming = 0; 887 m_lastIncoming = 0;
931 m_lastOutgoing = 0; 888 m_lastOutgoing = 0;
932>>>>>>> avn/ubitvar
933 889
934 m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); 890 m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
935 m_asyncSceneObjectDeleter.Enabled = true; 891 m_asyncSceneObjectDeleter.Enabled = true;
@@ -988,8 +944,6 @@ namespace OpenSim.Region.Framework.Scenes
988 EventManager.OnLandObjectRemoved += 944 EventManager.OnLandObjectRemoved +=
989 new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); 945 new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
990 946
991<<<<<<< HEAD
992=======
993 m_sceneGraph = new SceneGraph(this); 947 m_sceneGraph = new SceneGraph(this);
994 m_sceneGraph.PhysicsScene = physicsScene; 948 m_sceneGraph.PhysicsScene = physicsScene;
995 949
@@ -1006,7 +960,6 @@ namespace OpenSim.Region.Framework.Scenes
1006 RestartNow(); 960 RestartNow();
1007 }; 961 };
1008 962
1009>>>>>>> avn/ubitvar
1010 RegisterDefaultSceneEvents(); 963 RegisterDefaultSceneEvents();
1011 964
1012 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled 965 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled
@@ -1167,8 +1120,7 @@ namespace OpenSim.Region.Framework.Scenes
1167 } 1120 }
1168 } 1121 }
1169 1122
1170 if (startupConfig.Contains("MinFrameTime")) 1123 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
1171 MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000);
1172 1124
1173 m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); 1125 m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup);
1174 m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); 1126 m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
@@ -1246,43 +1198,13 @@ namespace OpenSim.Region.Framework.Scenes
1246 1198
1247 #endregion Interest Management 1199 #endregion Interest Management
1248 1200
1249 // The timer used by the Stopwatch class depends on the system hardware and operating system; inform
1250 // if the timer is based on a high-resolution performance counter or based on the system timer;
1251 // the performance counter will provide a more precise time than the system timer
1252 if (Stopwatch.IsHighResolution)
1253 m_log.InfoFormat("[SCENE]: Using high-resolution performance counter for statistics.");
1254 else
1255 m_log.InfoFormat("[SCENE]: Using system timer for statistics.");
1256
1257 // Acquire the statistics section of the OpenSim.ini file located
1258 // in the bin directory
1259 IConfig statisticsConfig = m_config.Configs["Statistics"];
1260 1201
1261 // Confirm that the statistics section existed in the configuration 1202 StatsReporter = new SimStatsReporter(this);
1262 // file
1263 if (statisticsConfig != null)
1264 {
1265 // Create the StatsReporter using the number of frames to store
1266 // for the frame time statistics, or 10 frames if the config
1267 // file doesn't contain a value
1268 StatsReporter = new SimStatsReporter(this,
1269 statisticsConfig.GetInt("NumberOfFrames",
1270 m_defaultNumberFramesStored));
1271 }
1272 else
1273 {
1274 // Create a StatsReporter with the current scene and a default
1275 // 10 frames stored for the frame time statistics
1276 StatsReporter = new SimStatsReporter(this);
1277 }
1278 1203
1279 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 1204 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
1280 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 1205 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
1281 1206
1282<<<<<<< HEAD
1283=======
1284 MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); 1207 MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect);
1285>>>>>>> avn/ubitvar
1286 } 1208 }
1287 1209
1288 public Scene(RegionInfo regInfo, PhysicsScene physicsScene) 1210 public Scene(RegionInfo regInfo, PhysicsScene physicsScene)
@@ -1314,7 +1236,28 @@ namespace OpenSim.Region.Framework.Scenes
1314 PeriodicBackup = true; 1236 PeriodicBackup = true;
1315 UseBackup = true; 1237 UseBackup = true;
1316 1238
1317<<<<<<< HEAD 1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1318 IsReprioritizationEnabled = true; 1261 IsReprioritizationEnabled = true;
1319 UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; 1262 UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time;
1320 ReprioritizationInterval = 5000; 1263 ReprioritizationInterval = 5000;
@@ -1325,8 +1268,6 @@ namespace OpenSim.Region.Framework.Scenes
1325 RootReprioritizationDistance = 10.0; 1268 RootReprioritizationDistance = 10.0;
1326 ChildReprioritizationDistance = 20.0; 1269 ChildReprioritizationDistance = 20.0;
1327 1270
1328=======
1329>>>>>>> avn/ubitvar
1330 m_eventManager = new EventManager(); 1271 m_eventManager = new EventManager();
1331 1272
1332 m_permissions = new ScenePermissions(this); 1273 m_permissions = new ScenePermissions(this);
@@ -1376,24 +1317,8 @@ namespace OpenSim.Region.Framework.Scenes
1376 { 1317 {
1377 if (RegionInfo.RegionHandle != otherRegion.RegionHandle) 1318 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
1378 { 1319 {
1379<<<<<<< HEAD 1320
1380 //// If these are cast to INT because long + negative values + abs returns invalid data
1381 //int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
1382 //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
1383 //if (resultX <= 1 && resultY <= 1)
1384 float dist = (float)Math.Max(DefaultDrawDistance,
1385 (float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY));
1386 uint newRegionX, newRegionY, thisRegionX, thisRegionY;
1387 Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY);
1388 Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY);
1389
1390 //m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
1391 // RegionInfo.RegionName, otherRegion.RegionName, newRegionX, newRegionY);
1392
1393 if (!Util.IsOutsideView(dist, thisRegionX, newRegionX, thisRegionY, newRegionY))
1394=======
1395 if (isNeighborRegion(otherRegion)) 1321 if (isNeighborRegion(otherRegion))
1396>>>>>>> avn/ubitvar
1397 { 1322 {
1398 // Let the grid service module know, so this can be cached 1323 // Let the grid service module know, so this can be cached
1399 m_eventManager.TriggerOnRegionUp(otherRegion); 1324 m_eventManager.TriggerOnRegionUp(otherRegion);
@@ -1693,45 +1618,8 @@ namespace OpenSim.Region.Framework.Scenes
1693 1618
1694 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; 1619 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
1695 m_lastFrameTick = Util.EnvironmentTickCount(); 1620 m_lastFrameTick = Util.EnvironmentTickCount();
1696 1621 Update(-1);
1697 if (UpdateOnTimer) 1622 }
1698 {
1699 m_sceneUpdateTimer = new Timer(MinFrameTicks);
1700 m_sceneUpdateTimer.AutoReset = true;
1701 m_sceneUpdateTimer.Elapsed += Update;
1702 m_sceneUpdateTimer.Start();
1703 }
1704 else
1705 {
1706 Thread.CurrentThread.Priority = ThreadPriority.Highest;
1707 Update(-1);
1708 Watchdog.RemoveThread();
1709 m_isRunning = false;
1710 }
1711 }
1712
1713 private volatile bool m_isTimerUpdateRunning;
1714
1715 private void Update(object sender, ElapsedEventArgs e)
1716 {
1717 if (m_isTimerUpdateRunning)
1718 return;
1719
1720 m_isTimerUpdateRunning = true;
1721
1722 // If the last frame did not complete on time, then immediately start the next update on the same thread
1723 // and ignore further timed updates until we have a frame that had spare time.
1724 while (!Update(1) && Active) { }
1725
1726 if (!Active || m_shuttingDown)
1727 {
1728 m_sceneUpdateTimer.Stop();
1729 m_sceneUpdateTimer = null;
1730 m_isRunning = false;
1731 }
1732
1733 m_isTimerUpdateRunning = false;
1734 }
1735 1623
1736 private void Maintenance() 1624 private void Maintenance()
1737 { 1625 {
@@ -1800,24 +1688,24 @@ namespace OpenSim.Region.Framework.Scenes
1800 previousMaintenanceTick = m_lastMaintenanceTick; 1688 previousMaintenanceTick = m_lastMaintenanceTick;
1801 m_lastMaintenanceTick = Util.EnvironmentTickCount(); 1689 m_lastMaintenanceTick = Util.EnvironmentTickCount();
1802 runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); 1690 runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc);
1803 runtc = MinMaintenanceTicks - runtc; 1691 runtc = (int)(MinMaintenanceTime * 1000) - runtc;
1804 1692
1805 if (runtc > 0) 1693 if (runtc > 0)
1806 m_maintenanceWaitEvent.WaitOne(runtc); 1694 m_maintenanceWaitEvent.WaitOne(runtc);
1807 1695
1808 // Optionally warn if a frame takes double the amount of time that it should. 1696 // Optionally warn if a frame takes double the amount of time that it should.
1809 if (DebugUpdates 1697 if (DebugUpdates
1810 && Util.EnvironmentTickCountSubtract( 1698 && Util.EnvironmentTickCountSubtract(
1811 m_lastMaintenanceTick, previousMaintenanceTick) > MinMaintenanceTicks * 2) 1699 m_lastMaintenanceTick, previousMaintenanceTick) > (int)(MinMaintenanceTime * 1000 * 2))
1812 m_log.WarnFormat( 1700 m_log.WarnFormat(
1813 "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", 1701 "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}",
1814 Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), 1702 Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick),
1815 MinMaintenanceTicks, 1703 MinMaintenanceTime * 1000,
1816 RegionInfo.RegionName); 1704 RegionInfo.RegionName);
1817 } 1705 }
1818 } 1706 }
1819 1707
1820 public override bool Update(int frames) 1708 public override void Update(int frames)
1821 { 1709 {
1822 long? endFrame = null; 1710 long? endFrame = null;
1823 1711
@@ -1825,30 +1713,12 @@ namespace OpenSim.Region.Framework.Scenes
1825 endFrame = Frame + frames; 1713 endFrame = Frame + frames;
1826 1714
1827 float physicsFPS = 0f; 1715 float physicsFPS = 0f;
1828<<<<<<< HEAD 1716
1829 int previousFrameTick, tmpMS;
1830
1831 // These variables will be used to save the precise frame time using the
1832 // Stopwatch class of Microsoft SDK; the times are recorded at the start
1833 // and end of a particular section of code, and then used to calculate
1834 // the frame times, which are the sums of the sections for each given name
1835 double preciseTotalFrameTime = 0.0;
1836 double preciseSimFrameTime = 0.0;
1837 double precisePhysicsFrameTime = 0.0;
1838 Stopwatch totalFrameStopwatch = new Stopwatch();
1839 Stopwatch simFrameStopwatch = new Stopwatch();
1840 Stopwatch physicsFrameStopwatch = new Stopwatch();
1841
1842 // Begin the stopwatch to keep track of the time that the frame
1843 // started running to determine how long the frame took to complete
1844 totalFrameStopwatch.Start();
1845=======
1846 int tmpMS; 1717 int tmpMS;
1847 int previousFrameTick; 1718 int previousFrameTick;
1848 int maintc; 1719 int maintc;
1849 int sleepMS; 1720 int sleepMS;
1850 int framestart; 1721 int framestart;
1851>>>>>>> avn/ubitvar
1852 1722
1853 while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) 1723 while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame))
1854 { 1724 {
@@ -1857,11 +1727,7 @@ namespace OpenSim.Region.Framework.Scenes
1857 1727
1858 // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); 1728 // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
1859 1729
1860<<<<<<< HEAD
1861 agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0;
1862=======
1863 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; 1730 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1864>>>>>>> avn/ubitvar
1865 1731
1866 try 1732 try
1867 { 1733 {
@@ -1877,93 +1743,42 @@ namespace OpenSim.Region.Framework.Scenes
1877 1743
1878 if (Frame % m_update_terrain == 0) 1744 if (Frame % m_update_terrain == 0)
1879 { 1745 {
1880<<<<<<< HEAD
1881 // At several points inside the code there was a need to
1882 // create a more precise measurement of time elapsed.
1883 // This led to the addition of variables that have a
1884 // similar function and thus remain tightly connected to
1885 // their original counterparts. However, the original
1886 // code is not receiving comments from our group because
1887 // we don't feel right modifying the code to that degree
1888 // at this point in time, the precise values all begin
1889 // with the keyword precise
1890 tmpMS = Util.EnvironmentTickCount();
1891 simFrameStopwatch.Start();
1892 UpdateTerrain();
1893
1894 // Get the simulation frame time that the avatar force
1895 // input took
1896 simFrameStopwatch.Stop();
1897 preciseSimFrameTime =
1898 simFrameStopwatch.Elapsed.TotalMilliseconds;
1899 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
1900 }
1901
1902 // At several points inside the code there was a need to
1903 // create a more precise measurement of time elapsed. This
1904 // led to the addition of variables that have a similar
1905 // function and thus remain tightly connected to their
1906 // original counterparts. However, the original code is
1907 // not receiving comments from our group because we don't
1908 // feel right modifying the code to that degree at this
1909 // point in time, the precise values all begin with the
1910 // keyword precise
1911=======
1912 UpdateTerrain(); 1746 UpdateTerrain();
1913 } 1747 }
1914 1748
1915 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); 1749 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
1916>>>>>>> avn/ubitvar
1917
1918 tmpMS = Util.EnvironmentTickCount(); 1750 tmpMS = Util.EnvironmentTickCount();
1919 1751
1920 // Begin the stopwatch to track the time to prepare physics
1921 physicsFrameStopwatch.Start();
1922 if (PhysicsEnabled && Frame % m_update_physics == 0) 1752 if (PhysicsEnabled && Frame % m_update_physics == 0)
1923 m_sceneGraph.UpdatePreparePhysics(); 1753 m_sceneGraph.UpdatePreparePhysics();
1924 1754
1925 // Get the time it took to prepare the physics, this
1926 // would report the most precise time that physics was
1927 // running on the machine and should the physics not be
1928 // enabled will report the time it took to check if physics
1929 // was enabled
1930 physicsFrameStopwatch.Stop();
1931 precisePhysicsFrameTime = physicsFrameStopwatch.Elapsed.TotalMilliseconds;
1932 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); 1755 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
1933 1756
1934 // Apply any pending avatar force input to the avatar's velocity 1757 // Apply any pending avatar force input to the avatar's velocity
1935 tmpMS = Util.EnvironmentTickCount(); 1758 tmpMS = Util.EnvironmentTickCount();
1936 simFrameStopwatch.Restart();
1937 if (Frame % m_update_entitymovement == 0) 1759 if (Frame % m_update_entitymovement == 0)
1938 m_sceneGraph.UpdateScenePresenceMovement(); 1760 m_sceneGraph.UpdateScenePresenceMovement();
1939 1761
1940 // Get the simulation frame time that the avatar force input 1762 // Get the simulation frame time that the avatar force input
1941 // took 1763 // took
1942 simFrameStopwatch.Stop();
1943 preciseSimFrameTime +=
1944 simFrameStopwatch.Elapsed.TotalMilliseconds;
1945 agentMS = Util.EnvironmentTickCountSubtract(tmpMS); 1764 agentMS = Util.EnvironmentTickCountSubtract(tmpMS);
1946 1765
1947 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their 1766 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
1948 // velocity 1767 // velocity
1949 tmpMS = Util.EnvironmentTickCount(); 1768 tmpMS = Util.EnvironmentTickCount();
1950 physicsFrameStopwatch.Restart();
1951 if (Frame % m_update_physics == 0) 1769 if (Frame % m_update_physics == 0)
1952 { 1770 {
1953 if (PhysicsEnabled) 1771 if (PhysicsEnabled)
1954 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameSeconds); 1772 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
1955 1773
1956 if (SynchronizeScene != null) 1774 if (SynchronizeScene != null)
1957 SynchronizeScene(this); 1775 SynchronizeScene(this);
1958 } 1776 }
1959 1777
1960 // Add the main physics update time to the prepare physics time 1778 // Add the main physics update time to the prepare physics time
1961 physicsFrameStopwatch.Stop();
1962 precisePhysicsFrameTime += physicsFrameStopwatch.Elapsed.TotalMilliseconds;
1963 physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); 1779 physicsMS = Util.EnvironmentTickCountSubtract(tmpMS);
1964 1780
1965 // Start the stopwatch for the remainder of the simulation 1781 // Start the stopwatch for the remainder of the simulation
1966 simFrameStopwatch.Restart();
1967 tmpMS = Util.EnvironmentTickCount(); 1782 tmpMS = Util.EnvironmentTickCount();
1968 1783
1969 // Check if any objects have reached their targets 1784 // Check if any objects have reached their targets
@@ -1980,10 +1795,7 @@ namespace OpenSim.Region.Framework.Scenes
1980 m_sceneGraph.UpdatePresences(); 1795 m_sceneGraph.UpdatePresences();
1981 1796
1982 agentMS += Util.EnvironmentTickCountSubtract(tmpMS); 1797 agentMS += Util.EnvironmentTickCountSubtract(tmpMS);
1983 1798
1984<<<<<<< HEAD
1985=======
1986
1987 // Delete temp-on-rez stuff 1799 // Delete temp-on-rez stuff
1988 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) 1800 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
1989 { 1801 {
@@ -1993,7 +1805,6 @@ namespace OpenSim.Region.Framework.Scenes
1993 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); 1805 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS);
1994 } 1806 }
1995 1807
1996>>>>>>> avn/ubitvar
1997 if (Frame % m_update_events == 0) 1808 if (Frame % m_update_events == 0)
1998 { 1809 {
1999 tmpMS = Util.EnvironmentTickCount(); 1810 tmpMS = Util.EnvironmentTickCount();
@@ -2062,42 +1873,9 @@ namespace OpenSim.Region.Framework.Scenes
2062 } 1873 }
2063 1874
2064 EventManager.TriggerRegionHeartbeatEnd(this); 1875 EventManager.TriggerRegionHeartbeatEnd(this);
2065 otherMS = eventMS + backupMS + terrainMS + landMS;
2066
2067 // Get the elapsed time for the simulation frame
2068 simFrameStopwatch.Stop();
2069 preciseSimFrameTime +=
2070 simFrameStopwatch.Elapsed.TotalMilliseconds;
2071
2072<<<<<<< HEAD
2073 if (!UpdateOnTimer)
2074 {
2075 Watchdog.UpdateThread();
2076
2077 spareMS = MinFrameTicks - Util.EnvironmentTickCountSubtract(m_lastFrameTick);
2078
2079 if (spareMS > 0)
2080 m_updateWaitEvent.WaitOne(spareMS);
2081 else
2082 spareMS = 0;
2083 }
2084 else
2085 {
2086 spareMS = Math.Max(0, MinFrameTicks - physicsMS2 - agentMS - physicsMS - otherMS);
2087 }
2088 1876
2089 // Get the total frame time 1877 Watchdog.UpdateThread();
2090 totalFrameStopwatch.Stop();
2091 preciseTotalFrameTime =
2092 totalFrameStopwatch.Elapsed.TotalMilliseconds;
2093
2094 // Restart the stopwatch for the total time of the next frame
2095 totalFrameStopwatch.Restart();
2096 1878
2097 previousFrameTick = m_lastFrameTick;
2098 frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick);
2099 m_lastFrameTick = Util.EnvironmentTickCount();
2100=======
2101 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; 1879 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
2102 1880
2103 StatsReporter.AddPhysicsFPS(physicsFPS); 1881 StatsReporter.AddPhysicsFPS(physicsFPS);
@@ -2125,46 +1903,22 @@ namespace OpenSim.Region.Framework.Scenes
2125 frameMS = Util.EnvironmentTickCountSubtract(framestart); 1903 frameMS = Util.EnvironmentTickCountSubtract(framestart);
2126 StatsReporter.addSleepMS(sleepMS); 1904 StatsReporter.addSleepMS(sleepMS);
2127 StatsReporter.addFrameMS(frameMS); 1905 StatsReporter.addFrameMS(frameMS);
2128>>>>>>> avn/ubitvar
2129 1906
2130 // if (Frame%m_update_avatars == 0) 1907 // if (Frame%m_update_avatars == 0)
2131 // UpdateInWorldTime(); 1908 // UpdateInWorldTime();
2132 1909
2133<<<<<<< HEAD 1910 // Optionally warn if a frame takes double the amount of time that it should.
2134 StatsReporter.addFrameMS(frameMS);
2135 StatsReporter.addAgentMS(agentMS);
2136 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
2137 StatsReporter.addOtherMS(otherMS);
2138 StatsReporter.AddSpareMS(spareMS);
2139 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
2140 StatsReporter.AddScriptMS((int) GetAndResetScriptExecutionTime());
2141=======
2142>>>>>>> avn/ubitvar
2143
2144 // Send the correct time values to the stats reporter for the
2145 // frame times
2146 StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime,
2147 preciseSimFrameTime, precisePhysicsFrameTime, 0.0);
2148
2149 // Send the correct number of frames that the physics library
2150 // has processed to the stats reporter
2151 StatsReporter.addPhysicsFrame(1);
2152
2153 // Optionally warn if a frame takes double the amount of time that it should.
2154 if (DebugUpdates 1911 if (DebugUpdates
2155 && Util.EnvironmentTickCountSubtract( 1912 && Util.EnvironmentTickCountSubtract(
2156 m_lastFrameTick, previousFrameTick) > MinFrameTicks * 2) 1913 m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2))
1914
2157 m_log.WarnFormat( 1915 m_log.WarnFormat(
2158 "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", 1916 "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
2159 Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), 1917 Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
2160 MinFrameTicks, 1918 MinFrameTime * 1000,
1919
2161 RegionInfo.RegionName); 1920 RegionInfo.RegionName);
2162 } 1921 }
2163
2164 // Finished updating scene frame, so stop the total frame's Stopwatch
2165 totalFrameStopwatch.Stop();
2166
2167 return spareMS >= 0;
2168 } 1922 }
2169 1923
2170 /// <summary> 1924 /// <summary>
@@ -2629,13 +2383,8 @@ namespace OpenSim.Region.Framework.Scenes
2629 2383
2630 if (ei.HitTF) 2384 if (ei.HitTF)
2631 { 2385 {
2632<<<<<<< HEAD
2633 pos = ei.ipoint;
2634 }
2635=======
2636 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 2386 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
2637 } 2387 }
2638>>>>>>> avn/ubitvar
2639 else 2388 else
2640 { 2389 {
2641 // fall back to our stupid functionality 2390 // fall back to our stupid functionality
@@ -3013,8 +2762,6 @@ namespace OpenSim.Region.Framework.Scenes
3013 m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); 2762 m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
3014 } 2763 }
3015 return; 2764 return;
3016<<<<<<< HEAD
3017=======
3018 } 2765 }
3019 2766
3020 if (grp.RootPart.RETURN_AT_EDGE) 2767 if (grp.RootPart.RETURN_AT_EDGE)
@@ -3056,70 +2803,11 @@ namespace OpenSim.Region.Framework.Scenes
3056 // Regular region. Just check for region size 2803 // Regular region. Just check for region size
3057 if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) 2804 if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY )
3058 ret = true; 2805 ret = true;
3059>>>>>>> avn/ubitvar
3060 }
3061
3062 if (grp.RootPart.RETURN_AT_EDGE)
3063 {
3064<<<<<<< HEAD
3065 // We remove the object here
3066 try
3067 {
3068 List<SceneObjectGroup> objects = new List<SceneObjectGroup>();
3069 objects.Add(grp);
3070 SceneObjectGroup[] objectsArray = objects.ToArray();
3071 returnObjects(objectsArray, UUID.Zero);
3072 }
3073 catch (Exception)
3074 {
3075 m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
3076 }
3077 return;
3078 }
3079
3080 if (EntityTransferModule != null)
3081 EntityTransferModule.Cross(grp, attemptedPosition, silent);
3082 }
3083
3084 // Simple test to see if a position is in the current region.
3085 // This test is mostly used to see if a region crossing is necessary.
3086 // Assuming the position is relative to the region so anything outside its bounds.
3087 // Return 'true' if position inside region.
3088 public bool PositionIsInCurrentRegion(Vector3 pos)
3089 {
3090 bool ret = false;
3091 int xx = (int)Math.Floor(pos.X);
3092 int yy = (int)Math.Floor(pos.Y);
3093 if (xx < 0 || yy < 0)
3094 return false;
3095
3096 IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>();
3097 if (regionCombinerModule == null)
3098 {
3099 // Regular region. Just check for region size
3100 if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY)
3101 ret = true;
3102 }
3103 else
3104 {
3105 // We're in a mega-region so see if we are still in that larger region
3106 ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy);
3107 }
3108
3109 return ret;
3110
3111 }
3112
3113=======
3114 // We're in a mega-region so see if we are still in that larger region
3115 ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy);
3116 } 2806 }
3117 2807
3118 return ret; 2808 return ret;
3119
3120 } 2809 }
3121 2810
3122>>>>>>> avn/ubitvar
3123 /// <summary> 2811 /// <summary>
3124 /// Called when objects or attachments cross the border, or teleport, between regions. 2812 /// Called when objects or attachments cross the border, or teleport, between regions.
3125 /// </summary> 2813 /// </summary>
@@ -3141,10 +2829,6 @@ namespace OpenSim.Region.Framework.Scenes
3141 return false; 2829 return false;
3142 } 2830 }
3143 2831
3144<<<<<<< HEAD
3145 if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition))
3146 return false;
3147=======
3148 // If the user is banned, we won't let any of their objects 2832 // If the user is banned, we won't let any of their objects
3149 // enter. Period. 2833 // enter. Period.
3150 // 2834 //
@@ -3189,7 +2873,6 @@ namespace OpenSim.Region.Framework.Scenes
3189 //if (newObject.RootPart.KeyframeMotion != null) 2873 //if (newObject.RootPart.KeyframeMotion != null)
3190 // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); 2874 // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject);
3191 } 2875 }
3192>>>>>>> avn/ubitvar
3193 2876
3194 // Do this as late as possible so that listeners have full access to the incoming object 2877 // Do this as late as possible so that listeners have full access to the incoming object
3195 EventManager.TriggerOnIncomingSceneObject(newObject); 2878 EventManager.TriggerOnIncomingSceneObject(newObject);
@@ -3286,8 +2969,6 @@ namespace OpenSim.Region.Framework.Scenes
3286 return true; 2969 return true;
3287 } 2970 }
3288 2971
3289<<<<<<< HEAD
3290=======
3291 private int GetStateSource(SceneObjectGroup sog) 2972 private int GetStateSource(SceneObjectGroup sog)
3292 { 2973 {
3293 ScenePresence sp = GetScenePresence(sog.OwnerID); 2974 ScenePresence sp = GetScenePresence(sog.OwnerID);
@@ -3316,7 +2997,7 @@ namespace OpenSim.Region.Framework.Scenes
3316 return uac.UserFlags; 2997 return uac.UserFlags;
3317 //} 2998 //}
3318 } 2999 }
3319>>>>>>> avn/ubitvar 3000
3320 #endregion 3001 #endregion
3321 3002
3322 #region Add/Remove Avatar Methods 3003 #region Add/Remove Avatar Methods
@@ -3352,15 +3033,10 @@ namespace OpenSim.Region.Framework.Scenes
3352 vialogin 3033 vialogin
3353 = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 3034 = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0
3354 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 3035 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
3355<<<<<<< HEAD
3356
3357 // CheckHeartbeat();
3358
3359=======
3360 3036
3361 CheckHeartbeat(); 3037 CheckHeartbeat();
3362 3038
3363>>>>>>> avn/ubitvar 3039
3364 sp = GetScenePresence(client.AgentId); 3040 sp = GetScenePresence(client.AgentId);
3365 3041
3366 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this 3042 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this
@@ -3370,29 +3046,6 @@ namespace OpenSim.Region.Framework.Scenes
3370 if (sp == null) 3046 if (sp == null)
3371 { 3047 {
3372 m_log.DebugFormat( 3048 m_log.DebugFormat(
3373<<<<<<< HEAD
3374 "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}",
3375 client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos);
3376
3377 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
3378
3379 // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the
3380 // client is for a root or child agent.
3381 // We must also set this before adding the client to the client manager so that an exception later on
3382 // does not leave a client manager entry without the scene agent set, which will cause other code
3383 // to fail since any entry in the client manager should have a ScenePresence
3384 //
3385 // XXX: This may be better set for a new client before that client is added to the client manager.
3386 // But need to know what happens in the case where a ScenePresence is already present (and if this
3387 // actually occurs).
3388 client.SceneAgent = sp;
3389
3390 m_clientManager.Add(client);
3391 SubscribeToClientEvents(client);
3392 m_eventManager.TriggerOnNewPresence(sp);
3393
3394 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
3395=======
3396 "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}", 3049 "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}",
3397 client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos, 3050 client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos,
3398 ((TPFlags)aCircuit.teleportFlags).ToString()); 3051 ((TPFlags)aCircuit.teleportFlags).ToString());
@@ -3414,8 +3067,6 @@ namespace OpenSim.Region.Framework.Scenes
3414 m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF); 3067 m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF);
3415 */ 3068 */
3416 m_eventManager.TriggerOnNewPresence(sp); 3069 m_eventManager.TriggerOnNewPresence(sp);
3417
3418>>>>>>> avn/ubitvar
3419 } 3070 }
3420 else 3071 else
3421 { 3072 {
@@ -3424,7 +3075,7 @@ namespace OpenSim.Region.Framework.Scenes
3424 // XXX: This may be better set for a new client before that client is added to the client manager. 3075 // XXX: This may be better set for a new client before that client is added to the client manager.
3425 // But need to know what happens in the case where a ScenePresence is already present (and if this 3076 // But need to know what happens in the case where a ScenePresence is already present (and if this
3426 // actually occurs). 3077 // actually occurs).
3427 client.SceneAgent = sp; 3078
3428 3079
3429 m_log.WarnFormat( 3080 m_log.WarnFormat(
3430 "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", 3081 "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence",
@@ -3432,6 +3083,7 @@ namespace OpenSim.Region.Framework.Scenes
3432 3083
3433 reallyNew = false; 3084 reallyNew = false;
3434 } 3085 }
3086 client.SceneAgent = sp;
3435 3087
3436 // This is currently also being done earlier in NewUserConnection for real users to see if this 3088 // This is currently also being done earlier in NewUserConnection for real users to see if this
3437 // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other 3089 // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other
@@ -3454,15 +3106,6 @@ namespace OpenSim.Region.Framework.Scenes
3454 return sp; 3106 return sp;
3455 } 3107 }
3456 3108
3457 public string GetAgentHomeURI(UUID agentID)
3458 {
3459 AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID);
3460 if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI"))
3461 return circuit.ServiceURLs["HomeURI"].ToString();
3462 else
3463 return null;
3464 }
3465
3466 /// <summary> 3109 /// <summary>
3467 /// Returns the Home URI of the agent, or null if unknown. 3110 /// Returns the Home URI of the agent, or null if unknown.
3468 /// </summary> 3111 /// </summary>
@@ -3899,16 +3542,14 @@ namespace OpenSim.Region.Framework.Scenes
3899 if (target != null && target2 != null) 3542 if (target != null && target2 != null)
3900 { 3543 {
3901 Vector3 direction = Vector3.Normalize(RayEnd - RayStart); 3544 Vector3 direction = Vector3.Normalize(RayEnd - RayStart);
3902 Vector3 AXOrigin = RayStart; 3545
3903 Vector3 AXdirection = direction;
3904
3905 pos = target2.AbsolutePosition; 3546 pos = target2.AbsolutePosition;
3906 //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); 3547 //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString());
3907 3548
3908 // TODO: Raytrace better here 3549 // TODO: Raytrace better here
3909 3550
3910 //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); 3551 //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection));
3911 Ray NewRay = new Ray(AXOrigin, AXdirection); 3552 Ray NewRay = new Ray(RayStart,direction);
3912 3553
3913 // Ray Trace against target here 3554 // Ray Trace against target here
3914 EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters); 3555 EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters);
@@ -4010,13 +3651,8 @@ namespace OpenSim.Region.Framework.Scenes
4010 } 3651 }
4011 3652
4012 // TODO: Can we now remove this lock? 3653 // TODO: Can we now remove this lock?
4013<<<<<<< HEAD
4014 lock (acd)
4015 {
4016=======
4017 lock (m_removeClientPrivLock) 3654 lock (m_removeClientPrivLock)
4018 { 3655 {
4019>>>>>>> avn/ubitvar
4020 bool isChildAgent = false; 3656 bool isChildAgent = false;
4021 3657
4022 ScenePresence avatar = GetScenePresence(agentID); 3658 ScenePresence avatar = GetScenePresence(agentID);
@@ -4060,13 +3696,8 @@ namespace OpenSim.Region.Framework.Scenes
4060 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop 3696 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop
4061 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI 3697 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI
4062 if (closeChildAgents && CapsModule != null) 3698 if (closeChildAgents && CapsModule != null)
4063<<<<<<< HEAD
4064 CapsModule.RemoveCaps(agentID);
4065
4066=======
4067 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); 3699 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode);
4068 3700
4069>>>>>>> avn/ubitvar
4070 if (closeChildAgents && !isChildAgent) 3701 if (closeChildAgents && !isChildAgent)
4071 { 3702 {
4072 List<ulong> regions = avatar.KnownRegionHandles; 3703 List<ulong> regions = avatar.KnownRegionHandles;
@@ -4079,12 +3710,8 @@ namespace OpenSim.Region.Framework.Scenes
4079 m_eventManager.TriggerClientClosed(agentID, this); 3710 m_eventManager.TriggerClientClosed(agentID, this);
4080// m_log.Debug("[Scene]TriggerClientClosed done"); 3711// m_log.Debug("[Scene]TriggerClientClosed done");
4081 m_eventManager.TriggerOnRemovePresence(agentID); 3712 m_eventManager.TriggerOnRemovePresence(agentID);
4082<<<<<<< HEAD
4083
4084=======
4085// m_log.Debug("[Scene]TriggerOnRemovePresence done"); 3713// m_log.Debug("[Scene]TriggerOnRemovePresence done");
4086 3714
4087>>>>>>> avn/ubitvar
4088 if (!isChildAgent) 3715 if (!isChildAgent)
4089 { 3716 {
4090 if (AttachmentsModule != null) 3717 if (AttachmentsModule != null)
@@ -4228,14 +3855,10 @@ namespace OpenSim.Region.Framework.Scenes
4228 /// or other applications where a full grid/Hypergrid presence may not be required.</param> 3855 /// or other applications where a full grid/Hypergrid presence may not be required.</param>
4229 /// <returns>True if the region accepts this agent. False if it does not. False will 3856 /// <returns>True if the region accepts this agent. False if it does not. False will
4230 /// also return a reason.</returns> 3857 /// also return a reason.</returns>
4231<<<<<<< HEAD
4232 public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup)
4233=======
4234 /// 3858 ///
4235 private object m_newUserConnLock = new object(); 3859 private object m_newUserConnLock = new object();
4236 3860
4237 public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, out string reason, bool requirePresenceLookup) 3861 public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup)
4238>>>>>>> avn/ubitvar
4239 { 3862 {
4240 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || 3863 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 ||
4241 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); 3864 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0);
@@ -4507,13 +4130,7 @@ namespace OpenSim.Region.Framework.Scenes
4507 { 4130 {
4508 m_log.DebugFormat( 4131 m_log.DebugFormat(
4509 "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", 4132 "[SCENE]: Adjusting known seeds for existing agent {0} in {1}",
4510<<<<<<< HEAD
4511 acd.AgentID, RegionInfo.RegionName);
4512
4513 sp.AdjustKnownSeeds();
4514=======
4515 acd.AgentID, RegionInfo.RegionName); 4133 acd.AgentID, RegionInfo.RegionName);
4516>>>>>>> avn/ubitvar
4517 4134
4518 if (CapsModule != null) 4135 if (CapsModule != null)
4519 { 4136 {
@@ -4646,21 +4263,13 @@ namespace OpenSim.Region.Framework.Scenes
4646 { 4263 {
4647 if (posX < 0) 4264 if (posX < 0)
4648 posX = 0; 4265 posX = 0;
4649<<<<<<< HEAD 4266
4650 else if (posX >= (float)RegionInfo.RegionSizeX)
4651 posX = (float)RegionInfo.RegionSizeX - 0.001f;
4652 if (posY < 0)
4653 posY = 0;
4654 else if (posY >= (float)RegionInfo.RegionSizeY)
4655 posY = (float)RegionInfo.RegionSizeY - 0.001f;
4656=======
4657 else if (posX >= RegionInfo.RegionSizeX) 4267 else if (posX >= RegionInfo.RegionSizeX)
4658 posX = RegionInfo.RegionSizeX - 0.5f; 4268 posX = RegionInfo.RegionSizeX - 0.5f;
4659 if (posY < 0) 4269 if (posY < 0)
4660 posY = 0; 4270 posY = 0;
4661 else if (posY >= RegionInfo.RegionSizeY) 4271 else if (posY >= RegionInfo.RegionSizeY)
4662 posY = RegionInfo.RegionSizeY - 0.5f; 4272 posY = RegionInfo.RegionSizeY - 0.5f;
4663>>>>>>> avn/ubitvar
4664 4273
4665 reason = String.Empty; 4274 reason = String.Empty;
4666 if (Permissions.IsGod(agentID)) 4275 if (Permissions.IsGod(agentID))
@@ -5249,15 +4858,11 @@ namespace OpenSim.Region.Framework.Scenes
5249 sp.LifecycleState = ScenePresenceState.Removing; 4858 sp.LifecycleState = ScenePresenceState.Removing;
5250 } 4859 }
5251 4860
5252<<<<<<< HEAD
5253 sp.ControllingClient.Close(force);
5254=======
5255 if (sp != null) 4861 if (sp != null)
5256 { 4862 {
5257 sp.ControllingClient.Close(force, force); 4863 sp.ControllingClient.Close(force, force);
5258 return true; 4864 return true;
5259 } 4865 }
5260>>>>>>> avn/ubitvar
5261 4866
5262 return true; 4867 return true;
5263 } 4868 }
@@ -5862,9 +5467,7 @@ namespace OpenSim.Region.Framework.Scenes
5862 // 5 = We have seen a new user enter within the past 4 minutes 5467 // 5 = We have seen a new user enter within the past 4 minutes
5863 // which can be seen as positive confirmation of sim health 5468 // which can be seen as positive confirmation of sim health
5864 // 5469 //
5865<<<<<<< HEAD
5866 int health = 1; // Start at 1, means we're up 5470 int health = 1; // Start at 1, means we're up
5867=======
5868 5471
5869 flags = 0; 5472 flags = 0;
5870 message = String.Empty; 5473 message = String.Empty;
@@ -5879,9 +5482,6 @@ namespace OpenSim.Region.Framework.Scenes
5879 return 0; 5482 return 0;
5880 } 5483 }
5881 5484
5882 int health=1; // Start at 1, means we're up
5883>>>>>>> avn/ubitvar
5884
5885 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) 5485 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000)
5886 { 5486 {
5887 health+=1; 5487 health+=1;
@@ -6176,13 +5776,7 @@ Environment.Exit(1);
6176 //Go to the edge, this happens in teleporting to a region with no available parcels 5776 //Go to the edge, this happens in teleporting to a region with no available parcels
6177 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); 5777 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar);
6178 5778
6179<<<<<<< HEAD
6180 //m_log.Debug("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
6181
6182=======
6183 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); 5779 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
6184
6185>>>>>>> avn/ubitvar
6186 return nearestRegionEdgePoint; 5780 return nearestRegionEdgePoint;
6187 } 5781 }
6188 5782
@@ -6513,11 +6107,7 @@ Environment.Exit(1);
6513 /// <param name='position'></param> 6107 /// <param name='position'></param>
6514 /// <param name='reason'></param> 6108 /// <param name='reason'></param>
6515 /// <returns></returns> 6109 /// <returns></returns>
6516<<<<<<< HEAD
6517 public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out string reason) 6110 public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out string reason)
6518=======
6519 public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason)
6520>>>>>>> avn/ubitvar
6521 { 6111 {
6522 reason = string.Empty; 6112 reason = string.Empty;
6523 6113
@@ -6527,14 +6117,8 @@ Environment.Exit(1);
6527 return true; 6117 return true;
6528 } 6118 }
6529 6119
6530<<<<<<< HEAD
6531 if (!AllowAvatarCrossing && !viaTeleport) 6120 if (!AllowAvatarCrossing && !viaTeleport)
6532 return false; 6121 return false;
6533=======
6534
6535// if (!AllowAvatarCrossing && !viaTeleport)
6536// return false;
6537>>>>>>> avn/ubitvar
6538 6122
6539 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. 6123 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check.
6540 // However, the long term fix is to make sure root agent count is always accurate. 6124 // However, the long term fix is to make sure root agent count is always accurate.
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index c4671f0..f420f69 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -1,4 +1,3 @@
1<<<<<<< HEAD
2/* 1/*
3 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
4 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
@@ -201,7 +200,7 @@ namespace OpenSim.Region.Framework.Scenes
201 /// If -1 then updates until shutdown. 200 /// If -1 then updates until shutdown.
202 /// </param> 201 /// </param>
203 /// <returns>true if update completed within minimum frame time, false otherwise.</returns> 202 /// <returns>true if update completed within minimum frame time, false otherwise.</returns>
204 public abstract bool Update(int frames); 203 public abstract void Update(int frames);
205 204
206 #endregion 205 #endregion
207 206
@@ -635,603 +634,3 @@ namespace OpenSim.Region.Framework.Scenes
635 public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep); 634 public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep);
636 } 635 }
637} 636}
638=======
639/*
640 * Copyright (c) Contributors, http://opensimulator.org/
641 * See CONTRIBUTORS.TXT for a full list of copyright holders.
642 *
643 * Redistribution and use in source and binary forms, with or without
644 * modification, are permitted provided that the following conditions are met:
645 * * Redistributions of source code must retain the above copyright
646 * notice, this list of conditions and the following disclaimer.
647 * * Redistributions in binary form must reproduce the above copyright
648 * notice, this list of conditions and the following disclaimer in the
649 * documentation and/or other materials provided with the distribution.
650 * * Neither the name of the OpenSimulator Project nor the
651 * names of its contributors may be used to endorse or promote products
652 * derived from this software without specific prior written permission.
653 *
654 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
655 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
656 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
657 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
658 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
659 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
660 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
661 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
662 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
663 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
664 */
665
666using System;
667using System.Collections.Generic;
668using System.Reflection;
669using System.Threading;
670using OpenMetaverse;
671using log4net;
672using Nini.Config;
673using OpenSim.Framework;
674using OpenSim.Framework.Console;
675
676using OpenSim.Region.Framework.Interfaces;
677using GridRegion = OpenSim.Services.Interfaces.GridRegion;
678
679namespace OpenSim.Region.Framework.Scenes
680{
681 public abstract class SceneBase : IScene
682 {
683 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
684 protected static readonly string LogHeader = "[SCENE]";
685
686 #region Events
687
688 public event restart OnRestart;
689
690 #endregion
691
692 #region Fields
693
694 public string Name { get { return RegionInfo.RegionName; } }
695
696 public IConfigSource Config
697 {
698 get { return GetConfig(); }
699 }
700
701 protected virtual IConfigSource GetConfig()
702 {
703 return null;
704 }
705
706 /// <value>
707 /// All the region modules attached to this scene.
708 /// </value>
709 public Dictionary<string, IRegionModuleBase> RegionModules
710 {
711 get { return m_regionModules; }
712 }
713 private Dictionary<string, IRegionModuleBase> m_regionModules = new Dictionary<string, IRegionModuleBase>();
714
715 /// <value>
716 /// The module interfaces available from this scene.
717 /// </value>
718 protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>();
719
720 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
721
722 /// <value>
723 /// The module commanders available from this scene
724 /// </value>
725 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
726
727 /// <value>
728 /// Registered classes that are capable of creating entities.
729 /// </value>
730 protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>();
731
732 /// <summary>
733 /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is
734 /// dispensed.
735 /// </summary>
736 protected uint m_lastAllocatedLocalId = 720000;
737
738 private readonly Mutex _primAllocateMutex = new Mutex(false);
739
740 protected readonly ClientManager m_clientManager = new ClientManager();
741
742 public bool LoginsEnabled
743 {
744 get
745 {
746 return m_loginsEnabled;
747 }
748
749 set
750 {
751 if (m_loginsEnabled != value)
752 {
753 m_loginsEnabled = value;
754 EventManager.TriggerRegionLoginsStatusChange(this);
755 }
756 }
757 }
758 private bool m_loginsEnabled;
759
760 public bool Ready
761 {
762 get
763 {
764 return m_ready;
765 }
766
767 set
768 {
769 if (m_ready != value)
770 {
771 m_ready = value;
772 EventManager.TriggerRegionReadyStatusChange(this);
773 }
774 }
775 }
776 private bool m_ready;
777
778 public float TimeDilation
779 {
780 get { return 1.0f; }
781 }
782
783 protected ulong m_regionHandle;
784 protected string m_regionName;
785
786 public ITerrainChannel Heightmap;
787
788 /// <value>
789 /// Allows retrieval of land information for this scene.
790 /// </value>
791 public ILandChannel LandChannel;
792
793 /// <value>
794 /// Manage events that occur in this scene (avatar movement, script rez, etc.). Commonly used by region modules
795 /// to subscribe to scene events.
796 /// </value>
797 public EventManager EventManager
798 {
799 get { return m_eventManager; }
800 }
801 protected EventManager m_eventManager;
802
803 protected ScenePermissions m_permissions;
804 public ScenePermissions Permissions
805 {
806 get { return m_permissions; }
807 }
808
809 protected string m_datastore;
810
811 /* Used by the loadbalancer plugin on GForge */
812 protected RegionStatus m_regStatus;
813 public RegionStatus RegionStatus
814 {
815 get { return m_regStatus; }
816 set { m_regStatus = value; }
817 }
818
819 #endregion
820
821 public SceneBase(RegionInfo regInfo)
822 {
823 RegionInfo = regInfo;
824 }
825
826 #region Update Methods
827
828 /// <summary>
829 /// Called to update the scene loop by a number of frames and until shutdown.
830 /// </summary>
831 /// <param name="frames">
832 /// Number of frames to update. Exits on shutdown even if there are frames remaining.
833 /// If -1 then updates until shutdown.
834 /// </param>
835 public abstract void Update(int frames);
836
837 #endregion
838
839 #region Terrain Methods
840
841 /// <summary>
842 /// Loads the World heightmap
843 /// </summary>
844 public abstract void LoadWorldMap();
845
846 /// <summary>
847 /// Send the region heightmap to the client
848 /// </summary>
849 /// <param name="RemoteClient">Client to send to</param>
850 public virtual void SendLayerData(IClientAPI RemoteClient)
851 {
852// RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised());
853 ITerrainModule terrModule = RequestModuleInterface<ITerrainModule>();
854 if (terrModule != null)
855 {
856 terrModule.PushTerrain(RemoteClient);
857 }
858 }
859
860 #endregion
861
862 #region Add/Remove Agent/Avatar
863
864 public abstract ISceneAgent AddNewAgent(IClientAPI client, PresenceType type);
865
866 public abstract bool CloseAgent(UUID agentID, bool force);
867
868 public bool TryGetScenePresence(UUID agentID, out object scenePresence)
869 {
870 scenePresence = null;
871 ScenePresence sp = null;
872 if (TryGetScenePresence(agentID, out sp))
873 {
874 scenePresence = sp;
875 return true;
876 }
877
878 return false;
879 }
880
881 /// <summary>
882 /// Try to get a scene presence from the scene
883 /// </summary>
884 /// <param name="agentID"></param>
885 /// <param name="scenePresence">null if there is no scene presence with the given agent id</param>
886 /// <returns>true if there was a scene presence with the given id, false otherwise.</returns>
887 public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence);
888
889 #endregion
890
891 /// <summary>
892 ///
893 /// </summary>
894 /// <returns></returns>
895 public virtual RegionInfo RegionInfo { get; private set; }
896
897 #region admin stuff
898
899 public abstract void OtherRegionUp(GridRegion otherRegion);
900
901 public virtual string GetSimulatorVersion()
902 {
903 return "OpenSimulator Server";
904 }
905
906 #endregion
907
908 #region Shutdown
909
910 /// <summary>
911 /// Tidy before shutdown
912 /// </summary>
913 public virtual void Close()
914 {
915 try
916 {
917 EventManager.TriggerShutdown();
918 }
919 catch (Exception e)
920 {
921 m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e));
922 }
923 }
924
925 #endregion
926
927 /// <summary>
928 /// Returns a new unallocated local ID
929 /// </summary>
930 /// <returns>A brand new local ID</returns>
931 public uint AllocateLocalId()
932 {
933 uint myID;
934
935 _primAllocateMutex.WaitOne();
936 myID = ++m_lastAllocatedLocalId;
937 _primAllocateMutex.ReleaseMutex();
938
939 return myID;
940 }
941
942 public uint AllocatePresenceLocalId()
943 {
944 uint myID;
945
946 _primAllocateMutex.WaitOne();
947 myID = ++m_lastAllocatedLocalId;
948 ++m_lastAllocatedLocalId;
949 _primAllocateMutex.ReleaseMutex();
950
951 return myID;
952 }
953
954 #region Module Methods
955
956 /// <summary>
957 /// Add a region-module to this scene. TODO: This will replace AddModule in the future.
958 /// </summary>
959 /// <param name="name"></param>
960 /// <param name="module"></param>
961 public void AddRegionModule(string name, IRegionModuleBase module)
962 {
963 if (!RegionModules.ContainsKey(name))
964 {
965 RegionModules.Add(name, module);
966 }
967 }
968
969 public void RemoveRegionModule(string name)
970 {
971 RegionModules.Remove(name);
972 }
973
974 /// <summary>
975 /// Register a module commander.
976 /// </summary>
977 /// <param name="commander"></param>
978 public void RegisterModuleCommander(ICommander commander)
979 {
980 lock (m_moduleCommanders)
981 {
982 m_moduleCommanders.Add(commander.Name, commander);
983 }
984 }
985
986 /// <summary>
987 /// Unregister a module commander and all its commands
988 /// </summary>
989 /// <param name="name"></param>
990 public void UnregisterModuleCommander(string name)
991 {
992 lock (m_moduleCommanders)
993 {
994 ICommander commander;
995 if (m_moduleCommanders.TryGetValue(name, out commander))
996 m_moduleCommanders.Remove(name);
997 }
998 }
999
1000 /// <summary>
1001 /// Get a module commander
1002 /// </summary>
1003 /// <param name="name"></param>
1004 /// <returns>The module commander, null if no module commander with that name was found</returns>
1005 public ICommander GetCommander(string name)
1006 {
1007 lock (m_moduleCommanders)
1008 {
1009 if (m_moduleCommanders.ContainsKey(name))
1010 return m_moduleCommanders[name];
1011 }
1012
1013 return null;
1014 }
1015
1016 public Dictionary<string, ICommander> GetCommanders()
1017 {
1018 return m_moduleCommanders;
1019 }
1020
1021 /// <summary>
1022 /// Register an interface to a region module. This allows module methods to be called directly as
1023 /// well as via events. If there is already a module registered for this interface, it is not replaced
1024 /// (is this the best behaviour?)
1025 /// </summary>
1026 /// <param name="mod"></param>
1027 public void RegisterModuleInterface<M>(M mod)
1028 {
1029// m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M));
1030
1031 List<Object> l = null;
1032 if (!ModuleInterfaces.TryGetValue(typeof(M), out l))
1033 {
1034 l = new List<Object>();
1035 ModuleInterfaces.Add(typeof(M), l);
1036 }
1037
1038 if (l.Count > 0)
1039 return;
1040
1041 l.Add(mod);
1042
1043 if (mod is IEntityCreator)
1044 {
1045 IEntityCreator entityCreator = (IEntityCreator)mod;
1046 foreach (PCode pcode in entityCreator.CreationCapabilities)
1047 {
1048 m_entityCreators[pcode] = entityCreator;
1049 }
1050 }
1051 }
1052
1053 public void UnregisterModuleInterface<M>(M mod)
1054 {
1055 List<Object> l;
1056 if (ModuleInterfaces.TryGetValue(typeof(M), out l))
1057 {
1058 if (l.Remove(mod))
1059 {
1060 if (mod is IEntityCreator)
1061 {
1062 IEntityCreator entityCreator = (IEntityCreator)mod;
1063 foreach (PCode pcode in entityCreator.CreationCapabilities)
1064 {
1065 m_entityCreators[pcode] = null;
1066 }
1067 }
1068 }
1069 }
1070 }
1071
1072 public void StackModuleInterface<M>(M mod)
1073 {
1074 List<Object> l;
1075 if (ModuleInterfaces.ContainsKey(typeof(M)))
1076 l = ModuleInterfaces[typeof(M)];
1077 else
1078 l = new List<Object>();
1079
1080 if (l.Contains(mod))
1081 return;
1082
1083 l.Add(mod);
1084
1085 if (mod is IEntityCreator)
1086 {
1087 IEntityCreator entityCreator = (IEntityCreator)mod;
1088 foreach (PCode pcode in entityCreator.CreationCapabilities)
1089 {
1090 m_entityCreators[pcode] = entityCreator;
1091 }
1092 }
1093
1094 ModuleInterfaces[typeof(M)] = l;
1095 }
1096
1097 /// <summary>
1098 /// For the given interface, retrieve the region module which implements it.
1099 /// </summary>
1100 /// <returns>null if there is no registered module implementing that interface</returns>
1101 public T RequestModuleInterface<T>()
1102 {
1103 if (ModuleInterfaces.ContainsKey(typeof(T)) &&
1104 (ModuleInterfaces[typeof(T)].Count > 0))
1105 return (T)ModuleInterfaces[typeof(T)][0];
1106 else
1107 return default(T);
1108 }
1109
1110 /// <summary>
1111 /// For the given interface, retrieve an array of region modules that implement it.
1112 /// </summary>
1113 /// <returns>an empty array if there are no registered modules implementing that interface</returns>
1114 public T[] RequestModuleInterfaces<T>()
1115 {
1116 if (ModuleInterfaces.ContainsKey(typeof(T)))
1117 {
1118 List<T> ret = new List<T>();
1119
1120 foreach (Object o in ModuleInterfaces[typeof(T)])
1121 ret.Add((T)o);
1122 return ret.ToArray();
1123 }
1124 else
1125 {
1126 return new T[] {};
1127 }
1128 }
1129
1130 #endregion
1131
1132 /// <summary>
1133 /// Call this from a region module to add a command to the OpenSim console.
1134 /// </summary>
1135 /// <param name="mod"></param>
1136 /// <param name="command"></param>
1137 /// <param name="shorthelp"></param>
1138 /// <param name="longhelp"></param>
1139 /// <param name="callback"></param>
1140 public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback)
1141 {
1142 AddCommand(module, command, shorthelp, longhelp, string.Empty, callback);
1143 }
1144
1145 /// <summary>
1146 /// Call this from a region module to add a command to the OpenSim console.
1147 /// </summary>
1148 /// <param name="mod">
1149 /// The use of IRegionModuleBase is a cheap trick to get a different method signature,
1150 /// though all new modules should be using interfaces descended from IRegionModuleBase anyway.
1151 /// </param>
1152 /// <param name="category">
1153 /// Category of the command. This is the section under which it will appear when the user asks for help
1154 /// </param>
1155 /// <param name="command"></param>
1156 /// <param name="shorthelp"></param>
1157 /// <param name="longhelp"></param>
1158 /// <param name="callback"></param>
1159 public void AddCommand(
1160 string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback)
1161 {
1162 AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback);
1163 }
1164
1165 /// <summary>
1166 /// Call this from a region module to add a command to the OpenSim console.
1167 /// </summary>
1168 /// <param name="mod"></param>
1169 /// <param name="command"></param>
1170 /// <param name="shorthelp"></param>
1171 /// <param name="longhelp"></param>
1172 /// <param name="descriptivehelp"></param>
1173 /// <param name="callback"></param>
1174 public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
1175 {
1176 string moduleName = "";
1177
1178 if (module != null)
1179 moduleName = module.Name;
1180
1181 AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback);
1182 }
1183
1184 /// <summary>
1185 /// Call this from a region module to add a command to the OpenSim console.
1186 /// </summary>
1187 /// <param name="category">
1188 /// Category of the command. This is the section under which it will appear when the user asks for help
1189 /// </param>
1190 /// <param name="mod"></param>
1191 /// <param name="command"></param>
1192 /// <param name="shorthelp"></param>
1193 /// <param name="longhelp"></param>
1194 /// <param name="descriptivehelp"></param>
1195 /// <param name="callback"></param>
1196 public void AddCommand(
1197 string category, IRegionModuleBase module, string command,
1198 string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
1199 {
1200 if (MainConsole.Instance == null)
1201 return;
1202
1203 bool shared = false;
1204
1205 if (module != null)
1206 shared = module is ISharedRegionModule;
1207
1208 MainConsole.Instance.Commands.AddCommand(
1209 category, shared, command, shorthelp, longhelp, descriptivehelp, callback);
1210 }
1211
1212 public virtual ISceneObject DeserializeObject(string representation)
1213 {
1214 return null;
1215 }
1216
1217 public virtual bool AllowScriptCrossings
1218 {
1219 get { return false; }
1220 }
1221
1222 public virtual void Start()
1223 {
1224 }
1225
1226 public void Restart()
1227 {
1228 // This has to be here to fire the event
1229 restart handlerPhysicsCrash = OnRestart;
1230 if (handlerPhysicsCrash != null)
1231 handlerPhysicsCrash(RegionInfo);
1232 }
1233
1234 public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep);
1235 }
1236}
1237>>>>>>> avn/ubitvar
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 3f6a7f8..c9c88d3 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1928,7 +1928,7 @@ namespace OpenSim.Region.Framework.Scenes
1928 SceneObjectGroupsByLocalPartID[part.LocalId] = parentGroup; 1928 SceneObjectGroupsByLocalPartID[part.LocalId] = parentGroup;
1929 } 1929 }
1930*/ 1930*/
1931 parentGroup.AdjustChildPrimPermissions(); 1931 parentGroup.AdjustChildPrimPermissions(false);
1932 parentGroup.HasGroupChanged = true; 1932 parentGroup.HasGroupChanged = true;
1933 parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true); 1933 parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true);
1934 parentGroup.ScheduleGroupForFullUpdate(); 1934 parentGroup.ScheduleGroupForFullUpdate();
@@ -2066,7 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes
2066 // return unless the root is deleted. This will remove them 2066 // return unless the root is deleted. This will remove them
2067 // from the database. They will be rewritten immediately, 2067 // from the database. They will be rewritten immediately,
2068 // minus the rows for the unlinked child prims. 2068 // minus the rows for the unlinked child prims.
2069 g.AdjustChildPrimPermissions(); 2069 g.AdjustChildPrimPermissions(false);
2070 m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID); 2070 m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID);
2071 g.TriggerScriptChangedEvent(Changed.LINK); 2071 g.TriggerScriptChangedEvent(Changed.LINK);
2072 g.HasGroupChanged = true; // Persist 2072 g.HasGroupChanged = true; // Persist
@@ -2154,13 +2154,8 @@ namespace OpenSim.Region.Framework.Scenes
2154 if (m_parentScene.Permissions.CanDuplicateObject( 2154 if (m_parentScene.Permissions.CanDuplicateObject(
2155 original.PrimCount, original.UUID, AgentID, original.AbsolutePosition)) 2155 original.PrimCount, original.UUID, AgentID, original.AbsolutePosition))
2156 { 2156 {
2157<<<<<<< HEAD
2158 m_log.WarnFormat(
2159 "[SCENEGRAPH]: Attempt to duplicate nonexistent prim id {0} by {1}", originalPrimID, AgentID);
2160=======
2161 SceneObjectGroup copy = original.Copy(true); 2157 SceneObjectGroup copy = original.Copy(true);
2162 copy.AbsolutePosition = copy.AbsolutePosition + offset; 2158 copy.AbsolutePosition = copy.AbsolutePosition + offset;
2163>>>>>>> avn/ubitvar
2164 2159
2165 if (original.OwnerID != AgentID) 2160 if (original.OwnerID != AgentID)
2166 { 2161 {
@@ -2197,63 +2192,12 @@ namespace OpenSim.Region.Framework.Scenes
2197 2192
2198 // PROBABLE END OF FIXME 2193 // PROBABLE END OF FIXME
2199 2194
2200<<<<<<< HEAD
2201 // FIXME: This section needs to be refactored so that it just calls AddSceneObject()
2202 Entities.Add(copy);
2203
2204 lock (SceneObjectGroupsByFullID)
2205 SceneObjectGroupsByFullID[copy.UUID] = copy;
2206
2207 SceneObjectPart[] children = copy.Parts;
2208
2209 lock (SceneObjectGroupsByFullPartID)
2210 {
2211 SceneObjectGroupsByFullPartID[copy.UUID] = copy;
2212 foreach (SceneObjectPart part in children)
2213 SceneObjectGroupsByFullPartID[part.UUID] = copy;
2214 }
2215
2216 lock (SceneObjectGroupsByLocalPartID)
2217 {
2218 SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
2219 foreach (SceneObjectPart part in children)
2220 SceneObjectGroupsByLocalPartID[part.LocalId] = copy;
2221 }
2222 // PROBABLE END OF FIXME
2223
2224 // Since we copy from a source group that is in selected
2225 // state, but the copy is shown deselected in the viewer,
2226 // We need to clear the selection flag here, else that
2227 // prim never gets persisted at all. The client doesn't
2228 // think it's selected, so it will never send a deselect...
2229 copy.IsSelected = false;
2230
2231 m_numTotalPrim += copy.Parts.Length;
2232
2233 // Go through all parts (primitives and meshes) of this Scene Object
2234 foreach (SceneObjectPart part in copy.Parts)
2235 {
2236 // Keep track of the total number of meshes or geometric primitives now in the scene;
2237 // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to
2238 // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives
2239 if (part.GetPrimType() == PrimType.SCULPT)
2240 m_numMesh++;
2241 else
2242 m_numPrim++;
2243 }
2244
2245 if (rot != Quaternion.Identity)
2246 {
2247 copy.UpdateGroupRotationR(rot);
2248 }
2249=======
2250 // Since we copy from a source group that is in selected 2195 // Since we copy from a source group that is in selected
2251 // state, but the copy is shown deselected in the viewer, 2196 // state, but the copy is shown deselected in the viewer,
2252 // We need to clear the selection flag here, else that 2197 // We need to clear the selection flag here, else that
2253 // prim never gets persisted at all. The client doesn't 2198 // prim never gets persisted at all. The client doesn't
2254 // think it's selected, so it will never send a deselect... 2199 // think it's selected, so it will never send a deselect...
2255 copy.IsSelected = false; 2200 copy.IsSelected = false;
2256>>>>>>> avn/ubitvar
2257 2201
2258 m_numPrim += copy.Parts.Length; 2202 m_numPrim += copy.Parts.Length;
2259 2203
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 79de6c0..98617d1 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -266,15 +266,12 @@ namespace OpenSim.Region.Framework.Scenes
266 for (int i = 0; i < parts.Length; i++) 266 for (int i = 0; i < parts.Length; i++)
267 { 267 {
268 SceneObjectPart part = parts[i]; 268 SceneObjectPart part = parts[i];
269<<<<<<< HEAD 269
270// m_log.DebugFormat("[SCENE OBJECT GROUP INVENTORY]: Effective perms of {0} are {1}", part.Name, (OpenMetaverse.PermissionMask)part.OwnerMask);
271 ownerMask &= part.OwnerMask;
272=======
273 if (useBase) 270 if (useBase)
274 ownerMask &= part.BaseMask; 271 ownerMask &= part.BaseMask;
275 else 272 else
276 ownerMask &= part.OwnerMask; 273 ownerMask &= part.OwnerMask;
277>>>>>>> avn/ubitvar 274
278 perms &= part.Inventory.MaskEffectivePermissions(); 275 perms &= part.Inventory.MaskEffectivePermissions();
279 } 276 }
280 277
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index a703377..5e1801a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -122,17 +122,12 @@ namespace OpenSim.Region.Framework.Scenes
122 /// since the group's last persistent backup 122 /// since the group's last persistent backup
123 /// </summary> 123 /// </summary>
124 private bool m_hasGroupChanged = false; 124 private bool m_hasGroupChanged = false;
125<<<<<<< HEAD
126 private long timeFirstChanged;
127 private long timeLastChanged;
128=======
129 private long timeFirstChanged = 0; 125 private long timeFirstChanged = 0;
130 private long timeLastChanged = 0; 126 private long timeLastChanged = 0;
131 private long m_maxPersistTime = 0; 127 private long m_maxPersistTime = 0;
132 private long m_minPersistTime = 0; 128 private long m_minPersistTime = 0;
133// private Random m_rand; 129// private Random m_rand;
134 private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); 130 private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>();
135>>>>>>> avn/ubitvar
136 131
137 /// <summary> 132 /// <summary>
138 /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage 133 /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage
@@ -205,7 +200,6 @@ namespace OpenSim.Region.Framework.Scenes
205 /// the prims in the database still use the old SceneGroupID. That's a problem if the group 200 /// the prims in the database still use the old SceneGroupID. That's a problem if the group
206 /// is deleted, because we delete groups by searching for prims by their SceneGroupID. 201 /// is deleted, because we delete groups by searching for prims by their SceneGroupID.
207 /// </summary> 202 /// </summary>
208<<<<<<< HEAD
209 public bool GroupContainsForeignPrims 203 public bool GroupContainsForeignPrims
210 { 204 {
211 private set 205 private set
@@ -218,9 +212,7 @@ namespace OpenSim.Region.Framework.Scenes
218 get { return m_groupContainsForeignPrims; } 212 get { return m_groupContainsForeignPrims; }
219 } 213 }
220 214
221=======
222 public bool HasGroupChangedDueToDelink { get; set; } 215 public bool HasGroupChangedDueToDelink { get; set; }
223>>>>>>> avn/ubitvar
224 216
225 private bool isTimeToPersist() 217 private bool isTimeToPersist()
226 { 218 {
@@ -350,7 +342,6 @@ namespace OpenSim.Region.Framework.Scenes
350 get { return RootPart.VolumeDetectActive; } 342 get { return RootPart.VolumeDetectActive; }
351 } 343 }
352 344
353<<<<<<< HEAD
354 private Vector3 lastPhysGroupPos; 345 private Vector3 lastPhysGroupPos;
355 private Quaternion lastPhysGroupRot; 346 private Quaternion lastPhysGroupRot;
356 347
@@ -358,9 +349,8 @@ namespace OpenSim.Region.Framework.Scenes
358 /// Is this entity set to be saved in persistent storage? 349 /// Is this entity set to be saved in persistent storage?
359 /// </summary> 350 /// </summary>
360 public bool Backup { get; private set; } 351 public bool Backup { get; private set; }
361======= 352
362 private bool m_isBackedUp; 353 private bool m_isBackedUp;
363>>>>>>> avn/ubitvar
364 354
365 public bool IsBackedUp 355 public bool IsBackedUp
366 { 356 {
@@ -570,146 +560,11 @@ namespace OpenSim.Region.Framework.Scenes
570 && !Scene.LoadingPrims 560 && !Scene.LoadingPrims
571 ) 561 )
572 { 562 {
573<<<<<<< HEAD
574 if (
575 !Scene.PositionIsInCurrentRegion(val)
576 && !IsAttachmentCheckFull()
577 && (!Scene.LoadingPrims)
578 )
579 {
580 IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
581 string version = String.Empty;
582 Vector3 newpos = Vector3.Zero;
583 string failureReason = String.Empty;
584 OpenSim.Services.Interfaces.GridRegion destination = null;
585
586 if (m_rootPart.KeyframeMotion != null)
587 m_rootPart.KeyframeMotion.StartCrossingCheck();
588
589 bool canCross = true;
590 foreach (ScenePresence av in GetSittingAvatars())
591 {
592 // We need to cross these agents. First, let's find
593 // out if any of them can't cross for some reason.
594 // We have to deny the crossing entirely if any
595 // of them are banned. Alternatively, we could
596 // unsit banned agents....
597
598
599 // We set the avatar position as being the object
600 // position to get the region to send to
601 if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out version, out newpos, out failureReason)) == null)
602 {
603 canCross = false;
604 break;
605 }
606
607 m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName);
608 }
609
610 if (canCross)
611 {
612 // We unparent the SP quietly so that it won't
613 // be made to stand up
614
615 List<avtocrossInfo> avsToCross = new List<avtocrossInfo>();
616
617 foreach (ScenePresence av in GetSittingAvatars())
618 {
619 avtocrossInfo avinfo = new avtocrossInfo();
620 SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID);
621 if (parentPart != null)
622 av.ParentUUID = parentPart.UUID;
623
624 avinfo.av = av;
625 avinfo.ParentID = av.ParentID;
626 avsToCross.Add(avinfo);
627
628 av.PrevSitOffset = av.OffsetPosition;
629 av.ParentID = 0;
630 }
631
632 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
633
634 // Normalize
635 if (val.X >= m_scene.RegionInfo.RegionSizeX)
636 val.X -= m_scene.RegionInfo.RegionSizeX;
637 if (val.Y >= m_scene.RegionInfo.RegionSizeY)
638 val.Y -= m_scene.RegionInfo.RegionSizeY;
639 if (val.X < 0)
640 val.X += m_scene.RegionInfo.RegionSizeX;
641 if (val.Y < 0)
642 val.Y += m_scene.RegionInfo.RegionSizeY;
643
644 // If it's deleted, crossing was successful
645 if (IsDeleted)
646 {
647 foreach (avtocrossInfo avinfo in avsToCross)
648 {
649 ScenePresence av = avinfo.av;
650 if (!av.IsInTransit) // just in case...
651 {
652 m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);
653
654 av.IsInTransit = true;
655
656 // A temporary measure to allow regression tests to work.
657 // Quite possibly, all BeginInvoke() calls should be replaced by Util.FireAndForget
658 // or similar since BeginInvoke() always uses the system threadpool to launch
659 // threads rather than any replace threadpool that we might be using.
660 if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest)
661 {
662 entityTransfer.CrossAgentToNewRegionAsync(av, val, destination, av.Flying, version);
663 CrossAgentToNewRegionCompleted(av);
664 }
665 else
666 {
667 CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync;
668 d.BeginInvoke(
669 av, val, destination, av.Flying, version,
670 ar => CrossAgentToNewRegionCompleted(d.EndInvoke(ar)), null);
671 }
672 }
673 else
674 {
675 m_log.DebugFormat("[SCENE OBJECT]: Not crossing avatar {0} to {1} because it's already in transit", av.Name, val);
676 }
677 }
678
679 return;
680 }
681 else // cross failed, put avas back ??
682 {
683 foreach (avtocrossInfo avinfo in avsToCross)
684 {
685 ScenePresence av = avinfo.av;
686 av.ParentUUID = UUID.Zero;
687 av.ParentID = avinfo.ParentID;
688 }
689 }
690 }
691 else
692 {
693 if (m_rootPart.KeyframeMotion != null)
694 m_rootPart.KeyframeMotion.CrossingFailure();
695
696 if (RootPart.PhysActor != null)
697 {
698 RootPart.PhysActor.CrossingFailure();
699 }
700 }
701
702 Vector3 oldp = AbsolutePosition;
703 val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)m_scene.RegionInfo.RegionSizeX - 0.5f);
704 val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)m_scene.RegionInfo.RegionSizeY - 0.5f);
705 val.Z = Util.Clamp<float>(oldp.Z, 0.5f, Constants.RegionHeight);
706=======
707 if (!inTransit) 563 if (!inTransit)
708 { 564 {
709 inTransit = true; 565 inTransit = true;
710 SOGCrossDelegate d = CrossAsync; 566 SOGCrossDelegate d = CrossAsync;
711 d.BeginInvoke(this, val, CrossAsyncCompleted, d); 567 d.BeginInvoke(this, val, CrossAsyncCompleted, d);
712>>>>>>> avn/ubitvar
713 } 568 }
714 return; 569 return;
715 } 570 }
@@ -1200,7 +1055,7 @@ namespace OpenSim.Region.Framework.Scenes
1200 /// No avatar should appear more than once in this list. 1055 /// No avatar should appear more than once in this list.
1201 /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. 1056 /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart.
1202 /// </remarks> 1057 /// </remarks>
1203 protected internal List<ScenePresence> m_sittingAvatars = new List<ScenePresence>(); 1058 protected internal List<UUID> m_sittingAvatars = new List<UUID>();
1204 1059
1205 #endregion 1060 #endregion
1206 1061
@@ -1311,14 +1166,10 @@ namespace OpenSim.Region.Framework.Scenes
1311 /// </summary> 1166 /// </summary>
1312 public virtual void AttachToBackup() 1167 public virtual void AttachToBackup()
1313 { 1168 {
1314<<<<<<< HEAD
1315 if (CanBeBackedUp)
1316=======
1317 if (IsAttachment) return; 1169 if (IsAttachment) return;
1318 m_scene.SceneGraph.FireAttachToBackup(this); 1170 m_scene.SceneGraph.FireAttachToBackup(this);
1319 1171
1320 if (InSceneBackup) 1172// if (InSceneBackup)
1321>>>>>>> avn/ubitvar
1322 { 1173 {
1323// m_log.DebugFormat( 1174// m_log.DebugFormat(
1324// "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID); 1175// "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID);
@@ -1431,21 +1282,12 @@ namespace OpenSim.Region.Framework.Scenes
1431 /// <returns></returns> 1282 /// <returns></returns>
1432 public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) 1283 public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
1433 { 1284 {
1434<<<<<<< HEAD
1435 maxX = -256f;
1436 maxY = -256f;
1437 maxZ = -256f;
1438 minX = 10000f;
1439 minY = 10000f;
1440 minZ = 10000f;
1441=======
1442 maxX = float.MinValue; 1285 maxX = float.MinValue;
1443 maxY = float.MinValue; 1286 maxY = float.MinValue;
1444 maxZ = float.MinValue; 1287 maxZ = float.MinValue;
1445 minX = float.MaxValue; 1288 minX = float.MaxValue;
1446 minY = float.MaxValue; 1289 minY = float.MaxValue;
1447 minZ = float.MaxValue; 1290 minZ = float.MaxValue;
1448>>>>>>> avn/ubitvar
1449 1291
1450 SceneObjectPart[] parts = m_parts.GetArray(); 1292 SceneObjectPart[] parts = m_parts.GetArray();
1451 foreach (SceneObjectPart part in parts) 1293 foreach (SceneObjectPart part in parts)
@@ -1843,17 +1685,6 @@ namespace OpenSim.Region.Framework.Scenes
1843 } 1685 }
1844 } 1686 }
1845 1687
1846<<<<<<< HEAD
1847
1848 /// <summary>
1849 ///
1850 /// </summary>
1851 /// <param name="part"></param>
1852 private void SetPartAsNonRoot(SceneObjectPart part)
1853 {
1854 part.ParentID = m_rootPart.LocalId;
1855 part.ClearUndoState();
1856=======
1857 /// <summary> 1688 /// <summary>
1858 /// Add the avatar to this linkset (avatar is sat). 1689 /// Add the avatar to this linkset (avatar is sat).
1859 /// </summary> 1690 /// </summary>
@@ -1893,7 +1724,6 @@ namespace OpenSim.Region.Framework.Scenes
1893 public List<ScenePresence> GetLinkedAvatars() 1724 public List<ScenePresence> GetLinkedAvatars()
1894 { 1725 {
1895 return m_linkedAvatars; 1726 return m_linkedAvatars;
1896>>>>>>> avn/ubitvar
1897 } 1727 }
1898 1728
1899 /// <summary> 1729 /// <summary>
@@ -2197,14 +2027,7 @@ namespace OpenSim.Region.Framework.Scenes
2197 2027
2198 if (Scene != null) 2028 if (Scene != null)
2199 { 2029 {
2200<<<<<<< HEAD
2201 if (!sp.IsChildAgent && sp.ParentID == part.LocalId)
2202 sp.StandUp();
2203
2204 if (!silent)
2205=======
2206 Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) 2030 Scene.ForEachRootScenePresence(delegate(ScenePresence avatar)
2207>>>>>>> avn/ubitvar
2208 { 2031 {
2209 if (avatar.ParentID == LocalId) 2032 if (avatar.ParentID == LocalId)
2210 avatar.StandUp(); 2033 avatar.StandUp();
@@ -2504,16 +2327,6 @@ namespace OpenSim.Region.Framework.Scenes
2504 /// <returns></returns> 2327 /// <returns></returns>
2505 public SceneObjectGroup Copy(bool userExposed) 2328 public SceneObjectGroup Copy(bool userExposed)
2506 { 2329 {
2507<<<<<<< HEAD
2508 // FIXME: This is dangerous since it's easy to forget to reset some references when necessary and end up
2509 // with bugs that only occur in some circumstances (e.g. crossing between regions on the same simulator
2510 // but not between regions on different simulators). Really, all copying should be done explicitly.
2511 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
2512
2513 dupe.Backup = false;
2514 dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>();
2515 dupe.m_sittingAvatars = new List<ScenePresence>();
2516=======
2517 m_dupeInProgress = true; 2330 m_dupeInProgress = true;
2518 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); 2331 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
2519 dupe.m_isBackedUp = false; 2332 dupe.m_isBackedUp = false;
@@ -2525,7 +2338,6 @@ namespace OpenSim.Region.Framework.Scenes
2525 dupe.m_linkedAvatars = new List<ScenePresence>(); 2338 dupe.m_linkedAvatars = new List<ScenePresence>();
2526 dupe.m_sittingAvatars = new List<UUID>(); 2339 dupe.m_sittingAvatars = new List<UUID>();
2527 2340
2528>>>>>>> avn/ubitvar
2529 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 2341 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
2530 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 2342 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
2531 2343
@@ -2700,12 +2512,8 @@ namespace OpenSim.Region.Framework.Scenes
2700 return RootPart.Torque; 2512 return RootPart.Torque;
2701 } 2513 }
2702 2514
2703<<<<<<< HEAD
2704 public void MoveToTarget(Vector3 target, float tau)
2705=======
2706 // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object 2515 // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object
2707 public void moveToTarget(Vector3 target, float tau) 2516 public void MoveToTarget(Vector3 target, float tau)
2708>>>>>>> avn/ubitvar
2709 { 2517 {
2710 if (IsAttachment) 2518 if (IsAttachment)
2711 { 2519 {
@@ -2732,21 +2540,7 @@ namespace OpenSim.Region.Framework.Scenes
2732 if (IsAttachment) 2540 if (IsAttachment)
2733 { 2541 {
2734 ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); 2542 ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
2735<<<<<<< HEAD
2736
2737 if (avatar != null)
2738 avatar.ResetMoveToTarget();
2739 }
2740 else
2741 {
2742 PhysicsActor pa = RootPart.PhysActor;
2743 2543
2744 if (pa != null && pa.PIDActive)
2745 {
2746 pa.PIDActive = false;
2747
2748 ScheduleGroupForTerseUpdate();
2749=======
2750 if (avatar != null) 2544 if (avatar != null)
2751 { 2545 {
2752 avatar.ResetMoveToTarget(); 2546 avatar.ResetMoveToTarget();
@@ -2786,7 +2580,6 @@ namespace OpenSim.Region.Framework.Scenes
2786 rootpart.PhysActor.APIDDamping = damping; 2580 rootpart.PhysActor.APIDDamping = damping;
2787 rootpart.PhysActor.APIDActive = true; 2581 rootpart.PhysActor.APIDActive = true;
2788 } 2582 }
2789>>>>>>> avn/ubitvar
2790 } 2583 }
2791 } 2584 }
2792 } 2585 }
@@ -3484,18 +3277,6 @@ namespace OpenSim.Region.Framework.Scenes
3484 3277
3485 linkPart.Rezzed = RootPart.Rezzed; 3278 linkPart.Rezzed = RootPart.Rezzed;
3486 3279
3487<<<<<<< HEAD
3488 // We must persist the delinked group to the database immediately, for safety. The problem
3489 // is that although in memory the new group has a new SceneGroupID, in the database it
3490 // still has the parent group's SceneGroupID (until the next backup). This means that if the
3491 // parent group is deleted then the delinked group will also be deleted from the database.
3492 // This problem will disappear if the region remains alive long enough for another backup,
3493 // since at that time the delinked group's new SceneGroupID will be written to the database.
3494 // But if the region crashes before that then the prims will be permanently gone, and this must
3495 // not happen. (We can't use a just-in-time trick like GroupContainsForeignPrims in this case
3496 // because the delinked group doesn't know when the source group is deleted.)
3497 m_scene.ForceSceneObjectBackup(objectGroup);
3498=======
3499 // When we delete a group, we currently have to force persist to the database if the object id has changed 3280 // When we delete a group, we currently have to force persist to the database if the object id has changed
3500 // (since delete works by deleting all rows which have a given object id) 3281 // (since delete works by deleting all rows which have a given object id)
3501 3282
@@ -3507,7 +3288,6 @@ namespace OpenSim.Region.Framework.Scenes
3507 m_rootPart.PhysActor.Building = false; 3288 m_rootPart.PhysActor.Building = false;
3508 3289
3509 objectGroup.HasGroupChangedDueToDelink = true; 3290 objectGroup.HasGroupChangedDueToDelink = true;
3510>>>>>>> avn/ubitvar
3511 3291
3512 if (sendEvents) 3292 if (sendEvents)
3513 linkPart.TriggerScriptChangedEvent(Changed.LINK); 3293 linkPart.TriggerScriptChangedEvent(Changed.LINK);
@@ -3521,13 +3301,9 @@ namespace OpenSim.Region.Framework.Scenes
3521 /// <param name="objectGroup"></param> 3301 /// <param name="objectGroup"></param>
3522 public virtual void DetachFromBackup() 3302 public virtual void DetachFromBackup()
3523 { 3303 {
3524<<<<<<< HEAD
3525 if (Backup && Scene != null)
3526=======
3527 if (m_scene != null) 3304 if (m_scene != null)
3528 m_scene.SceneGraph.FireDetachFromBackup(this); 3305 m_scene.SceneGraph.FireDetachFromBackup(this);
3529 if (m_isBackedUp && Scene != null) 3306 if (m_isBackedUp && Scene != null)
3530>>>>>>> avn/ubitvar
3531 m_scene.EventManager.OnBackup -= ProcessBackup; 3307 m_scene.EventManager.OnBackup -= ProcessBackup;
3532 3308
3533 Backup = false; 3309 Backup = false;
@@ -3973,9 +3749,6 @@ namespace OpenSim.Region.Framework.Scenes
3973 { 3749 {
3974 RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF); 3750 RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF);
3975 3751
3976<<<<<<< HEAD
3977 AdjustChildPrimPermissions(Scene.Permissions.IsGod(AgentID));
3978=======
3979 bool god = Scene.Permissions.IsGod(AgentID); 3752 bool god = Scene.Permissions.IsGod(AgentID);
3980 3753
3981 if (field == 1 && god) 3754 if (field == 1 && god)
@@ -3986,8 +3759,7 @@ namespace OpenSim.Region.Framework.Scenes
3986 }); 3759 });
3987 } 3760 }
3988 3761
3989 AdjustChildPrimPermissions(); 3762 AdjustChildPrimPermissions(false);
3990>>>>>>> avn/ubitvar
3991 3763
3992 if (field == 1 && god) // Base mask was set. Update all child part inventories 3764 if (field == 1 && god) // Base mask was set. Update all child part inventories
3993 { 3765 {
@@ -5037,10 +4809,10 @@ namespace OpenSim.Region.Framework.Scenes
5037 /// down after it move one place down the list. 4809 /// down after it move one place down the list.
5038 /// </remarks> 4810 /// </remarks>
5039 /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns> 4811 /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns>
5040 public List<ScenePresence> GetSittingAvatars() 4812 public List<UUID> GetSittingAvatars()
5041 { 4813 {
5042 lock (m_sittingAvatars) 4814 lock (m_sittingAvatars)
5043 return new List<ScenePresence>(m_sittingAvatars); 4815 return new List<UUID>(m_sittingAvatars);
5044 } 4816 }
5045 4817
5046 /// <summary> 4818 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 1cfa8ed..c300b96 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1046,39 +1046,22 @@ namespace OpenSim.Region.Framework.Scenes
1046 } 1046 }
1047 set 1047 set
1048 { 1048 {
1049<<<<<<< HEAD
1050 if (Util.IsNanOrInfinity(value)) 1049 if (Util.IsNanOrInfinity(value))
1051 m_angularVelocity = Vector3.Zero; 1050 m_angularVelocity = Vector3.Zero;
1052 else 1051 else
1053 m_angularVelocity = value; 1052 m_angularVelocity = value;
1054 1053
1055 PhysicsActor actor = PhysActor; 1054 PhysicsActor actor = PhysActor;
1056 if ((actor != null) && actor.IsPhysical)
1057 actor.RotationalVelocity = m_angularVelocity;
1058=======
1059 m_angularVelocity = value;
1060 PhysicsActor actor = PhysActor;
1061 if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE) 1055 if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE)
1062 { 1056 {
1063 actor.RotationalVelocity = m_angularVelocity; 1057 actor.RotationalVelocity = m_angularVelocity;
1064 } 1058 }
1065>>>>>>> avn/ubitvar
1066 } 1059 }
1067 } 1060 }
1068 1061
1069 /// <summary></summary> 1062 /// <summary></summary>
1070 public Vector3 Acceleration 1063 public Vector3 Acceleration
1071 { 1064 {
1072<<<<<<< HEAD
1073 get { return m_acceleration; }
1074 set
1075 {
1076 if (Util.IsNanOrInfinity(value))
1077 m_acceleration = Vector3.Zero;
1078 else
1079 m_acceleration = value;
1080 }
1081=======
1082 get 1065 get
1083 { 1066 {
1084 PhysicsActor actor = PhysActor; 1067 PhysicsActor actor = PhysActor;
@@ -1088,9 +1071,14 @@ namespace OpenSim.Region.Framework.Scenes
1088 } 1071 }
1089 return m_acceleration; 1072 return m_acceleration;
1090 } 1073 }
1091 1074
1092 set { m_acceleration = value; } 1075 set
1093>>>>>>> avn/ubitvar 1076 {
1077 if (Util.IsNanOrInfinity(value))
1078 m_acceleration = Vector3.Zero;
1079 else
1080 m_acceleration = value;
1081 }
1094 } 1082 }
1095 1083
1096 public string Description { get; set; } 1084 public string Description { get; set; }
@@ -1431,7 +1419,7 @@ namespace OpenSim.Region.Framework.Scenes
1431 /// <value> 1419 /// <value>
1432 /// null if there are no sitting avatars. This is to save us create a hashset for every prim in a scene. 1420 /// null if there are no sitting avatars. This is to save us create a hashset for every prim in a scene.
1433 /// </value> 1421 /// </value>
1434 private HashSet<ScenePresence> m_sittingAvatars; 1422 private HashSet<UUID> m_sittingAvatars;
1435 1423
1436 public virtual UUID RegionID 1424 public virtual UUID RegionID
1437 { 1425 {
@@ -1932,7 +1920,6 @@ namespace OpenSim.Region.Framework.Scenes
1932 1920
1933 public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) 1921 public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim)
1934 { 1922 {
1935<<<<<<< HEAD
1936 byte[] data; 1923 byte[] data;
1937 1924
1938 if (pTexAnim.Flags == Primitive.TextureAnimMode.ANIM_OFF) 1925 if (pTexAnim.Flags == Primitive.TextureAnimMode.ANIM_OFF)
@@ -1944,13 +1931,6 @@ namespace OpenSim.Region.Framework.Scenes
1944 data = new byte[16]; 1931 data = new byte[16];
1945 int pos = 0; 1932 int pos = 0;
1946 1933
1947=======
1948 if (((int)pTexAnim.Flags & 1) != 0) // ANIM_ON
1949 {
1950 byte[] data = new byte[16];
1951 int pos = 0;
1952
1953>>>>>>> avn/ubitvar
1954 // The flags don't like conversion from uint to byte, so we have to do 1934 // The flags don't like conversion from uint to byte, so we have to do
1955 // it the crappy way. See the above function :( 1935 // it the crappy way. See the above function :(
1956 1936
@@ -1962,17 +1942,9 @@ namespace OpenSim.Region.Framework.Scenes
1962 Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); 1942 Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos);
1963 Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); 1943 Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4);
1964 Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); 1944 Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8);
1965<<<<<<< HEAD 1945
1966 }
1967=======
1968>>>>>>> avn/ubitvar
1969
1970 m_TextureAnimation = data;
1971 }
1972 else
1973 {
1974 m_TextureAnimation = Utils.EmptyBytes;
1975 } 1946 }
1947 m_TextureAnimation = data;
1976 } 1948 }
1977 1949
1978 public void AdjustSoundGain(double volume) 1950 public void AdjustSoundGain(double volume)
@@ -2240,7 +2212,7 @@ namespace OpenSim.Region.Framework.Scenes
2240 Array.Copy(Shape.ExtraParams, extraP, extraP.Length); 2212 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
2241 dupe.Shape.ExtraParams = extraP; 2213 dupe.Shape.ExtraParams = extraP;
2242 2214
2243 dupe.m_sittingAvatars = new HashSet<ScenePresence>(); 2215 dupe.m_sittingAvatars = new HashSet<UUID>();
2244 2216
2245 // safeguard actual copy is done in sog.copy 2217 // safeguard actual copy is done in sog.copy
2246 dupe.KeyframeMotion = null; 2218 dupe.KeyframeMotion = null;
@@ -2829,7 +2801,7 @@ namespace OpenSim.Region.Framework.Scenes
2829 CollidingMessage = CreateColliderArgs(this, colliders); 2801 CollidingMessage = CreateColliderArgs(this, colliders);
2830 2802
2831 if (CollidingMessage.Colliders.Count > 0) 2803 if (CollidingMessage.Colliders.Count > 0)
2832 DoNotify(notify, LocalId, CollidingMessage); 2804 notify(LocalId, CollidingMessage);
2833 2805
2834 if (PassCollisions) 2806 if (PassCollisions)
2835 sendToRoot = true; 2807 sendToRoot = true;
@@ -2843,7 +2815,7 @@ namespace OpenSim.Region.Framework.Scenes
2843 { 2815 {
2844 CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders); 2816 CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders);
2845 if (CollidingMessage.Colliders.Count > 0) 2817 if (CollidingMessage.Colliders.Count > 0)
2846 DoNotify(notify, ParentGroup.RootPart.LocalId, CollidingMessage); 2818 notify(ParentGroup.RootPart.LocalId, CollidingMessage);
2847 } 2819 }
2848 } 2820 }
2849 } 2821 }
@@ -2858,35 +2830,6 @@ namespace OpenSim.Region.Framework.Scenes
2858 colliding.Add(CreateDetObjectForGround()); 2830 colliding.Add(CreateDetObjectForGround());
2859 LandCollidingMessage.Colliders = colliding; 2831 LandCollidingMessage.Colliders = colliding;
2860 2832
2861<<<<<<< HEAD
2862 DoNotify(notify, LocalId, LandCollidingMessage);
2863 }
2864 }
2865
2866 private void DoNotify(ScriptCollidingNotification notify, uint id, ColliderArgs collargs)
2867 {
2868 if (m_parentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.ShouldUseFireAndForgetForCollisions)
2869 {
2870 // For those learning C#, FireAndForget takes a function, an object to pass
2871 // to that function and an ID string. The "oo => {}" construct is a lambda expression
2872 // for a function with one arguement ('oo'). The 'new Object[] {}" construct creates an Object
2873 // that is an object array and initializes it with three items (the parameters
2874 // being passed). The parameters passed are the function to call ('notify') and
2875 // its two arguements. Finally, once in the function (called later by the FireAndForget
2876 // thread scheduler), the passed object is cast to an object array and then each
2877 // of its items (aoo[0] to aoo[2]) are individually cast to what they are and
2878 // then used in a call of the passed ScriptCollidingNotification function.
2879 Util.FireAndForget(oo =>
2880 {
2881 Object[] aoo = (Object[])oo;
2882 ((ScriptCollidingNotification)aoo[0])((uint)aoo[1], (ColliderArgs)aoo[2]);
2883
2884 }, new Object[] { notify, id, collargs }, "SOP.Collision");
2885 }
2886 else
2887 {
2888 notify(id, collargs);
2889=======
2890 if (Inventory.ContainsScripts()) 2833 if (Inventory.ContainsScripts())
2891 { 2834 {
2892 if (!PassCollisions) 2835 if (!PassCollisions)
@@ -2898,7 +2841,6 @@ namespace OpenSim.Region.Framework.Scenes
2898 if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot) 2841 if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot)
2899 { 2842 {
2900 notify(ParentGroup.RootPart.LocalId, LandCollidingMessage); 2843 notify(ParentGroup.RootPart.LocalId, LandCollidingMessage);
2901>>>>>>> avn/ubitvar
2902 } 2844 }
2903 } 2845 }
2904 2846
@@ -3046,12 +2988,7 @@ namespace OpenSim.Region.Framework.Scenes
3046 2988
3047 if (pa != null) 2989 if (pa != null)
3048 { 2990 {
3049<<<<<<< HEAD
3050 Vector3 newpos = pa.Position; 2991 Vector3 newpos = pa.Position;
3051=======
3052 Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0);
3053
3054>>>>>>> avn/ubitvar
3055 if (!ParentGroup.Scene.PositionIsInCurrentRegion(newpos)) 2992 if (!ParentGroup.Scene.PositionIsInCurrentRegion(newpos))
3056 { 2993 {
3057 // Setting position outside current region will start region crossing 2994 // Setting position outside current region will start region crossing
@@ -3996,14 +3933,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
3996 3933
3997 public void StopMoveToTarget() 3934 public void StopMoveToTarget()
3998 { 3935 {
3999<<<<<<< HEAD
4000 ParentGroup.StopMoveToTarget(); 3936 ParentGroup.StopMoveToTarget();
4001=======
4002 ParentGroup.stopMoveToTarget();
4003
4004// ParentGroup.ScheduleGroupForTerseUpdate();
4005 //ParentGroup.ScheduleGroupForFullUpdate();
4006>>>>>>> avn/ubitvar
4007 } 3937 }
4008 3938
4009 public void StoreUndoState(ObjectChangeType change) 3939 public void StoreUndoState(ObjectChangeType change)
@@ -4665,8 +4595,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4665 4595
4666 public void ClonePermissions(SceneObjectPart source) 4596 public void ClonePermissions(SceneObjectPart source)
4667 { 4597 {
4668 bool update = false;
4669
4670 uint prevOwnerMask = OwnerMask; 4598 uint prevOwnerMask = OwnerMask;
4671 uint prevGroupMask = GroupMask; 4599 uint prevGroupMask = GroupMask;
4672 uint prevEveryoneMask = EveryoneMask; 4600 uint prevEveryoneMask = EveryoneMask;
@@ -4851,12 +4779,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4851 } 4779 }
4852 else // it already has a physical representation 4780 else // it already has a physical representation
4853 { 4781 {
4854<<<<<<< HEAD 4782
4855 pa.SetMaterial(Material);
4856 pa.Position = GetWorldPosition();
4857 pa.Orientation = GetWorldRotation();
4858 DoPhysicsPropertyUpdate(UsePhysics, true);
4859=======
4860 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. 4783 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status.
4861/* moved into DoPhysicsPropertyUpdate 4784/* moved into DoPhysicsPropertyUpdate
4862 if(VolumeDetectActive) 4785 if(VolumeDetectActive)
@@ -4864,7 +4787,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4864 else 4787 else
4865 pa.SetVolumeDetect(0); 4788 pa.SetVolumeDetect(0);
4866*/ 4789*/
4867>>>>>>> avn/ubitvar
4868 4790
4869 if (pa.Building != building) 4791 if (pa.Building != building)
4870 pa.Building = building; 4792 pa.Building = building;
@@ -5621,19 +5543,19 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5621 /// true if the avatar was not already recorded, false otherwise. 5543 /// true if the avatar was not already recorded, false otherwise.
5622 /// </returns> 5544 /// </returns>
5623 /// <param name='avatarId'></param> 5545 /// <param name='avatarId'></param>
5624 protected internal bool AddSittingAvatar(ScenePresence sp) 5546 protected internal bool AddSittingAvatar(UUID id)
5625 { 5547 {
5626 lock (ParentGroup.m_sittingAvatars) 5548 lock (ParentGroup.m_sittingAvatars)
5627 { 5549 {
5628 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) 5550 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
5629 SitTargetAvatar = sp.UUID; 5551 SitTargetAvatar = id;
5630 5552
5631 if (m_sittingAvatars == null) 5553 if (m_sittingAvatars == null)
5632 m_sittingAvatars = new HashSet<ScenePresence>(); 5554 m_sittingAvatars = new HashSet<UUID>();
5633 5555
5634 if (m_sittingAvatars.Add(sp)) 5556 if (m_sittingAvatars.Add(id))
5635 { 5557 {
5636 ParentGroup.m_sittingAvatars.Add(sp); 5558 ParentGroup.m_sittingAvatars.Add(id);
5637 5559
5638 return true; 5560 return true;
5639 } 5561 }
@@ -5650,22 +5572,22 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5650 /// true if the avatar was present and removed, false if it was not present. 5572 /// true if the avatar was present and removed, false if it was not present.
5651 /// </returns> 5573 /// </returns>
5652 /// <param name='avatarId'></param> 5574 /// <param name='avatarId'></param>
5653 protected internal bool RemoveSittingAvatar(ScenePresence sp) 5575 protected internal bool RemoveSittingAvatar(UUID id)
5654 { 5576 {
5655 lock (ParentGroup.m_sittingAvatars) 5577 lock (ParentGroup.m_sittingAvatars)
5656 { 5578 {
5657 if (SitTargetAvatar == sp.UUID) 5579 if (SitTargetAvatar == id)
5658 SitTargetAvatar = UUID.Zero; 5580 SitTargetAvatar = UUID.Zero;
5659 5581
5660 if (m_sittingAvatars == null) 5582 if (m_sittingAvatars == null)
5661 return false; 5583 return false;
5662 5584
5663 if (m_sittingAvatars.Remove(sp)) 5585 if (m_sittingAvatars.Remove(id))
5664 { 5586 {
5665 if (m_sittingAvatars.Count == 0) 5587 if (m_sittingAvatars.Count == 0)
5666 m_sittingAvatars = null; 5588 m_sittingAvatars = null;
5667 5589
5668 ParentGroup.m_sittingAvatars.Remove(sp); 5590 ParentGroup.m_sittingAvatars.Remove(id);
5669 5591
5670 return true; 5592 return true;
5671 } 5593 }
@@ -5679,14 +5601,14 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5679 /// </summary> 5601 /// </summary>
5680 /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> 5602 /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks>
5681 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> 5603 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
5682 public HashSet<ScenePresence> GetSittingAvatars() 5604 public HashSet<UUID> GetSittingAvatars()
5683 { 5605 {
5684 lock (ParentGroup.m_sittingAvatars) 5606 lock (ParentGroup.m_sittingAvatars)
5685 { 5607 {
5686 if (m_sittingAvatars == null) 5608 if (m_sittingAvatars == null)
5687 return null; 5609 return null;
5688 else 5610 else
5689 return new HashSet<ScenePresence>(m_sittingAvatars); 5611 return new HashSet<UUID>(m_sittingAvatars);
5690 } 5612 }
5691 } 5613 }
5692 5614
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 7af0b20..5811ed9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -892,16 +892,8 @@ namespace OpenSim.Region.Framework.Scenes
892 offsetHeight = 0; 892 offsetHeight = 0;
893 return false; 893 return false;
894 } 894 }
895<<<<<<< HEAD
896
897 Vector3 bbox;
898 float offsetHeight;
899
900 m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight);
901=======
902 895
903 bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); 896 bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight);
904>>>>>>> avn/ubitvar
905 897
906 for (int i = 0; i < objlist.Count; i++) 898 for (int i = 0; i < objlist.Count; i++)
907 { 899 {
@@ -1068,12 +1060,7 @@ namespace OpenSim.Region.Framework.Scenes
1068 m_items.LockItemsForRead(false); 1060 m_items.LockItemsForRead(false);
1069 if (type == 10) // Script 1061 if (type == 10) // Script
1070 { 1062 {
1071<<<<<<< HEAD
1072 // route it through here, to handle script cleanup tasks
1073 RemoveScriptInstance(itemID, false);
1074=======
1075 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); 1063 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
1076>>>>>>> avn/ubitvar
1077 } 1064 }
1078 m_items.LockItemsForWrite(true); 1065 m_items.LockItemsForWrite(true);
1079 m_items.Remove(itemID); 1066 m_items.Remove(itemID);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4bccb7d..022a90d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -299,6 +299,7 @@ namespace OpenSim.Region.Framework.Scenes
299// private int m_lastColCount = -1; //KF: Look for Collision chnages 299// private int m_lastColCount = -1; //KF: Look for Collision chnages
300// private int m_updateCount = 0; //KF: Update Anims for a while 300// private int m_updateCount = 0; //KF: Update Anims for a while
301// private static readonly int UPDATE_COUNT = 10; // how many frames to update for 301// private static readonly int UPDATE_COUNT = 10; // how many frames to update for
302 private List<uint> m_lastColliders = new List<uint>();
302 303
303 private TeleportFlags m_teleportFlags; 304 private TeleportFlags m_teleportFlags;
304 public TeleportFlags TeleportFlags 305 public TeleportFlags TeleportFlags
@@ -361,6 +362,9 @@ namespace OpenSim.Region.Framework.Scenes
361 //private int m_moveToPositionStateStatus; 362 //private int m_moveToPositionStateStatus;
362 //***************************************************** 363 //*****************************************************
363 364
365 private bool m_collisionEventFlag = false;
366 private object m_collisionEventLock = new Object();
367
364 private int m_movementAnimationUpdateCounter = 0; 368 private int m_movementAnimationUpdateCounter = 0;
365 369
366 public Vector3 PrevSitOffset { get; set; } 370 public Vector3 PrevSitOffset { get; set; }
@@ -377,7 +381,6 @@ namespace OpenSim.Region.Framework.Scenes
377 } 381 }
378 } 382 }
379 383
380 public bool SentInitialDataToClient { get; private set; }
381 384
382 /// <summary> 385 /// <summary>
383 /// Copy of the script states while the agent is in transit. This state may 386 /// Copy of the script states while the agent is in transit. This state may
@@ -438,12 +441,6 @@ namespace OpenSim.Region.Framework.Scenes
438 private object m_originRegionIDAccessLock = new object(); 441 private object m_originRegionIDAccessLock = new object();
439 442
440 /// <summary> 443 /// <summary>
441 /// Triggered on entity transfer after to allow CompleteMovement() to proceed after we have received an
442 /// UpdateAgent from the originating region.ddkjjkj
443 /// </summary>
444 private AutoResetEvent m_updateAgentReceivedAfterTransferEvent = new AutoResetEvent(false);
445
446 /// <summary>
447 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent 444 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent
448 /// teleport is reusing the connection. 445 /// teleport is reusing the connection.
449 /// </summary> 446 /// </summary>
@@ -470,11 +467,6 @@ namespace OpenSim.Region.Framework.Scenes
470 public uint MovementFlag { get; private set; } 467 public uint MovementFlag { get; private set; }
471 468
472 /// <summary> 469 /// <summary>
473 /// Set this if we need to force a movement update on the next received AgentUpdate from the viewer.
474 /// </summary>
475 private const uint ForceUpdateMovementFlagValue = uint.MaxValue;
476
477 /// <summary>
478 /// Is the agent stop control flag currently active? 470 /// Is the agent stop control flag currently active?
479 /// </summary> 471 /// </summary>
480 public bool AgentControlStopActive { get; private set; } 472 public bool AgentControlStopActive { get; private set; }
@@ -653,12 +645,6 @@ namespace OpenSim.Region.Framework.Scenes
653 // in the sim unless the avatar is on a sit target. While 645 // in the sim unless the avatar is on a sit target. While
654 // on a sit target, m_pos will contain the desired offset 646 // on a sit target, m_pos will contain the desired offset
655 // without the parent rotation applied. 647 // without the parent rotation applied.
656<<<<<<< HEAD
657 SceneObjectPart sitPart = ParentPart;
658
659 if (sitPart != null)
660 return sitPart.ParentGroup.AbsolutePosition + (m_pos * sitPart.GetWorldRotation());
661=======
662 if (ParentPart != null) 648 if (ParentPart != null)
663 { 649 {
664 SceneObjectPart rootPart = ParentPart.ParentGroup.RootPart; 650 SceneObjectPart rootPart = ParentPart.ParentGroup.RootPart;
@@ -667,7 +653,6 @@ namespace OpenSim.Region.Framework.Scenes
667 if (rootPart != null) 653 if (rootPart != null)
668 return rootPart.AbsolutePosition + (m_pos * rootPart.GetWorldRotation()); 654 return rootPart.AbsolutePosition + (m_pos * rootPart.GetWorldRotation());
669 } 655 }
670>>>>>>> avn/ubitvar
671 } 656 }
672 657
673 return m_pos; 658 return m_pos;
@@ -721,11 +706,8 @@ namespace OpenSim.Region.Framework.Scenes
721 } 706 }
722 707
723 /// <summary> 708 /// <summary>
724 /// Velocity of the avatar with respect to its local reference frame. 709 /// Current velocity of the avatar.
725 /// </summary> 710 /// </summary>
726 /// <remarks>
727 /// So when sat on a vehicle this will be 0. To get velocity with respect to the world use GetWorldVelocity()
728 /// </remarks>
729 public override Vector3 Velocity 711 public override Vector3 Velocity
730 { 712 {
731 get 713 get
@@ -738,21 +720,12 @@ namespace OpenSim.Region.Framework.Scenes
738// "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", 720// "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!",
739// m_velocity, Name, Scene.RegionInfo.RegionName); 721// m_velocity, Name, Scene.RegionInfo.RegionName);
740 } 722 }
741// else if (ParentPart != null)
742// {
743// return ParentPart.ParentGroup.Velocity;
744// }
745 723
746 return m_velocity; 724 return m_velocity;
747 } 725 }
748 726
749 set 727 set
750 { 728 {
751// Util.PrintCallStack();
752// m_log.DebugFormat(
753// "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}",
754// Scene.RegionInfo.RegionName, Name, value);
755
756 if (PhysicsActor != null) 729 if (PhysicsActor != null)
757 { 730 {
758 try 731 try
@@ -765,7 +738,11 @@ namespace OpenSim.Region.Framework.Scenes
765 } 738 }
766 } 739 }
767 740
768 m_velocity = value; 741 m_velocity = value;
742
743// m_log.DebugFormat(
744// "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}",
745// Scene.RegionInfo.RegionName, Name, m_velocity);
769 } 746 }
770 } 747 }
771 748
@@ -849,15 +826,21 @@ namespace OpenSim.Region.Framework.Scenes
849 } 826 }
850 827
851 /// <summary> 828 /// <summary>
852 /// Get rotation relative to the world. 829 /// Gets the world rotation of this presence.
853 /// </summary> 830 /// </summary>
831 /// <remarks>
832 /// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not.
833 /// </remarks>
854 /// <returns></returns> 834 /// <returns></returns>
855 public Quaternion GetWorldRotation() 835 public Quaternion GetWorldRotation()
856 { 836 {
857 SceneObjectPart sitPart = ParentPart; 837 if (IsSatOnObject)
838 {
839 SceneObjectPart sitPart = ParentPart;
858 840
859 if (sitPart != null) 841 if (sitPart != null)
860 return sitPart.GetWorldRotation() * Rotation; 842 return sitPart.GetWorldRotation() * Rotation;
843 }
861 844
862 return Rotation; 845 return Rotation;
863 } 846 }
@@ -924,7 +907,7 @@ no information to check this
924 } 907 }
925 908
926 private bool m_mouseLook; 909 private bool m_mouseLook;
927// private bool m_leftButtonDown; 910 private bool m_leftButtonDown;
928 911
929 private bool m_inTransit; 912 private bool m_inTransit;
930 913
@@ -991,12 +974,7 @@ no information to check this
991 { 974 {
992 get { return Util.GetViewerName(m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode)); } 975 get { return Util.GetViewerName(m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode)); }
993 } 976 }
994 977
995 /// <summary>
996 /// Count of how many terse updates we have sent out. It doesn't matter if this overflows.
997 /// </summary>
998 private int m_terseUpdateCount;
999
1000 #endregion 978 #endregion
1001 979
1002 #region Constructor(s) 980 #region Constructor(s)
@@ -1012,8 +990,7 @@ no information to check this
1012 Animator = new ScenePresenceAnimator(this); 990 Animator = new ScenePresenceAnimator(this);
1013 Overrides = new MovementAnimationOverrides(); 991 Overrides = new MovementAnimationOverrides();
1014 PresenceType = type; 992 PresenceType = type;
1015 // DrawDistance = world.DefaultDrawDistance; 993 DrawDistance = world.DefaultDrawDistance;
1016 DrawDistance = Constants.RegionSize;
1017 RegionHandle = world.RegionInfo.RegionHandle; 994 RegionHandle = world.RegionInfo.RegionHandle;
1018 ControllingClient = client; 995 ControllingClient = client;
1019 Firstname = ControllingClient.FirstName; 996 Firstname = ControllingClient.FirstName;
@@ -1021,7 +998,7 @@ no information to check this
1021 m_name = String.Format("{0} {1}", Firstname, Lastname); 998 m_name = String.Format("{0} {1}", Firstname, Lastname);
1022 m_scene = world; 999 m_scene = world;
1023 m_uuid = client.AgentId; 1000 m_uuid = client.AgentId;
1024 LocalId = m_scene.AllocatePresenceLocalId(); 1001 LocalId = m_scene.AllocateLocalId();
1025 1002
1026 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); 1003 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);
1027 if (account != null) 1004 if (account != null)
@@ -1103,21 +1080,6 @@ no information to check this
1103 1080
1104 private void SetDirectionVectors() 1081 private void SetDirectionVectors()
1105 { 1082 {
1106<<<<<<< HEAD
1107 Dir_Vectors[0] = Vector3.UnitX; //FORWARD
1108 Dir_Vectors[1] = -Vector3.UnitX; //BACK
1109 Dir_Vectors[2] = Vector3.UnitY; //LEFT
1110 Dir_Vectors[3] = -Vector3.UnitY; //RIGHT
1111 Dir_Vectors[4] = Vector3.UnitZ; //UP
1112 Dir_Vectors[5] = -Vector3.UnitZ; //DOWN
1113 Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE
1114 Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE
1115 Dir_Vectors[8] = new Vector3(0f, 0.5f, 0f); //LEFT_NUDGE
1116 Dir_Vectors[9] = new Vector3(0f, -0.5f, 0f); //RIGHT_NUDGE
1117 Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
1118 }
1119
1120=======
1121 Dir_Vectors[0] = new Vector3(AgentControlNormalVel,0,0); //FORWARD 1083 Dir_Vectors[0] = new Vector3(AgentControlNormalVel,0,0); //FORWARD
1122 Dir_Vectors[1] = new Vector3(-AgentControlNormalVel,0,0);; //BACK 1084 Dir_Vectors[1] = new Vector3(-AgentControlNormalVel,0,0);; //BACK
1123 Dir_Vectors[2] = new Vector3(0,AgentControlNormalVel,0); //LEFT 1085 Dir_Vectors[2] = new Vector3(0,AgentControlNormalVel,0); //LEFT
@@ -1131,27 +1093,6 @@ no information to check this
1131 Dir_Vectors[10] = new Vector3(0f, 0f, AgentControlNudgeVel); //UP_Nudge 1093 Dir_Vectors[10] = new Vector3(0f, 0f, AgentControlNudgeVel); //UP_Nudge
1132 Dir_Vectors[11] = new Vector3(0f, 0f, -AgentControlNudgeVel); //DOWN_Nudge 1094 Dir_Vectors[11] = new Vector3(0f, 0f, -AgentControlNudgeVel); //DOWN_Nudge
1133 } 1095 }
1134
1135/* dont see any use for this
1136 private Vector3[] GetWalkDirectionVectors()
1137 {
1138 Vector3[] vector = new Vector3[12];
1139 vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD
1140 vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK
1141 vector[2] = Vector3.UnitY; //LEFT
1142 vector[3] = -Vector3.UnitY; //RIGHT
1143 vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP
1144 vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN
1145 vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE
1146 vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE
1147 vector[8] = Vector3.UnitY; //LEFT_NUDGE
1148 vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
1149 vector[10] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP_NUDGE
1150 vector[11] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE
1151 return vector;
1152 }
1153*/
1154>>>>>>> avn/ubitvar
1155 #endregion 1096 #endregion
1156 1097
1157 #region Status Methods 1098 #region Status Methods
@@ -1203,14 +1144,9 @@ no information to check this
1203 } 1144 }
1204 else 1145 else
1205 { 1146 {
1206<<<<<<< HEAD
1207 part.AddSittingAvatar(this);
1208 // ParentPosition = part.GetWorldPosition();
1209=======
1210 part.ParentGroup.AddAvatar(UUID); 1147 part.ParentGroup.AddAvatar(UUID);
1211 if (part.SitTargetPosition != Vector3.Zero) 1148 if (part.SitTargetPosition != Vector3.Zero)
1212 part.SitTargetAvatar = UUID; 1149 part.SitTargetAvatar = UUID;
1213>>>>>>> avn/ubitvar
1214 ParentID = part.LocalId; 1150 ParentID = part.LocalId;
1215 ParentPart = part; 1151 ParentPart = part;
1216 m_pos = PrevSitOffset; 1152 m_pos = PrevSitOffset;
@@ -1222,8 +1158,6 @@ no information to check this
1222 { 1158 {
1223 IsLoggingIn = false; 1159 IsLoggingIn = false;
1224 } 1160 }
1225
1226 IsChildAgent = false;
1227 } 1161 }
1228 1162
1229 m_log.DebugFormat("[MakeRootAgent] out lock: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1163 m_log.DebugFormat("[MakeRootAgent] out lock: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@@ -1237,7 +1171,7 @@ no information to check this
1237 if (gm != null) 1171 if (gm != null)
1238 Grouptitle = gm.GetGroupTitle(m_uuid); 1172 Grouptitle = gm.GetGroupTitle(m_uuid);
1239 1173
1240<<<<<<< HEAD 1174
1241 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode); 1175 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode);
1242 uint teleportFlags = (aCircuit == null) ? 0 : aCircuit.teleportFlags; 1176 uint teleportFlags = (aCircuit == null) ? 0 : aCircuit.teleportFlags;
1243 if ((teleportFlags & (uint)TeleportFlags.ViaHGLogin) != 0) 1177 if ((teleportFlags & (uint)TeleportFlags.ViaHGLogin) != 0)
@@ -1246,75 +1180,18 @@ no information to check this
1246 // avatar's name to or from the special Hypergrid format ("First.Last @grid.example.com"). 1180 // avatar's name to or from the special Hypergrid format ("First.Last @grid.example.com").
1247 // Unfortunately, due to a viewer bug, viewers don't always show the new name. 1181 // Unfortunately, due to a viewer bug, viewers don't always show the new name.
1248 // But we have a trick that can force them to update the name anyway. 1182 // But we have a trick that can force them to update the name anyway.
1249 ForceViewersUpdateName(); 1183// ForceViewersUpdateName();
1250 } 1184 }
1251======= 1185
1252 m_log.DebugFormat("[MakeRootAgent] Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1186 m_log.DebugFormat("[MakeRootAgent] Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1253>>>>>>> avn/ubitvar
1254 1187
1255 RegionHandle = m_scene.RegionInfo.RegionHandle; 1188 RegionHandle = m_scene.RegionInfo.RegionHandle;
1256 1189
1257 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); 1190 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
1258 m_log.DebugFormat("[MakeRootAgent] TriggerSetRootAgentScene: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1191 m_log.DebugFormat("[MakeRootAgent] TriggerSetRootAgentScene: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1259 1192
1260<<<<<<< HEAD
1261 UUID groupUUID = ControllingClient.ActiveGroupId;
1262 string groupName = string.Empty;
1263 ulong groupPowers = 0;
1264
1265 // ----------------------------------
1266 // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status
1267 try
1268 {
1269 if (groupUUID != UUID.Zero && gm != null)
1270 {
1271 GroupRecord record = gm.GetGroupRecord(groupUUID);
1272 if (record != null)
1273 groupName = record.GroupName;
1274
1275 GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid);
1276
1277 if (groupMembershipData != null)
1278 groupPowers = groupMembershipData.GroupPowers;
1279 }
1280
1281 ControllingClient.SendAgentDataUpdate(
1282 m_uuid, groupUUID, Firstname, Lastname, groupPowers, groupName, Grouptitle);
1283 }
1284 catch (Exception e)
1285 {
1286 m_log.Error("[AGENTUPDATE]: Error ", e);
1287 }
1288 // ------------------------------------
1289
1290 if (ParentID == 0)
1291 {
1292 // Moved this from SendInitialData to ensure that Appearance is initialized
1293 // before the inventory is processed in MakeRootAgent. This fixes a race condition
1294 // related to the handling of attachments
1295 //m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
1296
1297 /* RA 20140111: Commented out these TestBorderCross's.
1298 * Not sure why this code is here. It is not checking all the borders
1299 * and 'in region' sanity checking is done in CheckAndAdjustLandingPoint and below.
1300 if (m_scene.TestBorderCross(pos, Cardinals.E))
1301 {
1302 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
1303 pos.X = crossedBorder.BorderLine.Z - 1;
1304 }
1305
1306 if (m_scene.TestBorderCross(pos, Cardinals.N))
1307 {
1308 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N);
1309 pos.Y = crossedBorder.BorderLine.Z - 1;
1310 }
1311 */
1312
1313=======
1314
1315 if (ParentID == 0) 1193 if (ParentID == 0)
1316 { 1194 {
1317>>>>>>> avn/ubitvar
1318 CheckAndAdjustLandingPoint(ref pos); 1195 CheckAndAdjustLandingPoint(ref pos);
1319 1196
1320 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) 1197 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f)
@@ -1350,30 +1227,18 @@ no information to check this
1350// 1227//
1351 if (m_teleportFlags == TeleportFlags.Default) 1228 if (m_teleportFlags == TeleportFlags.Default)
1352 { 1229 {
1230 Vector3 vel = Velocity;
1353 AddToPhysicalScene(isFlying); 1231 AddToPhysicalScene(isFlying);
1354// 1232 if (PhysicsActor != null)
1355// Console.WriteLine( 1233 PhysicsActor.SetMomentum(vel);
1356// "Set velocity of {0} in {1} to {2} from input velocity of {3} on MakeRootAgent",
1357// Name, Scene.Name, PhysicsActor.Velocity, vel);
1358// }
1359 } 1234 }
1360 else 1235 else
1361 { 1236 {
1362 AddToPhysicalScene(isFlying); 1237 AddToPhysicalScene(isFlying);
1363<<<<<<< HEAD
1364 }
1365 1238
1366 // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a
1367 // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it
1368 // since it requires a physics actor to be present. If it is left any later, then physics appears to reset
1369 // the value to a negative position which does not trigger the border cross.
1370 // This may not be the best location for this.
1371 CheckForBorderCrossing();
1372=======
1373 // reset camera to avatar pos 1239 // reset camera to avatar pos
1374 CameraPosition = pos; 1240 CameraPosition = pos;
1375 } 1241 }
1376>>>>>>> avn/ubitvar
1377 1242
1378 if (ForceFly) 1243 if (ForceFly)
1379 { 1244 {
@@ -1383,40 +1248,6 @@ no information to check this
1383 { 1248 {
1384 Flying = false; 1249 Flying = false;
1385 } 1250 }
1386<<<<<<< HEAD
1387 }
1388
1389 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
1390 // avatar to return to the standing position in mid-air. On login it looks like this is being sent
1391 // elsewhere anyway
1392 // Animator.SendAnimPack();
1393
1394 m_scene.SwapRootAgentCount(false);
1395
1396 if (Scene.AttachmentsModule != null)
1397 {
1398 // The initial login scene presence is already root when it gets here
1399 // and it has already rezzed the attachments and started their scripts.
1400 // We do the following only for non-login agents, because their scripts
1401 // haven't started yet.
1402 if (PresenceType == PresenceType.Npc || IsRealLogin(m_teleportFlags))
1403 {
1404 WorkManager.RunJob(
1405 "RezAttachments",
1406 o => Scene.AttachmentsModule.RezAttachments(this),
1407 null,
1408 string.Format("Rez attachments for {0} in {1}", Name, Scene.Name));
1409 }
1410 else
1411 {
1412 WorkManager.RunJob(
1413 "StartAttachmentScripts",
1414 o => RestartAttachmentScripts(),
1415 null,
1416 string.Format("Start attachment scripts for {0} in {1}", Name, Scene.Name),
1417 true);
1418 }
1419=======
1420 1251
1421 // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a 1252 // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a
1422 // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it 1253 // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it
@@ -1427,28 +1258,16 @@ no information to check this
1427 1258
1428 // its not 1259 // its not
1429// CheckForBorderCrossing(); 1260// CheckForBorderCrossing();
1430>>>>>>> avn/ubitvar
1431 } 1261 }
1262
1432 1263
1433 m_log.DebugFormat("[MakeRootAgent] position and physical: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1264 m_log.DebugFormat("[MakeRootAgent] position and physical: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1434 m_scene.SwapRootAgentCount(false); 1265 m_scene.SwapRootAgentCount(false);
1435 1266
1436<<<<<<< HEAD
1437 SendAvatarDataToAllClients();
1438
1439 // send the animations of the other presences to me
1440 m_scene.ForEachRootScenePresence(delegate(ScenePresence presence)
1441 {
1442 if (presence != this)
1443 presence.Animator.SendAnimPackToClient(ControllingClient);
1444 });
1445=======
1446>>>>>>> avn/ubitvar
1447
1448 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will 1267 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
1449 // stall on the border crossing since the existing child agent will still have the last movement 1268 // stall on the border crossing since the existing child agent will still have the last movement
1450 // recorded, which stops the input from being processed. 1269 // recorded, which stops the input from being processed.
1451 MovementFlag = ForceUpdateMovementFlagValue; 1270 MovementFlag = 0;
1452 1271
1453 m_scene.EventManager.TriggerOnMakeRootAgent(this); 1272 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1454 m_log.DebugFormat("[MakeRootAgent] TriggerOnMakeRootAgent and done: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1273 m_log.DebugFormat("[MakeRootAgent] TriggerOnMakeRootAgent and done: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@@ -1500,12 +1319,13 @@ no information to check this
1500 /// Group Title. So the following trick makes viewers update the avatar's name by briefly changing 1319 /// Group Title. So the following trick makes viewers update the avatar's name by briefly changing
1501 /// the group title (to "(Loading)"), and then restoring it. 1320 /// the group title (to "(Loading)"), and then restoring it.
1502 /// </remarks> 1321 /// </remarks>
1322/*
1503 public void ForceViewersUpdateName() 1323 public void ForceViewersUpdateName()
1504 { 1324 {
1505 m_log.DebugFormat("[SCENE PRESENCE]: Forcing viewers to update the avatar name for " + Name); 1325 m_log.DebugFormat("[SCENE PRESENCE]: Forcing viewers to update the avatar name for " + Name);
1506 1326
1507 UseFakeGroupTitle = true; 1327 UseFakeGroupTitle = true;
1508 SendAvatarDataToAllClients(false); 1328
1509 1329
1510 Util.FireAndForget(o => 1330 Util.FireAndForget(o =>
1511 { 1331 {
@@ -1519,7 +1339,7 @@ no information to check this
1519 SendAvatarDataToAllClients(false); 1339 SendAvatarDataToAllClients(false);
1520 }, null, "Scenepresence.ForceViewersUpdateName"); 1340 }, null, "Scenepresence.ForceViewersUpdateName");
1521 } 1341 }
1522 1342*/
1523 public int GetStateSource() 1343 public int GetStateSource()
1524 { 1344 {
1525 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID); 1345 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID);
@@ -1557,11 +1377,6 @@ no information to check this
1557 lock (m_originRegionIDAccessLock) 1377 lock (m_originRegionIDAccessLock)
1558 m_originRegionID = UUID.Zero; 1378 m_originRegionID = UUID.Zero;
1559 1379
1560 // Reset the m_originRegionID as it has dual use as a flag to signal that the UpdateAgent() call orignating
1561 // from the source simulator has completed on a V2 teleport.
1562 lock (m_originRegionIDAccessLock)
1563 m_originRegionID = UUID.Zero;
1564
1565 // Reset these so that teleporting in and walking out isn't seen 1380 // Reset these so that teleporting in and walking out isn't seen
1566 // as teleporting back 1381 // as teleporting back
1567 TeleportFlags = TeleportFlags.Default; 1382 TeleportFlags = TeleportFlags.Default;
@@ -1609,9 +1424,10 @@ no information to check this
1609 if (PhysicsActor != null) 1424 if (PhysicsActor != null)
1610 { 1425 {
1611// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 1426// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
1612 PhysicsActor.UnSubscribeEvents(); 1427
1613 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; 1428 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
1614 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; 1429 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1430 PhysicsActor.UnSubscribeEvents();
1615 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); 1431 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
1616 PhysicsActor = null; 1432 PhysicsActor = null;
1617 } 1433 }
@@ -1649,6 +1465,8 @@ no information to check this
1649 else 1465 else
1650 PhysicsActor.SetMomentum(vel); 1466 PhysicsActor.SetMomentum(vel);
1651 } 1467 }
1468
1469 SendTerseUpdateToAllClients();
1652 } 1470 }
1653 1471
1654 public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) 1472 public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY)
@@ -1680,6 +1498,7 @@ no information to check this
1680 } 1498 }
1681 } 1499 }
1682 } 1500 }
1501 SendTerseUpdateToAllClients();
1683 } 1502 }
1684 1503
1685 public void StopFlying() 1504 public void StopFlying()
@@ -1915,17 +1734,7 @@ no information to check this
1915 public void SetSize(Vector3 size, float feetoffset) 1734 public void SetSize(Vector3 size, float feetoffset)
1916 { 1735 {
1917 if (PhysicsActor != null && !IsChildAgent) 1736 if (PhysicsActor != null && !IsChildAgent)
1918<<<<<<< HEAD
1919 {
1920 // Eventually there will be a physics call that sets avatar size that includes offset info.
1921 // For the moment, just set the size as passed.
1922 PhysicsActor.Size = size;
1923 // PhysicsActor.setAvatarSize(size, feetoffset);
1924 }
1925=======
1926 PhysicsActor.setAvatarSize(size, feetoffset); 1737 PhysicsActor.setAvatarSize(size, feetoffset);
1927
1928>>>>>>> avn/ubitvar
1929 } 1738 }
1930 1739
1931 private bool WaitForUpdateAgent(IClientAPI client) 1740 private bool WaitForUpdateAgent(IClientAPI client)
@@ -1934,13 +1743,23 @@ no information to check this
1934 // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination, 1743 // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination,
1935 // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the 1744 // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the
1936 // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero 1745 // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero
1937 m_updateAgentReceivedAfterTransferEvent.WaitOne(10000); 1746// m_updateAgentReceivedAfterTransferEvent.WaitOne(10000);
1938 1747 int count = 50;
1939 UUID originID = UUID.Zero; 1748 UUID originID = UUID.Zero;
1940 1749
1941 lock (m_originRegionIDAccessLock) 1750 lock (m_originRegionIDAccessLock)
1942 originID = m_originRegionID; 1751 originID = m_originRegionID;
1943 1752
1753
1754 while (originID.Equals(UUID.Zero) && count-- > 0)
1755 {
1756 lock (m_originRegionIDAccessLock)
1757 originID = m_originRegionID;
1758
1759 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name);
1760 Thread.Sleep(200);
1761 }
1762
1944 if (originID.Equals(UUID.Zero)) 1763 if (originID.Equals(UUID.Zero))
1945 { 1764 {
1946 // Movement into region will fail 1765 // Movement into region will fail
@@ -1970,40 +1789,6 @@ no information to check this
1970 1789
1971 m_inTransit = true; 1790 m_inTransit = true;
1972 1791
1973<<<<<<< HEAD
1974 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); // Get this ahead of time because IsInTransit modifies 'm_AgentControlFlags'
1975
1976 IsInTransit = true;
1977 try
1978 {
1979 // Make sure it's not a login agent. We don't want to wait for updates during login
1980 if (!(PresenceType == PresenceType.Npc || IsRealLogin(m_teleportFlags)))
1981 {
1982 // Let's wait until UpdateAgent (called by departing region) is done
1983 if (!WaitForUpdateAgent(client))
1984 // The sending region never sent the UpdateAgent data, we have to refuse
1985 return;
1986 }
1987
1988 Vector3 look = Velocity;
1989
1990 // if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
1991 if ((Math.Abs(look.X) < 0.1) && (Math.Abs(look.Y) < 0.1) && (Math.Abs(look.Z) < 0.1))
1992 {
1993 look = new Vector3(0.99f, 0.042f, 0);
1994 }
1995
1996 // Prevent teleporting to an underground location
1997 // (may crash client otherwise)
1998 //
1999 Vector3 pos = AbsolutePosition;
2000 float ground = m_scene.GetGroundHeight(pos.X, pos.Y);
2001 if (pos.Z < ground + 1.5f)
2002 {
2003 pos.Z = ground + 1.5f;
2004 AbsolutePosition = pos;
2005 }
2006=======
2007 try 1792 try
2008 { 1793 {
2009 // Make sure it's not a login agent. We don't want to wait for updates during login 1794 // Make sure it's not a login agent. We don't want to wait for updates during login
@@ -2019,103 +1804,16 @@ no information to check this
2019 m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1804 m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2020 1805
2021 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1806 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
2022>>>>>>> avn/ubitvar
2023 1807
2024 if (!MakeRootAgent(AbsolutePosition, flying)) 1808 if (!MakeRootAgent(AbsolutePosition, flying))
2025 { 1809 {
2026 m_log.DebugFormat( 1810 m_log.DebugFormat(
2027<<<<<<< HEAD
2028 "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root",
2029=======
2030 "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root", 1811 "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root",
2031>>>>>>> avn/ubitvar
2032 Name, Scene.Name); 1812 Name, Scene.Name);
2033 1813
2034 return; 1814 return;
2035 } 1815 }
2036 1816
2037<<<<<<< HEAD
2038 // Tell the client that we're totally ready
2039 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
2040
2041 // Child agents send initial data up in LLUDPServer.HandleUseCircuitCode()
2042 if (!SentInitialDataToClient)
2043 SendInitialDataToClient();
2044
2045 // m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
2046
2047 if (!string.IsNullOrEmpty(m_callbackURI))
2048 {
2049 // We cannot sleep here since this would hold up the inbound packet processing thread, as
2050 // CompleteMovement() is executed synchronously. However, it might be better to delay the release
2051 // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete
2052 // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this
2053 // region as the current region, meaning that a close sent before then will fail the teleport.
2054 // System.Threading.Thread.Sleep(2000);
2055
2056 m_log.DebugFormat(
2057 "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}",
2058 client.Name, client.AgentId, m_callbackURI);
2059
2060 Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI);
2061 m_callbackURI = null;
2062 }
2063 // else
2064 // {
2065 // m_log.DebugFormat(
2066 // "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}",
2067 // client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
2068 // }
2069
2070 ValidateAndSendAppearanceAndAgentData();
2071
2072 // Create child agents in neighbouring regions
2073 if (openChildAgents && !IsChildAgent)
2074 {
2075 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
2076 if (m_agentTransfer != null)
2077 {
2078 // Note: this call can take a while, because it notifies each of the simulator's neighbours.
2079 // It's important that we don't allow the avatar to cross regions meanwhile, as that will
2080 // cause serious errors. We've prevented that from happening by setting IsInTransit=true.
2081 m_agentTransfer.EnableChildAgents(this);
2082 }
2083
2084 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
2085 if (friendsModule != null)
2086 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
2087
2088 }
2089
2090 // XXX: If we force an update after activity has completed, then multiple attachments do appear correctly on a destination region
2091 // If we do it a little bit earlier (e.g. when converting the child to a root agent) then this does not work.
2092 // This may be due to viewer code or it may be something we're not doing properly simulator side.
2093 WorkManager.RunJob(
2094 "ScheduleAttachmentsForFullUpdate",
2095 o => ScheduleAttachmentsForFullUpdate(),
2096 null,
2097 string.Format("Schedule attachments for full update for {0} in {1}", Name, Scene.Name),
2098 true);
2099
2100 // m_log.DebugFormat(
2101 // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
2102 // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
2103 }
2104 finally
2105 {
2106 IsInTransit = false;
2107 }
2108 }
2109
2110 private void ScheduleAttachmentsForFullUpdate()
2111 {
2112 lock (m_attachments)
2113 {
2114 foreach (SceneObjectGroup sog in m_attachments)
2115 sog.ScheduleGroupForFullUpdate();
2116 }
2117 }
2118=======
2119 m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1817 m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
2120 1818
2121 Vector3 look = Lookat; 1819 Vector3 look = Lookat;
@@ -2134,7 +1832,7 @@ no information to check this
2134 1832
2135 if (!IsChildAgent && !isNPC) 1833 if (!IsChildAgent && !isNPC)
2136 { 1834 {
2137 InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (AssetType)46); 1835 InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (FolderType)46);
2138 if (cof == null) 1836 if (cof == null)
2139 COF = UUID.Zero; 1837 COF = UUID.Zero;
2140 else 1838 else
@@ -2197,9 +1895,6 @@ no information to check this
2197 // so sequence is clear 1895 // so sequence is clear
2198 1896
2199 // verify baked textures and cache 1897 // verify baked textures and cache
2200>>>>>>> avn/ubitvar
2201
2202
2203 bool cachedbaked = false; 1898 bool cachedbaked = false;
2204 1899
2205 if (isNPC) 1900 if (isNPC)
@@ -2484,23 +2179,16 @@ no information to check this
2484 // When we get to the point of re-computing neighbors everytime this 2179 // When we get to the point of re-computing neighbors everytime this
2485 // changes, then start using the agent's drawdistance rather than the 2180 // changes, then start using the agent's drawdistance rather than the
2486 // region's draw distance. 2181 // region's draw distance.
2487<<<<<<< HEAD
2488 DrawDistance = agentData.Far;
2489 // DrawDistance = Scene.DefaultDrawDistance;
2490=======
2491 2182
2492 DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); 2183 DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance);
2493 2184
2494// DrawDistance = Scene.DefaultDrawDistance;
2495>>>>>>> avn/ubitvar
2496
2497 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; 2185 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
2498 2186
2499 // FIXME: This does not work as intended because the viewer only sends the lbutton down when the button 2187 // FIXME: This does not work as intended because the viewer only sends the lbutton down when the button
2500 // is first pressed, not whilst it is held down. If this is required in the future then need to look 2188 // is first pressed, not whilst it is held down. If this is required in the future then need to look
2501 // for an AGENT_CONTROL_LBUTTON_UP event and make sure to handle cases where an initial DOWN is not 2189 // for an AGENT_CONTROL_LBUTTON_UP event and make sure to handle cases where an initial DOWN is not
2502 // received (e.g. on holding LMB down on the avatar in a viewer). 2190 // received (e.g. on holding LMB down on the avatar in a viewer).
2503// m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; 2191 m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0;
2504 2192
2505 #endregion Inputs 2193 #endregion Inputs
2506 2194
@@ -2592,14 +2280,6 @@ no information to check this
2592 2280
2593 bool update_movementflag = false; 2281 bool update_movementflag = false;
2594 2282
2595 // If we were just made root agent then we must perform movement updates for the first AgentUpdate that
2596 // we get
2597 if (MovementFlag == ForceUpdateMovementFlagValue)
2598 {
2599 MovementFlag = 0;
2600 update_movementflag = true;
2601 }
2602
2603 if (agentData.UseClientAgentPosition) 2283 if (agentData.UseClientAgentPosition)
2604 { 2284 {
2605 MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; 2285 MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
@@ -2631,8 +2311,6 @@ no information to check this
2631 { 2311 {
2632 bool bAllowUpdateMoveToPosition = false; 2312 bool bAllowUpdateMoveToPosition = false;
2633 2313
2634<<<<<<< HEAD
2635=======
2636 Vector3[] dirVectors; 2314 Vector3[] dirVectors;
2637 2315
2638 // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying 2316 // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying
@@ -2642,8 +2320,6 @@ no information to check this
2642// else 2320// else
2643 dirVectors = Dir_Vectors; 2321 dirVectors = Dir_Vectors;
2644 2322
2645
2646>>>>>>> avn/ubitvar
2647 // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. 2323 // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction.
2648 foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) 2324 foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
2649 { 2325 {
@@ -2865,12 +2541,8 @@ no information to check this
2865 // When we get to the point of re-computing neighbors everytime this 2541 // When we get to the point of re-computing neighbors everytime this
2866 // changes, then start using the agent's drawdistance rather than the 2542 // changes, then start using the agent's drawdistance rather than the
2867 // region's draw distance. 2543 // region's draw distance.
2868<<<<<<< HEAD 2544
2869 DrawDistance = agentData.Far;
2870 // DrawDistance = Scene.DefaultDrawDistance;
2871=======
2872 DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); 2545 DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance);
2873>>>>>>> avn/ubitvar
2874 2546
2875 // Check if Client has camera in 'follow cam' or 'build' mode. 2547 // Check if Client has camera in 'follow cam' or 'build' mode.
2876 Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); 2548 Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
@@ -3064,54 +2736,63 @@ no information to check this
3064 || pos.Y < 0 || pos.Y >= regionSize.Y 2736 || pos.Y < 0 || pos.Y >= regionSize.Y
3065 || pos.Z < 0) 2737 || pos.Z < 0)
3066 return; 2738 return;
3067 2739
3068 Scene targetScene = m_scene; 2740 Scene targetScene = m_scene;
3069
3070// Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2);
3071// pos += heightAdjust;
3072//
3073// // Anti duck-walking measure
3074// if (Math.Abs(pos.Z - AbsolutePosition.Z) < 0.2f)
3075// {
3076//// m_log.DebugFormat("[SCENE PRESENCE]: Adjusting MoveToPosition from {0} to {1}", pos, AbsolutePosition);
3077// pos.Z = AbsolutePosition.Z;
3078// }
3079
3080 // Get terrain height for sub-region in a megaregion if necessary 2741 // Get terrain height for sub-region in a megaregion if necessary
3081<<<<<<< HEAD
3082=======
3083 int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X);
3084 int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y);
3085 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y);
3086 // If X and Y is NaN, target_region will be null
3087 if (target_region == null)
3088 return;
3089 UUID target_regionID = target_region.RegionID;
3090 Scene targetScene = m_scene;
3091>>>>>>> avn/ubitvar
3092
3093 //COMMENT: If its only nessesary in a megaregion, why do it on normal region's too?
3094
3095 if (regionCombinerModule != null) 2742 if (regionCombinerModule != null)
3096 { 2743 {
3097 int x = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); 2744 int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X);
3098 int y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); 2745 int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y);
3099 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, x, y); 2746 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y);
3100
3101<<<<<<< HEAD
3102 // If X and Y is NaN, target_region will be null 2747 // If X and Y is NaN, target_region will be null
3103 if (target_region == null) 2748 if (target_region == null)
3104 return; 2749 return;
3105 2750 UUID target_regionID = target_region.RegionID;
3106 SceneManager.Instance.TryGetScene(target_region.RegionID, out targetScene); 2751 SceneManager.Instance.TryGetScene(target_region.RegionID, out targetScene);
3107 } 2752 }
3108 2753
3109 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; 2754
3110======= 2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
3111 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; 2792 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)];
3112 // dont try to land underground 2793 // dont try to land underground
3113 terrainHeight += Appearance.AvatarHeight / 2; 2794 terrainHeight += Appearance.AvatarHeight / 2;
3114>>>>>>> avn/ubitvar 2795
3115 pos.Z = Math.Max(terrainHeight, pos.Z); 2796 pos.Z = Math.Max(terrainHeight, pos.Z);
3116 2797
3117 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is 2798 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is
@@ -3120,26 +2801,15 @@ no information to check this
3120 if (pos.Z - terrainHeight < 0.2) 2801 if (pos.Z - terrainHeight < 0.2)
3121 pos.Z = terrainHeight; 2802 pos.Z = terrainHeight;
3122 2803
3123<<<<<<< HEAD
3124=======
3125// m_log.DebugFormat( 2804// m_log.DebugFormat(
3126// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", 2805// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
3127// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); 2806// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
3128 2807
3129
3130>>>>>>> avn/ubitvar
3131 if (noFly) 2808 if (noFly)
3132 Flying = false; 2809 Flying = false;
3133 else if (pos.Z > terrainHeight + Appearance.AvatarHeight / 2 || Flying) 2810 else if (pos.Z > terrainHeight + Appearance.AvatarHeight / 2 || Flying)
3134 Flying = true; 2811 Flying = true;
3135 2812
3136// m_log.DebugFormat(
3137// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
3138// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
3139
3140 if (noFly)
3141 Flying = false;
3142
3143 LandAtTarget = landAtTarget; 2813 LandAtTarget = landAtTarget;
3144 MovingToTarget = true; 2814 MovingToTarget = true;
3145 MoveToPositionTarget = pos; 2815 MoveToPositionTarget = pos;
@@ -3214,13 +2884,10 @@ no information to check this
3214 } 2884 }
3215 } 2885 }
3216 2886
3217<<<<<<< HEAD
3218=======
3219 part.ParentGroup.DeleteAvatar(UUID); 2887 part.ParentGroup.DeleteAvatar(UUID);
3220 2888
3221 Quaternion standRotation = part.ParentGroup.RootPart.RotationOffset; 2889 Quaternion standRotation = part.ParentGroup.RootPart.RotationOffset;
3222 Vector3 sitPartWorldPosition = part.ParentGroup.AbsolutePosition + m_pos * standRotation; 2890 Vector3 sitPartWorldPosition = part.ParentGroup.AbsolutePosition + m_pos * standRotation;
3223>>>>>>> avn/ubitvar
3224 ControllingClient.SendClearFollowCamProperties(part.ParentUUID); 2891 ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
3225 2892
3226 ParentID = 0; 2893 ParentID = 0;
@@ -3248,25 +2915,9 @@ no information to check this
3248 standRotationZ.Z = 0f; 2915 standRotationZ.Z = 0f;
3249 } 2916 }
3250 2917
3251<<<<<<< HEAD
3252 //Vector3 standPos = ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
3253 //Vector3 standPos = ParentPosition;
3254
3255// Vector3 standPositionAdjustment
3256// = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f);
3257 Vector3 adjustmentForSitPosition = OffsetPosition * part.ParentGroup.GroupRotation - SIT_TARGET_ADJUSTMENT * part.GetWorldRotation();
3258
3259 // XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than
3260 // hardcoding here.
3261 Vector3 adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotation;
3262
3263 Vector3 standPos = part.ParentGroup.AbsolutePosition + adjustmentForSitPosition + adjustmentForSitPose;
3264=======
3265 Vector3 adjustmentForSitPose = new Vector3(0.75f, 0, m_sitAvatarHeight + .3f) * standRotationZ; 2918 Vector3 adjustmentForSitPose = new Vector3(0.75f, 0, m_sitAvatarHeight + .3f) * standRotationZ;
3266 2919
3267 Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose; 2920 Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose;
3268>>>>>>> avn/ubitvar
3269
3270 m_pos = standPos; 2921 m_pos = standPos;
3271 } 2922 }
3272 2923
@@ -3277,16 +2928,9 @@ no information to check this
3277 2928
3278 if (satOnObject) 2929 if (satOnObject)
3279 { 2930 {
3280<<<<<<< HEAD
3281 SendAvatarDataToAllClients();
3282 m_requestedSitTargetID = 0;
3283 2931
3284 part.RemoveSittingAvatar(this);
3285
3286=======
3287 m_requestedSitTargetID = 0; 2932 m_requestedSitTargetID = 0;
3288 part.RemoveSittingAvatar(UUID); 2933 part.RemoveSittingAvatar(UUID);
3289>>>>>>> avn/ubitvar
3290 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 2934 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
3291 2935
3292 SendAvatarDataToAllAgents(); 2936 SendAvatarDataToAllAgents();
@@ -3386,37 +3030,11 @@ no information to check this
3386 3030
3387 Velocity = Vector3.Zero; 3031 Velocity = Vector3.Zero;
3388 3032
3389 part.AddSittingAvatar(this); 3033 part.AddSittingAvatar(UUID);
3390 3034
3391 cameraAtOffset = part.GetCameraAtOffset(); 3035 cameraAtOffset = part.GetCameraAtOffset();
3392
3393 if (!part.IsRoot && cameraAtOffset == Vector3.Zero)
3394 cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset();
3395
3396 bool cameraEyeOffsetFromRootForChild = false;
3397 cameraEyeOffset = part.GetCameraEyeOffset(); 3036 cameraEyeOffset = part.GetCameraEyeOffset();
3398 3037
3399 if (!part.IsRoot && cameraEyeOffset == Vector3.Zero)
3400 {
3401 cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset();
3402 cameraEyeOffsetFromRootForChild = true;
3403 }
3404
3405 if ((cameraEyeOffset != Vector3.Zero && !cameraEyeOffsetFromRootForChild) || cameraAtOffset != Vector3.Zero)
3406 {
3407 if (!part.IsRoot)
3408 {
3409 cameraEyeOffset = cameraEyeOffset * part.RotationOffset;
3410 cameraAtOffset += part.OffsetPosition;
3411 }
3412
3413 cameraEyeOffset += part.OffsetPosition;
3414 }
3415
3416// m_log.DebugFormat(
3417// "[SCENE PRESENCE]: Using cameraAtOffset {0}, cameraEyeOffset {1} for sit on {2} by {3} in {4}",
3418// cameraAtOffset, cameraEyeOffset, part.Name, Name, Scene.Name);
3419
3420 forceMouselook = part.GetForceMouselook(); 3038 forceMouselook = part.GetForceMouselook();
3421 3039
3422 if (!part.IsRoot) 3040 if (!part.IsRoot)
@@ -3560,7 +3178,7 @@ no information to check this
3560 Velocity = Vector3.Zero; 3178 Velocity = Vector3.Zero;
3561 m_AngularVelocity = Vector3.Zero; 3179 m_AngularVelocity = Vector3.Zero;
3562 3180
3563 part.AddSittingAvatar(this); 3181 part.AddSittingAvatar(UUID);
3564 3182
3565 Vector3 cameraAtOffset = part.GetCameraAtOffset(); 3183 Vector3 cameraAtOffset = part.GetCameraAtOffset();
3566 Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); 3184 Vector3 cameraEyeOffset = part.GetCameraEyeOffset();
@@ -3596,6 +3214,7 @@ no information to check this
3596 3214
3597 3215
3598 m_requestedSitTargetID = 0; 3216 m_requestedSitTargetID = 0;
3217 part.ParentGroup.AddAvatar(UUID);
3599 3218
3600 ParentPart = part; 3219 ParentPart = part;
3601 ParentID = part.LocalId; 3220 ParentID = part.LocalId;
@@ -3607,9 +3226,6 @@ no information to check this
3607 Animator.TrySetMovementAnimation("SIT_GROUND"); 3226 Animator.TrySetMovementAnimation("SIT_GROUND");
3608 else 3227 else
3609 Animator.TrySetMovementAnimation("SIT"); 3228 Animator.TrySetMovementAnimation("SIT");
3610<<<<<<< HEAD
3611 SendAvatarDataToAllClients();
3612=======
3613*/ 3229*/
3614 if (status == 3) 3230 if (status == 3)
3615 sitAnimation = "SIT_GROUND"; 3231 sitAnimation = "SIT_GROUND";
@@ -3617,8 +3233,6 @@ no information to check this
3617 sitAnimation = "SIT"; 3233 sitAnimation = "SIT";
3618 3234
3619 Animator.SetMovementAnimations("SIT"); 3235 Animator.SetMovementAnimations("SIT");
3620>>>>>>> avn/ubitvar
3621
3622 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 3236 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
3623 } 3237 }
3624 3238
@@ -3654,40 +3268,27 @@ no information to check this
3654 3268
3655 //Quaternion result = (sitTargetOrient * vq) * nq; 3269 //Quaternion result = (sitTargetOrient * vq) * nq;
3656 3270
3657 double x, y, z, m1, m2; 3271 double x, y, z, m;
3658 3272
3659 Quaternion r = sitTargetOrient; 3273 Quaternion r = sitTargetOrient;
3660 m1 = r.X * r.X + r.Y * r.Y; 3274 m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W;
3661 m2 = r.Z * r.Z + r.W * r.W;
3662
3663 // Rotate the vector <0, 0, 1>
3664 x = 2 * (r.X * r.Z + r.Y * r.W);
3665 y = 2 * (-r.X * r.W + r.Y * r.Z);
3666 z = m2 - m1;
3667
3668 // Set m to be the square of the norm of r.
3669 double m = m1 + m2;
3670 3275
3671 // This constant is emperically determined to be what is used in SL. 3276 if (Math.Abs(1.0 - m) > 0.000001)
3672 // See also http://opensimulator.org/mantis/view.php?id=7096
3673 double offset = 0.05;
3674
3675 // Normally m will be ~ 1, but if someone passed a handcrafted quaternion
3676 // to llSitTarget with values so small that squaring them is rounded off
3677 // to zero, then m could be zero. The result of this floating point
3678 // round off error (causing us to skip this impossible normalization)
3679 // is only 5 cm.
3680 if (m > 0.000001)
3681 { 3277 {
3682 offset /= m; 3278 m = 1.0 / Math.Sqrt(m);
3279 r.X *= (float)m;
3280 r.Y *= (float)m;
3281 r.Z *= (float)m;
3282 r.W *= (float)m;
3683 } 3283 }
3684 3284
3285 x = 2 * (r.X * r.Z + r.Y * r.W);
3286 y = 2 * (-r.X * r.W + r.Y * r.Z);
3287 z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W;
3685 Vector3 up = new Vector3((float)x, (float)y, (float)z); 3288 Vector3 up = new Vector3((float)x, (float)y, (float)z);
3686 Vector3 sitOffset = up * (float)offset; 3289 Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f;
3687 3290
3688 // sitOffset is in Avatar Center coordinates: from origin to 'sitTargetPos + SIT_TARGET_ADJUSTMENT'. 3291 Vector3 newPos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT;
3689 // So, we need to _substract_ it to get to the origin of the Avatar Center.
3690 Vector3 newPos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset;
3691 Quaternion newRot; 3292 Quaternion newRot;
3692 3293
3693 if (part.IsRoot) 3294 if (part.IsRoot)
@@ -3720,7 +3321,8 @@ no information to check this
3720// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); 3321// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId);
3721 } 3322 }
3722 3323
3723 ParentPart = part; 3324 part.ParentGroup.AddAvatar(UUID);
3325 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
3724 ParentID = m_requestedSitTargetID; 3326 ParentID = m_requestedSitTargetID;
3725 m_AngularVelocity = Vector3.Zero; 3327 m_AngularVelocity = Vector3.Zero;
3726 Velocity = Vector3.Zero; 3328 Velocity = Vector3.Zero;
@@ -3733,13 +3335,8 @@ no information to check this
3733 { 3335 {
3734 sitAnimation = part.SitAnimation; 3336 sitAnimation = part.SitAnimation;
3735 } 3337 }
3736<<<<<<< HEAD
3737 Animator.TrySetMovementAnimation(sitAnimation);
3738 SendAvatarDataToAllClients();
3739=======
3740// Animator.TrySetMovementAnimation(sitAnimation); 3338// Animator.TrySetMovementAnimation(sitAnimation);
3741 Animator.SetMovementAnimations("SIT"); 3339 Animator.SetMovementAnimations("SIT");
3742>>>>>>> avn/ubitvar
3743 TriggerScenePresenceUpdated(); 3340 TriggerScenePresenceUpdated();
3744 } 3341 }
3745 } 3342 }
@@ -3801,25 +3398,10 @@ no information to check this
3801 // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", 3398 // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}",
3802 // vec, Rotation, thisAddSpeedModifier, Name); 3399 // vec, Rotation, thisAddSpeedModifier, Name);
3803 3400
3804<<<<<<< HEAD
3805 Quaternion rot = Rotation;
3806 if (!Flying && PresenceType != PresenceType.Npc)
3807 {
3808 // The only situation in which we care about X and Y is avatar flying. The rest of the time
3809 // these parameters are not relevant for determining avatar movement direction and cause issues such
3810 // as wrong walk speed if the camera is rotated.
3811 rot.X = 0;
3812 rot.Y = 0;
3813 rot.Normalize();
3814 }
3815
3816 Vector3 direc = vec * rot;
3817=======
3818 // rotate from avatar coord space to world 3401 // rotate from avatar coord space to world
3819 // for now all controls assume this is only a rotation around Z 3402 // for now all controls assume this is only a rotation around Z
3820 // if not all checks below need to be done before this rotation 3403 // if not all checks below need to be done before this rotation
3821 Vector3 direc = vec * Rotation; 3404 Vector3 direc = vec * Rotation;
3822>>>>>>> avn/ubitvar
3823 direc.Normalize(); 3405 direc.Normalize();
3824 3406
3825 // mouse look situation ? 3407 // mouse look situation ?
@@ -3869,6 +3451,10 @@ no information to check this
3869 3451
3870 public override void Update() 3452 public override void Update()
3871 { 3453 {
3454 const float ROTATION_TOLERANCE = 0.01f;
3455 const float VELOCITY_TOLERANCE = 0.001f;
3456 const float POSITION_TOLERANCE = 0.05f;
3457
3872 if (IsChildAgent == false) 3458 if (IsChildAgent == false)
3873 { 3459 {
3874 CheckForBorderCrossing(); 3460 CheckForBorderCrossing();
@@ -3880,21 +3466,11 @@ no information to check this
3880 // grab the latest PhysicsActor velocity, whereas m_velocity is often 3466 // grab the latest PhysicsActor velocity, whereas m_velocity is often
3881 // storing a requested force instead of an actual traveling velocity 3467 // storing a requested force instead of an actual traveling velocity
3882 if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) 3468 if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn)
3883 SendAvatarDataToAllClients(); 3469 SendAvatarDataToAllAgents();
3884 3470
3885 // Allow any updates for sitting avatars to that llSetPrimitiveLinkParams() can work for very 3471 if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
3886 // small increments (e.g. sit position adjusters). An alternative may be to eliminate the tolerance 3472 !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
3887 // checks on all updates but the ramifications of this would need careful consideration. 3473 !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
3888 bool updateClients
3889 = IsSatOnObject && (Rotation != m_lastRotation || Velocity != m_lastVelocity || m_pos != m_lastPosition);
3890
3891 if (!updateClients)
3892 updateClients
3893 = !Rotation.ApproxEquals(m_lastRotation, Scene.RootRotationUpdateTolerance)
3894 || !Velocity.ApproxEquals(m_lastVelocity, Scene.RootVelocityUpdateTolerance)
3895 || !m_pos.ApproxEquals(m_lastPosition, Scene.RootPositionUpdateTolerance);
3896
3897 if (updateClients)
3898 { 3474 {
3899 SendTerseUpdateToAllClients(); 3475 SendTerseUpdateToAllClients();
3900 3476
@@ -3904,12 +3480,6 @@ no information to check this
3904 m_lastVelocity = Velocity; 3480 m_lastVelocity = Velocity;
3905 } 3481 }
3906 3482
3907<<<<<<< HEAD
3908 if (Scene.AllowAvatarCrossing)
3909 CheckForBorderCrossing();
3910
3911=======
3912>>>>>>> avn/ubitvar
3913 CheckForSignificantMovement(); // sends update to the modules. 3483 CheckForSignificantMovement(); // sends update to the modules.
3914 } 3484 }
3915 } 3485 }
@@ -3918,8 +3488,6 @@ no information to check this
3918 3488
3919 #region Update Client(s) 3489 #region Update Client(s)
3920 3490
3921<<<<<<< HEAD
3922=======
3923 public void SendUpdateToAgent(ScenePresence p) 3491 public void SendUpdateToAgent(ScenePresence p)
3924 { 3492 {
3925 IClientAPI remoteClient = p.ControllingClient; 3493 IClientAPI remoteClient = p.ControllingClient;
@@ -3949,7 +3517,6 @@ no information to check this
3949 ControllingClient.SendAgentTerseUpdate(p); 3517 ControllingClient.SendAgentTerseUpdate(p);
3950 } 3518 }
3951 3519
3952>>>>>>> avn/ubitvar
3953 /// <summary> 3520 /// <summary>
3954 /// Sends a location update to the client connected to this scenePresence 3521 /// Sends a location update to the client connected to this scenePresence
3955 /// via entity updates 3522 /// via entity updates
@@ -3961,29 +3528,6 @@ no information to check this
3961 // server. 3528 // server.
3962 if (remoteClient.IsActive) 3529 if (remoteClient.IsActive)
3963 { 3530 {
3964 if (Scene.RootTerseUpdatePeriod > 1)
3965 {
3966// Console.WriteLine(
3967// "{0} {1} {2} {3} {4} {5} for {6} to {7}",
3968// remoteClient.AgentId, UUID, remoteClient.SceneAgent.IsChildAgent, m_terseUpdateCount, Scene.RootTerseUpdatePeriod, Velocity.ApproxEquals(Vector3.Zero, 0.001f), Name, remoteClient.Name);
3969 if (remoteClient.AgentId != UUID
3970 && !remoteClient.SceneAgent.IsChildAgent
3971 && m_terseUpdateCount % Scene.RootTerseUpdatePeriod != 0
3972 && !Velocity.ApproxEquals(Vector3.Zero, 0.001f))
3973 {
3974// m_log.DebugFormat("[SCENE PRESENCE]: Discarded update from {0} to {1}, args {2} {3} {4} {5} {6} {7}",
3975// Name, remoteClient.Name, remoteClient.AgentId, UUID, remoteClient.SceneAgent.IsChildAgent, m_terseUpdateCount, Scene.RootTerseUpdatePeriod, Velocity.ApproxEquals(Vector3.Zero, 0.001f));
3976
3977 return;
3978 }
3979 }
3980
3981 if (Scene.ChildTerseUpdatePeriod > 1
3982 && remoteClient.SceneAgent.IsChildAgent
3983 && m_terseUpdateCount % Scene.ChildTerseUpdatePeriod != 0
3984 && !Velocity.ApproxEquals(Vector3.Zero, 0.001f))
3985 return;
3986
3987 //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); 3531 //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
3988 remoteClient.SendEntityUpdate( 3532 remoteClient.SendEntityUpdate(
3989 this, 3533 this,
@@ -4054,10 +3598,6 @@ no information to check this
4054 float speed = Velocity.Length(); 3598 float speed = Velocity.Length();
4055 float velocityDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity); 3599 float velocityDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity);
4056 3600
4057// m_log.DebugFormat(
4058// "[SCENE PRESENCE]: Delta-v {0}, lastVelocity {1}, Velocity {2} for {3} in {4}",
4059// velocidyDiff, lastVelocitySentToAllClients, Velocity, Name, Scene.Name);
4060
4061 // assuming 5 ms. worst case precision for timer, use 2x that 3601 // assuming 5 ms. worst case precision for timer, use 2x that
4062 // for distance error threshold 3602 // for distance error threshold
4063 float distanceErrorThreshold = speed * 0.01f; 3603 float distanceErrorThreshold = speed * 0.01f;
@@ -4066,17 +3606,11 @@ no information to check this
4066 || Math.Abs(distanceError) > distanceErrorThreshold 3606 || Math.Abs(distanceError) > distanceErrorThreshold
4067 || velocityDiff > 0.01f) // did velocity change from last update? 3607 || velocityDiff > 0.01f) // did velocity change from last update?
4068 { 3608 {
4069// m_log.DebugFormat(
4070// "[SCENE PRESENCE]: Update triggered with speed {0}, distanceError {1}, distanceThreshold {2}, delta-v {3} for {4} in {5}",
4071// speed, distanceError, distanceErrorThreshold, velocidyDiff, Name, Scene.Name);
4072
4073 lastVelocitySentToAllClients = Velocity; 3609 lastVelocitySentToAllClients = Velocity;
4074 lastTerseUpdateToAllClientsTick = currentTick; 3610 lastTerseUpdateToAllClientsTick = currentTick;
4075 lastPositionSentToAllClients = OffsetPosition; 3611 lastPositionSentToAllClients = OffsetPosition;
4076 3612
4077 m_terseUpdateCount++; 3613 // Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name);
4078
4079// Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name);
4080// m_scene.ForEachClient(SendTerseUpdateToClient); 3614// m_scene.ForEachClient(SendTerseUpdateToClient);
4081 m_scene.ForEachScenePresence(SendTerseUpdateToAgent); 3615 m_scene.ForEachScenePresence(SendTerseUpdateToAgent);
4082 } 3616 }
@@ -4103,24 +3637,14 @@ no information to check this
4103 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); 3637 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
4104 } 3638 }
4105 3639
4106 public void SendInitialDataToClient() 3640 public void SendInitialDataToMe()
4107 { 3641 {
4108 SentInitialDataToClient = true;
4109
4110 // Send all scene object to the new client 3642 // Send all scene object to the new client
4111 WorkManager.RunJob("SendInitialDataToClient", delegate 3643 Util.FireAndForget(delegate
4112 { 3644 {
4113// m_log.DebugFormat(
4114// "[SCENE PRESENCE]: Sending initial data to {0} agent {1} in {2}, tp flags {3}",
4115// IsChildAgent ? "child" : "root", Name, Scene.Name, m_teleportFlags);
4116
4117 // we created a new ScenePresence (a new child agent) in a fresh region. 3645 // we created a new ScenePresence (a new child agent) in a fresh region.
4118 // Request info about all the (root) agents in this region 3646 // Request info about all the (root) agents in this region
4119 // Note: This won't send data *to* other clients in that region (children don't send) 3647 // Note: This won't send data *to* other clients in that region (children don't send)
4120<<<<<<< HEAD
4121 SendOtherAgentsAvatarDataToClient();
4122 SendOtherAgentsAppearanceToClient();
4123=======
4124 if (m_teleportFlags <= 0) 3648 if (m_teleportFlags <= 0)
4125 { 3649 {
4126 ILandChannel landch = m_scene.LandChannel; 3650 ILandChannel landch = m_scene.LandChannel;
@@ -4129,7 +3653,6 @@ no information to check this
4129 landch.sendClientInitialLandInfo(ControllingClient); 3653 landch.sendClientInitialLandInfo(ControllingClient);
4130 } 3654 }
4131 } 3655 }
4132>>>>>>> avn/ubitvar
4133 3656
4134 SendOtherAgentsAvatarFullToMe(); 3657 SendOtherAgentsAvatarFullToMe();
4135 EntityBase[] entities = Scene.Entities.GetEntities(); 3658 EntityBase[] entities = Scene.Entities.GetEntities();
@@ -4138,13 +3661,9 @@ no information to check this
4138 if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) 3661 if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment)
4139 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); 3662 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient);
4140 } 3663 }
4141<<<<<<< HEAD
4142 }, null, string.Format("SendInitialDataToClient ({0} in {1})", Name, Scene.Name), false, true);
4143=======
4144 }); 3664 });
4145>>>>>>> avn/ubitvar
4146 } 3665 }
4147 3666
4148 /// <summary> 3667 /// <summary>
4149 /// Do everything required once a client completes its movement into a region and becomes 3668 /// Do everything required once a client completes its movement into a region and becomes
4150 /// a root agent. 3669 /// a root agent.
@@ -4171,17 +3690,6 @@ no information to check this
4171 if (m_scene.AvatarFactory != null) 3690 if (m_scene.AvatarFactory != null)
4172 m_scene.AvatarFactory.QueueAppearanceSave(UUID); 3691 m_scene.AvatarFactory.QueueAppearanceSave(UUID);
4173 } 3692 }
4174<<<<<<< HEAD
4175
4176 // This agent just became root. We are going to tell everyone about it. The process of
4177 // getting other avatars information was initiated elsewhere immediately after the child circuit connected... don't do it
4178 // again here... this comes after the cached appearance check because the avatars
4179 // appearance goes into the avatar update packet
4180 SendAvatarDataToAllClients();
4181
4182 // This invocation always shows up in the viewer logs as an error. Is it needed?
4183 SendAppearanceToClient(this);
4184=======
4185 3693
4186 // send avatar object to all viewers so they cross it into region 3694 // send avatar object to all viewers so they cross it into region
4187 bool newhide = m_currentParcelHide; 3695 bool newhide = m_currentParcelHide;
@@ -4197,7 +3705,6 @@ no information to check this
4197 } 3705 }
4198 3706
4199 SendAppearanceToAgent(this); 3707 SendAppearanceToAgent(this);
4200>>>>>>> avn/ubitvar
4201 3708
4202 m_inTransit = false; 3709 m_inTransit = false;
4203 3710
@@ -4220,13 +3727,6 @@ no information to check this
4220 if (p.UUID == UUID) 3727 if (p.UUID == UUID)
4221 return; 3728 return;
4222 3729
4223<<<<<<< HEAD
4224 // If the avatars baked textures are all in the cache, then we have a
4225 // complete appearance... send it out, if not, then we'll send it when
4226 // the avatar finishes updating its appearance
4227 SendAppearanceToAllOtherClients();
4228 }
4229=======
4230 // get the avatar, then a kill if can't see it 3730 // get the avatar, then a kill if can't see it
4231 p.SendInitialAvatarDataToAgent(this); 3731 p.SendInitialAvatarDataToAgent(this);
4232 3732
@@ -4240,19 +3740,13 @@ no information to check this
4240 }); 3740 });
4241 3741
4242 m_scene.StatsReporter.AddAgentUpdates(count); 3742 m_scene.StatsReporter.AddAgentUpdates(count);
4243>>>>>>> avn/ubitvar
4244 }
4245
4246 public void SendAvatarDataToAllClients()
4247 {
4248 SendAvatarDataToAllClients(true);
4249 } 3743 }
4250 3744
4251 /// <summary> 3745 /// <summary>
4252 /// Send this agent's avatar data to all other root and child agents in the scene 3746 /// Send this agent's avatar data to all other root and child agents in the scene
4253 /// This agent must be root. This avatar will receive its own update. 3747 /// This agent must be root. This avatar will receive its own update.
4254 /// </summary> 3748 /// </summary>
4255 public void SendAvatarDataToAllClients(bool full) 3749 public void SendAvatarDataToAllAgents()
4256 { 3750 {
4257 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAllAgents: {0} ({1})", Name, UUID); 3751 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAllAgents: {0} ({1})", Name, UUID);
4258 // only send update from root agents to other clients; children are only "listening posts" 3752 // only send update from root agents to other clients; children are only "listening posts"
@@ -4269,47 +3763,18 @@ no information to check this
4269 3763
4270 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 3764 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
4271 { 3765 {
4272<<<<<<< HEAD
4273 if (full)
4274 SendAvatarDataToClient(scenePresence);
4275 else
4276 scenePresence.ControllingClient.SendAvatarDataImmediate(this);
4277=======
4278 SendAvatarDataToAgent(scenePresence); 3766 SendAvatarDataToAgent(scenePresence);
4279>>>>>>> avn/ubitvar
4280 count++; 3767 count++;
4281 }); 3768 });
4282 3769
4283 m_scene.StatsReporter.AddAgentUpdates(count); 3770 m_scene.StatsReporter.AddAgentUpdates(count);
4284 } 3771 }
4285
4286<<<<<<< HEAD
4287 /// <summary>
4288 /// Send avatar data for all other root agents to this agent, this agent
4289 /// can be either a child or root
4290 /// </summary>
4291 public void SendOtherAgentsAvatarDataToClient()
4292=======
4293 // sends avatar object to all clients so they cross it into region 3772 // sends avatar object to all clients so they cross it into region
4294 // then sends kills to hide 3773 // then sends kills to hide
4295 public void SendInitialAvatarDataToAllAgents(List<ScenePresence> presences) 3774 public void SendInitialAvatarDataToAllAgents(List<ScenePresence> presences)
4296>>>>>>> avn/ubitvar
4297 { 3775 {
4298 m_lastSize = Appearance.AvatarSize; 3776 m_lastSize = Appearance.AvatarSize;
4299 int count = 0; 3777 int count = 0;
4300<<<<<<< HEAD
4301 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
4302 {
4303 // only send information about other root agents
4304 if (scenePresence.UUID == UUID)
4305 return;
4306
4307 scenePresence.SendAvatarDataToClient(this);
4308 count++;
4309 });
4310=======
4311>>>>>>> avn/ubitvar
4312
4313 foreach (ScenePresence p in presences) 3778 foreach (ScenePresence p in presences)
4314 { 3779 {
4315 p.ControllingClient.SendAvatarDataImmediate(this); 3780 p.ControllingClient.SendAvatarDataImmediate(this);
@@ -4337,16 +3802,11 @@ no information to check this
4337 /// Send avatar data to an agent. 3802 /// Send avatar data to an agent.
4338 /// </summary> 3803 /// </summary>
4339 /// <param name="avatar"></param> 3804 /// <param name="avatar"></param>
4340 public void SendAvatarDataToClient(ScenePresence avatar) 3805 public void SendAvatarDataToAgent(ScenePresence avatar)
4341 { 3806 {
4342<<<<<<< HEAD
4343 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToClient from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
4344
4345=======
4346 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); 3807 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
4347 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) 3808 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200)
4348 return; 3809 return;
4349>>>>>>> avn/ubitvar
4350 avatar.ControllingClient.SendAvatarDataImmediate(this); 3810 avatar.ControllingClient.SendAvatarDataImmediate(this);
4351 } 3811 }
4352 3812
@@ -4354,18 +3814,14 @@ no information to check this
4354 { 3814 {
4355 avatar.ControllingClient.SendAvatarDataImmediate(this); 3815 avatar.ControllingClient.SendAvatarDataImmediate(this);
4356 } 3816 }
4357 3817
4358 /// <summary> 3818 /// <summary>
4359 /// Send this agent's appearance to all other root and child agents in the scene 3819 /// Send this agent's appearance to all other root and child agents in the scene
4360 /// This agent must be root. 3820 /// This agent must be root.
4361 /// </summary> 3821 /// </summary>
4362 public void SendAppearanceToAllOtherClients() 3822 public void SendAppearanceToAllOtherAgents()
4363 { 3823 {
4364<<<<<<< HEAD
4365// m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherClients: {0} {1}", Name, UUID);
4366=======
4367 // m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} {1}", Name, UUID); 3824 // m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} {1}", Name, UUID);
4368>>>>>>> avn/ubitvar
4369 3825
4370 // only send update from root agents to other clients; children are only "listening posts" 3826 // only send update from root agents to other clients; children are only "listening posts"
4371 if (IsChildAgent) 3827 if (IsChildAgent)
@@ -4379,51 +3835,21 @@ no information to check this
4379 3835
4380 int count = 0; 3836 int count = 0;
4381 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 3837 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
4382 { 3838 {
4383 // only send information to other root agents 3839 // only send information to other root agents
4384 if (scenePresence.UUID == UUID) 3840 if (scenePresence.UUID == UUID)
4385 return; 3841 return;
4386
4387 SendAppearanceToClient(scenePresence);
4388 count++;
4389 });
4390<<<<<<< HEAD
4391
4392 m_scene.StatsReporter.AddAgentUpdates(count);
4393 }
4394
4395 /// <summary>
4396 /// Send appearance from all other root agents to this agent. this agent
4397 /// can be either root or child
4398 /// </summary>
4399 public void SendOtherAgentsAppearanceToClient()
4400 {
4401// m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToClient {0} {1}", Name, UUID);
4402
4403 int count = 0;
4404 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
4405 {
4406 // only send information about other root agents
4407 if (scenePresence.UUID == UUID)
4408 return;
4409
4410 scenePresence.SendAppearanceToClient(this);
4411 count++;
4412 });
4413 3842
4414======= 3843 SendAppearanceToAgent(scenePresence);
4415>>>>>>> avn/ubitvar 3844 count++;
3845 });
4416 m_scene.StatsReporter.AddAgentUpdates(count); 3846 m_scene.StatsReporter.AddAgentUpdates(count);
4417 } 3847 }
4418 3848
4419 /// <summary> 3849 public void SendAppearanceToAgent(ScenePresence avatar)
4420 /// Send appearance data to an agent.
4421 /// </summary>
4422 /// <param name="avatar"></param>
4423 public void SendAppearanceToClient(ScenePresence avatar)
4424 { 3850 {
4425// m_log.DebugFormat( 3851 // m_log.DebugFormat(
4426// "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); 3852 // "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
4427 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) 3853 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200)
4428 return; 3854 return;
4429 SendAppearanceToAgentNF(avatar); 3855 SendAppearanceToAgentNF(avatar);
@@ -4574,81 +4000,6 @@ no information to check this
4574 if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero) 4000 if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero)
4575 return; 4001 return;
4576 4002
4577<<<<<<< HEAD
4578 if (IsInTransit)
4579 return;
4580
4581 Vector3 pos2 = AbsolutePosition;
4582 Vector3 origPosition = pos2;
4583 Vector3 vel = Velocity;
4584
4585 // Compute the future avatar position.
4586 // If the avatar will be crossing, we force the crossing to happen now
4587 // in the hope that this will make the avatar movement smoother when crossing.
4588 pos2 += vel * 0.05f;
4589
4590 if (m_scene.PositionIsInCurrentRegion(pos2))
4591 return;
4592
4593 m_log.DebugFormat("{0} CheckForBorderCrossing: position outside region. {1} in {2} at pos {3}",
4594 LogHeader, Name, Scene.Name, pos2);
4595
4596 // Disconnect from the current region
4597 bool isFlying = Flying;
4598 RemoveFromPhysicalScene();
4599
4600 // pos2 is the forcasted position so make that the 'current' position so the crossing
4601 // code will move us into the newly addressed region.
4602 m_pos = pos2;
4603
4604 if (CrossToNewRegion())
4605 {
4606 AddToPhysicalScene(isFlying);
4607 }
4608 else
4609 {
4610 // Tried to make crossing happen but it failed.
4611 if (m_requestedSitTargetUUID == UUID.Zero)
4612 {
4613 m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader);
4614
4615 Velocity = Vector3.Zero;
4616 AbsolutePosition = EnforceSanityOnPosition(origPosition);
4617
4618 AddToPhysicalScene(isFlying);
4619 }
4620 }
4621 }
4622
4623 // Given a position, make sure it is within the current region.
4624 // If just outside some border, the returned position will be just inside the border on that side.
4625 private Vector3 EnforceSanityOnPosition(Vector3 origPosition)
4626 {
4627 const float borderFudge = 0.1f;
4628 Vector3 ret = origPosition;
4629
4630 // Sanity checking on the position to make sure it is in the region we couldn't cross from
4631 float extentX = (float)m_scene.RegionInfo.RegionSizeX;
4632 float extentY = (float)m_scene.RegionInfo.RegionSizeY;
4633 IRegionCombinerModule combiner = m_scene.RequestModuleInterface<IRegionCombinerModule>();
4634 if (combiner != null)
4635 {
4636 // If a mega-region, the size could be much bigger
4637 Vector2 megaExtent = combiner.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
4638 extentX = megaExtent.X;
4639 extentY = megaExtent.Y;
4640 }
4641 if (ret.X < 0)
4642 ret.X = borderFudge;
4643 else if (ret.X >= extentX)
4644 ret.X = extentX - borderFudge;
4645 if (ret.Y < 0)
4646 ret.Y = borderFudge;
4647 else if (ret.Y >= extentY)
4648 ret.Y = extentY - borderFudge;
4649
4650 return ret;
4651=======
4652 Vector3 pos2 = AbsolutePosition; 4003 Vector3 pos2 = AbsolutePosition;
4653 Vector3 vel = Velocity; 4004 Vector3 vel = Velocity;
4654 4005
@@ -4710,8 +4061,6 @@ no information to check this
4710 4061
4711 AddToPhysicalScene(isFlying); 4062 AddToPhysicalScene(isFlying);
4712 } 4063 }
4713
4714>>>>>>> avn/ubitvar
4715 } 4064 }
4716 4065
4717 /// <summary> 4066 /// <summary>
@@ -4779,16 +4128,6 @@ no information to check this
4779 // Don't close the agent on this region yet 4128 // Don't close the agent on this region yet
4780 if (handle != Scene.RegionInfo.RegionHandle) 4129 if (handle != Scene.RegionInfo.RegionHandle)
4781 { 4130 {
4782<<<<<<< HEAD
4783 uint x, y;
4784 Util.RegionHandleToRegionLoc(handle, out x, out y);
4785
4786// m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
4787// m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));
4788 float dist = (float)Math.Max(Scene.DefaultDrawDistance,
4789 (float)Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY));
4790 if (Util.IsOutsideView(dist, x, newRegionX, y, newRegionY))
4791=======
4792 Util.RegionHandleToRegionLoc(handle, out x, out y); 4131 Util.RegionHandleToRegionLoc(handle, out x, out y);
4793 if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) 4132 if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo))
4794 { 4133 {
@@ -4802,7 +4141,6 @@ no information to check this
4802 } 4141 }
4803 } 4142 }
4804 else 4143 else
4805>>>>>>> avn/ubitvar
4806 { 4144 {
4807 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, 4145 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY,
4808 (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) 4146 (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY))
@@ -4875,8 +4213,7 @@ no information to check this
4875 return; 4213 return;
4876 4214
4877 CopyFrom(cAgentData); 4215 CopyFrom(cAgentData);
4878 4216
4879 m_updateAgentReceivedAfterTransferEvent.Set();
4880 } 4217 }
4881 4218
4882 private static Vector3 marker = new Vector3(-1f, -1f, -1f); 4219 private static Vector3 marker = new Vector3(-1f, -1f, -1f);
@@ -4895,23 +4232,11 @@ no information to check this
4895 if (!IsChildAgent) 4232 if (!IsChildAgent)
4896 return; 4233 return;
4897 4234
4898<<<<<<< HEAD
4899// m_log.DebugFormat(
4900// "[SCENE PRESENCE]: ChildAgentPositionUpdate for {0} in {1}, tRegion {2},{3}, rRegion {4},{5}, pos {6}",
4901// Name, Scene.Name, tRegionX, tRegionY, rRegionX, rRegionY, cAgentData.Position);
4902
4903 // Find the distance (in meters) between the two regions
4904 // XXX: We cannot use Util.RegionLocToHandle() here because a negative value will silently overflow the
4905 // uint
4906 int shiftx = (int)(((int)rRegionX - (int)tRegionX) * Constants.RegionSize);
4907 int shifty = (int)(((int)rRegionY - (int)tRegionY) * Constants.RegionSize);
4908=======
4909 RegionHandle = cAgentData.RegionHandle; 4235 RegionHandle = cAgentData.RegionHandle;
4910 4236
4911 //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); 4237 //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY);
4912 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; 4238 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
4913 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; 4239 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
4914>>>>>>> avn/ubitvar
4915 4240
4916 Vector3 offset = new Vector3(shiftx, shifty, 0f); 4241 Vector3 offset = new Vector3(shiftx, shifty, 0f);
4917 4242
@@ -4919,11 +4244,7 @@ no information to check this
4919 // changes, then start using the agent's drawdistance rather than the 4244 // changes, then start using the agent's drawdistance rather than the
4920 // region's draw distance. 4245 // region's draw distance.
4921 DrawDistance = cAgentData.Far; 4246 DrawDistance = cAgentData.Far;
4922<<<<<<< HEAD
4923 // DrawDistance = Scene.DefaultDrawDistance;
4924=======
4925// DrawDistance = Scene.DefaultDrawDistance; 4247// DrawDistance = Scene.DefaultDrawDistance;
4926>>>>>>> avn/ubitvar
4927 4248
4928 if (cAgentData.Position != marker) // UGH!! 4249 if (cAgentData.Position != marker) // UGH!!
4929 m_pos = cAgentData.Position + offset; 4250 m_pos = cAgentData.Position + offset;
@@ -5038,10 +4359,6 @@ no information to check this
5038 4359
5039 private void CopyFrom(AgentData cAgent) 4360 private void CopyFrom(AgentData cAgent)
5040 { 4361 {
5041<<<<<<< HEAD
5042=======
5043
5044>>>>>>> avn/ubitvar
5045 m_callbackURI = cAgent.CallbackURI; 4362 m_callbackURI = cAgent.CallbackURI;
5046// m_log.DebugFormat( 4363// m_log.DebugFormat(
5047// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", 4364// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()",
@@ -5060,9 +4377,6 @@ no information to check this
5060 // changes, then start using the agent's drawdistance rather than the 4377 // changes, then start using the agent's drawdistance rather than the
5061 // region's draw distance. 4378 // region's draw distance.
5062 DrawDistance = cAgent.Far; 4379 DrawDistance = cAgent.Far;
5063<<<<<<< HEAD
5064 // DrawDistance = Scene.DefaultDrawDistance;
5065=======
5066 //DrawDistance = Scene.DefaultDrawDistance; 4380 //DrawDistance = Scene.DefaultDrawDistance;
5067 4381
5068 if (cAgent.ChildrenCapSeeds != null && cAgent.ChildrenCapSeeds.Count > 0) 4382 if (cAgent.ChildrenCapSeeds != null && cAgent.ChildrenCapSeeds.Count > 0)
@@ -5073,7 +4387,6 @@ no information to check this
5073 } 4387 }
5074 KnownRegions = cAgent.ChildrenCapSeeds; 4388 KnownRegions = cAgent.ChildrenCapSeeds;
5075 } 4389 }
5076>>>>>>> avn/ubitvar
5077 4390
5078 if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) 4391 if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
5079 ControllingClient.SetChildAgentThrottle(cAgent.Throttles); 4392 ControllingClient.SetChildAgentThrottle(cAgent.Throttles);
@@ -5135,35 +4448,10 @@ no information to check this
5135 Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; 4448 Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState;
5136 4449
5137 if (Scene.AttachmentsModule != null) 4450 if (Scene.AttachmentsModule != null)
5138<<<<<<< HEAD
5139 {
5140 // If the JobEngine is running we can schedule this job now and continue rather than waiting for all
5141 // attachments to copy, which might take a long time in the Hypergrid case as the entire inventory
5142 // graph is inspected for each attachments and assets possibly fetched.
5143 //
5144 // We don't need to worry about a race condition as the job to later start the scripts is also
5145 // JobEngine scheduled and so will always occur after this task.
5146 // XXX: This will not be true if JobEngine ever gets more than one thread.
5147 WorkManager.RunJob(
5148 "CopyAttachments",
5149 o => Scene.AttachmentsModule.CopyAttachments(cAgent, this),
5150 null,
5151 string.Format("Copy attachments for {0} entering {1}", Name, Scene.Name),
5152 true);
5153 }
5154
5155 // This must occur after attachments are copied or scheduled to be copied, as it releases the CompleteMovement() calling thread
5156 // originating from the client completing a teleport. Otherwise, CompleteMovement() code to restart
5157 // script attachments can outrace this thread.
5158 lock (m_originRegionIDAccessLock)
5159 m_originRegionID = cAgent.RegionID;
5160=======
5161 Scene.AttachmentsModule.CopyAttachments(cAgent, this); 4451 Scene.AttachmentsModule.CopyAttachments(cAgent, this);
5162 4452
5163 lock (m_originRegionIDAccessLock) 4453 lock (m_originRegionIDAccessLock)
5164 m_originRegionID = cAgent.RegionID; 4454 m_originRegionID = cAgent.RegionID;
5165
5166>>>>>>> avn/ubitvar
5167 } 4455 }
5168 4456
5169 public bool CopyAgent(out IAgentData agent) 4457 public bool CopyAgent(out IAgentData agent)
@@ -5212,22 +4500,13 @@ no information to check this
5212 if (Appearance.AvatarHeight == 0) 4500 if (Appearance.AvatarHeight == 0)
5213// Appearance.SetHeight(); 4501// Appearance.SetHeight();
5214 Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); 4502 Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f));
5215
5216/*
5217 PhysicsActor = scene.AddAvatar(
5218 LocalId, Firstname + "." + Lastname, pVec,
5219 new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying);
5220*/
5221 4503
5222<<<<<<< HEAD 4504 PhysicsScene scene = m_scene.PhysicsScene;
5223 PhysicsActor = m_scene.PhysicsScene.AddAvatar( 4505 Vector3 pVec = AbsolutePosition;
5224 LocalId, Firstname + "." + Lastname, AbsolutePosition, Velocity, 4506
5225 Appearance.AvatarBoxSize, isFlying);
5226=======
5227 PhysicsActor = scene.AddAvatar( 4507 PhysicsActor = scene.AddAvatar(
5228 LocalId, Firstname + "." + Lastname, pVec, 4508 LocalId, Firstname + "." + Lastname, pVec,
5229 Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying); 4509 Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying);
5230>>>>>>> avn/ubitvar
5231 4510
5232 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 4511 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
5233 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 4512 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index dc5de58..c8a01a0 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -307,21 +307,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
307 } 307 }
308 } 308 }
309 309
310<<<<<<< HEAD
311
312=======
313>>>>>>> avn/ubitvar
314 /// <summary> 310 /// <summary>
315 /// Modifies a SceneObjectGroup. 311 /// Modifies a SceneObjectGroup.
316 /// </summary> 312 /// </summary>
317 /// <param name="sog">The object</param> 313 /// <param name="sog">The object</param>
318 /// <returns>Whether the object was actually modified</returns> 314 /// <returns>Whether the object was actually modified</returns>
319 public delegate bool SceneObjectModifier(SceneObjectGroup sog); 315 public delegate bool SceneObjectModifier(SceneObjectGroup sog);
320<<<<<<< HEAD
321
322=======
323 316
324>>>>>>> avn/ubitvar
325 /// <summary> 317 /// <summary>
326 /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing. 318 /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing.
327 /// </summary> 319 /// </summary>
@@ -335,11 +327,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
335 CoalescedSceneObjects coa = null; 327 CoalescedSceneObjects coa = null;
336 328
337 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); 329 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data));
338<<<<<<< HEAD
339
340=======
341
342>>>>>>> avn/ubitvar
343 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) 330 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
344 { 331 {
345 // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); 332 // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
@@ -384,10 +371,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
384 371
385 return data; 372 return data;
386 } 373 }
387<<<<<<< HEAD
388
389=======
390>>>>>>> avn/ubitvar
391 374
392 #region manual serialization 375 #region manual serialization
393 376
@@ -739,44 +722,42 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
739 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); 722 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
740 } 723 }
741 724
742<<<<<<< HEAD 725 private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlReader reader)
743 private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
744=======
745 private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlTextReader reader)
746 { 726 {
747 obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset")); 727 obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset"));
748 } 728 }
749 729
750 private static void ProcessCameraAtOffset(SceneObjectPart obj, XmlTextReader reader) 730 private static void ProcessCameraAtOffset(SceneObjectPart obj, XmlReader reader)
751 { 731 {
752 obj.SetCameraAtOffset(Util.ReadVector(reader, "CameraAtOffset")); 732 obj.SetCameraAtOffset(Util.ReadVector(reader, "CameraAtOffset"));
753 } 733 }
754 734
755 private static void ProcessSoundID(SceneObjectPart obj, XmlTextReader reader) 735 private static void ProcessSoundID(SceneObjectPart obj, XmlReader reader)
756 { 736 {
757 obj.Sound = Util.ReadUUID(reader, "SoundID"); 737 obj.Sound = Util.ReadUUID(reader, "SoundID");
758 } 738 }
759 739
760 private static void ProcessSoundGain(SceneObjectPart obj, XmlTextReader reader) 740 private static void ProcessSoundGain(SceneObjectPart obj, XmlReader reader)
761 { 741 {
762 obj.SoundGain = reader.ReadElementContentAsDouble("SoundGain", String.Empty); 742 obj.SoundGain = reader.ReadElementContentAsDouble("SoundGain", String.Empty);
763 } 743 }
764 744
765 private static void ProcessSoundFlags(SceneObjectPart obj, XmlTextReader reader) 745 private static void ProcessSoundFlags(SceneObjectPart obj, XmlReader reader)
766 { 746 {
767 obj.SoundFlags = (byte)reader.ReadElementContentAsInt("SoundFlags", String.Empty); 747 obj.SoundFlags = (byte)reader.ReadElementContentAsInt("SoundFlags", String.Empty);
768 } 748 }
769 749
770 private static void ProcessSoundRadius(SceneObjectPart obj, XmlTextReader reader) 750 private static void ProcessSoundRadius(SceneObjectPart obj, XmlReader reader)
771 { 751 {
772 obj.SoundRadius = reader.ReadElementContentAsDouble("SoundRadius", String.Empty); 752 obj.SoundRadius = reader.ReadElementContentAsDouble("SoundRadius", String.Empty);
773 } 753 }
774 754
775 private static void ProcessSoundQueueing(SceneObjectPart obj, XmlTextReader reader) 755 private static void ProcessSoundQueueing(SceneObjectPart obj, XmlReader reader)
776 { 756 {
777 obj.SoundQueueing = Util.ReadBoolean(reader); 757 obj.SoundQueueing = Util.ReadBoolean(reader);
778 } 758 }
779 private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader) 759
760 private static void ProcessVehicle(SceneObjectPart obj, XmlReader reader)
780 { 761 {
781 SOPVehicle vehicle = SOPVehicle.FromXml2(reader); 762 SOPVehicle vehicle = SOPVehicle.FromXml2(reader);
782 763
@@ -793,8 +774,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
793 } 774 }
794 } 775 }
795 776
796 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 777 private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
797>>>>>>> avn/ubitvar
798 { 778 {
799 List<string> errorNodeNames; 779 List<string> errorNodeNames;
800 obj.Shape = ReadShape(reader, "Shape", out errorNodeNames, obj); 780 obj.Shape = ReadShape(reader, "Shape", out errorNodeNames, obj);
@@ -968,21 +948,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
968 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); 948 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
969 } 949 }
970 950
971 private static void ProcessBuoyancy(SceneObjectPart obj, XmlTextReader reader) 951 private static void ProcessBuoyancy(SceneObjectPart obj, XmlReader reader)
972 { 952 {
973 obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty); 953 obj.Buoyancy = (float)reader.ReadElementContentAsFloat("Buoyancy", String.Empty);
974 } 954 }
975 955
976 private static void ProcessForce(SceneObjectPart obj, XmlTextReader reader) 956 private static void ProcessForce(SceneObjectPart obj, XmlReader reader)
977 { 957 {
978 obj.Force = Util.ReadVector(reader, "Force"); 958 obj.Force = Util.ReadVector(reader, "Force");
979 } 959 }
980 private static void ProcessTorque(SceneObjectPart obj, XmlTextReader reader) 960 private static void ProcessTorque(SceneObjectPart obj, XmlReader reader)
981 { 961 {
982 obj.Torque = Util.ReadVector(reader, "Torque"); 962 obj.Torque = Util.ReadVector(reader, "Torque");
983 } 963 }
984 964
985 private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlTextReader reader) 965 private static void ProcessVolumeDetectActive(SceneObjectPart obj, XmlReader reader)
986 { 966 {
987 obj.VolumeDetectActive = Util.ReadBoolean(reader); 967 obj.VolumeDetectActive = Util.ReadBoolean(reader);
988 } 968 }
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 52e3ff1..bdddd73 100755
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -184,11 +184,7 @@ namespace OpenSim.Region.Framework.Scenes
184 184
185 // saved last reported value so there is something available for llGetRegionFPS 185 // saved last reported value so there is something available for llGetRegionFPS
186 private float lastReportedSimFPS; 186 private float lastReportedSimFPS;
187<<<<<<< HEAD
188 private float[] lastReportedSimStats = new float[m_statisticArraySize];
189=======
190 private float[] lastReportedSimStats = new float[23]; 187 private float[] lastReportedSimStats = new float[23];
191>>>>>>> avn/ubitvar
192 private float m_pfps; 188 private float m_pfps;
193 189
194 /// <summary> 190 /// <summary>
@@ -208,14 +204,10 @@ namespace OpenSim.Region.Framework.Scenes
208 private int m_physicsMS; 204 private int m_physicsMS;
209 private int m_imageMS; 205 private int m_imageMS;
210 private int m_otherMS; 206 private int m_otherMS;
211<<<<<<< HEAD
212 private int m_scriptMS;
213=======
214 private int m_sleeptimeMS; 207 private int m_sleeptimeMS;
215 208
216//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. 209//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed.
217//Ckrinke private int m_scriptMS = 0; 210//Ckrinke private int m_scriptMS = 0;
218>>>>>>> avn/ubitvar
219 211
220 private int m_rootAgents; 212 private int m_rootAgents;
221 private int m_childAgents; 213 private int m_childAgents;
@@ -269,27 +261,10 @@ namespace OpenSim.Region.Framework.Scenes
269 261
270 private IEstateModule estateModule; 262 private IEstateModule estateModule;
271 263
272 public SimStatsReporter(Scene scene) 264 public SimStatsReporter(Scene scene)
273 : this(scene, Scene.m_defaultNumberFramesStored)
274 { 265 {
275 }
276
277 public SimStatsReporter(Scene scene, int numberOfFrames)
278 {
279 // Store the number of frames from the OpenSim.ini configuration file
280 m_numberFramesStored = numberOfFrames;
281
282 // Initialize the different frame time arrays to the correct sizes
283 m_totalFrameTimeMilliseconds = new double[m_numberFramesStored];
284 m_simulationFrameTimeMilliseconds = new double[m_numberFramesStored];
285 m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored];
286 m_networkFrameTimeMilliseconds = new double[m_numberFramesStored];
287
288 // Initialize the current number of users logging into the region
289 m_usersLoggingIn = 0;
290
291 m_scene = scene; 266 m_scene = scene;
292 m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps; 267 m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps;
293 m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); 268 m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000);
294 ReportingRegion = scene.RegionInfo; 269 ReportingRegion = scene.RegionInfo;
295 270
@@ -304,7 +279,7 @@ namespace OpenSim.Region.Framework.Scenes
304 279
305 /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit 280 /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit
306 /// longer than ideal (which in itself is a concern). 281 /// longer than ideal (which in itself is a concern).
307 SlowFramesStatReportThreshold = (int)Math.Ceiling(scene.MinFrameTicks * 1.2); 282 SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2);
308 283
309 SlowFramesStat 284 SlowFramesStat
310 = new Stat( 285 = new Stat(
@@ -319,7 +294,6 @@ namespace OpenSim.Region.Framework.Scenes
319 StatVerbosity.Info); 294 StatVerbosity.Info);
320 295
321 StatsManager.RegisterStat(SlowFramesStat); 296 StatsManager.RegisterStat(SlowFramesStat);
322
323 } 297 }
324 298
325 299
@@ -356,25 +330,10 @@ namespace OpenSim.Region.Framework.Scenes
356 330
357 private void statsHeartBeat(object sender, EventArgs e) 331 private void statsHeartBeat(object sender, EventArgs e)
358 { 332 {
359 double totalSumFrameTime; 333 if (!m_scene.Active)
360 double simulationSumFrameTime;
361 double physicsSumFrameTime;
362 double networkSumFrameTime;
363 float frameDilation;
364 int currentFrame;
365
366 if (!m_scene.Active)
367 return; 334 return;
368 335
369<<<<<<< HEAD
370 // Create arrays to hold the statistics for this current scene,
371 // these will be passed to the SimExtraStatsCollector, they are also
372 // sent to the SimStats class
373 SimStatsPacket.StatBlock[] sb = new
374 SimStatsPacket.StatBlock[m_statisticArraySize];
375=======
376 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; 336 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23];
377>>>>>>> avn/ubitvar
378 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); 337 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
379 338
380 // Know what's not thread safe in Mono... modifying timers. 339 // Know what's not thread safe in Mono... modifying timers.
@@ -409,9 +368,8 @@ namespace OpenSim.Region.Framework.Scenes
409 368
410 // ORIGINAL code commented out until we have time to add our own 369 // ORIGINAL code commented out until we have time to add our own
411 // statistics to the statistics window 370 // statistics to the statistics window
412 //float physfps = ((m_pfps / 1000)); 371 float physfps = ((m_pfps / 1000));
413 float physfps = m_numberPhysicsFrames; 372
414
415 //if (physfps > 600) 373 //if (physfps > 600)
416 //physfps = physfps - (physfps - 600); 374 //physfps = physfps - (physfps - 600);
417 375
@@ -465,61 +423,16 @@ namespace OpenSim.Region.Framework.Scenes
465 // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; 423 // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS;
466 // m_imageMS m_netMS are not included in m_frameMS 424 // m_imageMS m_netMS are not included in m_frameMS
467 425
468<<<<<<< HEAD
469 uint thisFrame = m_scene.Frame;
470 uint numFrames = thisFrame - m_lastUpdateFrame;
471 float framesUpdated = (float)numFrames * m_reportedFpsCorrectionFactor;
472 m_lastUpdateFrame = thisFrame;
473
474 // Avoid div-by-zero if somehow we've not updated any frames.
475 if (framesUpdated == 0)
476 framesUpdated = 1;
477
478 for (int i = 0; i < m_statisticArraySize; i++)
479=======
480 m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; 426 m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS;
481 if (m_otherMS < 0) 427 if (m_otherMS < 0)
482 m_otherMS = 0; 428 m_otherMS = 0;
483 429
484 for (int i = 0; i < 23; i++) 430 for (int i = 0; i < 23; i++)
485>>>>>>> avn/ubitvar
486 { 431 {
487 sb[i] = new SimStatsPacket.StatBlock(); 432 sb[i] = new SimStatsPacket.StatBlock();
488 } 433 }
489 434
490 // Resetting the sums of the frame times to prevent any errors 435
491 // in calculating the moving average for frame time
492 totalSumFrameTime = 0;
493 simulationSumFrameTime = 0;
494 physicsSumFrameTime = 0;
495 networkSumFrameTime = 0;
496
497 // Loop through all the frames that were stored for the current
498 // heartbeat to process the moving average of frame times
499 for (int i = 0; i < m_numberFramesStored; i++)
500 {
501 // Sum up each frame time in order to calculate the moving
502 // average of frame time
503 totalSumFrameTime += m_totalFrameTimeMilliseconds[i];
504 simulationSumFrameTime +=
505 m_simulationFrameTimeMilliseconds[i];
506 physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i];
507 networkSumFrameTime += m_networkFrameTimeMilliseconds[i];
508 }
509
510 // Get the index that represents the current frame based on the next one known; go back
511 // to the last index if next one is stated to restart at 0
512 if (m_nextLocation == 0)
513 currentFrame = m_numberFramesStored - 1;
514 else
515 currentFrame = m_nextLocation - 1;
516
517 // Calculate the frame dilation; which is currently based on the ratio between the sum of the
518 // physics and simulation rate, and the set minimum time to run a scene's frame
519 frameDilation = (float)(m_simulationFrameTimeMilliseconds[currentFrame] +
520 m_physicsFrameTimeMilliseconds[currentFrame]) / m_scene.MinFrameTicks;
521
522 // ORIGINAL code commented out until we have time to add our own
523 sb[0].StatID = (uint) Stats.TimeDilation; 436 sb[0].StatID = (uint) Stats.TimeDilation;
524 sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); 437 sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
525 438
@@ -544,21 +457,7 @@ namespace OpenSim.Region.Framework.Scenes
544 sb[7].StatID = (uint) Stats.ActivePrim; 457 sb[7].StatID = (uint) Stats.ActivePrim;
545 sb[7].StatValue = m_activePrim; 458 sb[7].StatValue = m_activePrim;
546 459
547 // ORIGINAL code commented out until we have time to add our own
548 // statistics to the statistics window
549 sb[8].StatID = (uint)Stats.FrameMS; 460 sb[8].StatID = (uint)Stats.FrameMS;
550<<<<<<< HEAD
551 //sb[8].StatValue = m_frameMS / framesUpdated;
552 sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored;
553
554 sb[9].StatID = (uint)Stats.NetMS;
555 //sb[9].StatValue = m_netMS / framesUpdated;
556 sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored;
557
558 sb[10].StatID = (uint)Stats.PhysicsMS;
559 //sb[10].StatValue = m_physicsMS / framesUpdated;
560 sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored;
561=======
562 sb[8].StatValue = TotalFrameTime; 461 sb[8].StatValue = TotalFrameTime;
563 462
564 sb[9].StatID = (uint)Stats.NetMS; 463 sb[9].StatID = (uint)Stats.NetMS;
@@ -566,18 +465,12 @@ namespace OpenSim.Region.Framework.Scenes
566 465
567 sb[10].StatID = (uint)Stats.PhysicsMS; 466 sb[10].StatID = (uint)Stats.PhysicsMS;
568 sb[10].StatValue = m_physicsMS * perframe; 467 sb[10].StatValue = m_physicsMS * perframe;
569>>>>>>> avn/ubitvar
570 468
571 sb[11].StatID = (uint)Stats.ImageMS ; 469 sb[11].StatID = (uint)Stats.ImageMS ;
572 sb[11].StatValue = m_imageMS * perframe; 470 sb[11].StatValue = m_imageMS * perframe;
573 471
574 sb[12].StatID = (uint)Stats.OtherMS; 472 sb[12].StatID = (uint)Stats.OtherMS;
575<<<<<<< HEAD
576 //sb[12].StatValue = m_otherMS / framesUpdated;
577 sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored;
578=======
579 sb[12].StatValue = m_otherMS * perframe; 473 sb[12].StatValue = m_otherMS * perframe;
580>>>>>>> avn/ubitvar
581 474
582 sb[13].StatID = (uint)Stats.InPacketsPerSecond; 475 sb[13].StatID = (uint)Stats.InPacketsPerSecond;
583 sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); 476 sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor);
@@ -609,30 +502,6 @@ namespace OpenSim.Region.Framework.Scenes
609 sb[22].StatID = (uint)Stats.SimSleepMs; 502 sb[22].StatID = (uint)Stats.SimSleepMs;
610 sb[22].StatValue = sleeptime; 503 sb[22].StatValue = sleeptime;
611 504
612 // Current ratio between the sum of physics and sim rate, and the
613 // minimum time to run a scene's frame
614 sb[22].StatID = (uint)Stats.FrameDilation;
615 sb[22].StatValue = frameDilation;
616
617 // Current number of users currently attemptint to login to region
618 sb[23].StatID = (uint)Stats.UsersLoggingIn;
619 sb[23].StatValue = m_usersLoggingIn;
620
621 // Total number of geometric primitives in the scene
622 sb[24].StatID = (uint)Stats.TotalGeoPrim;
623 sb[24].StatValue = m_numGeoPrim;
624
625 // Total number of mesh objects in the scene
626 sb[25].StatID = (uint)Stats.TotalMesh;
627 sb[25].StatValue = m_numMesh;
628
629 // Current number of threads that XEngine is using
630 sb[26].StatID = (uint)Stats.ThreadCount;
631 sb[26].StatValue = m_inUseThreads;
632
633 sb[27].StatID = (uint)Stats.ScriptMS;
634 sb[27].StatValue = (numFrames <= 0) ? 0 : ((float)m_scriptMS / numFrames);
635
636 for (int i = 0; i < m_statisticArraySize; i++) 505 for (int i = 0; i < m_statisticArraySize; i++)
637 { 506 {
638 lastReportedSimStats[i] = sb[i].StatValue; 507 lastReportedSimStats[i] = sb[i].StatValue;
@@ -702,16 +571,11 @@ namespace OpenSim.Region.Framework.Scenes
702 m_physicsMS = 0; 571 m_physicsMS = 0;
703 m_imageMS = 0; 572 m_imageMS = 0;
704 m_otherMS = 0; 573 m_otherMS = 0;
705<<<<<<< HEAD
706 m_scriptMS = 0;
707 m_spareMS = 0;
708=======
709// m_spareMS = 0; 574// m_spareMS = 0;
710 m_sleeptimeMS = 0; 575 m_sleeptimeMS = 0;
711 576
712//Ckrinke This variable is not used, so comment to remove compiler warning until it is used. 577//Ckrinke This variable is not used, so comment to remove compiler warning until it is used.
713//Ckrinke m_scriptMS = 0; 578//Ckrinke m_scriptMS = 0;
714>>>>>>> avn/ubitvar
715 } 579 }
716 580
717 # region methods called from Scene 581 # region methods called from Scene
@@ -817,41 +681,9 @@ namespace OpenSim.Region.Framework.Scenes
817 m_otherMS += ms; 681 m_otherMS += ms;
818 } 682 }
819 683
820<<<<<<< HEAD
821 public void AddScriptMS(int ms)
822 {
823 m_scriptMS += ms;
824 }
825
826 public void addPhysicsFrame(int frames)
827 {
828 // Add the number of physics frames to the correct total physics
829 // frames
830 m_numberPhysicsFrames += frames;
831 }
832
833 public void addFrameTimeMilliseconds(double total, double simulation,
834 double physics, double network)
835 {
836 // Save the frame times from the current frame into the appropriate
837 // arrays
838 m_totalFrameTimeMilliseconds[m_nextLocation] = total;
839 m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation;
840 m_physicsFrameTimeMilliseconds[m_nextLocation] = physics;
841 m_networkFrameTimeMilliseconds[m_nextLocation] = network;
842
843 // Update to the next location in the list
844 m_nextLocation++;
845
846 // Since the list will begin to overwrite the oldest frame values
847 // first, the next location needs to loop back to the beginning of the
848 // list whenever it reaches the end
849 m_nextLocation = m_nextLocation % m_numberFramesStored;
850=======
851 public void addSleepMS(int ms) 684 public void addSleepMS(int ms)
852 { 685 {
853 m_sleeptimeMS += ms; 686 m_sleeptimeMS += ms;
854>>>>>>> avn/ubitvar
855 } 687 }
856 688
857 public void AddPendingDownloads(int count) 689 public void AddPendingDownloads(int count)
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
index 6fd9096..506ad24 100644
--- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
+++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
@@ -49,7 +49,6 @@ namespace OpenSim.Region.Framework.Scenes
49 { 49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 private static string LogHeader = "[TERRAIN CHANNEL]"; 51 private static string LogHeader = "[TERRAIN CHANNEL]";
52<<<<<<< HEAD
53 52
54 protected TerrainData m_terrainData; 53 protected TerrainData m_terrainData;
55 54
@@ -58,16 +57,7 @@ namespace OpenSim.Region.Framework.Scenes
58 public int Height { get { return m_terrainData.SizeY; } } // Y dimension 57 public int Height { get { return m_terrainData.SizeY; } } // Y dimension
59 public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension 58 public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension
60 59
61=======
62 60
63 protected TerrainData m_terrainData;
64
65 public int Width { get { return m_terrainData.SizeX; } } // X dimension
66 // Unfortunately, for historical reasons, in this module 'Width' is X and 'Height' is Y
67 public int Height { get { return m_terrainData.SizeY; } } // Y dimension
68 public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension
69
70>>>>>>> avn/ubitvar
71 // Default, not-often-used builder 61 // Default, not-often-used builder
72 public TerrainChannel() 62 public TerrainChannel()
73 { 63 {
@@ -168,15 +158,11 @@ namespace OpenSim.Region.Framework.Scenes
168 { 158 {
169 if (Double.IsNaN(value) || Double.IsInfinity(value)) 159 if (Double.IsNaN(value) || Double.IsInfinity(value))
170 return; 160 return;
171<<<<<<< HEAD
172
173=======
174 if (value < 0) 161 if (value < 0)
175 value = 0; 162 value = 0;
176 else 163 else
177 if (value > 655.35) 164 if (value > 655.35)
178 value = 655.35; 165 value = 655.35;
179>>>>>>> avn/ubitvar
180 m_terrainData[x, y] = (float)value; 166 m_terrainData[x, y] = (float)value;
181 } 167 }
182 } 168 }
@@ -382,13 +368,8 @@ namespace OpenSim.Region.Framework.Scenes
382 public int SizeY; 368 public int SizeY;
383 public int SizeZ; 369 public int SizeZ;
384 public float CompressionFactor; 370 public float CompressionFactor;
385<<<<<<< HEAD
386 public int[] Map;
387 public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, int[] pMap)
388=======
389 public float[] Map; 371 public float[] Map;
390 public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, float[] pMap) 372 public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, float[] pMap)
391>>>>>>> avn/ubitvar
392 { 373 {
393 Version = 1; 374 Version = 1;
394 SizeX = pX; 375 SizeX = pX;
@@ -419,25 +400,13 @@ namespace OpenSim.Region.Framework.Scenes
419 // Fill the heightmap with the center bump terrain 400 // Fill the heightmap with the center bump terrain
420 private void PinHeadIsland() 401 private void PinHeadIsland()
421 { 402 {
422<<<<<<< HEAD
423=======
424 float cx = m_terrainData.SizeX * 0.5f; 403 float cx = m_terrainData.SizeX * 0.5f;
425 float cy = m_terrainData.SizeY * 0.5f; 404 float cy = m_terrainData.SizeY * 0.5f;
426 float h; 405 float h;
427>>>>>>> avn/ubitvar
428 for (int x = 0; x < Width; x++) 406 for (int x = 0; x < Width; x++)
429 { 407 {
430 for (int y = 0; y < Height; y++) 408 for (int y = 0; y < Height; y++)
431 { 409 {
432<<<<<<< HEAD
433 m_terrainData[x, y] = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
434 float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, m_terrainData.SizeX / 2.0, m_terrainData.SizeY / 2.0, 50) * 0.01d);
435 float spherFacB = (float)(TerrainUtil.SphericalFactor(x, y, m_terrainData.SizeX / 2.0, m_terrainData.SizeY / 2.0, 100) * 0.001d);
436 if (m_terrainData[x, y]< spherFacA)
437 m_terrainData[x, y]= spherFacA;
438 if (m_terrainData[x, y]< spherFacB)
439 m_terrainData[x, y] = spherFacB;
440=======
441 // h = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10; 410 // h = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
442 h = 1.0f; 411 h = 1.0f;
443 float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, cx, cy, 50) * 0.01d); 412 float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, cx, cy, 50) * 0.01d);
@@ -447,7 +416,6 @@ namespace OpenSim.Region.Framework.Scenes
447 if (h < spherFacB) 416 if (h < spherFacB)
448 h = spherFacB; 417 h = spherFacB;
449 m_terrainData[x, y] = h; 418 m_terrainData[x, y] = h;
450>>>>>>> avn/ubitvar
451 } 419 }
452 } 420 }
453 } 421 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
index 1d41d33..93ac34f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
@@ -43,6 +43,7 @@ using OpenSim.Tests.Common;
43 43
44namespace OpenSim.Region.Framework.Scenes.Tests 44namespace OpenSim.Region.Framework.Scenes.Tests
45{ 45{
46 /*
46 /// <summary> 47 /// <summary>
47 /// Test copying of scene objects. 48 /// Test copying of scene objects.
48 /// </summary> 49 /// </summary>
@@ -344,4 +345,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
344 } 345 }
345 } 346 }
346 } 347 }
348 */
347} \ No newline at end of file 349} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
index b775178..0025e9b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
@@ -99,9 +99,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
99 99
100 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 100 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
101 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); 101 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
102 HashSet<ScenePresence> sittingAvatars = part.GetSittingAvatars(); 102 HashSet<UUID> sittingAvatars = part.GetSittingAvatars();
103 Assert.That(sittingAvatars.Count, Is.EqualTo(1)); 103 Assert.That(sittingAvatars.Count, Is.EqualTo(1));
104 Assert.That(sittingAvatars.Contains(m_sp)); 104 Assert.That(sittingAvatars.Contains(m_sp.UUID));
105 Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); 105 Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
106 } 106 }
107 107
@@ -211,9 +211,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
211 Assert.That(m_sp.PhysicsActor, Is.Null); 211 Assert.That(m_sp.PhysicsActor, Is.Null);
212 212
213 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); 213 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
214 HashSet<ScenePresence> sittingAvatars = part.GetSittingAvatars(); 214 HashSet<UUID> sittingAvatars = part.GetSittingAvatars();
215 Assert.That(sittingAvatars.Count, Is.EqualTo(1)); 215 Assert.That(sittingAvatars.Count, Is.EqualTo(1));
216 Assert.That(sittingAvatars.Contains(m_sp)); 216 Assert.That(sittingAvatars.Contains(m_sp.UUID));
217 217
218 m_sp.StandUp(); 218 m_sp.StandUp();
219 219
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 25bbd3a..d8928ee 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -120,53 +120,12 @@ namespace OpenSim.Region.Framework.Scenes
120 /// <param name="uuid">UUID.</param> 120 /// <param name="uuid">UUID.</param>
121 public bool AddForInspection(UUID uuid) 121 public bool AddForInspection(UUID uuid)
122 { 122 {
123<<<<<<< HEAD
124 if (m_assetUuidsToInspect.Contains(uuid)) 123 if (m_assetUuidsToInspect.Contains(uuid))
125 return false; 124 return false;
126 125
127// m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid); 126// m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid);
128 127
129 m_assetUuidsToInspect.Enqueue(uuid); 128 m_assetUuidsToInspect.Enqueue(uuid);
130=======
131 try
132 {
133 assetUuids[assetUuid] = assetType;
134
135 if ((sbyte)AssetType.Bodypart == assetType || (sbyte)AssetType.Clothing == assetType)
136 {
137 GetWearableAssetUuids(assetUuid, assetUuids);
138 }
139 else if ((sbyte)AssetType.Gesture == assetType)
140 {
141 GetGestureAssetUuids(assetUuid, assetUuids);
142 }
143 else if ((sbyte)AssetType.Notecard == assetType)
144 {
145 GetTextEmbeddedAssetUuids(assetUuid, assetUuids);
146 }
147 else if ((sbyte)AssetType.LSLText == assetType)
148 {
149 GetTextEmbeddedAssetUuids(assetUuid, assetUuids);
150 }
151 else if ((sbyte)OpenSimAssetType.Material == assetType)
152 {
153 GetMaterialAssetUuids(assetUuid, assetUuids);
154 }
155 else if ((sbyte)AssetType.Object == assetType)
156 {
157 GetSceneObjectAssetUuids(assetUuid, assetUuids);
158 }
159 }
160 catch (Exception)
161 {
162 m_log.ErrorFormat(
163 "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
164 assetUuid, assetType);
165 throw;
166 }
167 }
168>>>>>>> avn/ubitvar
169
170 return true; 129 return true;
171 } 130 }
172 131