ScriptSpot

Script

Sublime3dsMax

By br0t · 2013-11-28

Date updated
2013-11-27
Votes
6
Download
Download
Description

A plugin for the Sublime Text Editor to evaluate MAXScript code (complete file or selected lines) directly in Sublime, thereby running it in the open 3ds Max instance. Speeds up development of MAXScript in Sublime quite a bit :)

Based on this: m2u (Thanks to Johannes)

DOWNLOAD & INSTALLATION

For more detailed instructions on where to get it and how to install (very easy), please see the post "Sublime3dsMax" on my website.

Cheers

Comments (15)

Bug on french windows

KiboOst · 2014-05-16

Hi, I have a french windows 7 x64 and find_window() function in winapi.py return ascii codec error.

I just implemented a try/except and all runs fine now

def find_window(text):
for w in [Window(h) for h in EnumWindows()]:
try:
window_text = w.get_text()
if window_text is not None and text in window_text:
return w
except:
pass
return None

trebor777 · 2014-08-08

Being French too, I had the issue today when installing it. Thanks for your temporary fix :p After searching internet for hours...
So in the end you can just do this at line 529:

if window_text is not None and text in window_text.decode('cp1252'):

The issue resides in the difference of string encoding between python and the string data gathered by "GetWindowText" that isn't ANSI or Unicode with cp1252.

Issue

Nik · 2014-02-13

All set up as necessary:
Install manually steps 1 to 5 and
I was Set up shortcuts for the commands in the "Bindings - User":


[
	{ "keys": ["ctrl+e"], "command": "send_file_to_max" },
	{ "keys": ["shift+enter"], "command": "send_selection_to_max"}
]

And For example, I send:


box()

After I select code and press Shift + Enter, then Maxascript Listener returns

 
undefined

When I save script as .ms file, and I press Ctrl+E - nothing happens

I use 3dsMax 2012;
Sublime Text 3 Build 3059 x64.

what am I doing wrong?
Please help :)

Nik · 2014-02-13

Oh, sorry, all clear: "Known issues: This plugin currently only works in Sublime 2."
But that's just Sublime Text 2 does not work - says he's too old.

Please Update this to Sublime 3

Nik · 2014-03-06

Because Sublime3dsMax works on Sublime 2. And Sublime 2, he does not work until the upgrade to version Sublime 3.

Need Comment Hotkeys

Raumtaucher · 2013-12-11

Does anybody know how to make hotkeys for comments working.
I changed the keys but nothing happens i added this file

"Comments.tmPreferences"

can anybody help please i work with visual studio for c# programming, i love the ide but i hate the maxscript editor in 3ds max now sublime is cool but to comment things out with a hotkey is necessary to work faster

Attachments

Love it! But...

recubo · 2013-11-30

Hi br0t,

Thank you, this is really useful. I can use it without any problem on Sublime Text 2, but on Sublime Text 3 I get an error on the install process:


 File "C:\Users\Usuario\AppData\Roaming\Sublime Text 3\Packages\Send to 3ds Max\tomax.py", line 106
    print "wnd cls: "+cbuff.value+" name: "+buff.value+" enum: "+str(param._enum)
                    ^
SyntaxError: invalid syntax

Anyone else is having the same issue?

-Edit 1-------------------------------
After looking around for a while I think the problem is that Sublime 2 uses a python 2.x interpreter and Sublime 3 uses python 3.x. Then in Python 3.x the syntax of the command "print" must be under brackets () so the correct code would be:


print ("wnd cls: "+cbuff.value+" name: "+buff.value+" enum: "+str(param._enum))

There is only another print at line 130 that should be changed too.

With those two changes should work on both versions of python and sublime.

-Edit 2-------------------------------

Well, I've corrected the "print" issue but now I have another error that I can't solve:


reloading plugin Send to 3ds Max.Sublime3dsMax
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 73, in reload_plugin
    m = importlib.import_module(modulename)
  File "X/importlib/__init__.py", line 88, in import_module
  File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 671, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "C:\Users\Usuario\AppData\Roaming\Sublime Text 3\Packages\Send to 3ds Max\Sublime3dsMax.py", line 3, in <module>
    import tomax
ImportError: No module named 'tomax'

It seems that Sublime cant find the module tomax.py but I've checked and it's there for sure... Looks like it's more complex than I thought to adapt the code from v2 to v3 of Sublime. I'll have to stick to v2... not a big issue at all.

br0t · 2013-12-02

Hi recubo, thanks for pointing it out! I fixed the prints and imports, but sadly it still does not work and I think it is somewhat more complicated. I will try to figure it out, but for now the plugin only works in Sublime 2 :/

+1

Rodman · 2013-11-29

Does it support syntax highlighting ?
Also, can you fold parenthesis within Sublime Text Editor ?

br0t · 2013-11-29

no syntax highlighting included, but there is a file flying around here somewhere that you simply need to put into Packages/MAXScript or a similar folder to work, try searching for maxscript sublime.

and yes, sublime supports code folding by default as well as possibly every other thing you might want :D

mxs highlighting

barigazy · 2013-11-29

This is the it

Attachments

tassel · 2013-11-28

+1 :D

br0t · 2013-11-28

Thanks barigazy, glad you like it

+1

barigazy · 2013-11-28

Hey Christoph,
this is great!
Thanks and keep up good work.
Cheers!