Python-howto, Python-Scripts and Plug-Ins


#1

updateBlender is extendable with python-scripts. Just as maya uses MEL and 3DS-Max uses MAX-script, blender uses python.

  1. How to successfully install python
  2. List of some python scripts and plug-ins

1.In order to run certain scripts, you will need a fully installed version of python.
You can get it at: www.python.org
O.K. as many questions will come about python and plug-ins, here we go:

If you are on OSX, you should be fine, as it comes with python 2.3 installed.

On windows XP you need to install it on: C:\python23

On Linux it depends: newer distros come with python 2.3 allready installed, older ones (like mine) with older versions.
Attention: rpm based distros like rh and fc1 have many programs that depend on the already installed python versions (in my case python2.2.x), so don´t just get the rpm and click on it!! It will mess up your whole system (this is a known issue as seen on redhead.com) work around: load down the source and build it yourself with the usual ./configure, make procedure, check the install instructions coming with the source!! If you do so, you might have to rename some of the path ending 23.zip into /…/python2.3 (depending on your path in python)

Next step is to set the PYTHONPATH

On XP, there should be a PYTHONPATH in your environment variables. Normally there is no issue here, if you installed it to your C:\ partition

Now, after our python-install, we want blender to recognize the PYTHONPATH?

First thing to do is open python and write the first 2 lines as seen here and hit return:
On winXP you get something like this:

>>> import sys
>>> print sys.path
[’’, ‘c:\python23’, ‘c:\python23\dlls’, ‘c:\python23\lib’, ‘c:\python23\lib\plat-win’, ‘c:\python23\lib\lib-tk’, ‘c:\python23\pil’]

On Linux it would look like this:

>>> import sys
>>> print sys.path
[’’, ‘/usr/local/lib/python2.3’, ‘/usr/local/lib/python2.3/plat-linux2’, ‘/usr/local/lib/python2.3/lib-tk’, ‘/usr/local/lib/python2.3/lib-dynload’, ‘/usr/local/lib/python2.3/site-packages’]

Now open blender, and set your pythonpath in the “user preferences” (i) window >pathes>Python
Usually
Either /usr/local/lib/python2.3
Or C:/python23/lib

Now open a new text window in blender and write again:
Import sys
Print sys.path and hit alt-p

(you actually just executed your first python-script)

Then check your dos or bash-console (rember to start blender on linux allways with /path_to/blender):and
– there you have it!! Its done!! You see the same path in the blender console.–
Not there?
If not:
Then you have to create on win XP an environment variable PYTHONPATH

On linux you have to do this:
vi /home/user_name/.bashrc there you add:

export PYTHONPATH=/usr/local/lib/python2.3:/usr/local/lib/python2.3/plat-linux2:/usr/local/lib/python2.3/lib-tk:/usr/local/lib/python2.3/lib-dynload:/usr/local/lib/python2.3/site-packages

dont just copy and paste this text here! it might differ on your system, so get the path from python and edit it: all ‘,’ become :

now you should be fine.

2: List of python-scripts and plug-ins

O.K. now python is installed all right lets start and get bussy with some of those sweets.
Important note:
Blender 2.23/2.25 -2.27 works with python 2.0
Blender 2.28-2.32 works with python 2.2
Blender 2.33- until now works with python 2.3

Some scripts you find in the www, might not work with current versions of blender. Pls. refer to the documentation on their home-sites:
To execute python-scripts: if not explained in a different way, just open the .py in blenders text-window and hit >alt-p
Plug-ins are .dll on win and .so on unix. there are texture plug-ins and sequenz-editor plug-ins. to open them just add new> plug-in and select it from your folder where the plug-ins are. you can set the path to the plug-in folder in user-preferences

the list is in random order and far from complete! there must be like 1000 scripts out there.

read this first:
Blender Plugin Repository >collection of sequenz and texture plug-ins and python scripts
http://www-users.cs.umn.edu/~mein/blender/plugins/

for gamers, various export scripts:
http://bane.servebeer.com/programming/blender/index.html

blenderman .rib export (developement freeze)
http://www.geocities.com/gkocov/blenderman

povanim-pov-ray exporter
http://jmsoler.free.fr/util/blenderfile/povanim.htm

Fiber > create good looking grass
http://oregonstate.edu/~dennisa/Blender/Fiber2/
tut for fiber:
http://oregonstate.edu/~dennisa/Blender/Tutorials/FiberGUI.viewlet

L-system >tree maker
http://jmsoler.free.fr/util/blenderfile/images/lsystem/lsystem.htm
tutorial
http://marief.soler.free.fr/Monsite/lsystem_en.htm

beast >city-builder; also can fake hair and fur with alpha maps
http://projects.blender.org/projects/beast/
doc: http://projects.blender.org/docman/view.php/42/12/beast.pdf

makehuman > create a fully rigged human mesh with a couple of clicks
www.makehuman.org

sculpMesh >Zbrush style sculpting
http://wiki.blender.org/bin/view.pl/Blenderdev/SculpMesh

ter2blend > use terragen landscapes and animations in blender (development interrupted)
script maintenance (adapt it to python 2.3)
http://home.pacbell.net/c_keith/projects/blender/misc/Terragen.html
original site:
http://users.skynet.be/sky33676/ter2blend.html

blender people > attempt of a crowd simulation (still in developement)
http://www.harkyman.com/bp.html
oher scripts by the author:
http://www.harkyman.com/scripts.html

various scripts
http://www.iespana.es/klopes/enchufes.htm

some older stuff:
http://www.geocities.com/blenderdungeon/

there are many, many more, I will update this list, when I find a minute and did not want to add to many links for scripts only working with older versions.

so authors and users of scripts:
pls. post a link to the home-site of your favorite scripts here!!
dont post a direct download link, as scripts get updated quickly and we want to get the latest versions and some man-pages

update:
cool stuff from ideasman
http://members.iinet.net.au/~cpbarton/ideasman/


#2

Don’t forget the script repository on blender3d.org:

http://www.blender3d.org/cms/Python_Scripts.3.0.html


#3

Cool thread Birras,

The L-Systen version you link to at Blenderdungeon is out of date for 2.35. Better link to the 2.28 neo_lstseed.zip here:
http://jmsoler.free.fr/util/blenderfile/images/lsystem/lsystem.htm
and the tutorial here:
http://marief.soler.free.fr/Monsite/lsystem_en.htm


#4

I found this last week and thought it would be cool to add this here. Its a python script. http://www3.sympatico.ca/emilio.aguirre/s2flender.html


#5

i’ve followed all of the steps, but i get a quite different result at the end, and now i’m wondering: how would i go about creating a new environment variable?
the result i get in my blender console mentions the blender directory itself, not the python dir.
The only problem i can see is that maybe it can’t handle python 2.4?


#6

You’re right, Blender’s internal Python interpretor is coded for Python 2.3.x


#7

hey guys and girls

i’m another newbie. just created an account and logged on to ask a couple of python questions and found all this. gonna trawl through it all now and see if it sorts me out. thanks for the mind-reading tricks. i look forward to having my next question answered before i ask it. lol


#8

Thank You Thread Maker But My Brother We Need To Learn
How To Programm We Don’t Need A Ready Scripts :wink:
Thnxz Man For Your Help It’s Not Bad


#9

I have Python 24 in C:\Python24 on XP. I am wondering :

a) Can Blender 235 use this - or must it be Python23?

b) If Blender 235 must use Python23, will it be ok to install Python23 to C:\Python23, while Python24 remains in its presently installed location?

Help on this one would be much appreciated … I can paint a portrait in oils, compose a string quartet, use power tools, bake a black forest cake - but I always thought a Python was a b-i-i-i-g snake! Who knew? Well, it probably still is, whichever form it takes … it’s still a bit scarey to me…

thanks,


#10

Hello butterpaw

Python24 will be implemented in the next release of Blender. Most scripts out their today are using Python23 which is what blender already uses internally so you should have no problems. I have Python24 installed myself and have not had any issues running scripts off the internet yet.

CyberSorcerer


#11

Thanks Cybersorcerer!

I will move up to the next version of Blender as soon as it becomes availalble… and in the meantime …

I installed Python23 in its own folder right next to Python24 (in it’s own folder) on the C drive. When I fired up Blender - voila! no error messages… and so far, no signs of any compatibility problems.

I’m getting used to the Blender interface, and find it to be very elegant. But I see it’s not amenable to experimentation until one is very familiar with the interface… that’s ok… I’ll get there.

thanks again,


#12

I noticed your reference to Blender 2.35 … were you aware that version 2.36 (stable) is currently available?


#13

Thanks GuyGrr!

In fact I had just noticed it today - I’ll be installing it tonight - I will really appreciate the expanded undo capabilities. … although I am getting better at saving after every successful step.

After being proficient with other software, I feel really clutzy with this one… but I’ll get better at it… :rolleyes:


#14

bbirras: Many thanks, this really helped me out, I’ve been using the standard scripts for a while but have been having some problems implementing new ones, this helped me to finally I managed to correctly normal map a character model, thanks!


#15

glad to hear this:)


#16

i’m using mac osx 10.3 and blender 2.36 for this os and have been successfully running python scripts having put a file path in my preferences pane. recently i came back to blender after a 4 or 5 week lay off to find that it no longer works (!!). i get error messages such as

Traceback (most recent call last):

File “globLoc”, line 7, in ?

ImportError: No module named Rasterizer

my python path (printed in the console as result of print sys.path) is:

[’/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip’, ‘/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/’, ‘/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-darwin’, ‘/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac’, ‘/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/lib-scriptpackages’, ‘/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-tk’, ‘/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-dynload’, ‘/Applications/blender236/blender.app/Contents/MacOS’, ‘/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages’, ‘/System/Library/Frameworks/Python.framework/Versions/2.3/lib/site-python’, ‘/Users/andygracie/Library/Python/2.3/site-packages’, ‘/System/Library/Frameworks/Python.framework/Versions/2.3/’, ‘/Applications/blender236/blender.app/Contents/MacOS/.blender/scripts’]

i have not changed anything in my system or installed any other software or updates. could it be possible that my python installation is somehow ‘broken’?? i have run disk/file maintenance software which has not cleared up the problem either.

any pointers very gratefully received.

best

andy g


#17

which script? version? :shrug:the script might not be for 2.36 + 2.3.x


#18

well i was trying to make some tutorials for myself based on others i’d seen on the web. this is the first few lines i was running from starblenders tutorial at http://abjedi.free.fr/index.php3?language=en&section=tut&tut=gbtut4

import Rasterizer
import GameLogic
l = Rasterizer.getWindowWidth()
[color=White]L = Rasterizer.getWindowHeight()
Print I, L
[/color]

the funny thing is that when i was doing this originally it was working. that was a while ago and since i came back to it i’m getting all these errors. i HAVE just checked the website again and it states that the script is for 2.12 - though i did have it working succesfully when i was going through it with 2.36. i’ve checked other scripts such as OSC.py and the l-system one that both work fine.

maybe i need to be looking at syntax not python problems… so what would be the correct syntax to make this simple bit of script work…?

cheers

andy g


#19

I believe Python 2.3 is built into the current Blender release. I don’t watn to install 2.3 just for Blender sicne I use 2.4 on WIndows and OS X now. Any problems with using 2.4 as long as I stay away from 2.4-only features?


#20

You can install both, Blender will work without 2.3 but some scripts won’t.

LetterRip