there are probably two separate problems:
#1 is trying to delete that is already deleted or marked by system for deletion
#2 is doing some fatal operations (including delete) after scene pre-reset (pre-reset, pre-new, pre-load, etc.)
i’m sure that there are another actions (maybe renaming…) that cause max crash the same way as deleting…
so it could be nice to know when scene is in the stage of “resetting” (after PRE and before POST).
Would setting it up as another handler get around the problem?
Or since it only happens when the items are selected in a particular order, have some way to make it reorder the selection, maybe?
Hm. I guess not?
Well what about as MaxObjects then? I never did figure out how setting this up using weak referencing was supposed to work.
Rather than punish someone for deleting a critical node or nodes (stupid or not…) could you not use a #nodePreDelete or #selectedNodesPreDelete [font=Verdana]in a callback mechanism to protect your rig components from being deleted? [/font]
EDIT: Or what about this suggestion…
Wrap your entire rig in a Character Assembly… then when the user attempts to delete a component of the rig… simply use a callback script to:
- “Select” the Character Assembly node.
- “Lock” the Character Assembly node.
- “Destroy” the Character Assembly node.
Because according to the help docs:
Destroying a character deletes the character assembly node. If the character assembly is locked, the entire assembly is deleted. If the assembly is unlocked, the members of the assembly and any animation on the members are unaffected. This command is available only when a character assembly node is selected.
I actually know next to nothing about character assemblies, and the first hit I got when I googled (maxscript “character assembly”) was http://forums.cgsociety.org/showthread.php?t=393967
I realize it’s a somewhat older thread… have changes been made to the way character assemblies work since then?
of course you have to use Weak References. Other way you will get a lot limitations related to the Dependency Loop issue.
but… trust me… the when delete construct and tabChanged with #refDeleted will not work with weak references.
so… you have use global callbacks system.
#1 on predelete callback collect all nodes that have to be deleted with the deleting node
#2 on postdelete callback check the list of nodes that have to be deleted, remove all already deleted and delete the rest.
Trying to understand what you mean. These are additional callbacks that will need to be added, or…?
To clarify: what I mean is, are you referring to the #nodePreDelete and #nodePostDelete general callbacks, or something else?
#1 on predelete callback collect all nodes that have to be deleted with the deleting node
#2 on postdelete callback check the list of nodes that have to be deleted, remove all already deleted and delete the rest.
Sorry, I don’t think I’m getting it…
Specifically, how do I use callbacks to collect nodes??
here is what i am talking about:
callbacks.removescripts id:#delete_same_class
global NodesForDeletion = #()
fn preDeleteWholeClass =
(
node = callbacks.notificationParam()
if isvalidnode node do
(
NodesForDeletion = for n in (getclassinstances (classof node) astrackviewpick:on) where isvalidnode n.client and n != n.client collect n.client
)
)
fn postDeleteWholeClass =
(
for n in NodesForDeletion where isvalidnode n do delete n
NodesForDeletion = #()
)
callbacks.addscript #nodePreDelete "preDeleteWholeClass()" id:#delete_same_class
callbacks.addscript #nodePostDelete "postDeleteWholeClass()" id:#delete_same_class
delete objects
for k=0 to 4 do box pos:[k*30,0,0] widht: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
we style have the issue with REDO and deleting already deleted. but … it can be fixed now