techartorg / MXSPyCOM

A modern version of MXSCOM, to allow for editing & execution of 3ds Max MaxScript and Python files from external code editors.
MIT License
176 stars 23 forks source link

Option to suppress error pop-up dialogs #2

Closed garytyler closed 6 years ago

garytyler commented 6 years ago

I was still using the old MAXScript editor when experimenting because the error dialog pop-ups while using MXSPyCOM would interrupt my flow. I've devised one solution using a try() catch() maxscript command string that includes the filein call through com_obj.execute(). The catch() also prints a minimally useful log message to the max listener. The log messages are missing a few things compared to the MAXScript editor's but it should be more useful than the dialogs. There still might be a better way to do this, but I implemented it to run with an -s (suppress error dialogs) flag instead of the usual -f, and it's working as expected.

Code is here: https://github.com/garytyler/MXSPyCOM/tree/suppressdialogs

Would you take a pull request for something like this?

JeffHanna commented 6 years ago

Let me take a look at this, Gary. It sounds interesting. I might even be able to get a better stack trace and, possibly, send that back to the output window of the external editor. Thanks for identifying this!

garytyler commented 6 years ago

About a better stack trace, those are my thoughts exactly. Using a wrapper might be a more extensible approach for making a better readout? I could rewrite it that way too. Let me know. I'm just stringing a few maxscript commands together with parentheses here. Sending back to the editor would be excellent.

garytyler commented 6 years ago

Update: Please see my latest commit, which works well with Python and gives line numbers for both maxscript and Python.

https://github.com/garytyler/MXSPyCOM/tree/suppressdialogs

Of course it's not perfect, but it's a proof of concept that serves my current needs. I'm happy to help if you have any ideas to build something better.

JeffHanna commented 6 years ago

Just wanted to mention I haven't forgotten about this. I hope to be able to take a look at it either today or tomorrow.

garytyler commented 6 years ago

No worries! Sounds good.

JeffHanna commented 6 years ago

Gary,

Please send me a pull request. I see where you're going with that and it looks quite useful.

garytyler commented 6 years ago

Sure thing! I've got at least a few improvements in mind. I'll post them in the PR.