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.0.7.4.1
parent
f1f390cfdf
commit
7ff4eec79c
|
@ -1081,7 +1081,7 @@ namespace OpenSim.Data.Tests
|
|||
sop.Shape = PrimitiveBaseShape.Default;
|
||||
|
||||
SceneObjectGroup sog = new SceneObjectGroup(sop);
|
||||
sog.SetScene(scene);
|
||||
// sog.SetScene(scene);
|
||||
|
||||
return sog;
|
||||
}
|
||||
|
|
|
@ -2554,8 +2554,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <returns>True if the SceneObjectGroup was added, False if it was not</returns>
|
||||
public bool AddSceneObject(SceneObjectGroup sceneObject)
|
||||
{
|
||||
sceneObject.SetScene(this);
|
||||
|
||||
// Force allocation of new LocalId
|
||||
//
|
||||
SceneObjectPart[] parts = sceneObject.Parts;
|
||||
|
|
|
@ -355,9 +355,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (Entities.ContainsKey(sceneObject.UUID))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()",
|
||||
// m_parentScene.RegionInfo.RegionName, sceneObject.UUID);
|
||||
m_log.DebugFormat(
|
||||
"[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()",
|
||||
m_parentScene.RegionInfo.RegionName, sceneObject.UUID);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1056,16 +1056,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Added as a way for the storage provider to reset the scene,
|
||||
/// most likely a better way to do this sort of thing but for now...
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
public void SetScene(Scene scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set a part to act as the root part for this scene object
|
||||
/// </summary>
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
/// Test creation of an NPC where the appearance data comes from a notecard
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestOsNpcCreateFromNotecard()
|
||||
public void TestOsNpcCreateUsingAppearanceFromNotecard()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
|
@ -90,7 +90,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
|
||||
sp.Appearance.AvatarHeight = newHeight;
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
|
||||
SceneObjectPart part = so.RootPart;
|
||||
m_scene.AddSceneObject(so);
|
||||
|
||||
|
@ -114,10 +114,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
/// Test creation of an NPC where the appearance data comes from an avatar already in the region.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestOsNpcCreateFromAvatar()
|
||||
public void TestOsNpcCreateUsingAppearanceFromAvatar()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// log4net.Config.XmlConfigurator.Configure();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
// Store an avatar with a different height from default in a notecard.
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
|
@ -125,7 +125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
|
||||
sp.Appearance.AvatarHeight = newHeight;
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
|
||||
SceneObjectPart part = so.RootPart;
|
||||
m_scene.AddSceneObject(so);
|
||||
|
||||
|
@ -156,7 +156,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
|
||||
sp.Appearance.AvatarHeight = newHeight;
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
|
||||
SceneObjectPart part = so.RootPart;
|
||||
m_scene.AddSceneObject(so);
|
||||
|
||||
|
@ -197,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, nonOwnerId);
|
||||
sp.Appearance.AvatarHeight = newHeight;
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId);
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId, 0x10);
|
||||
SceneObjectPart part = so.RootPart;
|
||||
m_scene.AddSceneObject(so);
|
||||
|
||||
|
|
|
@ -97,11 +97,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
|
||||
sp.Appearance.AvatarHeight = newHeight;
|
||||
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
|
||||
SceneObjectPart part = so.RootPart;
|
||||
m_scene.AddSceneObject(so);
|
||||
|
||||
SceneObjectGroup otherSo = SceneHelpers.CreateSceneObject(1, otherUserId);
|
||||
SceneObjectGroup otherSo = SceneHelpers.CreateSceneObject(1, otherUserId, 0x20);
|
||||
SceneObjectPart otherPart = otherSo.RootPart;
|
||||
m_scene.AddSceneObject(otherSo);
|
||||
|
||||
|
@ -148,7 +148,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
|
||||
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
|
||||
sp.Appearance.AvatarHeight = newHeight;
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId);
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId, 0x10);
|
||||
SceneObjectPart part = so.RootPart;
|
||||
m_scene.AddSceneObject(so);
|
||||
|
||||
|
|
|
@ -606,14 +606,31 @@ namespace OpenSim.Tests.Common
|
|||
/// Create a scene object but do not add it to the scene.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// UUID always starts at 00000000-0000-0000-0000-000000000001
|
||||
/// UUID always starts at 00000000-0000-0000-0000-000000000001. For some purposes, (e.g. serializing direct
|
||||
/// to another object's inventory) we do not need a scene unique ID. So it would be better to add the
|
||||
/// UUID when we actually add an object to a scene rather than on creation.
|
||||
/// </remarks>
|
||||
/// <param name="parts">The number of parts that should be in the scene object</param>
|
||||
/// <param name="ownerId"></param>
|
||||
/// <returns></returns>
|
||||
public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId)
|
||||
{
|
||||
return CreateSceneObject(parts, ownerId, "", 0x1);
|
||||
return CreateSceneObject(parts, ownerId, 0x1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a scene object but do not add it to the scene.
|
||||
/// </summary>
|
||||
/// <param name="parts">The number of parts that should be in the scene object</param>
|
||||
/// <param name="ownerId"></param>
|
||||
/// <param name="uuidTail">
|
||||
/// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
|
||||
/// will be given to the root part, and incremented for each part thereafter.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, int uuidTail)
|
||||
{
|
||||
return CreateSceneObject(parts, ownerId, "", uuidTail);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue