Python and PyQt in 3dsMax


Eric, that’s very generous of you. If it works out, I’m sure I will see it show up on the googlepages and if not then we’ll just wait some more, which is ok too.



This is very awesome. very, very very.
Thanks you for this.


This is awesome, thank you so much for sharing.


First of all big ups to blur! And yes a max 2010 version would be great!

Maybe while you are at it, just an idea and maybe its quite easy…
Could you develop something like a python contolled mesh/poly or even spline shape. Similar to the mesh scripted plugin that maxscript offers? Or is this possible now and if so how?

Again thanks so much!!!




What do you mean by mesh scripted plugin? With this you can do with python anything that is available through maxscript – just through python. So you can control mesh / poly operations with it…



Now I can finish developing classes that can be used for MotionBuilder, Maya AND Max!

 From Blur import awesomeness


Thats not entirely true actually -

Rollouts for instance, aren’t accessible through python, and I’m pretty sure scripted controllers and plugins aren’t going to work yet either - I have to figure those out - because they’re generated via the parser and not through the globals hash table.

Will be looking into that in the future as we start developing more - hadn’t had the need for that before, so we’ll have to cross that bridge when we hit it.


did the recompile work?


Hi eric,

What about maxscript enums ?

I have ported a little script to test Py3dsMax. It’s working very good but I have a problem with addKnot function because it wants maxscript enums as parameters:


addKnot shape splIdx #smooth #curve point


mxsCommand = "addKnot $%s %s #smooth #curve [%s,%s,%s]" % (, splIdx, point.x, point.y, point.z)


Just out of curiosity and my lack of programming skills - why is everyone so happy about hearing news of Python in max? I know it’s an open-source programming language. As I get it’s a very, very good news to max?

I have some distant plans and intentions of learning maxscript, for purposes of being able to make some customm tools and such. Because of that news is it worth than to invest time now in learning maxscript or it’s better to dive into python which I guess is much harder to learn?


@ ypeuch

Hey man - thanks for the find! I was auto-converting names to strings thinking that all the maxscript methods would take them vs. names (most of them do), but that case doesn’t work. I put up new installs that’ll fix that problem.

Maxscript also natively doesn’t have a constructor that’ll port over:

mxs.#corner will fail in python
and there is no ‘as’ method (“corner” as name)

Easiest way around it was to register a global maxscript method called “namify” in the [max]/scripts/startup/ script that’ll do it for you, here’s an example of a python script ported from a maxscript help (you’ll need the 8678 build online now for it to work)

  from Py3dsMax import mxs 
 def drawLineBetweenTwoPoints( pointA, pointB ):
   	ss = mxs.SplineShape( pos = pointA )
   	mxs.addNewSpline( ss )

    	# Create name instances from maxscript using the global namify method
   	corner = mxs.namify( 'corner' )
   	line		= mxs.namify( 'line' )	
   	mxs.addKnot( ss, 1, corner, line, pointA )
   	mxs.addKnot( ss, 1, corner, line, pointB )
   	mxs.updateShape( ss )
   	return ss
    newSpline = drawLineBetweenTwoPoints( mxs.Point3( 10, 20, 30 ), mxs.Point3( 100, 200, 10 ) )

@ kashak

It’ll really be up to the studio/developer what solution will work best. Python is a really well designed language, easy to read and work with, and is used cross many applications and platforms.

The main advantage of exposing python to maxscript for us at Blur is consistency. We use python for all external tools, as well as tools in XSI. Being able to make all of our tools run python (instead of maxscript) allows for reuse of code and libraries (asset tracking, production tracking, pipeline tools that go cross project and application) can all be run from a single code base.

Another advantage of it is the PyQt framework, which, is immensely powerful for both graphics, and data backend.

But again, its up to you…if you’re developing utilities that will improve 3dsMax solely and can achieve what you need with the built-in rollout controls, there might not be an advantage for your needs.


could any volunteer make speed and memory leaking comparison tests for same functions implemented on Python and MXS? (scene exploring, mesh creation, array operations…)



Thanks for the fix Eric!



I’ll remember your answer once I will be ready to get my hands on scripting stuff in max.
Just one more - how hard it is to learn Python? Is it comparable with learning C++ which is ultra hard for novices in scripting? Is it okay to start learning Python without prior knowledge of some older languages?



Learning python is considerably easier than learning C++. Python is still a scripting language and C++ is a compiled language, so you don’t have to worry about type casting or memory management or a lot of the lower level programming issues that throw off novice scripters. The advantage of python though is that in comparison to say Javascript or Maxscript, its much faster and more powerful. Its also cross-platform and cross-application, learning python to script 3dsMax (especially learning it with PyQt), you will also learn to be able to build standalone applications really easily. That and most major 3d apps (now thanks to this plugin) support python scripting - (3dsMax, Maya, Softimage, Blender, Houdini, Real Flow). Learning maxscript only gets you knowledge useful in 3dsMax.

Python vs. Maxscript as languages is no contest, however, this is new technology, and has no real documentation - you will need to understand and be able to work with maxscript to understand how to get around some of the differences of developing python for 3dsMax until it becomes more mainstream.

There are python examples for python programming, and there are maxscript examples for 3dsMax, but short of whats on our blur-dev website, no python examples exist for 3dsMax.


You will currenlty first have to learn maxscript before you can use PYTHON in max. But PYTHON is so cool and if you dont code at all i would dive into PYTHON!
There is a great DVD set on MAXSCRIPT at which i can highly recommend! I a way the second DVD “Maxscript for the masses” could be a good starter!

I am still new to PYTHON too (i can work fine in Maxscript) and now i have to learn QT too…
If you want to learn PYTHON scripting in combination with 3D i would highly recommend Houdini or even Blender… but for sure currently not MAX.


Im pretty interested in this - i had just started learning c#, but as I can’t really interface with the max SDK natively (other than using Esphere’s tools) i’m sort of stuck what direction to go in.

So this is essentially the maxscript api in python form? Where by i can call built in functions, normalize?, sin(), abs() etc?

how does attribute.parameter stuff work? e.g. can i ask for an objects transform through python? its controllers? and there values?

A quick example of the pyQT would be awesome - i’m not really sure how that stuff works.


Check out the code site – – Eric added a bunch of really good starter tutorials for python and pyqt…
I think everything you just asked is already an example there… except for abs() and normalize() which would be mxs.abs(num) or mxs.normalize(mxs.Point3 Value) for abs, you don’t actually need to call it through mxs since it’s also built into python… and sin / cos would also be in the python math module… but you can call it through mxs if you want, so either way should be fine.

Controllers specifically read this page: goes over what does / doesn’t work…


Hi all,

About PyQt I have done some modifications in blur.wingui to integrate it better in 3ds Max.

I have added a function in blur.wingui to be able to apply 3ds Max icon to a Dialog or Window.

In blur.wingui, add before connectPlugin() :

(Need pywin library)

from win32gui import FindWindow, GetClassLong, GetIconInfo
 from win32con import GCL_HICONSM
 def applyMaxIcon(widget):
    dialogHandle = FindWindow( None, str(widget.windowTitle()) )
    maxIcon = GetClassLong( core.parentWindow(), GCL_HICONSM )
    if maxIcon != None:
 	  iconInfo = GetIconInfo(maxIcon)
 	  pixmap = QPixmap.fromWinHBITMAP( iconInfo[4], QPixmap.NoAlpha )
 	  pixmap.setMask( QBitmap( QPixmap.fromWinHBITMAP( iconInfo[3], QPixmap.NoAlpha ) ) )
 	  widget.setWindowIcon( QIcon( pixmap ) )

And in blur.wingui and, at the end of the constructor add:

blur.wingui.applyMaxIcon( self )

Also, in blur.wingui, in connectPlugin() function, I have changed the call to app.setStyle() to set Windows style:

app.setStyle( 'Windows' )


Great stuff everyone. Thanks alot to you guys this looks truely promising.

As a quick heads up for ppl installing it here’s an issue i ran into (@Erik: i also added this to the google issue tracker). The BlurQT installer wiped my systemwide path variable instead of appending the correct directory (wich caused other apps to malfunction too heh). After replacing it with the original + appending the right path all seems to work now.
As a sidenote on my system the path is NOT c:/blur/common wich doesnt exist at all but c:/windows/system32/blur64. This is also where the installer is placing all the DLLs.

Apropos DLLs. Will Some of your tools also be opensourced ? I’d definately like to take a look at sql integration and some other stuff i guessed from the libs :stuck_out_tongue:

Kind Regards,