{"id":66,"date":"2012-10-14T13:32:59","date_gmt":"2012-10-14T13:32:59","guid":{"rendered":"http:\/\/www.dannywynne.com\/blog\/?p=66"},"modified":"2013-09-11T02:40:58","modified_gmt":"2013-09-11T02:40:58","slug":"sublime-text-2-and-maya-setup-tutorial","status":"publish","type":"post","link":"http:\/\/www.dannywynne.com\/blog\/?p=66","title":{"rendered":"Sublime Text 2 and Maya Setup Guide"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/dannywynne.com\/images\/sublime_code_intel.jpg\" alt=\"sublime code intel\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Sublime Text 2 is a really great text editor. If you haven&#8217;t tried it, do yourself a favor! Here is a guide to get you setup for Maya scripting. It includes auto complete for PyQt and maya.cmds\/mel; and ctrl+enter communication with Maya. It took a bit of googling and fiddling to get this working, so hopefully I can save you some time and frustration.<\/p>\n<p>&nbsp;<\/p>\n<p>1) First, get <a title=\"sublime text 2\" href=\"http:\/\/www.sublimetext.com\/2\" target=\"_blank\">Sublime Text 2<\/a>. It has an infinite trial period. If you like it, support it by buying it.<\/p>\n<p>&nbsp;<\/p>\n<p>2) Get <a title=\"package control\" href=\"http:\/\/wbond.net\/sublime_packages\/package_control\/installation\">package control <\/a>. Once its installed, press ctrl+shift+p in Sublime Text and start typing &#8220;package.&#8221; If you want, go to &#8220;Package Control:Discover Package&#8221; to browse the huge list of plugins.<\/p>\n<p>&nbsp;<br \/>\n3) UPDATE: I&#8217;m using Jedi now, its a much easier setup  <a href=\"https:\/\/github.com\/srusskih\/SublimeJEDI\" title=\"Here's the github page\">Here&#8217;s the github page<\/a>, you can also install it through package control. Be sure to add to add &#8216;C:\/Program Files\/Autodesk\/Maya[VERSION]\/devkit\/other\/pymel\/extras\/completion\/py\/&#8217; to the paths (see github for setup instructions)<\/p>\n<p><del datetime=\"2013-09-11T02:28:33+00:00\">3) Press ctrl+shift+p, start typing &#8220;package&#8221;, go to &#8220;Package Control:Install Package&#8221; and press enter. Now start typing &#8220;codeintel&#8221; and select &#8220;SublimeCodeIntel.&#8221; Let it install.<br \/>\n<\/del><br \/>\n&nbsp;<\/p>\n<p><del datetime=\"2013-09-11T02:28:33+00:00\">4) I had to remove some files from code intel to get it to work. The files were throwing errors so I just removed them and it worked. So go to &#8220;&#8230;\\AppData\\Roaming\\Sublime Text 2\\Packages\\SublimeCodeIntel\\libs\\codeintel2&#8221; (You can easily navigate to this folder from Sublime Text 2 by selecting Preferences&gt;Browse Packages) and take out &#8220;lang_css.py&#8221; and &#8220;lang_less.py&#8221; and their respective .pyc files.<br \/>\n<\/del><br \/>\n&nbsp;<\/p>\n<p><del datetime=\"2013-09-11T02:28:33+00:00\">5) Place <a title=\"pyqt4.cix\" href=\"http:\/\/www.dannywynne.com\/blog\/wp-content\/uploads\/2012\/10\/pyqt4.zip\">pyqt4.cix<\/a> in &#8220;&#8230;\\AppData\\Roaming\\Sublime Text 2\\Packages\\SublimeCodeIntel\\libs\\codeintel2\\catalogs&#8221; (You can easily navigate to this folder from Sublime Text 2 by selecting Preferences&gt;Browse Packages). This .cix file is a catalog of pyqt for auto complete. I originally found it on <a title=\"wuub.net\" href=\"http:\/\/wuub.net\/\">wuub.net<\/a>. In the version you can download here I changed one line to make it work. I edited the &#8220;name&#8221; attribute to the value &#8220;PyQt4&#8221;. All other cix files I found on the web didn&#8217;t work properly and using codeintel&#8217;s gencix.py utility created an incomplete cix. This does it right!<\/del><\/p>\n<p>&nbsp;<\/p>\n<p><del datetime=\"2013-09-11T02:28:33+00:00\">6) Navigate to &#8220;C:\\Users\\[WHATEVER]\\Documents\\.codeintel&#8221; and edit the config file to look like this (change the paths to fit your environment):<br \/>\n{<br \/>\n&#8220;Python&#8221;: {<br \/>\n&#8220;python&#8221;: &#8216;C:\/Python26\/python.exe&#8217;,<br \/>\n&#8220;pythonExtraPaths&#8221;: [<br \/>\n&#8216;C:\/Python26\/Lib\/site-packages&#8217;,<br \/>\n&#8216;C:\/Program Files\/Autodesk\/Maya2013\/devkit\/other\/pymel\/extras\/completion\/py\/&#8217;<br \/>\n]<br \/>\n}<br \/>\n}<br \/>\n<\/del><\/p>\n<p><del datetime=\"2013-09-11T02:28:33+00:00\">Note: The first time code intel tries to auto complete something, it will take a while. Especially the PyQt4.cix file. It may seem like its not working even after it completes loading, but try it a few times. Eventually if it really isn&#8217;t working, check out the log in &#8220;C:\\Users\\[WHATEVER]\\Documents\\.codeintel&#8221;<\/del><\/p>\n<p>&nbsp;<\/p>\n<p>7)UPDATE: SublimeMaya is now in package control too. It shows proper stack trace and line number, so you can ignore this step. <del datetime=\"2013-09-11T02:36:16+00:00\">Now you need to get Sublime Text 2 to communicate with Maya. Get <a title=\"MayaSublime\" href=\"https:\/\/github.com\/justinfx\/MayaSublime\">MayaSublime<\/a>. In the plugin (which you can easily access from Sublime Text 2 via Preferences&gt;Browse Packages), I edited the MayaSublime.py file so that it provides stack trace and the proper line number in the stack trace. You can download my version <a title=\"MayaSublime.py\" href=\"http:\/\/www.dannywynne.com\/blog\/wp-content\/uploads\/2012\/10\/MayaSublime.zip\">here<\/a>. Thanks to <a title=\"justinfx\" href=\"http:\/\/www.justinfx.com\/\">Justin Israel<\/a> for writing this. I also put cmds.commandPort(name=&#8221;:7002&#8243;, sourceType=&#8221;python&#8221;) in my userSetup.py script for convenience.<\/del><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>I hope this helps! If you have any additional things you&#8217;ve done with Sublime Text 2 to help with Maya development, let me know in the comments.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Sublime Text 2 is a really great text editor. If you haven&#8217;t tried it, do yourself a favor! Here is a guide to get you setup for Maya scripting. It includes auto complete for PyQt and maya.cmds\/mel; and ctrl+enter communication with Maya. It took a bit of googling and fiddling to get this working, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[13],"class_list":["post-66","post","type-post","status-publish","format-standard","hentry","category-maya-scripting","tag-sublime-text-2"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.dannywynne.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.dannywynne.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.dannywynne.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.dannywynne.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.dannywynne.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=66"}],"version-history":[{"count":0,"href":"http:\/\/www.dannywynne.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/66\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.dannywynne.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.dannywynne.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.dannywynne.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}