Error, SceneObject not properly removed from sceneGraph
by Steven Peterson · in Torque Game Engine · 05/21/2008 (9:49 am) · 2 replies
If you want to create a scene object in the C++ code you have to register it with a call like this.:
If you register it, then you must unregister it with a similar call:
Failure to unregister will result in the following error:
"Error, SceneObject not properly removed from sceneGraph"
And your hapless soul will be doomed to lost productivity - until you stumble on this post and heed it's worthy guidance.
myFXRenderObject->registerObject()
If you register it, then you must unregister it with a similar call:
myFXRenderObject->unregisterObject()
Failure to unregister will result in the following error:
"Error, SceneObject not properly removed from sceneGraph"
And your hapless soul will be doomed to lost productivity - until you stumble on this post and heed it's worthy guidance.
#2
In my specific case, I'm not using dynamic-memory, but I believe this is the exception. For me it looks like:
But for those who are (like James says):
www.garagegames.com/mg/forums/result.thread.php?qt=14548
--------------
After you create it, simply call...
A neat way of unregistering and deleting the object in one go is to call...
Have a look in SimManager.cc for these commands and others that may help you.
Hope this helps,
- Melv.
-----------------
And of course if the object is instantiated from script side (eg. listed in your *.mis mission-file) it is added, registered, unregistered, removed, deleted, and near everything else auto-magically. And then you won't have to read this thread, either.
05/21/2008 (12:06 pm)
Both good points. In my specific case, I'm not using dynamic-memory, but I believe this is the exception. For me it looks like:
myFXRenderObject.registerObject() ... myFXRenderObject.unregisterObject()
But for those who are (like James says):
www.garagegames.com/mg/forums/result.thread.php?qt=14548
--------------
After you create it, simply call...
myFxRenderObject->registerObject();... which will automatically call its 'onAdd' and prior to deleting it, call ...
myFxRenderObject->unregisterObject();... which will automatically call its 'onRemove'.
A neat way of unregistering and deleting the object in one go is to call...
myFxRenderObject->deleteObject();
Have a look in SimManager.cc for these commands and others that may help you.
Hope this helps,
- Melv.
-----------------
And of course if the object is instantiated from script side (eg. listed in your *.mis mission-file) it is added, registered, unregistered, removed, deleted, and near everything else auto-magically. And then you won't have to read this thread, either.
Associate James Ford
Sickhead Games
Oh heres a neat trick ... you can actually pass a string name to registerObject ... which allows you to later find the object with Sim::findObject("name") and reference the object in script using the name.