Sublime Text plugin


#1

This little script requires you to install,

  1. sublime text 3 = https://www.sublimetext.com/3

  2. ST3 package manager = https://packagecontrol.io/installation

  3. Install the (awesome) Sent to 3Dsmax plugin via install package option

  4. Go to Preferences and Browse packages, and in the User folder create a file names : open_max_help.py
    Paste the following content:


import sublime, sublime_plugin
import subprocess

'''
Code taken from : https://forum.sublimetext.com/t/select-word-under-cursor-for-further-processing/10913
'''
class open_max_help(sublime_plugin.TextCommand):

    def run(self, edit):
        for region in self.view.sel():
            if region.begin() == region.end():
                word = self.view.word(region)
            else:
                word = region
            if not word.empty():
                key = self.view.substr(word)
                url = "http://docs.autodesk.com/3DSMAX/16/ENU/MAXScript-Help//index.html?query=" + key
                pid = subprocess.Popen(["C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", url]).pid
                print (url)

  1. Open key bindings user and add the following line to it (make sure to add a comma to previous line!)
{ "keys": ["f1"], "command" : "open_max_help"}

If all is well, you now can use Sublime text, almost exactly like the maxscript editor. Click in a word or make a selection and press F1 to go to the online help file. I’m sure it can be extended to a local help file of another version. Ideally this script is included in the “Sent to 3dsMax” package.

Hope it’s of use to anyone!


#2

Hey JHN,

Worth noting is that this open_max_help python script only targets Firefox.

You can edit it like this to have it open in the default web browser:

import sublime, sublime_plugin
import subprocess
import os

'''
Code taken from : https://forum.sublimetext.com/t/select-word-under-cursor-for-further-processing/10913
'''
class open_max_help(sublime_plugin.TextCommand):

    def run(self, edit):
        for region in self.view.sel():
            if region.begin() == region.end():
                word = self.view.word(region)
            else:
                word = region
            if not word.empty():
                key = self.view.substr(word)
                url = "http://docs.autodesk.com/3DSMAX/16/ENU/MAXScript-Help//index.html?query=" + key
                command = "start " + url
                os.system(command)
                print (url)

The changes are:

import os #required for os.system
...
                command = "start " + url #string to run
                os.system(command) #run the command

#3

Very cool guys! I’ve been wanting this feature for ST3 for a while.

On the topic of Sublime Text is there a fix for the parenthesis () not auto indenting properly?


#4

Hi everyone,

@Johan/Kevin: Daniel has forwarded your code to me on GitHub, thanks for the contribution, very useful! I have just released a new version (0.9.2), Sublime should update automatically the next time you open it.

I love how more and more people contribute work and make this better step by step :slight_smile:

@Juan: Try Preferences > Settings - User and add this:

"indent_to_bracket": false

#5

Awesome, thank you Christoph and Daniel!


#6

I’m on sublimetext2 and I think this latest update broke the send to 3ds max plugin. Has the update been tested on sublimetext2?


#7

I’m the absolute noob in python, but it was much simpler to create this one for Sublime Text
MxsTooltip github


#8

Awesome, thank you so much! :smiley:


#9

I love Sublime Text, thanks for this, i’m sure there’s a way to edit the max editor color scheme but i always have sublime text open anyway.


#10

I got it to work with Sublime text 3.1.1 by manually extracting the Send to 3Dsmax repository into the C:\Users\username\AppData\Roaming\Sublime Text 3\Packages\User\Send to 3ds Max directory that I made.

repository from here: https://github.com/cb109/sublime3dsmax

and don’t forget to setup the key bindings