After introducing himself and this training course, Sybren shows how to start scripting Blender.
- Introduction
- Computers are stupid
- Using the Python console
- Copying stuff from Blender's user interface
- Changing properties of objects
- Sources of information
Links from the video
- Blender's Python API documentation. This link is for daily builds, so it may be for a newer version of Blender than you're currently using. If you want the documentation for your version of Blender, go to Help → Python API Reference in Blender itself.
- Python Standard Library. Here you can find lots of information about Python itself.
The Slides
Slides are only visible to Blender Cloud susbcribers
37 Comments
Join to comment publicly.
Marjorie Chan
9th February 2020 - 09:07
For those using it for 2.81, UV Sphere now uses the radius key instead of size
bpy.ops.mesh.primitive_uv_sphere_add(radius=0.1, location=(1, 1, 1))
Luis Felipe Peredo Noguez
11th February 2021 - 20:19
@mclifeisagame Thank you
Neil Brown
7th May 2020 - 23:43
Using Blender version 2.82 out of the box the python code doesn't show, I had to tick Python Tooltips in menu Edit > Preferences > Interface
dangnhattoan
18th May 2020 - 07:56
*@Neil Brown* Thanks.
Jimmy Gunawan
22nd August 2017 - 13:19
Copy paste while hovering on command is handy indeed. Cool~
Luciano A. Muñoz Sessarego
21st August 2017 - 19:13
Really great, i also love that you put the slides!, it makes easy to go back and check stuff for reference!, good job sir!
Ludwig Heijden
24th December 2020 - 17:29
You made me buy a cloud account. Grrrrrr Sybren!
(thank you)
Jim Conrad
14th April 2021 - 02:34
Autocomplete hotkey is TAB in Blender 2.8+
Julian Darley
5th November 2020 - 19:12
at 4.20: auto-completion now uses
tab
rather thancontrol space
(in B2.90 - not sure about B2.8)LUKE MORGANE GABIN EWENN
29th August 2017 - 09:24
I just love this series of video. It's just technical enough not to be boring and still the examples are simple enough to be understandable. Great job. I'm already using all that in my latest project. I'm Done with monkey business !
Sybren A. Stüvel
29th August 2017 - 10:31
@luke.video: Thanks!
Konrad Welz
8th October 2017 - 12:33
This is so excellent! Great delivery and graphics. Already worth my monthly subscription. More tutorials like this are always welcome. Thank you.
PlumpMath
3rd February 2018 - 00:43
Transcript please. (no subtitle)
Gemma María Rull
9th November 2018 - 16:28
Great!
Björn Strandberg
21st November 2018 - 19:39
I get this error:
>>> bpy.data.objects("Cube").location.x Traceback (most recent call last): File "<blender_console>", line 1, in <module> TypeError: 'bpy_prop_collection' object is not callable
>>> bpy.data.objects("Cube").location[0] Traceback (most recent call last): File "<blender_console>", line 1, in <module> TypeError: 'bpy_prop_collection' object is not callable
what am i missing? Blender 2.79b MAC
Sybren A. Stüvel
22nd November 2018 - 11:49
@Björn Strandberg: You're writing a function call
objects(...)
instead of trying to index a collectionobjects[...]
-- note the use of parentheses for the former, and brackets for the latter.Björn Strandberg
25th November 2018 - 18:21
Thanks a bunch!@Sybren A. Stüvel:
Arnar Ómarsson
8th March 2019 - 22:42
Should all of this (and the rest of this course) apply to Blender 2.8 Beta (2019-03-03)? Or should I wait for the official release?
Sybren A. Stüvel
12th March 2019 - 09:49
*@Arnar Ómarsson* Much of these techniques will work on 2.8 beta, but there have been significant API changes. With that link you should be able to get quite far, though. Soon I'll start preparing to update things for Blender 2.80; not sure in which form or when that will be available on the Cloud though.
李杰
26th November 2019 - 06:26
great!!!
Yule Mayevsky
12th January 2020 - 01:49
i am copying exactly like you. and i get an IndentationError: unexpected indent
Sybren A. Stüvel
27th September 2020 - 17:14
*@Yule Mayevsky* Python is whitespace-sensitive, so make sure that the indentation is correct and that you're not mixing tabs and spaces.
<deleted>
16th September 2020 - 09:07
Very nice indeed. Especially copying from Blender into the search of (Api)the documemtation, is what I did not know , a feature I will use probably a lot.
And congratulations Sybren to your way to giving lessons: Introduction what you will talk about, the talk, AND a recapulation of what has been shown. Great!
Jenae Renee Jordan
16th September 2020 - 14:52
Thank you so very much for this course, Mr. Stuvel.
jamesrossbond
4th November 2020 - 22:18
I have blender 2.9.01. is this course something I can do with it?
Sybren A. Stüvel
3rd June 2021 - 17:18
@jamesrossbond Of course! Apart from a few minor things, Blender still works the same.
Julian Darley
5th November 2020 - 19:11
at around 4 minutes, manipulating the scale: is it correct that scale multiplication is always done with respect to the original object? in other words, with this example command
bpy.data.objects['Cube'].scale = (0.5, 0.3, 0.2)
will it always make the cube the same size, rather than shrinking it from whatever size it is at the moment of executing the command?Sybren A. Stüvel
3rd June 2021 - 17:19
@Julian Darley Yup, the scale is always relative to the original size of the object.
Julian Darley
5th November 2020 - 21:34
at 6.17, in the Help Menu one can see an Operator Cheat Sheet. clicking on it seems to do nothing, but in fact, a text file has been created and it can be viewed by selecting it in the Text Editor window under the text dropdown (see the text doc icon). if you keep clicking it (as i did before discovering what was happening), you will create more and more copies of the cheat sheet.
Troy Carpenter
7th December 2021 - 09:17
It seems in more recent versions of blender when you hover over something and press control-c you are copying that fields value and not the the python path. Is there a new hotkey?
Sybren A. Stüvel
4th January 2022 - 13:23
@Troy Carpenter for editable fields, use ctrl+shift+c to get the data path.
Patrick R Roza
24th April 2022 - 18:05
Great series and would like to your vscode integation with blender. Maybe some bender python file structure.I want to write scripts that use other 3rd party modules and output to blender for visuals ( web scrap data then blender to give visuals). Also using python to create node configurations. These are things that could make a new training series.
Johan Tri Handoyo
21st August 2017 - 21:25
copy and paste doesn't work for me. I'm using Blender 2.78c 64 bit in Ubuntu 16.04. Any idea why?
Sybren A. Stüvel
22nd August 2017 - 11:21
@johantri: What are you doing exactly? Which buttons are you pressing? Where is your mouse cursor when you press them?
Pete Robie
23rd December 2017 - 06:54
Hi Sybren. I've been trying to create a selection box with a file browser and I've had no luck as of yet. I know it's a little more advanced, but would you mind pointing me in the right direction?
Sybren A. Stüvel
24th December 2017 - 15:01
@Pete Robie: The importance here is to think from the data perspective, and not from the GUI perspective. If you want to have a file selector, the property to store the selected file should have
subtype='FILE_PATH'
. Blender will draw an appropriate interface for you then.Pete Robie
24th December 2017 - 18:10
@Sybren A. Stüvel: Thank you.