Undo Delete Callback

22 views
Skip to first unread message

Nicolas Chaverou

unread,
Aug 29, 2016, 12:38:49 PM8/29/16
to python_in...@googlegroups.com
Hey,

More an API question than a Python-specific question but this is the most technical list I'm in :)
Also posted on CgTalk

- - - - -

I'm having a custom node which has some treatments when it's created and when it's deleted.
The creation treatment has been added to the postConstructor method (inherited from MpxNode) and the deletion treatment throught the MNodeMessage::addNodeAboutToDeleteCallback mechanism

So far so good.

The thing is, I just discovered that, if the node is deleted, the deletion treatment is called but if the undo is used the node gets readded to the scene but the postConstructor code is not called anymore (and thus the creation treatment is not called neither). From what I read, when the node is deleted, it's added to the undo queue and hidden from the DG and if an undo is done, it's readded in the scene from the undo (and thus not recreated)...

This is where i'm stuck : is there any way to know the status of the node (within the undo queue) or hook to a callback when it's delete-undoed ?

I found a really similar topic here (http://forums.cgsociety.org/showthread.php?t=986113) but the self found answer does not look correct to me (even in the undo queue, userNode() on the deleted node returns something valid)

Anyone has an idea about how this could be solved ?

Cheers,
Reply all
Reply to author
Forward
0 new messages