you’ve posted some of your… contrivances about how to handle node transforms. forget about it now. let’s focus just on the ‘deleting all dependent nodes with deleting of their master’
That’s exactly what I’m doing.
Copy code, open Max, new file, paste code.
Ctrl-E. It works.
Ctrl-E a second time. It works again.
Ctrl-E 19 more times, it works.
Run it a 22nd time, though, and “An error has occurred and the application will now close…”
“An error has occurred and the application will now close. Do you want to attempt to save a copy of the current scene? (yes/no)”
do you know that is sunday tomorrow? but… i will go tomorrow to the office to prove myself that i’m not an idiot yet.
Eek. No copy of Max at home, eh? It can wait till monday, I’m going to a presentation thing tomorrow, so I won’t be around for part of the day anyway.
one day i’ve dissuaded myself to do any ‘work’ at home. because … i’ve been working some days for 23 hours…
it doesn’t crash for me… tell me all steps those make max crash.
That’s exactly what I’m doing.
Copy code, open Max, new file, paste code. Ctrl-E. It works. Ctrl-E a second time. It works again. Ctrl-E 19 more times, it works. Run it a 22nd time, though, and "An error has occurred and the application will now close..."
By the way, this happens on both my desktop and laptop (both running Max 2012 64-bit). 22 times exactly to crash the program.
But are you doing anything else between the “CTRL E” operations? That’s what he is asking…
No I’m not. I can do other things between the executions or not, but it crashes either way after the same number of times.
Okay, I think I have an idea what’s going on. I had initially thought that each the script was run, it would overwrite the previous definitions. But apparently that’s not the case. If you append
(custAttributes.getSceneDefs()).count
to the end of the script, you will see that every time it is run the number goes up.
Possibly at least a clue as to the cause of the crashes?
as i told my previous code don’t crash… but here is another version
global ContainerAttrib = attributes ContainerAttrib attribID:#(0x1f05aab6, 0x7a59c3a6)
(
local handler
fn getNode = (refs.dependentnodes (custattributes.getowner this) firstonly:on)
fn constructNode node: = if not (theHold.Redoing() or theHold.Holding()) do
(
if node == unsupplied do node = getNode()
if isvalidnode node and not isdeleted node and handler == undefined do
(
handler = when node deleted node do if (attr = node.baseobject.custattributes[#ContainerAttrib]) != undefined do
(
if attr.handler != undefined do deleteChangeHandler attr.handler
attr.handler = undefined
delete (for n in attr.container where isvalidnode n and not isdeleted n collect n)
attr.container = #()
)
)
)
parameters params
(
container type:#nodeTab tabsizevariable:on
on container set val do constructNode()
)
on update do constructNode()
on load do constructNode()
)
(
num = [50,10,10]
for i=1 to num[1] do
(
gc()
delete objects
for k=1 to num[2] do
(
y = (k-1)*20
global b = dummy name:(uniquename "master") pos:[0,y,0]
custattributes.add b ContainerAttrib
b.ContainerAttrib.constructNode()
b.container = for k = 1 to num[3] collect (point pos:[k*20,y,0] wirecolor:orange)
)
)
print "DONE!"
ok
)