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

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

workshops:blender:python_tools_in_blender [2015/06/19 00:58] – created Julien Deswaefworkshops:blender:python_tools_in_blender [2015/06/20 19:27] (current) Julien Deswaef
Line 1: Line 1:
 +====== Python tools in Blender ======
  
-<code=python> +===== The Scripting layout ===== 
->>> for objects in bpy.data.objects: +Blender has a handy "Scripting" layout ready for you, with 
-...     print(objects.name) +  * **Info panel** expanded to see what Python commands are being called when manipulating the interface 
-...      +  * **Text editor** to write your scripts 
-Camera +  * **Console** to explore commands 
-Cube +  * And the panels we know from the "Default" layout: **3D View**, **Outliner** and **Properties**
-Lamp+
  
->>> for object in bpy.data.objects: +In the Menu, ''Help Python API Reference'' will open a browser window pointing to the Blender Python API documentationYou want to keep this open at all time when scripting.  
-...     print(object) + 
-...      +===== Accessing data ===== 
-<bpy_struct, Object("Camera")> +Some examples of how to navigate in Blender data from the console
-<bpy_struct, Object("Cube")+ 
-<bpy_struct, Object("Lamp")>+<code=python
 +# With the default scene when starting Blender
  
->>> for object in bpy.data.objects: +for objects in bpy.data.objects: 
-...     print(object.location+    print(objects.name    
-...      +# Camera 
-<Vector (7.9362, -7.1326, 3.8174)> +# Cube 
-<Vector (0.0000, 0.0000, 0.0000)> +# Lamp
-<Vector (4.0762, 1.0055, 5.9039)>+
  
->>> a = 10 +for object in bpy.data.objects: 
->>> print(a+    print(object.location    
-10+# <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: +for object in bpy.data.objects: 
-...     print(object.location.x) +    print(object.location.x)     
-...      +7.93615198135376 
-7.93615198135376 +0.0 
-0.0 +4.076245307922363
-4.076245307922363+
 </code> </code>
workshops/blender/python_tools_in_blender.1434668322.txt.gz · Last modified: 2015/06/19 00:58 by Julien Deswaef