diff options
author | Justin Clark-Casey (justincc) | 2012-07-07 00:02:45 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-07 00:02:45 +0100 |
commit | 7ff4eec79cf16886439604a23126abd195ae8b2e (patch) | |
tree | f59be673321e6a74dc429e52e585ef165a8a845d | |
parent | Remove now duplicate interregion object check that should have been removed a... (diff) | |
download | opensim-SC-7ff4eec79cf16886439604a23126abd195ae8b2e.zip opensim-SC-7ff4eec79cf16886439604a23126abd195ae8b2e.tar.gz opensim-SC-7ff4eec79cf16886439604a23126abd195ae8b2e.tar.bz2 opensim-SC-7ff4eec79cf16886439604a23126abd195ae8b2e.tar.xz |
Remove redundant SetScene() function in Scene.AddSceneObject()
This is always done later on in SceneGraph.AddSceneObject() if the call hasn't failed due to sanity checks.
There's no other purpose for this method to exist and it's dangerous/pointless to call in other conditions.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/Tests/RegionTests.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | 6 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 23 |
7 files changed, 34 insertions, 29 deletions
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 474609b..55b9b4d 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs | |||
@@ -1081,7 +1081,7 @@ namespace OpenSim.Data.Tests | |||
1081 | sop.Shape = PrimitiveBaseShape.Default; | 1081 | sop.Shape = PrimitiveBaseShape.Default; |
1082 | 1082 | ||
1083 | SceneObjectGroup sog = new SceneObjectGroup(sop); | 1083 | SceneObjectGroup sog = new SceneObjectGroup(sop); |
1084 | sog.SetScene(scene); | 1084 | // sog.SetScene(scene); |
1085 | 1085 | ||
1086 | return sog; | 1086 | return sog; |
1087 | } | 1087 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5c7bca0..ec911a5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2554,8 +2554,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2554 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2554 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2555 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2555 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2556 | { | 2556 | { |
2557 | sceneObject.SetScene(this); | ||
2558 | |||
2559 | // Force allocation of new LocalId | 2557 | // Force allocation of new LocalId |
2560 | // | 2558 | // |
2561 | SceneObjectPart[] parts = sceneObject.Parts; | 2559 | SceneObjectPart[] parts = sceneObject.Parts; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index bc9a585..2be5364 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -355,9 +355,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
355 | 355 | ||
356 | if (Entities.ContainsKey(sceneObject.UUID)) | 356 | if (Entities.ContainsKey(sceneObject.UUID)) |
357 | { | 357 | { |
358 | // m_log.DebugFormat( | 358 | m_log.DebugFormat( |
359 | // "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", | 359 | "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", |
360 | // m_parentScene.RegionInfo.RegionName, sceneObject.UUID); | 360 | m_parentScene.RegionInfo.RegionName, sceneObject.UUID); |
361 | 361 | ||
362 | return false; | 362 | return false; |
363 | } | 363 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 96cc376..4e0e183 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1055,16 +1055,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1055 | { | 1055 | { |
1056 | return Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); | 1056 | return Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); |
1057 | } | 1057 | } |
1058 | |||
1059 | /// <summary> | ||
1060 | /// Added as a way for the storage provider to reset the scene, | ||
1061 | /// most likely a better way to do this sort of thing but for now... | ||
1062 | /// </summary> | ||
1063 | /// <param name="scene"></param> | ||
1064 | public void SetScene(Scene scene) | ||
1065 | { | ||
1066 | m_scene = scene; | ||
1067 | } | ||
1068 | 1058 | ||
1069 | /// <summary> | 1059 | /// <summary> |
1070 | /// Set a part to act as the root part for this scene object | 1060 | /// Set a part to act as the root part for this scene object |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 3965734..c8718d9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs | |||
@@ -79,7 +79,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
79 | /// Test creation of an NPC where the appearance data comes from a notecard | 79 | /// Test creation of an NPC where the appearance data comes from a notecard |
80 | /// </summary> | 80 | /// </summary> |
81 | [Test] | 81 | [Test] |
82 | public void TestOsNpcCreateFromNotecard() | 82 | public void TestOsNpcCreateUsingAppearanceFromNotecard() |
83 | { | 83 | { |
84 | TestHelpers.InMethod(); | 84 | TestHelpers.InMethod(); |
85 | // log4net.Config.XmlConfigurator.Configure(); | 85 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -90,7 +90,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
90 | 90 | ||
91 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); | 91 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); |
92 | sp.Appearance.AvatarHeight = newHeight; | 92 | sp.Appearance.AvatarHeight = newHeight; |
93 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); | 93 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); |
94 | SceneObjectPart part = so.RootPart; | 94 | SceneObjectPart part = so.RootPart; |
95 | m_scene.AddSceneObject(so); | 95 | m_scene.AddSceneObject(so); |
96 | 96 | ||
@@ -114,10 +114,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
114 | /// Test creation of an NPC where the appearance data comes from an avatar already in the region. | 114 | /// Test creation of an NPC where the appearance data comes from an avatar already in the region. |
115 | /// </summary> | 115 | /// </summary> |
116 | [Test] | 116 | [Test] |
117 | public void TestOsNpcCreateFromAvatar() | 117 | public void TestOsNpcCreateUsingAppearanceFromAvatar() |
118 | { | 118 | { |
119 | TestHelpers.InMethod(); | 119 | TestHelpers.InMethod(); |
120 | // log4net.Config.XmlConfigurator.Configure(); | 120 | // TestHelpers.EnableLogging(); |
121 | 121 | ||
122 | // Store an avatar with a different height from default in a notecard. | 122 | // Store an avatar with a different height from default in a notecard. |
123 | UUID userId = TestHelpers.ParseTail(0x1); | 123 | UUID userId = TestHelpers.ParseTail(0x1); |
@@ -125,7 +125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
125 | 125 | ||
126 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); | 126 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); |
127 | sp.Appearance.AvatarHeight = newHeight; | 127 | sp.Appearance.AvatarHeight = newHeight; |
128 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); | 128 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); |
129 | SceneObjectPart part = so.RootPart; | 129 | SceneObjectPart part = so.RootPart; |
130 | m_scene.AddSceneObject(so); | 130 | m_scene.AddSceneObject(so); |
131 | 131 | ||
@@ -156,7 +156,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
156 | 156 | ||
157 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); | 157 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); |
158 | sp.Appearance.AvatarHeight = newHeight; | 158 | sp.Appearance.AvatarHeight = newHeight; |
159 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); | 159 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); |
160 | SceneObjectPart part = so.RootPart; | 160 | SceneObjectPart part = so.RootPart; |
161 | m_scene.AddSceneObject(so); | 161 | m_scene.AddSceneObject(so); |
162 | 162 | ||
@@ -197,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
197 | 197 | ||
198 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, nonOwnerId); | 198 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, nonOwnerId); |
199 | sp.Appearance.AvatarHeight = newHeight; | 199 | sp.Appearance.AvatarHeight = newHeight; |
200 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId); | 200 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId, 0x10); |
201 | SceneObjectPart part = so.RootPart; | 201 | SceneObjectPart part = so.RootPart; |
202 | m_scene.AddSceneObject(so); | 202 | m_scene.AddSceneObject(so); |
203 | 203 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index 813e53b..25679a6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |||
@@ -97,11 +97,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
97 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); | 97 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); |
98 | sp.Appearance.AvatarHeight = newHeight; | 98 | sp.Appearance.AvatarHeight = newHeight; |
99 | 99 | ||
100 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); | 100 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); |
101 | SceneObjectPart part = so.RootPart; | 101 | SceneObjectPart part = so.RootPart; |
102 | m_scene.AddSceneObject(so); | 102 | m_scene.AddSceneObject(so); |
103 | 103 | ||
104 | SceneObjectGroup otherSo = SceneHelpers.CreateSceneObject(1, otherUserId); | 104 | SceneObjectGroup otherSo = SceneHelpers.CreateSceneObject(1, otherUserId, 0x20); |
105 | SceneObjectPart otherPart = otherSo.RootPart; | 105 | SceneObjectPart otherPart = otherSo.RootPart; |
106 | m_scene.AddSceneObject(otherSo); | 106 | m_scene.AddSceneObject(otherSo); |
107 | 107 | ||
@@ -148,7 +148,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
148 | 148 | ||
149 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); | 149 | ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); |
150 | sp.Appearance.AvatarHeight = newHeight; | 150 | sp.Appearance.AvatarHeight = newHeight; |
151 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); | 151 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10); |
152 | SceneObjectPart part = so.RootPart; | 152 | SceneObjectPart part = so.RootPart; |
153 | m_scene.AddSceneObject(so); | 153 | m_scene.AddSceneObject(so); |
154 | 154 | ||
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 3a2e420..d5354cb 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -601,19 +601,36 @@ namespace OpenSim.Tests.Common | |||
601 | ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 601 | ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
602 | { Name = name, UUID = id, Scale = new Vector3(1, 1, 1) }; | 602 | { Name = name, UUID = id, Scale = new Vector3(1, 1, 1) }; |
603 | } | 603 | } |
604 | 604 | ||
605 | /// <summary> | 605 | /// <summary> |
606 | /// Create a scene object but do not add it to the scene. | 606 | /// Create a scene object but do not add it to the scene. |
607 | /// </summary> | 607 | /// </summary> |
608 | /// <remarks> | 608 | /// <remarks> |
609 | /// UUID always starts at 00000000-0000-0000-0000-000000000001 | 609 | /// UUID always starts at 00000000-0000-0000-0000-000000000001. For some purposes, (e.g. serializing direct |
610 | /// to another object's inventory) we do not need a scene unique ID. So it would be better to add the | ||
611 | /// UUID when we actually add an object to a scene rather than on creation. | ||
610 | /// </remarks> | 612 | /// </remarks> |
611 | /// <param name="parts">The number of parts that should be in the scene object</param> | 613 | /// <param name="parts">The number of parts that should be in the scene object</param> |
612 | /// <param name="ownerId"></param> | 614 | /// <param name="ownerId"></param> |
613 | /// <returns></returns> | 615 | /// <returns></returns> |
614 | public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) | 616 | public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) |
615 | { | 617 | { |
616 | return CreateSceneObject(parts, ownerId, "", 0x1); | 618 | return CreateSceneObject(parts, ownerId, 0x1); |
619 | } | ||
620 | |||
621 | /// <summary> | ||
622 | /// Create a scene object but do not add it to the scene. | ||
623 | /// </summary> | ||
624 | /// <param name="parts">The number of parts that should be in the scene object</param> | ||
625 | /// <param name="ownerId"></param> | ||
626 | /// <param name="uuidTail"> | ||
627 | /// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" | ||
628 | /// will be given to the root part, and incremented for each part thereafter. | ||
629 | /// </param> | ||
630 | /// <returns></returns> | ||
631 | public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, int uuidTail) | ||
632 | { | ||
633 | return CreateSceneObject(parts, ownerId, "", uuidTail); | ||
617 | } | 634 | } |
618 | 635 | ||
619 | /// <summary> | 636 | /// <summary> |