xuv's notebook

Side notes, howtos and random bits of information related to Julien Deswaef's projects

User Tools

Site Tools


workshops:blender:python_tools_in_blender

Python tools in Blender

The Scripting layout

Blender has a handy “Scripting” layout ready for you, with

  • Info panel expanded to see what Python commands are being called when manipulating the interface
  • Text editor to write your scripts
  • Console to explore commands
  • And the panels we know from the “Default” layout: 3D View, Outliner and Properties

In the Menu, Help > Python API Reference will open a browser window pointing to the Blender Python API documentation. You want to keep this open at all time when scripting.

Accessing data

Some examples of how to navigate in Blender data from the console.

# With the default scene when starting Blender
 
for objects in bpy.data.objects:
    print(objects.name)    
# Camera
# Cube
# Lamp
 
for object in bpy.data.objects:
    print(object.location)    
# <Vector (7.9362, -7.1326, 3.8174)>
# <Vector (0.0000, 0.0000, 0.0000)>
# <Vector (4.0762, 1.0055, 5.9039)>
 
for object in bpy.data.objects:
    print(object.location.x)    
# 7.93615198135376
# 0.0
# 4.076245307922363
workshops/blender/python_tools_in_blender.txt · Last modified: 2015/06/20 19:27 by Julien Deswaef