10 October 2007 | |
![]() |
|
Chief time waster
portfolio
Chris Williamson
3D / Motion Graphics Artist
Weta Workshop
Wellington,
New Zealand
|
So using Com, would there be a way to pass a bitmap object to max somehow? or would the best method be to open a PIL image, convert it to an array, pass that to max & use set pixels or something to recreate an bitmap? I'm guessing that would be fairly slow...
|
10 October 2007 | |
![]() |
|
Frequenter
portfolio
David Mackenzie
Technical Director
Sydney,
Australia
|
Hi Chris,
That would work just fine but as you rightly pointed out it would be pretty slow, other alternatives would be to just parse the path to the image to max and open it that way. I guess it depends on what you doing, you could also use PIL to save a temp image and then parse the temp file path to max... Cheers Dave __________________
|
10 October 2007 | |
![]() |
|
Frequenter
portfolio
David Mackenzie
Technical Director
Sydney,
Australia
|
PyInterp
Hi Guys,
This is a little script I quickly through together for a mate and thought some of you might like it. You can parse commands from max to python and have the tracbacks and stdout returned to you. Here is a simple example: http://forums.cgsociety.org/attachm...id=118728&stc=1 Here is an example of a traceback: http://forums.cgsociety.org/attachm...id=118729&stc=1 Anyways time for some code: here is the python code:
And now for the max code:
Cheers Dave __________________
|
10 October 2007 | |
![]() |
|
Frequenter
portfolio
David Mackenzie
Technical Director
Sydney,
Australia
|
Python + MySQL
Hi Guys,
A couple people following the thread have asked about some database code, I did have some stuff I wrote ages ago, which for whatever reason has seemingly disappeared from my hard drive! None the less I had been promising to post some code for a long time, I finally got off my ass and wrote some new stuff... So here a really simple class to demo straight saving maxfiles to (or any data for that matter) to a database (I was using MySQL i have tested the code with anything else). I will post a com version later tonight.... anyways enough jibba jabba here is the code, if you get any errors just post them or pm me and yes I was lazy and did not comment my code I will fix this later though... Cheers Dave
__________________
|
10 October 2007 | |
![]() |
|
Frequenter
portfolio
David Mackenzie
Technical Director
Sydney,
Australia
|
Hi guys,
Just wrote a new com class for MySQL connections. It works well and is simple to implement. Here is the code:
Cheers Dave __________________
|
11 November 2007 | |
![]() |
|
rm -rf /
portfolio
Brett Dixon
Sr Technical Artist
Irvine,
USA
|
I'm getting some wierd garbage collection errors when pairing python and max. So my script basically sends the "loadmaxfile" command with a file, max opens it, run a maxscript on it, and return a list of strings. then moves on to another file. simple enough right?
Well after about 3-4 files, max throws this wierd error: "Unknown error occured during garbage collection. If you see this message frequently, restart max." or something to that extent. I put the gc() in my maxscript hoping that would fix it, but no luck. Am i not doing something here? My python stuff is pretty simple:
"item()" is a python object which does some DB stuff. "RenderItem()" is the maxscript being run. Thanks |
11 November 2007 | |
![]() |
|
Lord of the posts
Shane Whitehead
Technical Artest/Sys Admin/Tools Developer
01 Animation
Frankston,
Australia
|
Originally Posted by TheIvIaxx:
I'm getting some wierd garbage collection errors when pairing python and max. So my script basically sends the "loadmaxfile" command with a file, max opens it, run a maxscript on it, and return a list of strings. then moves on to another file. simple enough right?
I had a simular issue recently (not with the com bridge, but with max). I may be totally off the mark, but...it may have something to do with the inital heap settings for maxscript.Well after about 3-4 files, max throws this wierd error: "Unknown error occured during garbage collection. If you see this message frequently, restart max." or something to that extent. I put the gc() in my maxscript hoping that would fix it, but no luck. Am i not doing something here? My python stuff is pretty simple:
"item()" is a python object which does some DB stuff. "RenderItem()" is the maxscript being run. Thanks Go to Customize -> Preferences -> Maxscript (tab) and increase the maxscript memory to a larger amount...about 60-70meg should do the trick. Then try again. At least you will know if it is a max issue or a com issue pretty quickly. Also, play around the amount of memory as well till you find a setting you are comfortable with. Hope it helps Shane __________________
If it's worth doing, it's worth scripting Don't wish for this to be eaiser, wish for you to better |
11 November 2007 | |
![]() |
|
Frequenter
portfolio
David Mackenzie
Technical Director
Sydney,
Australia
|
Hi Brett,
I have a similar setup for keeping asset library's in order, which essentially recursively goes through a library and updates the database where it needs to. I did notice that the machine I run it on has the max script heap size set to 128mb, so maybe Shane is on to something, I might try lowering the heap size and see what happens. I'm interested to here how you go... Cheers Dave __________________
|
11 November 2007 | |
![]() |
|
rm -rf /
portfolio
Brett Dixon
Sr Technical Artist
Irvine,
USA
|
ok, i set it to 128mb and it seemed to work pretty good. Due to some bugs with my script it will sometimes blow up max. But upping the heap size let me get through 12+ without issue which is way more than before. I will keep tweaking it and let you know what i find.
Thanks again |
11 November 2007 | |
![]() |
|
rm -rf /
portfolio
Brett Dixon
Sr Technical Artist
Irvine,
USA
|
OK, so i removed the gc() call in my script and upped my heap to 256MB and its working much better now. Thanks for the help guys.
__________________
"When sales determine status, I hold no faith in the majority" -El P Draenei:Thread Troll:Thread Last edited by TheIvIaxx : 11 November 2007 at 02:09 AM. Reason: resolved...kinda |
12 December 2007 | |
![]() |
|
Frequenter
|
What should I do if I have two instances of 3ds max launched, I want to control one of them with python and choose which one? Right now only max that was started first works as COM Server.
__________________
Pixel Factory |
12 December 2007 | |
![]() |
|
Developer
Eric Hulser
CEO/Lead Developer
Proejx Software, LLC
Palo Alto,
USA
|
Embedded Python for MAXScript
Hey guys,
I just finished up the first version of this DLL for 3dsMax (still pretty rough) that we're going to start using here at Blur...pretty much it embeds python for use inside of MAXScript, opening up all the modules that exist in python directly. There are some example scripts on how its used, but its relatively simple - you import your module, and work with with it as if you were in python. re = python.import "re" m = re.match "[a-zA-Z]*" "Test test test" if ( m != undefined ) then ( print (m.group()) ) -- prints "Test" etc. More examples in the DLL. We're working (still) on getting BlurBeta running where everything will be open source, but until that gets up, I have the *.zip file with the DLL and would love some feedback on how its working, just no where to throw the zip. If anyone has a mirror, I can email the file to you and upload it so others can download. Otherwise, email me if you want the DLL and I'll send it to you. Thanks! Eric Hulser eric@blur.com Tools Developer Blur Studio |
12 December 2007 | |
![]() |
|
TD
portfolio
Martin Breidt
Tuebingen,
Germany
|
Originally Posted by ehulser:
I just finished up the first version of this DLL for 3dsMax (still pretty rough) that we're going to start using here at Blur...pretty much it embeds python for use inside of MAXScript, opening up all the modules that exist in python directly.
That is pretty cool! I can wait for your final release but if that is out, make sure to let us know! Directly connecting Python to MAXScript will make a bunch of people very happy over here. Cheers! -- MartinB |
12 December 2007 | |
![]() |
|
Lord of the posts
portfolio
Yannick Puech
Software Engineer
Solid Angle SL
Madrid,
España
|
Originally Posted by ehulser:
I just finished up the first version of this DLL for 3dsMax (still pretty rough) that we're going to start using here at Blur....pretty much it embeds python for use inside of MAXScript
Being able to use Python inside Max is a great new stuff and will make me learn Python much faster!
Originally Posted by ehulser:
If anyone has a mirror, I can email the file to you and upload it so others can download. Otherwise, email me if you want the DLL and I'll send it to you.
You can contact David Baker of maxplugins.de (he is on CGtalk forums). He can offer a subdomain with space to host your plugins and web stuff for free. __________________
|
12 December 2007 | |
![]() |
|
R&D/Technical Director
portfolio
Paul Neale
PEN Productions
Canada
|
Not sure if this is going to create a double post, if so please delete.
If you want I can put it on on http://paulneale.com, just mail it to paul@paulneale.com
Originally Posted by ehulser:
Hey guys,
I just finished up the first version of this DLL for 3dsMax (still pretty rough) that we're going to start using here at Blur...pretty much it embeds python for use inside of MAXScript, opening up all the modules that exist in python directly. There are some example scripts on how its used, but its relatively simple - you import your module, and work with with it as if you were in python. re = python.import "re" m = re.match "[a-zA-Z]*" "Test test test" if ( m != undefined ) then ( print (m.group()) ) -- prints "Test" etc. More examples in the DLL. We're working (still) on getting BlurBeta running where everything will be open source, but until that gets up, I have the *.zip file with the DLL and would love some feedback on how its working, just no where to throw the zip. If anyone has a mirror, I can email the file to you and upload it so others can download. Otherwise, email me if you want the DLL and I'll send it to you. Thanks! Eric Hulser eric@blur.com Tools Developer Blur Studio |
reply share thread |
«
Previous Thread
|
Next Thread
»
|
|
|