Blender 2.49 Scripting

Blender 2.49 Scripting
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters


  • Gain control of all aspects of Blender using the powerful Python language
  • Create complex meshes programmatically and apply materials and textures
  • Automate the rendering process and extend Blender's image manipulation capabilities
  • Extend Blender's built-in editor
  • Interact with version control systems and store render results on a FTP server

Book Details

Language : English
Paperback : 292 pages [ 235mm x 191mm ]
Release Date : April 2010
ISBN : 1849510407
ISBN 13 : 9781849510400
Author(s) : Michel J. Anders
Topics and Technologies : All Books, Blender, Other, Open Source

Table of Contents

Chapter 1: Extending Blender with Python
Chapter 2: Creating and Editing Objects
Chapter 3: Vertex Groups and Materials
Chapter 4: Pydrivers and Constraints
Chapter 5: Acting on Frame Changes
Chapter 6: Shape Keys, IPOs, and Poses
Chapter 7: Creating Custom Shaders and Textures with Pynodes
Chapter 8: Rendering and Image Manipulation
Chapter 9: Expanding your Toolset
Appendix A: Links and Resources
Appendix B: Common Pitfalls
Appendix C: Future Developments
  • Chapter 1: Extending Blender with Python
    • The Blender API
      • A lot of power
      • Some batteries included
      • Check for a full Python distribution
      • Installing a full Python distribution
      • The interactive Python console
    • Exploring built-in modules, the help() function
      • Exploring built-in functions, the dir() function
    • Getting familiar with the built-in editor
      • An editor example
    • First steps: Hello world
      • Integrating a script in Blender's menus
      • Integrating a script in Blender's help system
    • Don't get confused, stay objective
    • Adding different types of object from a script
      • Adding a mesh object
      • Distributing scripts
      • The Blender API
      • The Blender module
      • Blender objects
      • The bpy module
      • Drawing on the screen
      • Utilities
    • Summary
  • Chapter 2: Creating and Editing Objects
    • Creepy crawlies—a GUI to configure objects
      • Building the user interface
      • Creating bugs—some assembly required
      • Creating a user interface
      • Remembering choices
      • The full power of Blender graphics
      • Creating a new Mesh object
    • Transforming mesh topology
      • Code outline bridging edge loops
    • Dazzle your boss—bar charts in Blender style
      • The bar chart script
    • Weird faces—selecting and editing faces in meshes
    • Selecting warped (non-planar) quads
      • Code outline warp select
    • Selecting ultra sharp faces
    • Selecting vertices with many edges
    • Selecting poles
      • Selecting poles, again
    • Determining the volume of a mesh
    • Determining the centre of mass of a mesh
      • Some remarks about accuracy
    • Growing sunflowers—parenting and grouping objects
      • Groups
      • Parenting
      • Growing a sunflower from a seed
      • Duplication versus instantiation
      • Growing a sunflower
    • Summary
  • Chapter 3: Vertex Groups and Materials
    • Vertex groups
      • A weighty issue
        • Code outline:
    • Modifiers
      • Engraving
        • Converting a Text3d object to a mesh
        • Extruding an edge loop
        • Expanding an edge loop
      • Putting it all together:
      • Flying sparks
        • Calculating the local curvature
        • Code outline:
        • Putting it all together: St. Elmo's fire
    • Bones
      • Tick-Tock
        • Code outline:
      • Get a bit of backbone boy!
    • Materials
      • Object materials versus ObData materials
      • Assigning materials to parts of an Object
      • Vertex colors versus face materials
      • Adding materials to our engraving
    • Summary
  • Chapter 4: Pydrivers and Constraints
    • Getting to grips with animated properties
      • IPO
      • IPOchannels and IPOCurves
      • Constraints
    • Difference between drivers and constraints
    • Programming with constraints
    • Programming with IPOs
    • PyDrivers
    • PyConstraints
    • Setting the time—one to rule them all
      • Shortcuts
        • Overcoming limitations:
    • Internal combustion—correlating complex changes
      • More power—combining multiple cylinders to an engine
    • Adding simple constraints
    • Defining complex constraints
      • The Blender constraint template
      • Do you find me attractive too?
      • Snapping to mesh vertices
      • Aligning along a vertex normal
      • Snap to vertices in a vertex group
    • Summary
  • Chapter 5: Acting on Frame Changes
    • Animating the visibility of objects
      • Fading a material
      • Changing layers
    • Countdown—animating a timer with script links
    • I'll keep an eye on you
      • Code outline:
      • Using themes
    • Revisiting mesh—making an impression
      • The user interface
      • Calculating an impression
    • Summary
  • Chapter 6: Shape Keys, IPOs, and Poses
    • A touchy subject—defining an IPO from scratch
      • Code outline:
    • A lot to swallow—defining poses
      • Application of to an armature
    • Get down with the beat—syncing shape keys to sound
      • Manipulating sound files
        • Code outline:
      • Animating a mesh by a .wav file: the workflow
    • Summary
  • Chapter 7: Creating Custom Shaders and Textures with Pynodes
    • The basics
      • From nodes to Pynodes
    • Regular tilings
      • Anti-aliasing
      • Indexing a texture by vector
      • A fresh breeze—textures with normals
    • Raindrops—animated Pynodes
      • Render-time parameters
      • What looks good, is good
      • Storing expensive results for reuse
      • Calculating normals
      • Putting it all together
    • Wuthering heights—a slope-dependent material
      • Determining the slope
      • World space versus camera space
    • Soap bubbles—a view-dependent shader
    • Summary
  • Chapter 8: Rendering and Image Manipulation
    • A different view—combining multiple camera angles
      • Code outline—
      • Workflow—how to showcase your model
    • Now, strip—creating a film strip from an animation
      • Workflow—using
    • Rendering billboards
      • Workflow—using
    • Generating CAPTCHA challenges
      • Design of a CAPTCHA server
    • Summary
  • Chapter 9: Expanding your Toolset
    • To the Web and beyond—publish a finished render with FTP
    • Spring cleaning—archive unused images
    • Extending the editor—searching with regular expressions
    • Extending the editor—interacting with Subversion
      • Committing a file to the repository
      • Updating a file from the repository
      • Working with a repository
    • The need for speed—using Psyco
      • Enabling Psyco
    • Summary
  • Appendix A: Links and Resources
    • General Blender-related forums and blogs
    • Python programming
    • Blender scripting
    • External packages used in this book
    • Other sources of information

Michel J. Anders

Although trained as a chemist and physicist, Michel J Anders has mainly been employed as an IT manager working for Internet providers and IT consultancy firms and is currently working for a software development company focusing on correspondence and document production applications. He has been actively involved in providing advice to Blender scripters on public forums.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Blender 2.49 Scripting +    Flash iOS Apps Cookbook =
50% Off
the second eBook
Price for both: $33.00

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book


  • Discover what can be accomplished in Blender with the help of Python
  • Explore built-in modules and add an object to a Blender scene
  • Create configurable mesh objects and modify them
  • Define and enhance vertex group and add modifiers to an object
  • Explore scriptlinks and spacehandlers and perform activities on each frame change in an animation
  • Manipulate IPOs and act on frame changes
  • Build a web server delivering CAPTCHA challenges and archive unreferenced assets
  • Develop custom shaders and slope-dependent materials
  • Animate objects with complex constraints and relations and automate rendering
  • Extend Blender's image manipulation
  • Create simple and effective user interfaces

In Detail

Blender 3D is a popular, open source modeling package that can produce photo-realistic 3D images and animations. Automating tasks and extending the functionality of an extensive application like Blender will streamline your workflow and make the impossible possible. However, implementing scripts may be daunting.

This book takes a practical step-by-step approach to implementing Python scripts that cover almost all areas of Blender. It clearly outlines each problem and focuses on straightforward, easy-to-understand code, highlighting the common pitfalls and Blender idiosyncrasies. It guides you from the installation process and the creation of a simple object to elaborate, fully rigged models with vertex groups and materials all the way to extending Blender's built-in editor. It also teaches how to implement a simple web server inside Blender to serve rendered images. This book will take you from a clear problem description to a fully functional program. The focus is on finding your way in Blender's vast array of possibilities and getting things done without losing too much time on programming details. Each script is carefully explained to provide insight that can be reused in other projects.

This practical book will help you gain control over all the aspects of Blender using the Python programming language


The focus of the book is on practical problems and how to solve them in Python. The examples given are useful programs that try to solve real-world needs. Each chapter revolves around a single concept giving several examples gradually growing in difficulty. Each section analyses the problem first before diving into coding and gives extensive background information to enable the reader to generalize from the specific problem to a wider range of challenges. The sample code is provided as fully working examples with all key issues extensively highlighted. All sample programs are clear and concise yet nothing essential is left out and the programming style focuses on readability rather than on stylistic rigor or efficiency.

Who this book is for

This book is for users comfortable with Blender as a modeling and rendering tool who want to expand their skills to include Blender scripting to automate laborious tasks and achieve results otherwise impossible. Blender experience is essential as is some experience in Python programming.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software