Getting started with python and Blender

Project:Blender
Component:Documentation
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Project wiki:Blender wiki
Related pages:#1161: Python
Description

Create a simple tutorial on how to animate object properties with python...

Comments

#1

#2

Category:feature request» task

#3

Tags:+python

#4

Related pages:+1161: Python

#5

I am not sure how the API documentation is organized.

For example, in
http://www.blender.org/documentation/blender_python_api_2_62_3/info_quic...
I see:

bpy.data.materials.new("MyMaterial")

but where is bpy.date documented?
The following page does not tell much:
http://www.blender.org/documentation/blender_python_api_2_62_release/bpy...
but leads to bpy.types.BlendData:
http://www.blender.org/documentation/blender_python_api_2_62_release/bpy...
which leads to BlendDataMaterials
http://www.blender.org/documentation/blender_python_api_2_62_release/bpy...
which has the property new()

!

Ok, that's a bit twisted, but I guess it's just a question of getting used to it.

#6

Another example:

// blender-2.62-linux-glibc27-x86_64/2.62/scripts/presets/keyconfig/maya.py
wm = bpy.context.window_manager
kc = wm.keyconfigs.new('maya')

Where is bpy.context.window_manager documented?
I go to bpy.context:
http://www.blender.org/documentation/blender_python_api_2_62_3/bpy.conte...
where there is nothing related to 'window' nor 'manager'.
I go to bpy.data:
http://www.blender.org/documentation/blender_python_api_2_62_3/bpy.data....
which leads to bpy.types.BlendData:
http://www.blender.org/documentation/blender_python_api_2_62_3/bpy.types...
where I find:

window_managers
Window manager datablocks
Type : BlendDataWindowManagers bpy_prop_collection of WindowManager, (readonly)

but I don't find window_manager without an s and in this case (lower case with an underscore).

...

Ah! I found Context(bpy_struct)
http://www.blender.org/documentation/blender_python_api_2_62_3/bpy.types...
which does list window_manager.... but I am not sure how I got there!

from there on, it's easier....: I window_manager is of type WindowManager, which has a keyconfigs property, etc.

but why isn't window_manager listed here:
http://www.blender.org/documentation/blender_python_api_2_62_3/bpy.conte...
?
Is this a bug in the documentation??

#8

Title:Animation with python» Getting started with python and Blender

http://www.blender.org/documentation/blender_python_api_2_62_3/bpy.ops.html
What's an operator?
It's nowhere defined.

I looked through Python operators in the Python docs, but it doesn't seem related to Blender operators.

#9

Scripting examples for 2.5 - update: Mar 26th 2010
http://blenderartists.org/forum/showthread.php?164765-Scripting-examples...