Your Advice For Getting into Python for Max & Photoshop

Hi

I have been dabbling in maxscript to make automation of some basic tasks in 3DS Max. I recently discovered you can script photoshop tasks in Python. I also saw that max supports python & so does Maya…so instead of learning each language and putting heaps of time into each, maybe python is the way to go?

As technical artists, what advice would you have about learning Python ? From where to go to set it up and which version or language type is best?
Do I need visual studio for this?

Any advice you can give would be appreciated!

Ash

Hi there,

first of all: If you want to break into TA python is definitely on the must-have list. That being said, photoshop does not have integrated python support (curse you adobe), you can only automate it using COM (which is a hassle, and a bigger hassle in photoshop). Max got native python support just recently and it still does not cover all aspects of maxscript (by far). So for max i’d say maxscript should still be a given.

The version does not really matter as long as it is 2.x. Most houses i know deal with the 2.6 or 2.7 releases. I have yet to find someone that is 3.x already (especially since pretty much all application integrations (nuke, max, maya) are 2.x (mostly 2.7 for current releases i’d say).

You don’t need visual studio. In fact python comes with everything you need. Though third party tools (ranging from good text editors to full fledged IDEs) usually provide a better experience.

I think there were some links in regards to learning python. There are various really good resources on learning python out there.

Cheers,
Thorsten

[QUOTE=instinct-vfx;25043]you can only automate it using COM (which is a hassle, and a bigger hassle in photoshop). [/QUOTE] You can also start JSX scripts via command line when PS is already running. Then you don’t have to deal with COM but with Photoshop’s Javascript instead. nDo used to do this. If it’s really better than COM is up to everyone’s taste I guess, but it’s a viable alternative to COM.

For learning Python, just get a text editor (e.g. notepad++ or SciTe) and the Python 2.7 installer from python.org. Many people recommend this http://learnpythonthehardway.org/ as starting point. I learned Python with Hetland’s “Beginning Python” book, which is also pretty easy to follow. Once you’re confident with the language, you can pick up “Maya Python for Games and Film”, which offers an excellent into to programming Maya using Python.

[QUOTE=RobertKist;25044]You can also start JSX scripts via command line when PS is already running. Then you don’t have to deal with COM but with Photoshop’s Javascript instead. nDo used to do this. If it’s really better than COM is up to everyone’s taste I guess, but it’s a viable alternative to COM.[/QUOTE]

Yes it is. Both approaches bring tears of despair and agony to my face when i just think of them…

Thanks for the responses!

I will take your advice but what is COM? does it have a more official term I can search?

So if im using MAX, Should I stick to Maxscript?
What about Photoshop? What should I use? I’d like to be able to automate tasks etc

I just though maybe Python would save me having to learn multiple languages & if Max is ever axed from Autodesk (please 3D gods no!) then it would be easier to transition.

Your thoughts, guidance is always appreciated!

Ash

You should learn python. That’s a given :slight_smile: For Max i’d say go python, but keep in mind that you won’t be able to do everything ONLY in python. But you can also call maxscript from python if needed.

For photoshop it does not really matter. If you want to get around learning jsx, python+com is just as good (or bad heh). So yes you can save yourself from learning additional languages to some extent.

COM is a Microsoft standard for interprocess communication: Component Object Model - Wikipedia

You can use it to “remote control” photoshop. Pete Hanshaw has quite some snippets: Pete Hanshaw: Photoshop Scripting

Cheers,
Thorsten

Ya I had some some success controlling Photoshop with Maya and python with the comtypes module. But its a bit of a headache. For the most part I just use jsx for working with Photoshop.

Python is a must learn for ta’s especially if you work with Maya.

I think you’re planning waaaay too far ahead. Max script won’t be axed soon, or else a lot of studios with their pipeline based on max script will be angry. Max script isn’t a very difficult language to learn, and it has the advantage, over Max Python, that there are many scripts which’s source code you can study regarding Max specific problems, and how to solve them. Python too has a lot of documentation, but not yet for Max.

If you already have a job: check what your employer needs.
If not, then I’d learn Python first and later Max Script.

[QUOTE=RobertKist;25051]I think you’re planning waaaay too far ahead. Max script won’t be axed soon, or else a lot of studios with their pipeline based on max script will be angry. Max script isn’t a very difficult language to learn, and it has the advantage, over Max Python, that there are many scripts which’s source code you can study regarding Max specific problems, and how to solve them. Python too has a lot of documentation, but not yet for Max.

If you already have a job: check what your employer needs.
If not, then I’d learn Python first and later Max Script.[/QUOTE]

Quoted for agreement!

Here’s a quick getting-started post for using Python + COM in Photoshop:

1 Like

Ok great stuff guys!

This gives me a lot to think about.

Greetings,

I’m using 3ds max 2015 and would like to learn how to use Python paired with a visual designer (like QT Designer/ Creator) to create tools with custom UI. I have no idea how to do this but have been trying various examples (without any real success). I’m wondering if anyone here can:

1.) Describe your personal best method for using Python in 3ds max today. (In editor?, Blur Python or from external IDEs?: Sublime, PyCharm, Visual Studio, etc)
2.) Are there any examples for getting this method setup?

I’m very new to Python and would like to know the general workflow for creating, editing and iterating on tools/ general scripts for python in 3ds max. I come from a MEL background and know my way around MXS pretty well. Using an external program to create the magic is unfamiliar. Just want to make sure I’m going about this the right way. I’ve tried searching through the docs for answers but keep running in circles.

I would really appreciate any assistance from you guys. Thanks!

I’d worry about learning good python programming first and wait a few months before worrying about GUI programming. It’s tough enough to learn a new language. It’s way tougher to learn how to program a second (C++) indirectly through a Python wrapper.

When you’re comfortable using classes, doing object oriented design, and working with python syntax move on to QT; if try to do advanced stuff before your Python is coming fluently you’ll probably get very frustrated.

PS : I’m lazy, I find Pycharm makes my life much easier an almost all regards. It certainly helps speed me up. The only downside is their stupid wierd unit test harness which causes me a lot of heartburn.

Thanks for the reply Theodox. I’ll take that into consideration. If I use Python to do small tasks (for the practice you mention), is this knowledge extendable to the 3ds max environment later? As far as the general workflow goes, do you you use Pycharm to write the code, then run that file through Max? Or do you execute straight from Pycharm? This is what is confusing to me at the moment.

Also, on the mention of Qt: I know that 3ds max comes with PySide, which is very similar to PyQt. Are you recommending using Qt Designer after I’m familiar with Python syntax and structure? Or is there some other method to using Qt?