Saturday, April 18, 2009

How to use an IDE (Notepad++) with Python and Blender

After some searching for existing solutions, the result I like best is using Notepad++. There is a feature in Notepad++ that allows execution of a command line program passed the name of the script being edited. I'm working on a windows platform mostly, so here is how to setup Notepad++ to work with blender.
Once you have a working version of Notepad++ installed, type up a test script. Here is a 'hello world' script that will verify the installation:

Here is the code a little easier to copy:

import Blender import sys print 'Hello World' # test blender functionality obj=Blender.Object.Get() print str(obj) sys.stdout.flush()

In Notepad++, use the Run menu option to execute the script. From Run, specify:

"C:\Program Files\Blender Foundation\Blender\blender.exe" -P "$(FULL_CURRENT_PATH)"
Press "Run!" and Blender should start and be left running. If you find the command window is that launched Blender, you should see the following.
With this, a tool to build and test more complex scripts is now ready for use.

No comments:

Post a Comment