Scripting for Artists
This training series spans several years, and thus were aimed at different versions of Blender. As it's not possible time-wise to re-record the videos, this page is here to help you out and bring the code to be compatible with a modern release of Blender (2.93 at moment of writing).
Below there are sections for the different versions of Blender used in Scripting for Artists.
Videos 1-4 were made in 2017 with Blender 2.78.
The object creation operators now use the radius
parameter instead of size
, so for example bpy.ops.mesh.primitive_uv_sphere_add(size=0.1, location=(1, 1, 1))
changes to bpy.ops.mesh.primitive_uv_sphere_add(radius=0.1, location=(1, 1, 1))
.
Since Blender 2.90, Operator Search (F3) only searches through operators that are contained in a menu. To see all operators in Blender, enable Developer Extra's in the Interface preferences.
Auto-completion in the Python console now uses Tab rather than Control-Space.
Hiding objects has changed, as objects can now have different visibility states in different view layers.
Instead of setting ob.hide = True
, you have to call ob.hide_set(True)
(docs).
Instead of getting ob.hide
, you can call either ob.hide_get()
(docs) or ob.visible_get()
(docs).
Selecting objects has changed just like hiding them.
Instead of setting ob.select = True
, you have to call ob.select_set(True)
(docs).
Instead of getting ob.select
, call ob.select_get()
(docs).
Matrix multiplication has changed. In Tech 4: Rendering from 'all' angles we use vcoord = placement_ob.matrix_world * vert.co
to perform a matrix multiplication. In modern Blenders this should use the @
operator, so it becomes vcoord = placement_ob.matrix_world @ vert.co
.
The Tech videos were made in 2017 with Blender 2.79. The same notes as above for Blender 2.78 apply.
Videos 5-15 were made in 2020 with Blender 2.83.
Video 16 was made in 2021 with Blender 3.0 alpha. It doesn't focus on writing any particular code, so there are no upgrade instructions here.