ScriptSpot home

Forum topic · General Scripting

Sublime Text Editor - MXS support

By Raymond Homme Ingebretsen · 2011-05-28

Description

Hi,

Is there anyone who has looked at opportunities to get support for the MXS to the Sublime Text Editor? (http://www.sublimetext.com/)

I have not investigated this much, but this should probably be able to do?

I see it already is language defenition files to notepad++ here(Notepad++ MXS Language Definition)

Have any of you tips, tricks and suggestions around this they would have been received with great thanks.

Comments (21)
Branko Živković

Just follow instructions from this .pdf
I modify previous attachment

Attachments
captainkeytar

I just created a MaxScript language definition for SublimeText

Haven't had a chance yet to properly host on GitHub/Package Control, but here's v0.1. It's a first pass and there's still numerous things I'd like to add, but I'm new to language definitions so some of that will take some more figuring out on my part.

Please let me know if this works for you, or not :)

https://www.dropbox.com/s/qv1v0weaq45ffqz/MaxScript.zip

Just unzip that to your Package dir in a directory called /MaxScript/

Enjoy!

Reply to captainkeytar
Raymond Homme Ingebretsen

Many many thanks, appreciate you sharing it. Will try it out when I get time :)

Reply to captainkeytar
Mambo4

great work!

thanks for this!

I found Sublime Text last year and dropped notepad++ in favor of it for all my python work. I Just started using Max script, so this will be welcome.

Works fine for me. Nice work!

Reply to captainkeytar
haavards

Running scripts from Sublime Text

I took the liberty of adding some files to your Maxscript package to Sublime Text so you can run maxscripts from Sublime. To make it work you have to copy "Autodesk.Max.dll" and "Autodesk.Max.Remoting.dll" from your max root folder to the Maxscript folder. Note, for this to work in versions previous to Max2013 you need to download the .Net wrappers from http://ephere.com/autodesk/max/downloads.html. If you got Max2013 you already got this installed. The last thing is to edit the \Users\username\AppData\Local\Autodesk\3dsMax\2013 - 64bit\ENU\en-US\plugcfg\MaxDotNet.config file and set AllowRemoting to true.

To assign a hotkey for running scripts, edit the "Default (Windows).sublime-keymap.json" file. You can also run it using Tools\Maxscript from the menu.

The files:
http://folk.ntnu.no/havardsc/scripts/SublimeMaxScript.rar

Reply to haavards
bob

Hi,

And first thanks Haavards for the maxscript support in sublime.
I create a package with everything you said and install it in sublime.

Syntax color works very well.
I have the tool \ max script command but when i click on it nothing happens (after a short wait)

Could you describe a little more how to be able to execute maxscript for sublime please ?

PS : I am using 3ds max 2013 64 bits.

Best,
Rob

Reply to bob
haavards

Not sure what could be wrong if there are no error messages popping up.

Here is a procedure to check if the remoting is properly set up:

First, be sure to copy the two .dll-files from your max root directory to the maxscript package folder.

Secondly, be sure to have enabled remoting as described in my first post, the two fields to check in the MaxDotNet.config file should look like this:

<RemotingPort>9998</RemotingPort>

 <AllowRemoting>true</AllowRemoting>

Then with Max open, go to the package folder and open up a cmd window at that location. A quick way to do that is to go to the parent folder and shift+right click on the folder and choose "Open command window here". Then enter

MXSSublime "teapot()" 

This calls the .exe file with a simple script. If it's set up correctly you should have a teapot in your scene.

This is basically what the python script does when calling it from the sublime editor. If the remoting works and the script fails it should display an error message in Max's listener as usual.

Try running sublime text as an administrator if it still does not work.

Reply to haavards
bob

HI,

Thanks !
It works.

But I found that each time I launch max it reset the MaxDotNet.config in my localApps.
In order to avoid the pb I have to modify the file in read only "
Now the system is working fine.

Best,
Rob

Reply to haavards
borent

Thanks for maxscript highlight! This really is not enough! Publish it on the Package Control think many useful =)

But unfortunately I have following problem with Building file. All set up as it was written. Creates a teapot. However, under my code pops up the following error:

Error trying to parse build system: Invalid escape in C:\Users\render\AppData\Roaming\Sublime Text 2\Packages\MaxScript\MaxScript.sublime-build:2:20

In this file, I have not changed anything:
{
"cmd": ["python", "$packages\MaxScript\Executer.py", "$packages\MaxScript", "$file"]
}

I try to send a file for execution "test.ms". Maybe you know what could be the problem?

Reply to borent
borent

I resolve my problem

In the file: "MaxScript.sublime-build" change to the \ to / and I did not have the environment variable so I pointed the way to a python:

Before:
{
"cmd": ["python", "$packages\MaxScript\Executer.py", "$packages\MaxScript", "$file"]
}

After:
{
"cmd": ["C:\\Python26\\python.exe", "$packages/MaxScript/Executer.py", "$packages/MaxScript", "$file"]
}

Reply to haavards
Felipe Nogueira

I am having a hard time getting it to work with sublime 2, I place the maxscript folder inside the pristine packages folder and it doesn't work.

I also tried making a packages folder at the sublime root directory and it doesn't work.

Any ideas?

Raymond Homme Ingebretsen

Thank you Anubis, I'll take a look at the ConText :)

Reply to Panayot Karabakalov
Branko Živković

about ConText

>>>to Anubis
thanks for txt editor suggestion. I agree that Sublime Editor is a good choise for web and other languages programing, but ConText is free and very easy to adjust basic mxs higlighters.
I don't like limitation to 5 keywords but anyway...
I share my *.chl. See attachment
Cheers!

Attachments
Reply to Branko Živković
Panayot Karabakalov

Thanks for the higlighter!

I'm too made my own simple higlighter but I see that you put a lot more keywords in your CHL-file. The limitation to 5 keywords is quite enough for some languages, and of course w'd be good to have more for Mxs... ConText is a good choice for me anyway :)

Reply to Panayot Karabakalov
Branko Živković

For me is the best choice these adjusments of MXS_Editor. Maybe you already try this but for those who are not let them try.
It is good way to increase functionality of MXS_Editor and also you can easily customize it.
Big Thanks to Josef Wienerroither (spacefrog) and James Haywood.

Attachments