aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMichael Heilmann2015-05-19 15:18:45 -0400
committerMichael Heilmann2015-05-19 15:18:45 -0400
commit140ea04b9d692344d803fc87364fb252561725c3 (patch)
treed503b7ae17baca374d704b548fc7da512f512388 /OpenSim/Region/Framework/Scenes
parentMerge pull request #7 from gamucf/moses.metricsPhase2 (diff)
parentresolve possible nullref when sending appearance packet. Thanks to zadark for... (diff)
downloadopensim-SC_OLD-140ea04b9d692344d803fc87364fb252561725c3.zip
opensim-SC_OLD-140ea04b9d692344d803fc87364fb252561725c3.tar.gz
opensim-SC_OLD-140ea04b9d692344d803fc87364fb252561725c3.tar.bz2
opensim-SC_OLD-140ea04b9d692344d803fc87364fb252561725c3.tar.xz
Merging Opensim upstream before generating patch
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs136
3 files changed, 167 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 31900ec..905bde2 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1653,7 +1653,7 @@ namespace OpenSim.Region.Framework.Scenes
1653 1653
1654 // These variables will be used to save the precise frame time using the 1654 // These variables will be used to save the precise frame time using the
1655 // Stopwatch class of Microsoft SDK; the times are recorded at the start 1655 // Stopwatch class of Microsoft SDK; the times are recorded at the start
1656 // and end of a parcticular section of code, and then used to calculate 1656 // and end of a particular section of code, and then used to calculate
1657 // the frame times, which are the sums of the sections for each given name 1657 // the frame times, which are the sums of the sections for each given name
1658 double preciseTotalFrameTime = 0.0; 1658 double preciseTotalFrameTime = 0.0;
1659 double preciseSimFrameTime = 0.0; 1659 double preciseSimFrameTime = 0.0;
@@ -1698,7 +1698,7 @@ namespace OpenSim.Region.Framework.Scenes
1698 // input took 1698 // input took
1699 simFrameStopwatch.Stop(); 1699 simFrameStopwatch.Stop();
1700 preciseSimFrameTime = 1700 preciseSimFrameTime =
1701 simFrameStopwatch.Elapsed.TotalMilliseconds; 1701 simFrameStopwatch.Elapsed.TotalMilliseconds;
1702 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); 1702 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
1703 } 1703 }
1704 1704
@@ -1717,7 +1717,7 @@ namespace OpenSim.Region.Framework.Scenes
1717 // Begin the stopwatch to track the time to prepare physics 1717 // Begin the stopwatch to track the time to prepare physics
1718 physicsFrameStopwatch.Start(); 1718 physicsFrameStopwatch.Start();
1719 if (PhysicsEnabled && Frame % m_update_physics == 0) 1719 if (PhysicsEnabled && Frame % m_update_physics == 0)
1720 m_sceneGraph.UpdatePreparePhysics(); 1720 m_sceneGraph.UpdatePreparePhysics();
1721 1721
1722 // Get the time it took to prepare the physics, this 1722 // Get the time it took to prepare the physics, this
1723 // would report the most precise time that physics was 1723 // would report the most precise time that physics was
@@ -1738,7 +1738,7 @@ namespace OpenSim.Region.Framework.Scenes
1738 // took 1738 // took
1739 simFrameStopwatch.Stop(); 1739 simFrameStopwatch.Stop();
1740 preciseSimFrameTime += 1740 preciseSimFrameTime +=
1741 simFrameStopwatch.Elapsed.TotalMilliseconds; 1741 simFrameStopwatch.Elapsed.TotalMilliseconds;
1742 agentMS = Util.EnvironmentTickCountSubtract(tmpMS); 1742 agentMS = Util.EnvironmentTickCountSubtract(tmpMS);
1743 1743
1744 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their 1744 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
@@ -1851,7 +1851,7 @@ namespace OpenSim.Region.Framework.Scenes
1851 // Get the elapsed time for the simulation frame 1851 // Get the elapsed time for the simulation frame
1852 simFrameStopwatch.Stop(); 1852 simFrameStopwatch.Stop();
1853 preciseSimFrameTime += 1853 preciseSimFrameTime +=
1854 simFrameStopwatch.Elapsed.TotalMilliseconds; 1854 simFrameStopwatch.Elapsed.TotalMilliseconds;
1855 1855
1856 if (!UpdateOnTimer) 1856 if (!UpdateOnTimer)
1857 { 1857 {
@@ -1872,7 +1872,7 @@ namespace OpenSim.Region.Framework.Scenes
1872 // Get the total frame time 1872 // Get the total frame time
1873 totalFrameStopwatch.Stop(); 1873 totalFrameStopwatch.Stop();
1874 preciseTotalFrameTime = 1874 preciseTotalFrameTime =
1875 totalFrameStopwatch.Elapsed.TotalMilliseconds; 1875 totalFrameStopwatch.Elapsed.TotalMilliseconds;
1876 1876
1877 // Restart the stopwatch for the total time of the next frame 1877 // Restart the stopwatch for the total time of the next frame
1878 totalFrameStopwatch.Restart(); 1878 totalFrameStopwatch.Restart();
@@ -1897,7 +1897,7 @@ namespace OpenSim.Region.Framework.Scenes
1897 // Send the correct time values to the stats reporter for the 1897 // Send the correct time values to the stats reporter for the
1898 // frame times 1898 // frame times
1899 StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime, 1899 StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime,
1900 preciseSimFrameTime, precisePhysicsFrameTime, 0.0); 1900 preciseSimFrameTime, precisePhysicsFrameTime, 0.0);
1901 1901
1902 // Send the correct number of frames that the physics library 1902 // Send the correct number of frames that the physics library
1903 // has processed to the stats reporter 1903 // has processed to the stats reporter
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0a1a226..866a43c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2672,20 +2672,27 @@ namespace OpenSim.Region.Framework.Scenes
2672 } 2672 }
2673 else 2673 else
2674 { 2674 {
2675 //NonPhysicalGrabMovement(pos); 2675 NonPhysicalGrabMovement(pos);
2676 } 2676 }
2677 } 2677 }
2678 else 2678 else
2679 { 2679 {
2680 //NonPhysicalGrabMovement(pos); 2680 NonPhysicalGrabMovement(pos);
2681 } 2681 }
2682 } 2682 }
2683 } 2683 }
2684 2684
2685 /// <summary>
2686 /// Apply possition for grabbing non-physical linksets (Ctrl+Drag)
2687 /// This MUST be blocked for linksets that contain touch scripts because the viewer triggers grab on the touch
2688 /// event (Viewer Bug?) This would allow anyone to drag a linkset with a touch script. SL behaviour is also to
2689 /// block grab on prims with touch events.
2690 /// </summary>
2691 /// <param name="pos">New Position</param>
2685 public void NonPhysicalGrabMovement(Vector3 pos) 2692 public void NonPhysicalGrabMovement(Vector3 pos)
2686 { 2693 {
2687 AbsolutePosition = pos; 2694 if(!IsAttachment && ScriptCount() == 0)
2688 m_rootPart.SendTerseUpdateToAllClients(); 2695 UpdateGroupPosition(pos);
2689 } 2696 }
2690 2697
2691 /// <summary> 2698 /// <summary>
@@ -2781,17 +2788,28 @@ namespace OpenSim.Region.Framework.Scenes
2781 } 2788 }
2782 else 2789 else
2783 { 2790 {
2784 //NonPhysicalSpinMovement(pos); 2791 NonPhysicalSpinMovement(newOrientation);
2785 } 2792 }
2786 } 2793 }
2787 else 2794 else
2788 { 2795 {
2789 //NonPhysicalSpinMovement(pos); 2796 NonPhysicalSpinMovement(newOrientation);
2790 } 2797 }
2791 } 2798 }
2792 } 2799 }
2793 2800
2794 /// <summary> 2801 /// <summary>
2802 /// Apply rotation for spinning non-physical linksets (Ctrl+Shift+Drag)
2803 /// As with dragging, scripted objects must be blocked from spinning
2804 /// </summary>
2805 /// <param name="newOrientation">New Rotation</param>
2806 private void NonPhysicalSpinMovement(Quaternion newOrientation)
2807 {
2808 if(!IsAttachment && ScriptCount() == 0)
2809 UpdateGroupRotationR(newOrientation);
2810 }
2811
2812 /// <summary>
2795 /// Set the name of a prim 2813 /// Set the name of a prim
2796 /// </summary> 2814 /// </summary>
2797 /// <param name="name"></param> 2815 /// <param name="name"></param>
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs
new file mode 100644
index 0000000..927d8e8
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs
@@ -0,0 +1,136 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Threading;
32using System.Xml;
33using System.Linq;
34using Nini.Config;
35using NUnit.Framework;
36using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Framework.Serialization.External;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Scenes.Serialization;
42using OpenSim.Services.Interfaces;
43using OpenSim.Tests.Common;
44
45namespace OpenSim.Region.Framework.Scenes.Tests
46{
47 /// <summary>
48 /// Basic scene object serialization tests.
49 /// </summary>
50 [TestFixture]
51 public class SceneObjectSerializationTests : OpenSimTestCase
52 {
53
54 /// <summary>
55 /// Serialize and deserialize.
56 /// </summary>
57 [Test]
58 public void TestSerialDeserial()
59 {
60 TestHelpers.InMethod();
61
62 Scene scene = new SceneHelpers().SetupScene();
63 int partsToTestCount = 3;
64
65 SceneObjectGroup so
66 = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10);
67 SceneObjectPart[] parts = so.Parts;
68 so.Name = "obj1";
69 so.Description = "xpto";
70
71 string xml = SceneObjectSerializer.ToXml2Format(so);
72 Assert.That(!string.IsNullOrEmpty(xml), "SOG serialization resulted in empty or null string");
73
74 XmlDocument doc = new XmlDocument();
75 doc.LoadXml(xml);
76 XmlNodeList nodes = doc.GetElementsByTagName("SceneObjectPart");
77 Assert.That(nodes.Count, Is.EqualTo(3), "SOG serialization resulted in wrong number of SOPs");
78
79 SceneObjectGroup so2 = SceneObjectSerializer.FromXml2Format(xml);
80 Assert.IsNotNull(so2, "SOG deserialization resulted in null object");
81 Assert.That(so2.Name == so.Name, "Name of deserialized object does not match original name");
82 Assert.That(so2.Description == so.Description, "Description of deserialized object does not match original name");
83 }
84
85 /// <summary>
86 /// This checks for a bug reported in mantis #7514
87 /// </summary>
88 [Test]
89 public void TestNamespaceAttribute()
90 {
91 TestHelpers.InMethod();
92
93 Scene scene = new SceneHelpers().SetupScene();
94 UserAccount account = new UserAccount(UUID.Zero, UUID.Random(), "Test", "User", string.Empty);
95 scene.UserAccountService.StoreUserAccount(account);
96 int partsToTestCount = 1;
97
98 SceneObjectGroup so
99 = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10);
100 SceneObjectPart[] parts = so.Parts;
101 so.Name = "obj1";
102 so.Description = "xpto";
103 so.OwnerID = account.PrincipalID;
104 so.RootPart.CreatorID = so.OwnerID;
105
106 string xml = SceneObjectSerializer.ToXml2Format(so);
107 Assert.That(!string.IsNullOrEmpty(xml), "SOG serialization resulted in empty or null string");
108
109 xml = ExternalRepresentationUtils.RewriteSOP(xml, "Test Scene", "http://localhost", scene.UserAccountService, UUID.Zero);
110 //Console.WriteLine(xml);
111
112 XmlDocument doc = new XmlDocument();
113 doc.LoadXml(xml);
114
115 XmlNodeList nodes = doc.GetElementsByTagName("SceneObjectPart");
116 Assert.That(nodes.Count, Is.GreaterThan(0), "SOG serialization resulted in no SOPs");
117 foreach (XmlAttribute a in nodes[0].Attributes)
118 {
119 int count = a.Name.Count(c => c == ':');
120 Assert.That(count, Is.EqualTo(1), "Cannot have multiple ':' in attribute name in SOP");
121 }
122 nodes = doc.GetElementsByTagName("CreatorData");
123 Assert.That(nodes.Count, Is.GreaterThan(0), "SOG serialization resulted in no CreatorData");
124 foreach (XmlAttribute a in nodes[0].Attributes)
125 {
126 int count = a.Name.Count(c => c == ':');
127 Assert.That(count, Is.EqualTo(1), "Cannot have multiple ':' in attribute name in CreatorData");
128 }
129
130 SceneObjectGroup so2 = SceneObjectSerializer.FromXml2Format(xml);
131 Assert.IsNotNull(so2, "SOG deserialization resulted in null object");
132 Assert.AreNotEqual(so.RootPart.CreatorIdentification, so2.RootPart.CreatorIdentification, "RewriteSOP failed to transform CreatorData.");
133 Assert.That(so2.RootPart.CreatorIdentification.Contains("http://"), "RewriteSOP failed to add the homeURL to CreatorData");
134 }
135 }
136} \ No newline at end of file