From BlenderWiki

Jump to: navigation, search
Blender3D FreeTip.gif
IMPORTANT! Do not update this page!
We have moved the Blender User Manual to a new location. Please do not update this page, as it will be locked soon.


Page status (reviewing guidelines)

Partial page Text Just started. If you have any suggestions, please add them in the discussion page. Thank you.
Proposed fixes: none

Why another Python tutorial?

This page exists for two reasons.

  1. To introduce Programming using Python 3.x quickly and efficiently.
  2. And most importantly teach inside of Blender's Console, so you can learn in context.
  3. See External links below

What is Programming?

Programming in simple terms is nothing more than manipulating data. Operations on the data either modifies it, or create new data.

The simplest data is Numbers. Operations on Numbers are addition, Subtraction, multiplication etc., Its the simplest type of data imaginable.

But for solving real world problems, we need have compound data, that is built from simpler data like numbers. A good example is Vector data type, that is built from 3 numbers.

During the course of this tutorial, we will take a look at what data types that Python language provides and how you can create your own custom data for your programs and also write operations that work with that data.

What is Python?

Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. Python combines remarkable power with very clear syntax.

Learning Python is also very easy, even if you have never programmed before.

Python Interpreter

All the exercises in this tutorial will be using the built-in Console window type in Blender 2.6, which has a Python 3.2 interpreter embedded in it.

Following is a video that shows how you can switch to the interpreter.

Manual-Part-XX-Manual-Extensions-Python-Console-Default-Console.png

You can start typing Python commands, expressions and statements at the interpreter prompt >>>

Hello World

Let's get started with the classical "Hello World" program.

Type the following print statement at the interpreter prompt and press ↵ Enter key.

Manual-Part-XX-Manual-Extensions-Python-Tutorial-Hello-World.jpg

Let's break down the above statement.

  1. "Hello World" is a string literal in Python.
    1. A string is a sequence of characters (numbers, alphabets, special characters)
  2. print() is a built-in function in Python to print output.
  3. print("Hello World") outputs Hello World to the console.
Exercise
Type the following commands and check the output
 print('"Hello World"')
 print("'Hello \n World'")

In Python, a string literal can be multiplied by a number. By doing so we are repeating the string by the count specified by number

  • number * string literal
  • string literal * number
  • * is the multiplication operator in Python

Manual-Part-XX-Manual-Extensions-Python-Tutorial-Hello-World2.jpg

Note


External links

Webpages

Video Tutorials

  • If you want to learn Python programming in general, have a look at this tutorials



Blender3D FreeTip.gif
This is the old manual!
For the current 2.7x manual see http://www.blender.org/manual/


User Manual

World and Ambient Effects

World

Introduction
World Background

Ambient Effects

Mist
Stars (2.69)


Game Engine

Introduction

Introduction to the Game Engine
Game Logic Screen Layout

Logic

Logic Properties and States
The Logic Editor

Sensors

Introduction to Sensors
Sensor Editing
Common Options
-Actuator Sensor
-Always Sensor
-Collision Sensor
-Delay Sensor
-Joystick Sensor
-Keyboard Sensor
-Message Sensor
-Mouse Sensor
-Near Sensor
-Property Sensor
-Radar Sensor
-Random Sensor
-Ray Sensor
-Touch Sensor

Controllers

Introduction
Controller Editing
-AND Controller
-OR Controller
-NAND Controller
-NOR Controller
-XOR Controller
-XNOR Controller
-Expression Controller
-Python Controller

Actuators

Introduction
Actuator Editing
Common Options
-2D Filters Actuator
-Action Actuator
-Camera Actuator
-Constraint Actuator
-Edit Object Actuator
-Game Actuator
-Message Actuator
-Motion Actuator
-Parent Actuator
-Property Actuator
-Random Actuator
-Scene Actuator
-Sound Actuator
-State Actuator
-Steering Actuator
-Visibility Actuator

Game Properties

Introduction
Property Editing

Game States

Introduction

Camera

Introduction
Camera Editing
Stereo Camera
Dome Camera

World

Introduction

Physics

Introduction
Material Physics
No Collision Object
Static Object
Dynamic Object
Rigid Body Object
Soft Body Object
Vehicle Controller
Sensor Object
Occluder Object

Path Finding

Navigation Mesh Modifier

Game Performance

Introduction
System
Display
Framerate and Profile
Level of Detail

Python API

Introduction
Bullet physics
VideoTexture

Deploying

Standalone Player
Licensing of Blender Game

Android Support

Android Game development