Remove all child objects
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/10/2005 at 04:59, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.1
Platform:
Language(s) : C++ ;---------
Hi,
I need a way to remove all the children of a BaseObject
This is what I currently havevoid RemoveChildObjects(BaseObject* op) { BaseObject *child = op->GetDown(); while(child) { child->Remove(); BaseObject::Free(child); child=child->GetNext(); } }
But that doesn't work because child becomes NULL after the first BaseObject::Free
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/10/2005 at 05:13, xxxxxxxx wrote:
get the child before you remove the original.
BaseObject* temp;
while(child)
{
temp = child->GetNext();
child->Remove();
BaseObject::Free(child);
child = temp;
} -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/10/2005 at 06:49, xxxxxxxx wrote:
why did I think of that
Thanks -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/10/2005 at 12:40, xxxxxxxx wrote:
I have a question indirect to this discussion. Every time that I Remove() something from a document and try to Free() it, Cinema 4D crashes (Objects, Tags, Materials, you name it). I have since determined that either Cinema 4D handles the deallocation or it is also possible that as long as the object is tied to an Undo, it cannot be deleted (thereafter handled by Cinema 4D). I always add AddUndo(UNDO_NEW) when inserting just-created objects. Could this be why I can't Remove()-Free()?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/11/2005 at 06:21, xxxxxxxx wrote:
Hi Kuro,
I don´t think it could be the cause for the crashing. Maybe another plugin is the cause? Try to remove all other plugins, this may help sometimes. Otherwise I don´t see a reason for crashing with Remove & Free(). Never has this issue.