[Closed] Any suggestions for getting around this deleted node bug?
This is not the first time I have encountered this problem, but I’ve yet to find a universal solution for dealing with it.
To observe it under the simplest possible conditions:
-
create any kind of scene node
-
manually move, rotate, or scale it
-
type “with undo off delete $” in the listener
-
either type “max undo” or perform an undo manually. Nothing will happen, as it is calling a maxscript statement that basically says, in fact, to do nothing. HOWEVER…
-
perform another undo and Max will crash.
I’ve been told there is no way around this other than rewriting part of Max’s c++ code. Would anyone care to try and find another solution??
If you’re willing to nuke the user’s undo stack, you can call clearUndoBuffer() after the delete.
You can avoid step 2 and it will also crash.
From the MXS Help:
“…Do not delete nodes with undo off, unless you also created the nodes with undo off and did not do anything to the node with undo on…”
Here are some simple tests:
(
obj = box()
with undo off delete obj
max undo -- crash
)
(
obj = box()
with undo off delete obj
gc light:on
max undo -- crash
)
(
obj = box()
with undo off delete obj
gc()
max undo -- works
)
(
with undo off obj = box()
with undo off delete obj
max undo -- works
)
Okay, so as long as I create the node with undo off, and any changes I make to it are likewise made with undo off, I should be able to /delete/ the object with (once again) undo off.
The problem comes in with user actions, as in my original post where an object is manipulated manually in the scene. I have not been able to find a way, if any exist, to disable undo for that sort of user action.
As for user actions, maybe I can use some variant of the solution I came up with in this thread?
http://forums.cgsociety.org/showpost.php?p=8043702&postcount=2