you can go to the solution #2 … learn the max SDK
there is a code of the ISDELETED function there. and it’s wrong… technically it’s not wrong, but it doesn’t truly tell that the node can be deleted or not.
On my computer, the code from http://forums.cgsociety.org/showpost.php?p=7678675&postcount=88 does in fact crash after a redo of an object deletion.
And as for your assertion that
we NEED AN EVENT THAT SAYS THAT ALL NODES OF CURRENT DELETING SESSION WERE DELETED
I agree entirely, but am at a loss as to what that event would be. If you know, maybe you can share?
I have an almost-completed version of a project I have been at for quite a long time. I’m redoing parts of the script to make it cleaner and faster, and get rid of irritating bugs. That doesn’t mean I don’t want to get the thing finished as soon as possible. Most of everything works. This is a tiny part of the project, and is holding me back from getting it completed. Giving me hints rather than solutions, even if you’re trying to be helpful by doing so, isn’t what I need right now…
i’m kinda in an opposite situation. all my rigs are working very well, but with your helpful idea i found that they could work better. i don’t want just simply share the final solution. as you see not many people are really interested. i can send my solution privately to you but i would prefer to see a discussion on this forum.
callbacks.removescripts id:#delete_same_class
try
(
PostDelete_NodeEventCallback.enabled = off
PostDelete_NodeEventCallback = undefined
)
catch()
global NodesForDeletion = #()
fn preDeleteWholeClass = if not theHold.Redoing() do
(
node = callbacks.notificationParam()
if isvalidnode node do
(
join NodesForDeletion (for n in (getclassinstances (classof node) astrackviewpick:on) where isvalidnode n.client and n != n.client collect n.client)
)
)
callbacks.addscript #nodePreDelete "preDeleteWholeClass()" id:#delete_same_class
fn PostDelete_Callback event handles =
(
nodes = for node in NodesForDeletion where isvalidnode node collect node
NodesForDeletion = #()
if nodes.count > 0 do
(
undo "Post Delete" on delete nodes
redrawviews()
)
)
PostDelete_NodeEventCallback = NodeEventCallback deleted:PostDelete_Callback
PostDelete_NodeEventCallback.enabled = on
delete objects
with redraw off
(
for k=0 to 4 do box pos:[k*30,0,0] width:20 length:20 height:20
for k=0 to 4 do cylinder pos:[k*30,40,0] radius:10
for k=0 to 4 do sphere pos:[k*30,80,0] radius:10
)
how to make only one UNDO record try to find on your own
I had something that worked on the initial undo/redo, but not on subsequent runs, and apparently forgot to save it before the program crashed again. I thought I remembered what I did, but I guess not
Still don’t have the single undo working, but I got it so that the “redo” does the same thing as the initial deletion. No idea if I am on the right track here or not…
callbacks.removescripts id:#delete_same_class
try
(
PostDelete_NodeEventCallback.enabled = off
PostDelete_NodeEventCallback = undefined
)
catch()
global NodesForDeletion = #()
fn PostDelete_Callback event handles =
(
nodes = for node in NodesForDeletion where isvalidnode node collect node
NodesForDeletion = #()
if nodes.count > 0 do
(
undo "Post Delete" on delete nodes
redrawViews()
)
PostDelete_NodeEventCallback.enabled = off
)
PostDelete_NodeEventCallback = NodeEventCallback deleted:PostDelete_Callback
fn preDeleteWholeClass =
(
if not theHold.Redoing() do
(
node = callbacks.notificationParam()
if isvalidnode node do
(
join NodesForDeletion (for n in (getclassinstances (classof node) astrackviewpick:on) where isvalidnode n.client and n != n.client collect n.client)
)
)
PostDelete_NodeEventCallback.enabled = on
)
callbacks.addscript #nodePreDelete "preDeleteWholeClass()" id:#delete_same_class
delete objects
with redraw off
(
for k=0 to 4 do box pos:[k*30,0,0] width:20 length:20 height:20
for k=0 to 4 do cylinder pos:[k*30,40,0] radius:10
for k=0 to 4 do sphere pos:[k*30,80,0] radius:10
)
Perhaps this node “Delete Protection” Maxscript Extension plugin created by Kees Rijnen can help you achieve your goals (protecting your rig components from deletion– not sure… never tried it)… it is available for 3ds Max versions 8 thru 2014.
[ http://www.maxplugins.de/max2014.php?search=Delete Protection&sort=Author]( http://www.maxplugins.de/max2014.php?search=Delete Protection&sort=Author)