Blender (software): Difference between revisions

From David's Wiki
Line 25: Line 25:
Blender supports scripting as an alternative means of interaction.
Blender supports scripting as an alternative means of interaction.
Most things are available in the <code>bpy</code> module.
Most things are available in the <code>bpy</code> module.
See one of the following resources to get started:
* [https://www.youtube.com/watch?v=XqX5wh4YeRw Python Crash Course for Blender! by Curtis Holt]


===Saving scripts outside===
===Saving scripts outside===
Line 36: Line 39:
exec(compile(open(filepath).read(), filename, 'exec'))
exec(compile(open(filepath).read(), filename, 'exec'))
</syntaxhighlight>
</syntaxhighlight>
===Resources===
* [https://www.youtube.com/watch?v=XqX5wh4YeRw Python Crash Course for Blender! by Curtis Holt]


==Resources==
==Resources==

Revision as of 17:03, 1 June 2021

Blender is an open-source 3D modelling software.
It can be used for creating 3D models for games, 2D/3D animations, and even video games.

Getting Started

Installation

Windows

Direct Download
From chocolatey:

choco install blender
Ubuntu

Blender is available on the Snap store

sudo snap install blender --classic

Modelling

Scripting

Blender Python API

Getting Started

Blender supports scripting as an alternative means of interaction. Most things are available in the bpy module.

See one of the following resources to get started:

Saving scripts outside

See using external ide and [1].

By default, everything is stored in the .blend file including your custom scripts. If you want to store your scripts outside or use another IDE, you will need to have the script inside Blender call the script outside:

import bpy
filepath = bpy.path.abspath("//myscript.py")
exec(compile(open(filepath).read(), filename, 'exec'))

Resources