Proper way to remove a series of bones?
shoei321
Posts: 113
I need to remove a sequence of bones from a figure (and from the scene). Can I just call dzScene->removeNode() on the root bone, or do I need to follow the entire chain and call removeNode() on each? If the latter, does the order matter? E.g. should I start at the end and work my way up to the root?
I've noticed that when you delete a node that has children in the Daz UI it automatically removes any children, but I'm not sure if the behavior is the same using dzScene->removeNode(). I also want to be sure I'm not introducing a memory leak in my code.
Thanks
Ivan
Comments
I would certainly work my way from the tips up the hierarchy, but I don't know if that is required or if the parenting will adjust when a parent node is removed. If it's a bone it might be wise to delete its modifiers before the bone, the ERC links before the modifiers.
Looks like you can get away with just removing the root bone. I tested this by removing the root bone from the figure and then saw the nodeRemoved signal get fired for all its children automatically.