Notifications
Clear all

[Closed] plugin crashes max

Hi

I have a really bad problem and need help. I have written a fairly complex scripted-plugin which evaluates and runs perfectly. But if I save the scene and try to open it again 3ds Max will crash with the very unsatisfying error message: “An error has occurred and the application will now close. …”. That’s it. This makes it really hard for me to track down the bug. It is especially disturbing that the error is not persistent, one out of ten times the scene will load and work, and sometimes max doesn’t crash but the scene keeps loading forever.

So what would you guys do in this situation? Currently I am disabling parts of the plugin to isolate the problem, but haven’t had any success so far. Is there a log file somewhere which has details to the fatal error, maybe? I have checked the 3dsmax error report but it wasn’t that useful to me. What other debugging practices can you advise me to use?

I hope someone can push me in the right direction. thanks in advance
David

6 Replies

are you using dotNet elements?

what is the script doing? generating objects? are you controlling viewport redraw with the script?

Hi

I am not using any dotnet objects (at least not in the version which I am debugging right now. I have some dotnet elements but they are not implemented yet). So that can’t be the cause.

I am working on a new version of my stereoscopic camera which is actually working quite nice so far. The script extends a freecamera and replaces it’s displaymesh with a yellow halfsphere. So the yellow main control is now a camera which is cool. Hope this information helps.

the reason I asked about viewport redraw is because I had similar problems when using redrawView()
suspendEditing()
etc. in a loop…

when creating nodes with a script and the viewports are not fully refreshed before something else happens, like user navigation in the viewport, max can crash is such a way sporadically.

Hi. This sounds like a good direction. I have reloaded the scene a couple of times until it didn’t crash but kept loading. I then realized that the scene did load, but the viewports stopped working. So viewport redraw seems to be an issue.

Unfortunately commands like enablesceneredraw() redrawview() or forcecompleteredraw() seem to have no effect. I also don’t use any of those commands (or disableseneredraw() etc.) in the script. Do you think maybe adding those commands somewhere could help? but where?

Those planes in your video, I guess they are geometry planes your script creates temporarily?

I’d wrap this around the generation code:


suspendEditing()  --disable mod panel flickering/slowdown
with undo off with redraw off
(
  --create geometry
  plane()
  --etc
)
resumeEditing()  --must be called after suspendEditing()
redrawviews()  --probably helps avoiding redraw crash

An alternative to suspendEditing() is:

setCommandPanelTaskMode  #create

It switches the command panel to the “Create” panel, which may be annoying for the user.
but it also avoids that the mod panel flashes/slows down the script, in case it’s open.
The problem with suspendEditing() is that in case your script crashes, the mod panel is frozen until it’s being reactivated with resumeEditing(), or max is restarted.
I only use those calls in combination with try() catch(resumeEditing()), to be sure that this wont happen.

hey plastic. Thanks for the advice. I will definitely use those commands.

I have found the bug at a different place inside the script, though, and managed to get rid of it. The part where I define the displaymesh was causing the trouble. I was using

meshobj = createinstance (halfsphere())

where halfsphere was a new geometry plugin that was also part of the script. If I change the part to something like

meshobj = createinstance (sphere()) 

everything works fine, and the scenes don’t crash anymore. I guess there was an evaluation order problem. The camera was referencing a geometry plugin which had, in many cases, not yet been fully evaluated. So I can easily get around this proplem now by defining the displaymesh inside of the camera plugin, which is a cleaner solution anyway.

So, thanks a lot and best regards
David