PDA

View Full Version : Python and PyQt in 3dsMax


ehulser
10-16-2009, 04:56 AM
Ok so here we go - we at Blur had released a plugin about a year ago that began exposing Python functionality to Maxscript....

We since decided that it was not good enough.

We have developed a way to run Python as a complete replacement of Maxscript in 3dsMax, utilizing Python and PyQt to develop tools, we're hoping to revolutionize the ability to develop fast, efficient and powerful utilities.

All the information you need to get going can be found at our new development website:

http://blur-dev.googlecode.com

Please feel free to post on the wiki pages for requests, bugs, and comments. Its still very beta and are looking forward to trying to make this the new future of programming in 3dsMax.

Please keep in mind - this is very much beta, and the code is as-is, but we will appreciate feedback as it'll make our own code more stable.

Enjoy!

Eric Hulser
Tools Developer
Blur Studio

SoLiTuDe
10-16-2009, 05:12 AM
BAD ASS! Been waiting for this for a while now... as you know by how often I've bugged you -- no, I don't have a life, thanks for reminding me! :D

--Great work, I think this will open a lot more doors for max / max users... can't wait to start doing some serious stuff with it!

MikeOwen
10-16-2009, 06:35 AM
Wow! Awesome stuff!
Thanks for sharing :-)
Mike

Gravey
10-16-2009, 07:22 AM
This is brilliant! I have been holding off on the whole python in max via com business mainly because of the lack of solid integration. I will be investigating this asap for sure.

Thanks a million!

jedie
10-16-2009, 07:46 AM
Absolute gread idea!!!

I try the 64bit version for 3dsmax2009...

My AntiVir Guard alerts while i install Blur3dsMax2009_x64_install_8275.exe !
The File "C:\blur\dev\offline\code\maxscript\treegrunt\Lib\blurSubmit.ms" whould have a script virus "HTML/Silly.Gen" ;)

Seems to be a false alarm, see:
http://virscan.org/report/e9866806a066b2ac4aaa284aa226d425.html
http://www.virustotal.com/de/analisis/5bd1f2897bf3a72fe47798f4393dc062a9c097b550f3b90a61c6c1c09321bebf-1255679004

@ehulser: Please activte the bug tracker on google code!


EDIT: I have installed Python 2.6 64Bit (ActiveState one), after this i installed Blur3dsMax2009_x64_install_8275.exe and than Py3dsMax2009_python26_x64_install_8666.exe
I started 3dsmax2009 64Bit and can't see the python menu item :(

EDIT2: Sorry, i found http://code.google.com/p/blur-dev/wiki/KnownIssues and the issues with the hardcoded path.
After i copied all files, i get this error on 3dsmax 2009 64Bit startup:
---------------------------
MAXScript Auto-load Script Error - C:\Program Files\Autodesk\3ds Max 2009\stdplugs\stdscripts\blurStartupMaxLib.ms Exception
---------------------------
-- Syntax error: at imgTagPlus, expected <rollout control>
-- In line: imgTagPlus u
---------------------------
OK
---------------------------

I run blurStartupMaxLib.ms in the maxscript editor and get this in the listener: http://paste.pocoo.org/show/145231/

EDIT3: I tried to install Blur Libs, but i get this error:
---------------------------
Blur Libs 1.0.0 win32-msvc2008_64 Setup
---------------------------
Error opening file for writing:

C:\windows\system32\blur64\stone.dll
Bat idea to install in C:\windows\system32\ :( (I'm using Vista 64Bit)

EDIT4: Sorry again. I installed "BlurBeta Tools" and found in the readme.txt the TroubleShooting section for MAX Users. The error was, i doesn't insert the path in plugin.ini correctly.

ypuech
10-16-2009, 08:42 AM
Great news Eric!

We will develop tools with Py3dsMax and the integration of Qt. Sure we will send feedback.

Are you planning a Max 2010 build in the near future ?

jedie
10-16-2009, 08:50 AM
OK, after a log road of installations and manuel copy things from one location to a other location, i see the Python main menu entry in 3dsmax 2009 64Bit ;)

But it doesn't work well.

I can open the Python Logger. But the menu points "new"-, "open"- and "run" python script doesn't work. I get this Tracebacks:
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'QApplication' object has no attribute 'openScript'
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'QApplication' object has no attribute 'newScript'
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'QApplication' object has no attribute 'runScript'

In the Python Logger menu under File i get this error on "open script"
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\blur\wingui\__init__.py", line 83, in openScript
fileName = str( QFileDialog.getOpenFileName( PyQWinHook.core, 'Open Script File', LAST_FILENAME, 'Python Files (*.py);;All Files (*.*)' ) )
NameError: global name 'PyQWinHook' is not defined

But PythonLogger/NewScript and PythonLogger/RunScript works!


EDIT: A other question: You tools are under GPL. But why you are not open the subversion server or use SVN from google code? I would like to checkout and help if i can.

PEN
10-16-2009, 11:11 AM
Very nice. I look forward to having a go at this when the current project is out of the way.

MarcoBrunetta
10-16-2009, 04:22 PM
:bowdown:

Perfect timing... I was just starting to dive into the whole python thing.

Thanks a bunch.

labbejason
10-16-2009, 04:59 PM
HUGE news! Thanks!

Ian, I guess this means you won't be using dotNet as much. :)

Edit: Might be good to have a PyQT sticky soon..!

SoLiTuDe
10-16-2009, 05:03 PM
HUGE news! Thanks!

Ian, I guess this means you won't be using dotNet as much. :)

Edit: Might be good to have a PyQT sticky soon..!

When you said dotNet, I just puked a lil bit. Thanks, Jason!

RobertF
10-16-2009, 05:13 PM
Wohooow!

awsome!!!

-R

ehulser
10-16-2009, 05:17 PM
Hey guys -

Thanks for the quick feedback:

@jeddie:

I have enabled the Issue Tracking on the Google Code page - we don't have a public SVN repo yet, so thats why we don't have the code online but I'll talk to my supervisor when I get into work about it.

I updated the KnownIssues page with your changes - I noticed you posted comments on there also, Thanks! Much appreciated.

I deprecated the Blur Tools download until this afternoon, I can fix those install paths and the plugin.ini config, the Py3dsMax installers should be working fine.

I'll talk to our other programmer Matt about the system32 install on Vista x64, but we don't run Vista at work - so we might not support that...may have to look into getting you the code.

jamesvecore
10-16-2009, 06:03 PM
This is great news. Glad to see progress on this project, I look forward to trying it out this weekend.

I would REALLY like to see this open-sourced so we can all contribute to making this a rock solid plugin. Plus it is very risky for our studio to build production tools around plugins we don't have source code for. We can't risk being left high and dry when new version of max comes out and we have to wait the plugin to be re-compiled. This is even more of an issue with beta testing 3dsmax versions.

Also, do you know if there are still licensing issues with Qt/PyQT on windows? Is a commercial license still required?

I'd be willing to get wxPython integrated as alternative since I have already done some work on this.

Thanks for sharing,

-James

irishlad
10-16-2009, 11:18 PM
New to Maxscript and such. I am a little confused as to where these files should be installed to. The root to my 3dsmax is C:\Program Files\Autodesk\3ds Max 2009 so where should I install downloads to. BTW I have 64 bit version.

thatoneguy
10-17-2009, 12:58 AM
Huzah! :bowdown:

StratusFarm
10-17-2009, 03:10 AM
Oh Hell Yeah!!!
I look forward to digging into this in hours #25-32 of my day.
(I just need to finish a time re-mapping script I am working on first)
Seriously this just kicks ass...can't wait till I wrap up the current project just to explore this.

EDIT: Who am I kidding? F the project, I'm digging into it now!

AkramParvez
10-17-2009, 01:00 PM
Thanks for sharing.... BLUR rocks :bowdown:

JHN
10-17-2009, 03:16 PM
Is there a eta on a probable max2010 release? Then I could try it on 2009 now, and move over when a 2010 release appears.

Greatly admire the stuff you guys share, it's worth quite a lot!

-Johan

ehulser
10-17-2009, 03:33 PM
@ Irishlad

You're going to want to set C:\Program Files\Autodesk\3ds Max 2009 as your 3dsMax install path, and wherever you installed your Python 26 x64 as your python path (most likely c:\python26)

This will install plugins and scripts into your 3ds Max 2009 directory and register them to your C:\Program Files\Autodesk\3ds Max 2009\plugin.ini file. However, with 3dsMax 2009, they changed the default configs I think to store/load the plugin.ini information in your users directory - if thats the case for your setup, you'll need to add a line to wherever that plugin.ini file underneath [Directories] that says:

blur=C:\Program Files\Autodesk\3ds Max 2009\plugins\blur

We at Blur just set it back to the way it always ran, so our installer doesn't support that new issue yet.

@JHN

I can't give you a definitive answer on that since we don't run 2010 in the studio, its not a high priority to get it to work internally...however, if the only change that I need to run to get it to work for 2010 is to compile with MSVC++ 2008, then it should work - I am going to give that a test run on Monday and hand it off to a friend w/ 2010 to see if it works.

JHN
10-17-2009, 05:33 PM
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.

Thanks!
-Johan

Nysuatro
10-17-2009, 08:20 PM
This is very awesome. very, very very.
Thanks you for this.

ErikE
10-18-2009, 05:37 AM
This is awesome, thank you so much for sharing.

olaf23
10-18-2009, 08:25 PM
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!!!

greetings

Olaf

SoLiTuDe
10-19-2009, 04:00 PM
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!!!

greetings

Olaf

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...

JamSession
10-19-2009, 06:57 PM
THANK YOU!

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


From Blur import awesomeness

ehulser
10-19-2009, 08:09 PM
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...

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.

kimgar
10-20-2009, 07:54 AM
did the recompile work?

ypuech
10-20-2009, 10:23 AM
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:

MAXScript
addKnot shape splIdx #smooth #curve point

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

Intars5d
10-20-2009, 12:46 PM
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?

ehulser
10-20-2009, 08:09 PM
@ 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/__init_py__.ms 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.

denisT
10-21-2009, 01:13 AM
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,

ypuech
10-21-2009, 08:20 AM
Thanks for the fix Eric!

Intars5d
10-21-2009, 10:49 AM
ehulser,


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?

ehulser
10-21-2009, 06:09 PM
@kashak

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.

olaf23
10-21-2009, 09:22 PM
@kashak
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 www.cg-academy.net 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.

eek
10-22-2009, 04:25 AM
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.

SoLiTuDe
10-22-2009, 04:54 AM
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 -- http://code.google.com/p/blur-dev/wiki/Py3dsMaxTutBasics -- 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: http://code.google.com/p/blur-dev/wiki/Py3dsMaxTutDiffs goes over what does / doesn't work...

ypuech
10-22-2009, 08:24 AM
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 __init__.py, 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 Dialog.py and Window.py, at the end of the constructor add:

blur.wingui.applyMaxIcon( self )


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

app.setStyle( 'Windows' )

instinct-vfx
10-22-2009, 08:36 AM
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 :P

Kind Regards,
Thorsten

loocas
10-22-2009, 12:17 PM
* booking tickets to California to kiss everyone's a$$ at blur for bringing this to the public *

:buttrock: :buttrock: :buttrock: :buttrock:

You rock guys, you always have! Thanks a lot for this pure awesomeness, I can't wait to start testing this out.

I've been on a mission of bringing IronPython to Max, but if this works better, I'll be totally thrilled and happy! :buttrock:


:bowdown:

eek
10-22-2009, 01:18 PM
Check out the code site -- http://code.google.com/p/blur-dev/wiki/Py3dsMaxTutBasics -- 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: http://code.google.com/p/blur-dev/wiki/Py3dsMaxTutDiffs goes over what does / doesn't work...

Thats awesome, i'm basically building my functions to be as generic as possible, even up to the point of building my own matrix handlers, converters etc in certain places. If i can learn a language that I can take between apps that would be great. Some questions I have:

How does pyQT compare with C# winForms? GDI+ stuff? Is it just a method to build interfaces or can we do drawing stuff with it? more advanced stuff?

As to .net and c# can we build library and interface with them in maxPython and maxPyQt?

one other little question, max natively supports script controllers with maxscript, is there support for this with python? or some python script controller in the works?

Questions regarding the BlurDev:

Do we have to download and build the python source 2.4.6? From the documentationI was reading it as blurCore was an executable which would install the lot - python, Qt, PyQt, BlurLib & blurPython.

What exact files do we need to actually download from the downloads? I got confused as

theres 'Blur Python X32(Python24)' and 'Python for 3ds Max 10 x32 (python24)'

SoLiTuDe
10-22-2009, 03:47 PM
How does pyQT compare with C# winForms? GDI+ stuff? Is it just a method to build interfaces or can we do drawing stuff with it? more advanced stuff?

As to .net and c# can we build library and interface with them in maxPython and maxPyQt?

one other little question, max natively supports script controllers with maxscript, is there support for this with python? or some python script controller in the works?

Questions regarding the BlurDev:

Do we have to download and build the python source 2.4.6? From the documentationI was reading it as blurCore was an executable which would install the lot - python, Qt, PyQt, BlurLib & blurPython.

What exact files do we need to actually download from the downloads? I got confused as

theres 'Blur Python X32(Python24)' and 'Python for 3ds Max 10 x32 (python24)'




I'm not familiar with C# to be honest, Eric would be the one to answer this really, but so far pyqt is super easy to use, and is very powerful... You should really download it and check out the example scripts. There are all sorts of drawing classes, and even opengl classes -- the Realflow gui for instance is made off of QT (not python) natively... though not sure if they're using the qt opengl modules or not. http://doc.trolltech.com/4.5/classes.html <<list of qt classes

For install you need to download python from python.org (if you're using 64bit max you download 2.6 x64, if you're using 32bit max you download 2.4 32bit)... then d/l and install pretty much everything else according to the max version / python 64 or 32.

Right now there is no python script controller... though that'd be freakin' sweet.

If you build a .net or c# library, you should still be able to call them from python via the mxs module, as you would via maxscript... or there are most likely other modules to access .net libraries from python (though I'm still a Noob, so I don't know what they'd be called)

EDIT: For the Scripted Controllers -- you can call python.X via maxscript, so in theory you can have a script controller call python, but I think you'd still be running in maxscript syntax, etc...

--Ian

eek
10-22-2009, 05:52 PM
I'm not familiar with...

--Ian

Cool thats awesome!

As to the python download, 2.4.6 is only a source release and not a binary release - how do we build the source?

-c

SoLiTuDe
10-22-2009, 06:37 PM
Looks like we're running 2.4.2 in the studio...
http://www.python.org/download/releases/2.4.2/

but 2.4.4 also has binary releases...
http://www.python.org/download/releases/2.4.4/

No idea if that .2 would make a huge difference ( I doubt it) :D

ehulser
10-22-2009, 07:17 PM
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 :P

Kind Regards,
Thorsten

Good catch - apologies about that:

If you install x32 bit, the DLLs go in c:/blur/common
If you install x64 bit, the DLLs go in c:/windows/system32/blur64

We're looking into the wiping of the PATH - that most definitely should not be happening, also right now we aren't supporting Vista64 - we don't have it here and haven't tested with it yet. I run Vista32 at home, and it seems to work ok, but Vista64, I don't know about yet.

@ypuech

Cool upgrade! We have it setup like that because we actually use that wingui package to run in many places (not just max)...so we have it more abstract on purpose, but if you want to host that somewhere for people using it for straight 3dsMax that'd be really cool.

(To that end, we'll prolly be coming out with PyQt for Softimage very shortly using the blur.wingui package - need docs and testing first)

@ eek
How does pyQT compare with C# winForms? GDI+ stuff? Is it just a method to build interfaces or can we do drawing stuff with it? more advanced stuff?

I personally haven't used C# and have limited experience with .net, but Qt is very, very robust. I've built custom widgets for all sorts of things, their QGraphicsView and QGraphicsScene is very powerful, on top of being able to just subclass any widget and define how it interacts is pretty simple. Look into QPainter for some of that.

As far as scripted controllers and attributes, I haven't done anything with those yet. So feel free to test, play and contribute knowledge!

loocas
10-22-2009, 07:19 PM
How do I get BlurLib installed? After successfull installation, the blur64 folder in Windows\System32\ is empty! :banghead:

I'm on Vista Business x64

csaez
10-23-2009, 03:55 AM
I need to try this!

Thanks :thumbsup:

SoLiTuDe
10-23-2009, 04:21 AM
I'm on Vista Business x64

Well that's the problem right there... :D a few posts back: Ehulser: "also right now we aren't supporting Vista64 - we don't have it here and haven't tested with it yet. I run Vista32 at home, and it seems to work ok, but Vista64, I don't know about yet."

loocas
10-23-2009, 11:15 AM
Well that's the problem right there... :D a few posts back: Ehulser: "also right now we aren't supporting Vista64 - we don't have it here and haven't tested with it yet. I run Vista32 at home, and it seems to work ok, but Vista64, I don't know about yet."

Well, looks like I'm out of the fun! :sad:

"BlurPython has not been loaded."

ypuech
10-23-2009, 11:39 AM
Cool upgrade! We have it setup like that because we actually use that wingui package to run in many places (not just max)...so we have it more abstract on purpose, but if you want to host that somewhere for people using it for straight 3dsMax that'd be really cool.

(To that end, we'll prolly be coming out with PyQt for Softimage very shortly using the blur.wingui package - need docs and testing first)
In fact we could rename applyMaxIcon with applyCoreAppParentIcon(), because it tries to get the core application parent icon with its handle. So this would work for all applications:

def applyCoreAppParentIcon(widget):
dialogHandle = FindWindow( None, str(widget.windowTitle()) )

maxIcon = SendMessage( core.parentWindow(), WM_GETICON, 0, 0 )
if maxIcon == 0:
maxIcon = SendMessage( core.parentWindow(), WM_GETICON, 1, 0 )
if maxIcon == 0:
maxIcon = GetClassLong( core.parentWindow(), GCL_HICONSM )
if maxIcon == 0:
maxIcon = GetClassLong( core.parentWindow(), GCL_HICON )

if maxIcon != 0:
iconInfo = GetIconInfo(maxIcon)
pixmap = QPixmap.fromWinHBITMAP( iconInfo[4], QPixmap.NoAlpha )
pixmap.setMask( QBitmap( QPixmap.fromWinHBITMAP( iconInfo[3], QPixmap.NoAlpha ) ) )
widget.setWindowIcon( QIcon( pixmap ) )

In Dialog.py and Window.py, replace applyMaxIcon() with applyCoreAppParentIcon().

instinct-vfx
10-23-2009, 11:41 AM
Do you get the DLL missing error or something alike ? I had to manually fix my path variable to make all the needed DLLs load as well as adjust my Python_Path variable to include the correct site-packages folder (as i already had a different python version installed).

BTW. Before there is double work done. Is there a simple way to use an external editor similar to the rez8 extension ? Or even using this extension ? It seems all one has to do is call maxscript call

python.exec "import blur.wingui;blur.wingui.runScript()"


and provide the scriptname instead of running it parameterless (at least according to what i saw in the wingui sources).

While the included editor is a nice touch for serious development external editors would ease dev a lot. Not to mention my fav advantage of external editors: if max crashes, the editor doesnt :)

Regards,
Thorsten

loocas
10-23-2009, 11:59 AM
Do you get the DLL missing error or something alike ? I had to manually fix my path variable to make all the needed DLLs load as well as adjust my Python_Path variable to include the correct site-packages folder (as i already had a different python version installed).

If it was a reply to me, then yes, I have all the paths properly set and I don't get any DLL load errors or anything. I simply only get this message in the MAXScript Listener:

"BlurPython has not been loaded."

instinct-vfx
10-23-2009, 12:14 PM
I assume you got the plugs in the right places ? did you check that the plugin is really loaded in the plugin manager ? as if i am not mistaken that error alone is an error message of the startup scripts that are checking if the plugin is present at all.

Regarding remote execution i basically know how to do it (and even with py itself rather than an extra exe so keepin it all pythonic). I cant find the right way to actually execute a python script via maxscript. The mentioned methods i took from the macroscripts dont seem to work (they just do nothing and return OK once i have the syntax right). Any pointers ?

Regards,
Thorsten

loocas
10-23-2009, 12:36 PM
I assume you got the plugs in the right places ? did you check that the plugin is really loaded in the plugin manager ? as if i am not mistaken that error alone is an error message of the startup scripts that are checking if the plugin is present at all.


:banghead:

Ah, yes! That was really lame of me! Sorry, I forgot I'm executing several versions of Max with different plugin.inis and the one I was running now didn't have the path to the blur plugin included.

So, again, sorry for this. As a TD, I should crawl to a dark corner and cry... :blush:

Thanks man! :beer:

instinct-vfx
10-23-2009, 01:04 PM
Yay...got external editor -> max execution to work :)

Here's a quick how-to:

1. You need to get pywin32 to get com functionality. The version matching the 64 bit version is here:
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/pywin32-214.win-amd64-py2.6.exe/download

2. Next we need a maxscript function to execute our script. It needs to be available via com hence we need to register it. Here is mine:


fn exec_py script = (
if ( python != undefined ) then ( python.run( script ))
else ( print "ERROR: BlurPython DLL is not loaded." )
)
registerOLEInterface #(exec_py)


place it in a .ms file and place this in your scripts/startup folder so it gets registered on max startup.

3. We need to connect to max from the outside world and trigger the function. Cause this is all about python i decided to do that in python too as a command line script :) See below the code for notes


import win32com.client
import sys

#Create a connection to Max
conn = win32com.client.Dispatch("MAX.Application.2008")

#Flag as a Method otherwise python or win32com will most likely treat it as attribute.
conn._FlagAsMethod("exec_py")

conn.exec_py(sys.argv[1])


You need to tweak "MAX.Application.2008" to match your version. What it does is connect to a running max instance or start a new one if none is available and call the ole function we registered before with the first commandline argument as a function argument.

To test this you can run it from the commandline:


python execute.py "scriptpath_and_filename"


If all went well max should run your python script triggered by the commandline. Neato :)

Now i went to my editor (for testing i used komodo edit) and added a custom run commando that looks like this:


c:\python26_64\python c:\blur\execute.py %F


%F is the placeholder for the currently edited script. So hitting the shortcut for that one executes the script in max. Now why do we do that ? Cause i dig the additional editing functions (esp things like intellisense and autocomplete...and yay...they work with the blur modules as far as i can tell)

Hope this helps someone,
Thorsten

P.S. Erik it might be worth considering adding this to the wiki for reference.

SoLiTuDe
10-23-2009, 03:39 PM
Loocas -- I have a laptop with 64bit vista on it... I'll get that going as a test bed soon...


Very cool stuff there, guys... just so you know, you can execute any python script with python.run(filename) internally from max, so you can create macros and such that point to your file (or in our case, since I'm currently at blur, by using the new treegrunt) and still edit in whatever app you want. Telling max what to do from external apps has a lot more potential now... could get some really cool inter-package scripts or just any sort of external python controlling max.

instinct-vfx
10-23-2009, 04:00 PM
Thanks Ian. That was what i was doing wrong before (using python.exec instead of run :shrug: )

Any chance we will also see the old tools beeing released again ? Like treegrunt and it's contents :P I only see the file structure not the actual tools.

Regards,
Thorsten

loocas
10-23-2009, 04:08 PM
Loocas -- I have a laptop with 64bit vista on it... I'll get that going as a test bed soon...

Thanks, but I'm fine already :) I've managed to install the libs via a 64bit XP virtual machine and then I just forgot to add the path to the plugin in the custom inis I have here.

It's all working just fine now, fantastic work guys, really! :buttrock:

I'm now trying to execute the scripts from an external editor, but I'm having some trouble with the OLE objects etc... hopefully I'll get to the root of the problem soon. :beer:

Edit: GOT IT! Stupid typo... :rolleyes:

loocas
10-23-2009, 06:05 PM
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 __init__.py, 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 Dialog.py and Window.py, at the end of the constructor add:

blur.wingui.applyMaxIcon( self )


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

app.setStyle( 'Windows' )

I can't get these to work for me here. I don't know why, but once I modify the files you suggest, I get tons of errors and the blurPython module won't work anymore within Max (it won't even load up the first time).

But I'm not that skilled with Qt, so I might have done it improperly. Can you, please, share your files so I can compare?

Thanks a lot! :beer:

loocas
10-23-2009, 07:03 PM
Ha, another issue :)

I'm new to Qt and PyQt, so, please, bear with me :D

But, I tried to create a simple UI in the Qt Designer and I saved it as a .ui file on C:\

However, when I try to run this Python code:

from blur.wingui import Dialog

from PyQt4.QtCore import SIGNAL # Signal mapping method for Qt
from PyQt4.QtGui import QTreeWidgetItem # Don't need the other imports, all loaded in the Ui file

import PyQt4.uic # Loader file

from Py3dsMax import mxs # Bring in the maxscript module

class ObjectItem( QTreeWidgetItem ):
def __init__( self, msobject ):
QTreeWidgetItem.__init__( self, [ msobject.name ] )
self._msobject = msobject

# Add the children of this item
for child in msobject.children:
self.addChild( ObjectItem( child ) )

def msobject( self ):
return self._msobject

class TestDialog( Dialog ):
def __init__( self ):
Dialog.__init__( self )
PyQt4.uic.loadUi( 'C:\\tst.ui', self )

self._connect() # Connect the signals/slots
self.refresh() # Load the data

# Create the dialog
dialog = TestDialog()
dialog.show()

I get a TypeError:

TypeError: ('Wrong base class of toplevel widget', (<class '__main__.TestDialog'>, 'QMainWindow'))

Anyone knows what might be the problem?

instinct-vfx
10-23-2009, 07:22 PM
You used a window instead of a dialogue in the .ui file hence it is a different class.

Here's Working code. What i did is replace instances of Dialog with Window (including the import statement of course!). On a second note it would still error out because you are calling methods that you removed from the class declatration. I commented them out (refresh and _connect).


from blur.wingui import Window

from PyQt4.QtCore import SIGNAL # Signal mapping method for Qt
from PyQt4.QtGui import QTreeWidgetItem # Don't need the other imports, all loaded in the Ui file

import PyQt4.uic # Loader file

from Py3dsMax import mxs # Bring in the maxscript module

class ObjectItem( QTreeWidgetItem ):
def __init__( self, msobject ):
QTreeWidgetItem.__init__( self, [ msobject.name ] )
self._msobject = msobject

# Add the children of this item
for child in msobject.children:
self.addChild( ObjectItem( child ) )

def msobject( self ):
return self._msobject

class TestDialog( Window ):
def __init__( self ):
Window.__init__( self )
PyQt4.uic.loadUi( 'C:\\tst.ui', self )

#self._connect() # Connect the signals/slots
#self.refresh() # Load the data

# Create the dialog
dialog = TestDialog()
dialog.show()


Hope that helps,
Thorsten

SoLiTuDe
10-23-2009, 07:47 PM
Thanks Ian. That was what i was doing wrong before (using python.exec instead of run :shrug: )

Any chance we will also see the old tools beeing released again ? Like treegrunt and it's contents :P I only see the file structure not the actual tools.

Regards,
Thorsten

http://www.blur.com/blurbeta.html <<Old Tools are here

loocas
10-23-2009, 07:58 PM
Thanks a lot! :)

Yeah, as I said, no prior experience with Qt and I only noticed the Dialog class now. Will pay more attention to the Qt Designer next time.

Thanks! :beer:

You used a window instead of a dialogue in the .ui file hence it is a different class.

Here's Working code. What i did is replace instances of Dialog with Window (including the import statement of course!). On a second note it would still error out because you are calling methods that you removed from the class declatration. I commented them out (refresh and _connect).


from blur.wingui import Window

from PyQt4.QtCore import SIGNAL # Signal mapping method for Qt
from PyQt4.QtGui import QTreeWidgetItem # Don't need the other imports, all loaded in the Ui file

import PyQt4.uic # Loader file

from Py3dsMax import mxs # Bring in the maxscript module

class ObjectItem( QTreeWidgetItem ):
def __init__( self, msobject ):
QTreeWidgetItem.__init__( self, [ msobject.name ] )
self._msobject = msobject

# Add the children of this item
for child in msobject.children:
self.addChild( ObjectItem( child ) )

def msobject( self ):
return self._msobject

class TestDialog( Window ):
def __init__( self ):
Window.__init__( self )
PyQt4.uic.loadUi( 'C:\\tst.ui', self )

#self._connect() # Connect the signals/slots
#self.refresh() # Load the data

# Create the dialog
dialog = TestDialog()
dialog.show()


Hope that helps,
Thorsten

ehulser
10-23-2009, 10:13 PM
@ ypuech

Thanks for the windows icon code - I'll include it in the next release, its very cool - works in 3dsMax and XSI. Though, it doesn't seem to work in x64 bit, just x32.

@ instinct-vfx

Thanks for the tutorial - I uploaded it to the wiki:
http://code.google.com/p/blur-dev/wiki/Py3dsMaxCOMExecute?ts=1256323833&updated=Py3dsMaxCOMExecute

Thanks guys for helping debug and build this!

Eric

ehulser
10-23-2009, 10:15 PM
Also, we're in the process of porting our tools over to a new PyQt based treegrunt that'll run in both XSI & 3dsMax, so we will be updating our tools download soon enough.

Thanks guys!

loocas
10-25-2009, 08:04 PM
Unfortunately, this modification throws me the following error when I launch Max (2009 x64):

Traceback (most recent call last):
File "C:\Program Files\Autodesk\3ds Max 2009\scripts\python/__startup__.py", line 15, in <module>
blur.wingui.connectPlugin( Py3dsMax.GetPluginInstance(), Py3dsMax.GetWindowHandle() )
File "C:\Python26\lib\site-packages\blur\wingui\__init__.py", line 49, in connectPlugin
logger = LoggerWindow()
File "C:\Python26\lib\site-packages\blur\wingui\windows\LoggerWindow.py", line 283, in __init__
Window.__init__( self )
File "C:\Python26\lib\site-packages\blur\wingui\Window.py", line 25, in __init__
blur.wingui.applyCoreAppParentIcon(self)
File "C:\Python26\lib\site-packages\blur\wingui\__init__.py", line 127, in applyCoreAppParentIcon
maxIcon = SendMessage( core.parentWindow(), WM_GETICON, 0, 0 )
NameError: global name 'SendMessage' is not defined

It worsk without the modification though.

I'm on Windows Vista Business x64, Max 2009 x64 if it makes any difference.


In fact we could rename applyMaxIcon with applyCoreAppParentIcon(), because it tries to get the core application parent icon with its handle. So this would work for all applications:

def applyCoreAppParentIcon(widget):
dialogHandle = FindWindow( None, str(widget.windowTitle()) )

maxIcon = SendMessage( core.parentWindow(), WM_GETICON, 0, 0 )
if maxIcon == 0:
maxIcon = SendMessage( core.parentWindow(), WM_GETICON, 1, 0 )
if maxIcon == 0:
maxIcon = GetClassLong( core.parentWindow(), GCL_HICONSM )
if maxIcon == 0:
maxIcon = GetClassLong( core.parentWindow(), GCL_HICON )

if maxIcon != 0:
iconInfo = GetIconInfo(maxIcon)
pixmap = QPixmap.fromWinHBITMAP( iconInfo[4], QPixmap.NoAlpha )
pixmap.setMask( QBitmap( QPixmap.fromWinHBITMAP( iconInfo[3], QPixmap.NoAlpha ) ) )
widget.setWindowIcon( QIcon( pixmap ) )

In Dialog.py and Window.py, replace applyMaxIcon() with applyCoreAppParentIcon().

ypuech
10-26-2009, 10:21 AM
@loocas:

I forgot to add in the modification the import of SendMessage from win32gui module:

from win32gui import FindWindow, SendMessage, GetClassLong, GetIconInfo
from win32con import WM_GETICON, GCL_HICONSM, GCL_HICON

@ehulser:

I will try to make the icon code works under x64.

loocas
10-26-2009, 03:54 PM
@loocas:

I forgot to add in the modification the import of SendMessage from win32gui module:

from win32gui import FindWindow, SendMessage, GetClassLong, GetIconInfo
from win32con import WM_GETICON, GCL_HICONSM, GCL_HICON

Thanks for the fix, it doesn't throw the error now :) but the icon still doesn't show up. I assume that'll be the 64bit issue, as I'm on Vista Business x64, right?

ypuech
10-26-2009, 04:19 PM
Thanks for the fix, it doesn't throw the error now but the icon still doesn't show up. I assume that'll be the 64bit issue, as I'm on Vista Business x64, right?
Exact, I will try to fix it.

EDIT: I have found the problem but I don't know how to fix it yet.
To get an application icon, it seems GetClassLong( core.parentWindow(), GCL_HICONSM ) is the function returning the icon most of the time.
But GetClassLong() is deprecated under x64 and replaced by GetClassLongPtr. I have checked in Python 2.4 and 2.6 PyWin32 documentation and I have not found it...

Lukashi
10-27-2009, 01:47 AM
Hey Eric!
Thanks for this cant wait to play with it! Now we can make some nifty node based ui's using qpainter...
Cheers,
Lukas

ehulser
10-27-2009, 09:59 PM
@ lukashi

I would recommend using the QGraphicsScene & QGraphicsView

We've been developing our own node based GUI's using them and they are quite powerful, pretty much designed to handle such things.

At some point we'll be releasing that out as well....

Eric

Lukashi
10-28-2009, 02:16 AM
Ooops ya thats what i meant! Looking forward to those node based tools when they are ready!

instinct-vfx
10-28-2009, 08:07 AM
Now that sounds pretty cool Eric! If you dont mind me asking did you develop the node system as a plugin to Qt with PyQt bindings or completely in PyQt?

Regards,
Thorsten

ehulser
10-28-2009, 06:08 PM
Right now its all PyQt, quick prototyping, but if at any point we want to make it faster it'll be easy to port to C++

Soulcialism
10-29-2009, 03:05 PM
just wanted to drop a line saying how cool this is. i haven't had much of a need to learn python since max doesn't natively support it, but having this is really awesome and opens a lot of doors, very exciting for our pipeline here.

i used to live near you guys in venice and always wondered what was happening upstairs late at night when the lights were on, and now i know. i'm sure the brig loves you guys.

as a question that might actually contribute to the thread - do you guys have any issues distributing to lots of users internally? with 5 seperate installers, i foresee our artists getting easily confused with what to do when things change. i suppose the installers could be packaged up but i was curious to see if you guys had a fancy way to distribute and guarantee everyone is working with latest versions.

ehulser
10-29-2009, 05:38 PM
We actually use our render farm software to manage our installations.

We send out batch jobs through our job queue that have highest priority over render jobs so that when an artist slaves their box, the installer runs first.

We just make a variety of batch files to say what version of what software upgrade we want to run at any given time, tag whichever hosts we want to install on and ship off a job to get it done.

Since this is involving DLLs that max locks down, it works perfectly, because we don't allow a Max session to be running when we run our render farm slave, it ensures that the plugins can be properly written and will occur during an artists preferred time.

If we have to force something out through the studio immediately, we just send an email in conjunction with the job asking people to slave their boxes as soon as possible.

Next step we're working on is a centralized way to update the database on a per box basis to know what version of what software is installed on any given box, so we can see if a user has or has not slaved/been updated easily.

Zbuffer
10-31-2009, 11:04 AM
Hi,

I am trying to get Py3dsmax to run, but it fails...
XP32 - 3dsmax 2009

here is what I did:

installed Python 2.4.4 (python-2.4.4.msi)
installed Qt (qt-win-opensource-4.5.3-mingw.exe)
installed Blur Dlls (qt_install_4.5.2-1_win32-msvc2008.exe)
installed Blur PyQt (PyQt4-gpl-snapshot-20090412_win32-msvc2008.exe)
installed Blur Libs (blur_libs_install_8851_win32-msvc2008.exe)
installed Blur Python (blur_pyqt_modules_install_8851_win32-msvc2008.exe)
installed Py3dsMax (Py3dsMax2009_python24_x32_install_8678.exe)


When I launch Max, I get the following error:

MAXScript Mini ListenerTraceback (most recent call last):
File "D:\3D\3ds Max 2009\scripts\python/__startup__.py", line 12, in ?
import blur.wingui
File "C:\Python24\lib\site-packages\blur\wingui\__init__.py", line 22, in ?
from PyQt4.QtCore import QCoreApplication
ImportError: DLL load failed: The specified procedure could not be found.
-- Error occurred in anonymous codeblock; filename: D:\3D\3ds Max 2009\scripts\startup\__init_py__.ms; position: 2473
-- Frame:
-- runScriptACT: undefined
-- newScriptACT: undefined
-- menuBar: undefined
-- subMenuIndex: undefined
-- openScriptACT: undefined
-- loggerACT: undefined
-- scriptPath: "D:\3D\3ds Max 2009\scripts\python"
-- pyMenu: undefined
-- subMenuACT: undefined
-- Error occurred during fileIn in <File:D:\3D\3ds Max 2009\scripts\startup\__init_py__.ms>
>> MAXScript Auto-load Script Error - D:\3D\3ds Max 2009\scripts\startup\__init_py__.ms Exception: -- Runtime error: Python Exception: Traceback printed in listener. <<


What Am I doing wrong ?

SoLiTuDe
10-31-2009, 06:48 PM
Just makin' sure: do you have Pyqt in this folder? C:\Python24\lib\site-packages\
Also, If you open python 2.4 (just run python from that python folder) and you type import PyQt4 or import blur does it give you an error?

Also, if you just type " python " into the maxscript listener does that come back with anything? --If not that means the plugin wasn't copied to the right location (check c:\max2009 or similar (and make sure the plugin is loading) I don't think it's this because I think it usually just says Blur Python Not Loaded on startup, not error like that... but thought I'd throw it in anyway.

ehulser
10-31-2009, 07:02 PM
Hey - that sounds like your setup is not finding the Qt DLLs in your PATH environment variables - you should make sure that c:/blur/common is in your PATH and it comes before any other Qt path information

Zbuffer
11-01-2009, 07:45 AM
Hi,

C:\blur\common is 1st in PATH environment variable
(there isn't any other Qt path information)

in C:\Python24\Lib\site-packages
I have 2 folders
blur
PyQt4

The plugin loads fine

When I type 'python' in the listener, I get the struct:
#Struct:python(
run:<fn>,
exec:<fn>,
reload:<fn>,
import:<fn>)


Directory of C:\Python24\Lib\site-packages

31/10/2009 11:03 <DIR> .
31/10/2009 11:03 <DIR> ..
31/10/2009 11:41 <DIR> blur
31/10/2009 11:10 <DIR> PyQt4
31/10/2009 11:03 48,361 pyqt_uninstall.exe
28/10/2005 20:15 121 README.txt
18/07/2009 00:32 55,808 sip.pyd
3 File(s) 104,290 bytes
4 Dir(s) 2,642,333,696 bytes free

C:\Python24\Lib\site-packages>python
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4
>>> import blur

When I type 'import PyQt4', no errors show up,
When I type 'import blur', I get an error messagebox:
python.exe - Entry Point Not Found
The procedure entry point ??BQByteRef@@QBE?BDXZ could not be located in the dynamic link library QtCore4.dll

Am pretty much lost...

labbejason
11-01-2009, 05:12 PM
Whenever I try to execute this script, Python closes down without any warnings or errors (came from Blur's PyQt and 3dsMax tutorials) :

# Use the blur.wingui package vs. the default PyQt4 packages for windows and dialogs
# because these items contain 3dsMax specific code needed to run

from blur.wingui import Dialog
from PyQt4.QtGui import QPushButton

# Create the dialog
dialog = Dialog()
button = QPushButton( dialog )
button.setText( 'Test' )

# Launch the dialog
dialog.show()

I'm using Python 2.6. I'm able to import blur and PyQt4 modules no problem, so not too sure why it's crashing on me like that. Any ideas?

ehulser
11-01-2009, 05:36 PM
you guys are all running into the DLLs not loading properlly - whenever you hit a problem like this, could you just create an issue on the blur-dev.googlecode.com website so we have them tracked? You'll also be asked for OS versions, max versions, python versions etc. so we can debug.

That way we don't bog down the thread w/ issue requests - thanks guys! Sorry for the errors - we'll look into them soon as we can.

SoLiTuDe
11-01-2009, 09:51 PM
Whenever I try to execute this script, Python closes down without any warnings or errors (came from Blur's PyQt and 3dsMax tutorials) :

# Use the blur.wingui package vs. the default PyQt4 packages for windows and dialogs
# because these items contain 3dsMax specific code needed to run

from blur.wingui import Dialog
from PyQt4.QtGui import QPushButton

# Create the dialog
dialog = Dialog()
button = QPushButton( dialog )
button.setText( 'Test' )

# Launch the dialog
dialog.show()

I'm using Python 2.6. I'm able to import blur and PyQt4 modules no problem, so not too sure why it's crashing on me like that. Any ideas?

How are you trying to exec the script? Just via python.exec() or do you actually have the script editor opening in max? --I'm sure Eric is right, especially since he wrote it, but I'm just thinking that the python logger and script editor inside of max wouldn't come up if you're getting those errors anyway, and just wanted to narrow it down.

labbejason
11-02-2009, 01:13 AM
How are you trying to exec the script? Just via python.exec() or do you actually have the script editor opening in max? --I'm sure Eric is right, especially since he wrote it, but I'm just thinking that the python logger and script editor inside of max wouldn't come up if you're getting those errors anyway, and just wanted to narrow it down.

..Farnsworth! *shakes fist*

I figured it out, it was my mistake. I was executing it from Python's Idle instead from max :). Actually, should the dialog still show up when executing from Python though?

The python script editor within Max is really cool, Eric! I do get an error message when trying using 'open script..', but I'm going to check out the known issues in the blur wiki to see if I can figure it out. The error reads:

Traceback (most recent call last):
File "<string>", line 1, in ?
File "C:\Python24\lib\site-packages\blur\wingui\__init__.py", line 83, in openScript
fileName = str( QFileDialog.getOpenFileName( PyQWinHook.core, 'Open Script File', LAST_FILENAME, 'Python Files (*.py);;All Files (*.*)' ) )
NameError: global name 'PyQWinHook' is not defined

Anyhow, this is really cool stuff. Excited to get into it.

EDIT: Did what it said in the known issues document, and presto, it now works.

SoLiTuDe
11-02-2009, 01:57 AM
Labbe!!! *Shakes fist back at you*

I think the blur module calls specific stuff for 3ds max, but I don't see why there wouldn't be a way to get the gui to come up outside of max anyway, but with that, I'm guessing that it might take a little bit of work to get it working outside of max. That should def be an option though, especially for something a little more cross platformish that won't necessarily run inside of max. I'm sure there's an easy enough way to code the gui to call blur.wingui if running inside of max, but call regular ol' pyqt dialogs and windows otherwise. Not sure.. Eric is the masta... he'll know.

ehulser
11-02-2009, 04:41 AM
Yeah, you can definitely develop a way to have things work inside/outside of max. You don't NEED to use a Dialog vs. a QDialog, you can see the things I've sublcassed in the blur.wingui.Dialog module, but mostly its a way to handle some of the 3dsMax hotkey disabling (which I still need to improve anyway...)

Easiest way to know is to just try/catch an import of mxs


mxs = None
try:
from Py3dsMax import mxs # will work if inside of max
from blur.wingui import Dialog # use the maxscript one
except:
from PyQt4.QtGui import QDialog as Dialog # bring in a standard one for external tools

from PyQt4.QtGui import QLineEdit

class MyDialog( Dialog ):
def __init__( self, parent = None ):
Dialog.__init__( self, parent )

self.resize( 400, 100 )

self._filename = ''
if ( mxs ):
self._filename = mxs.maxFilePath + mxs.maxFileName

edit = QLineEdit( self )
edit.setText( self._filename )

if ( mxs ):
MyDialog().show()
else:
# For external apps, need to instance a QApplication manually
from PyQt4.QtGui import QApplication
app = QApplication([])
dialog = MyDialog()
dialog.show()
app.exec_()

ehulser
11-02-2009, 04:46 AM
Also - the reason Python was shutting down on you while you were running that code is because there was no QApplication initialized.

I am managing all the QApplication instances and general Qt initialization inside of 3dsMax, but if you are going to develop code that'll run inside and outside, you'll need to include Qt initialization code - namely, you cannot create instances of any class from the QtGui package before you initialize a QApplication, and you can only run 1 QApplication instance.

The one that runs from the blur.wingui plugin can be accessed by calling


blur.wingui.app # QApplication Instance
blur.wingui.core # QWinWidget Instance that is the parent widget of all QWidgets in max
blur.wingui.logger # The 3dsMax python logger window
blur.wingui.progress # multi progress bar widget

MSchmeling
11-07-2009, 05:43 PM
I can't tell you how grateful I am for this plugin. I have started building a sophisticated plugin and I am so happy that I can do it in Python! It arrived exactly at the right moment!

Thanks!

mkl3139
11-09-2009, 10:56 PM
I can't wait to finally work with python in max, but i'm running into some issues. Has anyone gotten this to work for max 2009 xp 32 bit? I'm only getting the "BlurPython has not been loaded" error on startup. I don't see the BlurPython24.dlx in the plugin manager either.

MSchmeling
11-10-2009, 10:50 AM
How do you specify flags in a function call, like '#select' in the following call?

mergeMAXFile "test.max" #select

ypuech
11-10-2009, 04:24 PM
How do you specify flags in a function call, like '#select' in the following call?

mergeMAXFile "test.max" #select

This problem was solved by Eric creating a new function called namify():
http://forums.cgsociety.org/showpost.php?p=6163215&postcount=31

MSchmeling
11-10-2009, 04:52 PM
Ah, thanks! I hadn't seen this.

ehulser
11-10-2009, 06:59 PM
I can't wait to finally work with python in max, but i'm running into some issues. Has anyone gotten this to work for max 2009 xp 32 bit? I'm only getting the "BlurPython has not been loaded" error on startup. I don't see the BlurPython24.dlx in the plugin manager either.

You may be loading your plugin.ini differently than what is expected. In 3dsMax 2008+ they changed their user plugin location to your documents & settings folder, if you hunt around for your plugin.ini, you should be able to add under [DIRECTORIES] blur=.\plugins\blur and it should work.

MSchmeling
11-11-2009, 09:47 AM
What would be the way to call a max command like

max zoomext sel




I tried various ways which seemed more or less logical, but none worked.

ypuech
11-11-2009, 10:03 AM
I think the easiest way is:

python.exec("mxs.execute('max zoomext sel')")

MSchmeling
11-11-2009, 01:53 PM
I think the easiest way is:

python.exec("mxs.execute('max zoomext sel')")

Duh... I didn't know there was an 'mxs.execute' function... I don't know MAXScript that well... Thanks.

instinct-vfx
11-12-2009, 08:20 AM
Bevore i dive into it for no reason, is there any way to do scripted plugins/object types already ?

Regards,
Thorsten

Dubbie
11-12-2009, 07:16 PM
I'm holding my breath for a 2010 build.

I'm turning blue!

instinct-vfx
11-12-2009, 07:19 PM
2k10 builds are available. As far as i can tell there's R9/2008, 2009 and 2010 available

Any issues you ran into ?

Regards,
Thorsten

Dubbie
11-12-2009, 07:30 PM
Where?

http://code.google.com/p/blur-dev/downloads/list

I can only see up to 2009 here.

ypuech
11-12-2009, 07:39 PM
Where?

http://code.google.com/p/blur-dev/downloads/list

I can only see up to 2009 here.
Yes, maybe the installers named 3dsMax10 are confusing.
...
3ds Max 9 (= 2007)
3ds Max 10 = 2008
3ds Max 11 = 2009
3ds Max 12 = 2010

SoLiTuDe
11-12-2009, 07:48 PM
There's no max 2010 build (yet), yes you are correct in that max10 = max2008 :D

Dubbie
11-12-2009, 07:57 PM
I'm willing to send cake to Eric if he recompiles a 2010 version
:)

ehulser
11-12-2009, 08:42 PM
@ Dubbie - Sorry for the delay on the 2010 guys, we don't have it here so compiling & testing is low on our priority list, but I'll try and do it next week - will keep you posted

@ Thorsten - as of right now there isnt a way to do anything that is parser based (rollouts,attributes,scripted plugins,etc.) For now, the only real work around is to define it in maxscript and load it in python.

instinct-vfx
11-13-2009, 07:24 AM
Thanks Eric, prolly saved me a bunch of trial and error :D That would be a nice touch for future releases. Controllers, PyScripted Objects/Helpers/whatever etc.

Btw, any new plans on releasing that node framework ? (and nope am not gonna stop asking :P )

Kind Regards and thanks again...btw the more i think about it the more possibilities pop up. Yesterday i did a quick test creating nodes in nuke from max...and even tho that's pretty pointless it was great fun :P

Regards,
Thorsten

instinct-vfx
11-13-2009, 03:28 PM
teeeeeeeeeeeeeeeeease :P

SoLiTuDe
11-13-2009, 03:30 PM
Btw, any new plans on releasing that node framework ? (and nope am not gonna stop asking :P )

Kind Regards and thanks again...btw the more i think about it the more possibilities pop up. Yesterday i did a quick test creating nodes in nuke from max...and even tho that's pretty pointless it was great fun :P

Regards,
Thorsten

You can start making your own Node Based Gui already, ya know... just gotta take some time to program it the way you want it. :D The one Eric has set up looks nice though, and he took some extra time to add in some cool features... might take some time to be made "portable"

instinct-vfx
11-13-2009, 03:51 PM
Seems i answered to quick and the forum is mixing up reply order...the above reply was meant to come AFTER Solitude's reply of course heh

SoLiTuDe
11-13-2009, 05:03 PM
haha... that's been happening a lot lately. :D

loocas
11-17-2009, 11:05 PM
Oh, man!

I upgraded to Windows 7 and tried to install BlurPython again, but this time I'm really having problems getting the dlx load up in Max!

For some reason, it just doesn't load up at all! Nothing!

I have the correct path to the plugin in the plugin.ini, I have the libs installed in System32 etc... but the plugin doesn't load up in Max 2009 x64.

Anyone know a reason why this might be? :banghead:

Thanks a lot in advance!

luigi
11-18-2009, 12:43 AM
be sure in the root of max

the ini file: installsettings.ini

one of the lastest lines

useUserProfiles=0

if is useUserProfiles=1

you are loading data for a crazy place in your local settings.

that for sure what si not loading.you are using the plugin.ini for the enu folder not the one in max route.

instinct-vfx
11-18-2009, 01:10 PM
Just a quick question while i am in the progress of doing the first Python conversions for tools (YAY!). Is the installer problem regarding erasing the Path Variable fixed ? Just wondering as i dont wanna deploy on artists machines and get them all borked :P

Regards,
Thorsten

Edit: Oh and just stumbled over another question. Are there any plans to maybe use pyside instead of PyQt in the not so near future ? For one it will be lgpl like Qt, it is backed by Nokia itself and will prolly be more pythonic after the first release (wich is supposed to be API compatible with PyQT). With PyQT still beein GPL this seems like a nice option to me!

ehulser
11-18-2009, 07:11 PM
@ loocas - right now we're not supporting Vista x64 +, mainly because I dont have access to it to build the writeup on how to install it. The DLLs should work but the installers probably need tweaking and we don't have any test OS to run it on

@ luigi - thanks for that bit of info - I forgot we do that here already and is the cause of some of the installation headaches

@ thorsten - I don't have a reproducable case of the path variable being reset - we've never run into that on any of my installations....

As for pyside, I'm sure we'll shift things over to it at some point, we haven't seen the need to do it yet, but as it matures, it will probably replace PyQt, and we'll update at that point. Everything I've read leads me to believe it should be pretty much as easy as a mass find & replace w/ some minor bug checks

instinct-vfx
11-18-2009, 07:18 PM
Very very cool Eric. Great stuff and am still playing with doing some custom widgets and messing things up...great fun :)

I'll just try on a spare box and see if it'll reset the path there too. Eventually something else caused it...more to come!

Regards,
Thorsten

Dubbie
11-18-2009, 07:37 PM
Eric, if you want to just swap out the 2010 SDK in VS and hit compile for x64, I'm more than happy to test everything for you. ;) I won't blame you if anything breaks!

loocas
11-19-2009, 08:54 AM
@ loocas - right now we're not supporting Vista x64 +, mainly because I dont have access to it to build the writeup on how to install it. The DLLs should work but the installers probably need tweaking and we don't have any test OS to run it on

I understand that, but the weird thing is I got it running perfectly fine under Vista x64, however, doing the same steps, I can't seem to get blurPython running under Windows 7 x64.

I tried to force-load the .dlx in Max and it threw:

http://www.duber.cz/dump/blurPython_error.png

Any idea why it might trhow this error? :shrug:

Also, perhaps, providing the dlls etc... without the installers might help some of the more "adventurous" types to try to get it up and running under various OS versions. :lightbulb

Anyways, keep rocking, guys! :buttrock:

loocas
11-19-2009, 09:12 AM
be sure in the root of max

the ini file: installsettings.ini

one of the lastest lines

useUserProfiles=0

if is useUserProfiles=1

you are loading data for a crazy place in your local settings.

that for sure what si not loading.you are using the plugin.ini for the enu folder not the one in max route.

Unfortunately that's not the problem (see above). I'm not using user profiles and my INIs are loading properly (I load tons of stuff with them).

instinct-vfx
11-19-2009, 09:20 AM
Could it be that the Blur DLLs arent loaded (the ones going to the system dirs) ?
I wouldnt know for 7, but has the location for DLLs changed ?

Regards,
Thorsten

loocas
11-19-2009, 09:30 AM
Could it be that the Blur DLLs arent loaded (the ones going to the system dirs) ?
I wouldnt know for 7, but has the location for DLLs changed ?

Regards,
Thorsten

Yeah, I think so too, but why shouldn't they load up in Windows 7, but they did in Windows Vista? W7 is "just" a cosmetic update to Vista (well, that's an understatement, but still).

http://www.duber.cz/dump/blurPython_dlls.png

instinct-vfx
11-19-2009, 09:44 AM
Next Guess, Python/Qt not working correctly ?

loocas
11-19-2009, 10:01 AM
Next Guess, Python/Qt not working correctly ?

Hmm. I don't know. Python and Qt seem to be working just fine from the IDLE/CMD line. :banghead:

This is such a pitty. BlurPython seems to be the perfect answer to all our prayers as to having Python FINALLY implemented in 3ds Max, but on the other hand, since it's privately developped and not OpenSource, it's something you can't rely on in a production environment.

I can't build my entire pipeline on this as:

1) What if Blur decides not to release new versions anymore?

2) What if Blur will never upgrade to Max v. XYZ that we're using?

3) What if there's a bug we can't workaround that holds us back?

4) What if Blur changes the lic. policy that we won't be able to follow?

etc... etc...

Don't get me wrong, this is a HELLUVA awesome job you've done, blur guys! And I very, very much appretiate it. But to us outside Blur, it's "just a toy", not really a production tool. :cry:

ehulser
11-19-2009, 04:58 PM
Well - the end goal with this is to actually get Autodesk to pick it up and just build it in...we'll see how well that works out...

As for the error you're getting, its got nothing to do with Qt or PyQt. The DLLs we install that require the path changes won't actually be accessed until running the Python scripts from within the scripts in [max]/scripts/python/__startup__.py

The blurPython26.dlx itself doesn't have any Qt dependencies, its only linked to the 3dsMax & Python26 Libs

You have to make sure that you have Python26 x64 installed and that the path within your registry properly points to the installation path, I don't know how windows 7 works and if its changed, but for the others its at HKLM->Software->Python->2.6-> and then click the different variables to make sure your paths are correct. I've run into problems having multiple pythons installed with customized path locations where the registry is wrong, but if I run python from its install folder, it works just fine.

All that you really need to run python in max is the blurPython26.dlx itself, you just won't have any gui support.

To test it, you can strip out all else from the installer - the stuff in [max]/scripts/python/ & [max]/scripts/startup/__init_py__.ms

Run max, and in the listener just type: python

That should show you a global struct that the DLL registered. But you dont need to mess with the PATH variable, or Qt/PyQt installs to fix the error you're seeing.


As for open sourcing - its always been our plan to release the source code and support future versions, I still have to clean and document everything, and its still a work in progress.

loocas
11-19-2009, 05:22 PM
Well - the end goal with this is to actually get Autodesk to pick it up and just build it in...we'll see how well that works out...

As for the error you're getting, its got nothing to do with Qt or PyQt. The DLLs we install that require the path changes won't actually be accessed until running the Python scripts from within the scripts in [max]/scripts/python/__startup__.py

The blurPython26.dlx itself doesn't have any Qt dependencies, its only linked to the 3dsMax & Python26 Libs

You have to make sure that you have Python26 x64 installed and that the path within your registry properly points to the installation path, I don't know how windows 7 works and if its changed, but for the others its at HKLM->Software->Python->2.6-> and then click the different variables to make sure your paths are correct. I've run into problems having multiple pythons installed with customized path locations where the registry is wrong, but if I run python from its install folder, it works just fine.

All that you really need to run python in max is the blurPython26.dlx itself, you just won't have any gui support.

To test it, you can strip out all else from the installer - the stuff in [max]/scripts/python/ & [max]/scripts/startup/__init_py__.ms

Run max, and in the listener just type: python

That should show you a global struct that the DLL registered. But you dont need to mess with the PATH variable, or Qt/PyQt installs to fix the error you're seeing.


As for open sourcing - its always been our plan to release the source code and support future versions, I still have to clean and document everything, and its still a work in progress.

Now this is great news, Eric! Really, KUDOS for all that!

I hope ADSK will pick it up, it's becoming a must for 3ds Max TDs nowdays.

As for the Python path. I didn't know it was looking into the registry for the path actually, I don't have anything in the REG regarding Python (resp. under the HKLM > Software > ....).

Can you, please, show me a screenshot what the reg. key hierarchy should look like? I'll add it manually, but I don't know what's the correct format. I thought that only a PATH variable would be enough though.

Thanks a lot again, much appretiated! :thumbsup:

ehulser
11-19-2009, 05:46 PM
Here are the screengrabs:
http://forums.cgsociety.org/attachment.php?attachmentid=148394&stc=1

And:

http://forums.cgsociety.org/attachment.php?attachmentid=148395&stc=1
http://forums.cgsociety.org/attachment.php?attachmentid=&stc=1

loocas
11-19-2009, 06:40 PM
Here are the screengrabs:
http://forums.cgsociety.org/attachment.php?attachmentid=148394&stc=1

And:

http://forums.cgsociety.org/attachment.php?attachmentid=148395&stc=1
http://forums.cgsociety.org/attachment.php?attachmentid=&stc=1


Thank you very much again Eric, I appretiate it.

I assume I'll have to at least log off/on or restart Windows, since adding those lines and restarting Max didn't help. :banghead:

I'll let you know if restarting the machine helps (can't do it right now).

Raven5326
11-24-2009, 02:02 AM
Any plans for making this work with Max 2010?

dgsantana
11-24-2009, 10:23 AM
A 3dsmax 2010 would be great, i haven't tried Python since we already use Max 2010 in production, and it's no used to start coding tools in python if there will be no "support" for newer versions of max. ;)

Best regards,
Daniel

instinct-vfx
12-07-2009, 01:35 PM
Hey there, got a bit silent here. Is feedback/discussion best sent here or to the google code page ?

Anyways. One thing i didnt manage to get to work is feeding results back into the external editor with my Komodo Integration. So i'd like to output COM errors/maxscript output back to the results tab. I assume i'd have to get the maxside (execute_py.ms) to hand the data back to the python commandline (execute.py) so this one can pipe it back to komodo. Any ideas ?

Kind Regards,
Thorsten

MSchmeling
12-11-2009, 03:32 PM
Is there a way to use the

in coordsys ...
{
}

feature from maxscript in Python?

ehulser
12-23-2009, 05:16 AM
Sorry for the silence guys - been busy wrapping up the year.

But, in light of the Christmas spirit, we have just released the system for 3dsMax 2010 (x32 and x64).

Its available for download at our site http://blur-dev.googlecode.com

Still beta - it seems 3dsMax 2010 also now comes with its own Qt DLLs which clash with ours - so far it hasn't been a problem simply renaming their Qt DLLs to *.bak so it loads ours, but if anyone runs into problems - please let us know.

The DLLs are found in the [maxroot]/Qt*.dll (QtCore4.dll, QtGui4.dll, QtNetwork4.dll, QtXml4.dll) i believe

@ MSchmeling - I'll have to look into that, but probably not right now - anything that is parser based has a workaround, but I don't know what it is off hand, it may need custom methods.

@ instict - I haven't done much by way of IDE integration, so I can't really help unfortunately...

Merry Christmas Everyone!

ypuech
12-24-2009, 02:02 PM
Thanks for the release of the system for 3dsMax 2010.

Does somebody knows the reason of these Qt DLLs in 3dsMax root directory in version 2010 ?
Dependencies of a third party plugin ?

SoLiTuDe
12-25-2009, 12:48 AM
Thanks for the release of the system for 3dsMax 2010.

Does somebody knows the reason of these Qt DLLs in 3dsMax root directory in version 2010 ?
Dependencies of a third party plugin ?

No idea what's using Qt in 2010... I'll go through the new features at some point and see if anything breaks when there aren't an Qt dlls to load. :)

As a heads up, I did have an issue with the 2010 Py3dsMax -- Installation was fine, but a script I made works in 2008x64 but is erroring out (some stupid exception) on 2010x64 (I haven't tried and probably won't try 32bit) I already gave Eric the script / file to test.

MSchmeling
12-26-2009, 07:05 PM
Thanks for the reply, Eric.

I think I found a major memory leak (Max 9 32 bit).
It seems that iterators which return Max objects do not free memory correctly.
To illustrate this, run the following code snippet on an Editable Poly object:

for i in xrange(1000000):
for f in obj.faces:
f = f

The code does nothing useful, it serves only to illustrate the problem.
If you run it, Max allocates more and more heap memory, until it eventually
stops with an out of memory error or blows up.

Is it possible that *every* object returned from Max is not correctly freed? I suspect it.

This is a big problem, because I use the plugin to create some complex geometry
and often iterate over faces, edges and vertices. With this bug I currently can't create objects with more
than approx. 15000 faces.

SoLiTuDe
12-26-2009, 09:39 PM
^ I've actually noticed the same thing, and reported it with my last file... thought it was just my script, and haven't tested otherwise, but it appears you're running into the same thing I was.

ehulser
12-27-2009, 04:18 PM
Thanks for the catch guys - I will definitely look into the memory leak problem when I get back to the studio in January.

That is most definitely a big problem.

MSchmeling
12-28-2009, 09:29 AM
If you create a plane and specify the number of segments, the plugin always multiplies the specified number of segments by four.


obj = mxs.plane()
obj.lengthsegs = 1
obj.widthsegs = 1

creates a plane with 4x4 segments instead of 1x1.

The same code in maxscript works correctly:

obj = plane()
obj.lengthsegs=1
obj.widthsegs=1

so I assume there is a little bug in blurPython.

ehulser
12-28-2009, 09:07 PM
Are you basing that off the visible scene item?

Python won't refresh your scene - a max plane is built with a default of 4x4, if you add an mxs.redrawViews() it might fix your problem.

At any rate - that exact chunk of code works exactly as expected for me...

Could you let me know what version of the plugin & 3dsMax you are running? x32/x64 as well?

Thanks

MSchmeling
12-29-2009, 09:12 AM
You are right... I can't reproduce it this morning. Hm.... Maybe I got Max into some confused state, I don't know.
Anyway, sorry for the confusion, and thanks for your patience!

duke
01-12-2010, 11:51 PM
While I applaud the effort, i think i'll leave this alone and come back to it later. It's been a complete disaster for me - it overwrote my plugin.ini, and the base python install let alone any of the modules was touch and go as to whether it worked or not. That, and the Max plugin didn't ever load.

operator23
01-15-2010, 06:06 PM
Trying to get these tools up and running in max, but keep running in to this error. Any help? (Vista_x64/Max2010_x64)

MAXScript Mini ListenerTraceback (most recent call last):
File "C:\Program Files\Autodesk\3ds Max 2010\scripts\python/_startup.py", line 20, in <module>
import blur.wingui
ImportError: No module named blur.wingui
-- Error occurred in anonymous codeblock; filename: C:\Program Files\Autodesk\3ds Max 2010\scripts\startup\init_python.ms; position: 2341; line: 67
-- Frame:
-- scriptPath: "C:\Program Files\Autodesk\3ds Max 2010\scripts\python"
-- subMenuIndex: undefined
-- pyMenu: undefined
-- loggerACT: undefined
-- newScriptACT: undefined
-- menuBar: undefined
-- runScriptACT: undefined
-- openScriptACT: undefined
-- subMenuACT: undefined
-- Error occurred during fileIn in <File:C:\Program Files\Autodesk\3ds Max 2010\scripts\startup\init_python.ms>
>> MAXScript Auto-load Script Error - C:\Program Files\Autodesk\3ds Max 2010\scripts\startup\init_python.ms Exception: -- Runtime error: Python Exception: Traceback printed in listener. <<

ehulser
01-18-2010, 12:23 AM
you need to make sure that your python path is registered properly - by default, our x64 installs will install the blur module to:

c:/python26_64/lib/site-packages/blur

odds are though, if you are using a standard python26 x64 installation, your path is:

c:/python26/lib/site-packages/

You should be given the option to switch the paths when you run the installer, but if you didn't this might be the cause...if it is, you can just copy everything from:

c:/python26_64 >> c:/python26

ehulser
02-05-2010, 01:22 AM
Hey guys,

I have just put latest (and much more stable) builds up for all versions of 3dsMax (x32/x64) on the blur-dev website.

I've also finished cleaning up all the source code for the blurPython.dlx, and that is now available on the website as well.

I just gave this installers to a guy working with 3dsMax 2010 x64 on Windows 7, and it all worked for him just fine....so fingers crossed.

http://blur-dev.googlecode.com/

Eric

operator23
02-05-2010, 02:30 AM
Thanks mate, will give it a shot.

SoLiTuDe
02-05-2010, 02:57 AM
Wow... I really don't have a life... lol Thx for the update!

also, any word on blurdlx?

instinct-vfx
02-05-2010, 07:50 AM
Very cool Eric, thanks a lot!! :bounce:

Kind Regards,
Thorsten

loocas
02-20-2010, 02:32 PM
Hey! Thanks a lot for the sources, this is awesome! I hope it does what I want it to do, i.e. running maxscript commands from within Python. If so, this might prove to be an uber-powerful Python module for Max users!

Thanks a lot mate! :beer:

SoLiTuDe
02-20-2010, 05:18 PM
Hey! Thanks a lot for the sources, this is awesome! I hope it does what I want it to do, i.e. running maxscript commands from within Python. If so, this might prove to be an uber-powerful Python module for Max users!

Thanks a lot mate! :beer:

That's what it's meant for. :)

loocas
02-20-2010, 06:56 PM
That's what it's meant for. :)

Unfortunately I haven't had luck getting it to work the way I want.

The thing is, we've developed a different Python integration for 3ds Max in-house, but right now, it's working the way that from within 3ds Max I can call Python scripts and pass them 3ds Max variables. The bridge then converts the variables to Python compatible ones and processes the Python script. Then, whatever the script outputs gets converted back to MAXScript.

This has worked flawlessly so far, however, I'm not able to call Max functions (or whatever) from within Python scripts directly. This isn't implemented in our plugin, yet. So I though I'd use this one instead, but I haven't had any luck getting it to work the way I need.

Or maybe I'm assuming it works differently than it actually does?

Also, the plugin of ours is entirely 3ds Max independent. It was written in C# and uses .NET extensively. We're bridging IronPython with 3ds Max, due to obvious, .NET, reasons. So, this might also be a problem. And also I haven't had luck getting Win32 modules to work in IronPython, but that might be a different issue, though.

I hope to be able to show some of our 3ds Max Python efforts soon. Just need to iron out some last kinks. :)

SoLiTuDe
02-20-2010, 07:42 PM
If you look at the examples, you'll get a better idea of how it's integrated. You need to do the "from Py3dsMax import mxs" and then all maxscript functions get called from the mxs module. ie: mxs.getnodebyname or mxs.selection... etc.

http://code.google.com/p/blur-dev/wiki/Py3dsMaxTutValues

The way I understand it, and Eric will be the one to say for sure, is that this is a plugin that looks up the hash table of maxscript variables in the same way that maxscript itself does via the sdk.... hence it being a 3dsmax plugin. Of course he's also added all the awesome pyqt integration as well. :D

loocas
02-20-2010, 08:21 PM
If you look at the examples, you'll get a better idea of how it's integrated. You need to do the "from Py3dsMax import mxs" and then all maxscript functions get called from the mxs module. ie: mxs.getnodebyname or mxs.selection... etc.

http://code.google.com/p/blur-dev/wiki/Py3dsMaxTutValues

The way I understand it, and Eric will be the one to say for sure, is that this is a plugin that looks up the hash table of maxscript variables in the same way that maxscript itself does via the sdk.... hence it being a 3dsmax plugin. Of course he's also added all the awesome pyqt integration as well. :D

Thanks for the info, I appretiate it.

However, it seems that I've finally nailed a strict dotNET Interop communication between IronPython and 3ds Max, so, I won't need Eric's plugin, even though it'd be much, much more powerful and easier to script with.

Anyways, thanks again, your help is much appretiated!

NoFlame
02-23-2010, 04:10 PM
Hi guys~ How can i use double byte character (IE. chinese word) in Blur python editor ?
I try it all day... with no luck. Never success.
always get error message:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u4f60' in position 5: ordinal not in range(128)
can someone point me a way?

ehulser
03-01-2010, 03:13 AM
@ NoFlame -

That I have no idea about...I've never needed to do such a thing. Is the character in a string? How is it being created?

All the code for the python editor can be found in [python_path]/lib/site-packages/blur/wingui

instinct-vfx
03-24-2010, 10:53 AM
Hey there,

i just realised that there are new installers and it seems there is a naming change ? What is BlurOffline ? Replacing BlurCore and BlurLibs ? Sadly it isnt available for Max 2k8 it seems. Any insight Eric ?

Kind Regards,
Thorsten

SoLiTuDe
03-24-2010, 02:47 PM
^ Those are the blur tools (all the maxscripts and some plugins compiled for 2010), along with the latest max python plugins.

instinct-vfx
03-25-2010, 08:52 AM
Hm. Thanks Solitude, but then the current downloads are missing the blurlibs package ? it is only available as deprecated ? Do i use the old ones or are they included in other installers now ? gotta agree that i am a tad confused lol

Regards,
Thorsten

SoLiTuDe
03-25-2010, 02:33 PM
Hm. Thanks Solitude, but then the current downloads are missing the blurlibs package ? it is only available as deprecated ? Do i use the old ones or are they included in other installers now ? gotta agree that i am a tad confused lol

Regards,
Thorsten

You'll still need all the other python stuff... That package is for the max side of things only (blur tools + py3dsmax plugin). So (If I'm right ) you shouldn't need Py3dsMax2010_python26_x64_install_9051.exe anymore for example. But for max2008, you'd still have to use Py3dsMax10_python26_x64_install_9051.exe atm. Eric will have to answer whether they will continue to support 2008 or not.

T1ckL35
04-16-2010, 11:12 AM
Hi,
I'm interested in trying out the blur python libraries but they aren't currently available on the google code pages. Do you have any idea when the downloadable executables will be back online?

Cheers
Si

jedie
04-16-2010, 11:29 AM
from index page:
03.29.2010 - Site Down for Updates Hey guys, I have taken down all the installations today for a general cleaning. I'll be uploading latest installers, code, and updating the wiki this week - so check back soon. Eric

ehulser
04-16-2010, 06:34 PM
Sorry for the delay guys, we've been having some issues with the installers wiping out config settings and such things, and so im trying to consolidate everything into a single installer (for the blur stuff, pyqt/qt will still be separate) but it was a bit confusing as it was.

I'll post on here when I re-upload

SyncViewS
04-16-2010, 07:32 PM
Thanks a lot Eric, your efforts are really appreciated. A simple installer is definitely needed. Take your time and make it rock!

- Enrico

NoFlame
05-03-2010, 10:37 AM
@ NoFlame -

That I have no idea about...I've never needed to do such a thing. Is the character in a string? How is it being created?

All the code for the python editor can be found in [python_path]/lib/site-packages/blur/wingui

I found if i use a external editor,like. N++, and call my script use python.run.
It w'll be no problem at all with double byte character.
sorry for reply so late.

MichaelLevin
05-31-2010, 09:34 AM
hi Eric! aren't there any news about installers? =) they are definitely needed =))) thank you very much)

renzorosso
06-24-2010, 09:31 AM
any news on the installer? and thanks for your effort Eric! :bowdown:

BurGor
07-07-2010, 10:53 AM
hi guys! maybe anybody has saved the sources? i need this for max2011 and don't know what to do without the installers! please upload it somewhere, i need them very much!
thank you!

duke
07-21-2010, 12:09 PM
I'm eager to hear anything about this too :)

holycause
10-26-2010, 06:16 PM
hi guys.

any news? I m currently using PyQt at work within maya and would love to do it within max as well.

docfraiser
01-23-2011, 07:16 PM
Hello everyone,

I do feel a bit stupid to ask such a question but anyway....I am very new to Pyton maxdesk etc, and making movies....
and I did read on the site of blur that they do offer all for public what they use. But most of it isn't available anymore or not updated for quite a long time now.
My question is, if I want to make a trailer like in Dragon Age Origins Sacred ashes, or something else would I definately need all the stuff blur uses?? and are there maybe other sources to get it?? guess Assfreeze and BlurPython and Assburner is something that just belongs to Blur...and you cannot download BlurPython anymore. So what can I do?? can someone help me there??

and please don't make any bad comments about my question...as I said before I am totally new to all this...

thanks
docfraiser

met360
01-27-2011, 02:29 PM
Hi guys,

I had some problem with blur-dev (installed from gnomon workshop dvd), and I would like to know if someone knows how to remove the entire plugin.
I can't find anything anywhere that explain it, don't want to remove something I don't have to in max folder! :)

Thanks for any help.

Matteo

SoLiTuDe
01-27-2011, 09:24 PM
Shouldn't be hard. Start by removing the blur scripts in 3dsmax/stdplug/stdscripts (blurstartupmaxlib...?) ... remove any blur plugins in the plugins folder (transform cache, blurdlx, blurpython, etc) and remove any lines in your 3dsmax.ini that point to the blur stuff.

met360
01-27-2011, 09:33 PM
I wasn't sure of files installed in the directory by blur offline installer...at the end i realized that i could install it again on my desktop and see which was the files, so I removed them all and done a clean install again.
By the way thanks for the reply SoLiTuDe :)

elanari
05-30-2011, 03:03 PM
I didn't see this thread was still kind of active.

I have a problem with the installation of py3dsMax. I mean the installation goes fine, I have the "Python" tab in 3dsMax (2011), but none of the actions in this menu is enabled. I can't even create a new python script.

I'm not sure it's loading blur very well as I have an error when I run max that I didn't have before : DLL <D:\ProhgramFiles\Autodesk\3ds Max 2011\stdplugs\Caddies.gup> failed to initialize. Error code 126 - The specified module could not be found.

If anyone has a solution I'd really appreciate it !

holycause
05-30-2011, 03:09 PM
did you install the new release?
I had the same problem and by installing the new one, it fixed it.

elanari
05-30-2011, 03:12 PM
I installed the one from this page : http://code.google.com/p/blur-dev/downloads/list so I think it's the latest. I used the 64bit version.

ehulser
05-31-2011, 06:40 AM
Seeing the caddies.gup error on load means that your system can't find the Qt DLLs that are installed.

Caddies.gup requires Qt (as do the actions within the Python menu). By default 3dsMax ships with Qt DLLs but they're older than ours and so conflict so we move them to MAXPATH/bin/qt_bak on the install in place of ours.

Qt is backwards compatible, we do this in the studio no problem. However, if the system can't find our installed Qt files then the system won't work.


This usually has to do with write permissions in Windows 7, since we have to write the files to c:/windows/system32/blur64

Make sure that you have write access to that folder and re-run the installers. If you look in that path and you do already see the DLLs, then try updating your Environment Variables >> PATH value to include that location.

Its a bit tricky since everyone has their boxes configured differently, but when you see that error and get no response from the Python menu, its 100% missing the DLLs and thats where they get installed to.

Let me know if you're still running into problems.

elanari
05-31-2011, 08:23 AM
Thanks, this fixed the error at the lauching of 3dsMax. But I still don't have access to the Python menu (I'm also posting here (http://code.google.com/p/blur-dev/issues/detail?id=28) :)

bingoleung
06-14-2011, 07:12 AM
Hi guys,

I just install the latest BlurOffline for my 3dsmax 2009 64bit,I have install Python 2.7.2 and PyQT4(package in bluroffline).But the Python menu didnot appear next to the Maxscript automaticlly. Though I add them manually, it doesnt' work also. And I found some information from the MAXScript Listener below:

MAXScript Mini Listener"Code Path: c:/blur/dev/offline/maxscript/treegrunt/"
"BLUR: BlurArray Library 0.05 loaded."
blurInstall Library v1.0 loaded
[blurNotificationManager] v1.0 loaded
[blurNotificationManager] v1.0 - plugin registered: blurCameraNotification
[blurNotificationManager] v1.0 - plugin registered: blurErrorNotification
[blurNotificationManager] v1.0 - plugin registered: blurPointCacheNotification
blurModel Library v2.5 loaded
"Generating Onion Global Track Data"
"--------------------------------------------------------------------------------------------------------------"
"Loading Onion Plugins..."
"Registering Onion Plugin: Layer - Toggle Layer Atmospherics"
"Registering Onion Plugin: Pre Load - Disable Scene Atmospherics"
"Registering Onion Plugin: Object - Toggle Fx"
"Registering Onion Plugin: Layer - Toggle Particle Flow Actions"
"Registering Onion Plugin: Layer - Toggle Thinking Particles"
"Registering Onion Plugin: Object - Toggle Light"
"Registering Onion Plugin: Object - Toggle Point Caches"
"Registering Onion Plugin: Object - Toggle Transform Caches"
"--------------------------------------------------------------------------------------------------------------"
"Onion v.1.63 has been initialized."
"BlurPython has not been loaded."
"ERROR: BlurPython DLL is not loaded."
"ERROR: BlurPython DLL is not loaded."
----------end

Could anyone tell me why the DLL is not loaded? I have locate the installation to my max root. Does it relate to my OS(Win7 x64)?

holycause
06-14-2011, 07:34 AM
http://code.google.com/p/blur-dev/wiki/Installing

Pre-Requisites




Windows


Python24 (for 32-bit components)
Python26 (for 64-bit components)


pywin32 (3rd party module)


Qt 4.6+ (32-bit/64-bit)
PyQt4 (32-bit/64-bit)
You need to install the right Python ;)

bingoleung
06-14-2011, 07:42 AM
WOW!!!Thanks holycause for your quick reply!!
OK!I will try to downgrade my Python to 2.6 now to see if it can work. :thumbsup:

bingoleung
06-14-2011, 07:54 AM
Yes!!It seems better, the menu appear automaticlly at least. But whichever I click on the menu nothing happen. Why is that?

holycause
06-14-2011, 08:10 AM
don t know why.
I had the same problem with the previous version and max 2011, but the last release fixed it.

U should wait for Eric to answer.

bingoleung
06-14-2011, 09:23 AM
OK. Now what I am staying at is like @elanari...
I also check the link here (http://code.google.com/p/blur-dev/issues/detail?id=28). Follow to the end,it does not work finally...

bingoleung
06-14-2011, 10:32 AM
Ah Haaa! It works finally!!

Just follow this:

Comment 1 by djsolit...@gmail.com, May 13, 2011
I had a very similar issue. If you already had python installed, rename it / back it up or whatever and make sure the python folder doesn't exist, then do a fresh install of python, win32 and re running the blur installer and see what happens. For me, there was something in either pyqt or win32 that was left over from my previous python install that was interfering.

After I removed the Python 2.7.2 clearly then it run in any of the menu!

elanari
06-14-2011, 11:19 AM
What if you cannot remove and reinstall Python ?

ehulser
06-15-2011, 12:17 AM
There is probably something wrong in your registry about the python version that its looking for would be my guess.

If you run cmd >> regedit and look for Python 2.6 make sure all your paths are correct, that its pointing to the x64 bit version, and where that version is located is correct.

If it was installed and renamed manually or something, the registry wouldn't know about it.

bingoleung
06-15-2011, 01:19 AM
I think my previous problem is just like Eric's guess.

"Usually when we get an issue like that, its because the actual PyQt/Qt DLLs are not linking properly. Python itself would be working, but the Treegrunt and IDE would not because of a problem with PyQt."

Actually I have installed Qt 2.7 and Qt 2.6 at the same time,so when I remove the 2.7 then it works.

I can easily remove/uninstall the Python, even I have ever installed them at the same time also.

Eru
12-05-2011, 05:49 PM
Say, anybody, I remember reading about how this plugin is implemented back in the day, and remember all that stuff about it connecting to max via a socket, and all...

Does that mean it should cause problems, if you launch multiple instances of the same 3ds-max version on the same machine, simultaneously?

I also researched to see if I could reuse a C++ based Qt plugin I wrote for Maya and Mudbox, for 3ds-max, and got very disappointing answers - regarding Qt's event-loop...
How is that dealt with with this plugin's PyQt implementation?
Could THAT cause a problem, when using multiple instances of 3ds-max?
And what about docking PyQt-based UIs, into the native 3ds-max UI, would that work?

Eru
12-05-2011, 05:55 PM
Everyone who would like to have Python in 3dsmax as built in, should vote here:

https://autodesk.uservoice.com/forums/80701-publicsdkandscriptingenhancements/suggestions/1489587-python

I say will should all cast out vote, whether that would help or not, it's just a click...

ehulser
12-08-2011, 05:23 PM
I haven't seen docking Qt UI's into max's, but the way to solve the Qt event loop is that you have to build/use the QWinMigrate package:

http://doc.trolltech.com/solutions/qtwinmigrate/winmigrate-walkthrough.html

All the Qt code is python side and will work as a C++ plugin as well, so if you want to see how it is implemented, you can look at it in $PYTHONPATH/lib/site-packages/blurdev/cores/core.py:

Mostly, you need to create a singular QMfcApp instance.

This python plugin isn't a COM system, but a direct wrapper of Maxscript <-> Python via C/Python as a pre-compiled plugin. There is no problem with it running multiple instances of the same max with the same python, as it creates a separate session per Max instance.

Eru
12-08-2011, 05:35 PM
10x
I'll check it out...

I'm having problems now running any PyQt thing, I posted it here:
http://forums.cgsociety.org/showthread.php?f=183&t=983157&highlight=py3dsmax

Can somebody help?

CGTalk Moderation
12-08-2011, 05:35 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.