1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Ticket #52 (new defect)

Opened 3 years ago

Last modified 3 years ago

SceneManager.Remove...() Methods

Reported by: borrillis Owned by: borrillis
Priority: major Milestone:
Component: Core Library Version: 0.8.0.0 (crickhollow)
Keywords: Cc:

Description

Not a bug in it's truest sense but quite confusing.

All the Remove...() and RemoveAll...() methods in the
generic scene manager claim to be removing an item
from the scene in their docs. But they only remove the
appropriate item from the SceneManager's lists, which
doesn't prevent the removed item from being rendered.

1. The docs could be updated telling that an item is
going to be removed from the SceneManager's list only
and explain how it should be removed from the scene
correctly... i.e. I think that should be something
like this:

light.ParentSceneNode.DetachObject( light );
sceneManager.RemoveLight( light );

2. The set of Remove...() methods could be extended
either with overloads consuming additional bool param
telling whether or not to truely remove an item from
the scene as in the above example or a more
descriptive name could be used for the extended set of
removal methods. I'd like the second option better,
here an example of such an RemoveEntityFromScene()
method...

/// <summary>
/// Removes the specified entity from the scene hierarchy.
/// </summary>
/// <param name="entity">Entity to remove from the scene.</param>
public virtual void RemoveEntityFromScene( Entity entity )
{
    if (entity.ParentSceneNode != null)
    {
        entity.ParentSceneNode.DetachObject( entity );
    }

    //..if you'd eventually think the
    //following line could do a RemoveEntity( entity ) call
    //instead, just note that virtual methods cannot be in-
    //lined AFAIK...

    entityList.Remove( entity );
}

Change History

Changed 3 years ago by borrillis

From jswww

When I am done with a SceneNode, I find that I have to
call two methods in order to fully remove it:

tileSceneNode.Creator.DestroySceneNode(tileSceneNode.Name);
tileSceneNode.Parent.RemoveChild( tileSceneNode );

If I don't call both, then I later try to create a new
node with the same name, I get an exception because the
name is still being used in one place or the other.

It just seems wrong to me that I have to both destroy
the node and remove it from its parent. Is there a
better method that does it all?

Note: See TracTickets for help on using tickets.