Sublime3dsMax

6 votes
Date Updated: 
11/27/2013

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
trebor777's picture

Being French too, I had the

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.

KiboOst's picture

Bug on french windows

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

Nik's picture

Please Update this to Sublime 3

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

Nik's picture

Oh, sorry, all clear:

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.

Nik's picture

Issue

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 :)

Strob's picture

Cool that works very well

Thank for this. It works very well and scripts get executed instantly.

first I tried another method (http://www.scriptspot.com/forums/3ds-max/general-scripting/sublime-text-...) that was slower when sending a script for execution and I got error because of editing in maxdotnet file. So don't do that just use the method here.

Raumtaucher's picture

Need Comment Hotkeys

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

AttachmentSize
commentstmpreferences.txt 812 bytes
br0t's picture

Hi recubo, thanks for

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 :/

Never get low & slow & out of ideas

recubo's picture

Love it! But...

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.

barigazy's picture

mxs highlighting

This is the it

AttachmentSize
sublimemaxscript.rar 70.04 KB

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.