Notifications
Clear all

[Closed] How do I prevent this undo-based Max crash?

it might be possible to prevent a crash on undo ‘create’… if create a node using sdk and use your own RestoreObj which check that stored reference target still valid to be restored.

as i feel the crash is caused by system trying to restore an invalid reference target.

also i think that the system crashes not on undo but on trying to make redo

When the rollout is opened, the user selects two meshes using a pickbutton. The script then creates a total of 3 items. Two of these are modified copies of each of the the picked meshes, with flipped normals and added push modifier added. The third is a reference helper used for checking ray intersections against those two meshes.

The mesh copies are controlled solely from the rollout, where the user can adjust the value of the push modifiers. The reference helper should be able to be moved around the scene freely.

When the rollout is closed, the items it created should disappear, and not be allowed to be brought back via undo. However, I do not want to kill the undo stack – any changes made to the scene OTHER than to the rollout-related nodes should still be undoable.

The logical solution to this would be to delete the rollout nodes with undo turned off. However, when you try to undo past the point in the stack where a node was deleted, it still tries to undo the changes on the non-existent node. And when it can’t, Max crashes.

i would not delete these three helper nodes at all.
let’s consider that is a part of my tool (working nodes).
so the scenario could be:

when the tool is opened and user selected two source nodes…

if any of ‘working’ nodes doesn’t exist – with undo ON create it and put in special layer (hidden by default)

unhide working nodes

use them with the tool…

after close the tool hide the special layer with working nodes.

so:

if user deletes working nodes you create them back if your tool is open

if user changes shapes (type, geometry, etc.) of source nodes you delete old and create new that matches the task

Page 5 / 5