Films Training Blog
Pipeline and Tools Characters
Pipeline and Tools Characters
search Login Join
favorite

Development Fund

Support Blender Core Development with a monthly contribution.

theaters

Blender Studio

The creators who share. Access production content and knowledge from the Open Movies.

code

Blender Developer Blog

Latest news and updates on Blender development.

people

Get Involved

Join the community and help with design, development, docs and more.

bar_chart

Open Data

A platform to collect and display the Blender Benchmark results.

menu_book

Blender Docs

Documentation on Blender's features, tools and API.

Blender Conference

The yearly event that brings together the Blender community in one place.

download

Get Blender

Download the latest Blender version, or try the beta!

Films
Training
Blog
Pipeline and Tools
Characters
Search
Login
Join

Course

Scripting for Artists
feed Course Overview
feed Blender Versions
Videos keyboard_arrow_down
  1. 01

    Introduction & copy-pasting

    Free
  2. 02

    Names & Objects

  3. 03

    Stuff on Lists

  4. 04

    Data Types

  5. 05

    Collections: Mass-Rename of Objects

  6. 06

    Blender Collections

    Free
  7. 07

    For vs. While

    Free
  8. 08

    Your Own Operator

    Free
  9. 09

    From Script to Add-on

    Free
  10. 10

    User Interfaces

    Free
  11. 11

    Custom Properties

    Free
  12. 12

    Asset Linking

    Free
  13. 13

    Roast my Add-on

    Free
  14. 14

    The Roast of Nature Clicker

    Free
  15. 15

    Modal Operators

    Free
  16. 16

    Readability & Understandability

Tech keyboard_arrow_down
  1. 01

    Updating F-Curves

  2. 02

    Render 10,000 OBJ files

  3. 03

    Mass-Rename Bones & Vertex Groups

  4. 04

    Rendering from 'all' angles

Course

Scripting for Artists
feed Blender Versions
Videos keyboard_arrow_down
  1. 01

    Introduction & copy-pasting

    Free
  2. 02

    Names & Objects

  3. 03

    Stuff on Lists

  4. 04

    Data Types

  5. 05

    Collections: Mass-Rename of Objects

  6. 06

    Blender Collections

    Free
  7. 07

    For vs. While

    Free
  8. 08

    Your Own Operator

    Free
  9. 09

    From Script to Add-on

    Free
  10. 10

    User Interfaces

    Free
  11. 11

    Custom Properties

    Free
  12. 12

    Asset Linking

    Free
  13. 13

    Roast my Add-on

    Free
  14. 14

    The Roast of Nature Clicker

    Free
  15. 15

    Modal Operators

    Free
  16. 16

    Readability & Understandability

Tech keyboard_arrow_down
  1. 01

    Updating F-Curves

  2. 02

    Render 10,000 OBJ files

  3. 03

    Mass-Rename Bones & Vertex Groups

  4. 04

    Rendering from 'all' angles

You need to login to view this content

You can join Blender Studio for €11.50/month and get access to all of our training & film content instantly!

Login Join Blender Studio

Videos

Readability & Understandability

28th May 2021

info License: CC-BY
flag Report Problem

Author

Sybren A. Stüvel

Sometimes it can be tricky to get the computer to do exactly what you want, and it's a great victory when things finally work. It's tempting to move on to the next task at hand, but often it's better to look back and improve some things.

In this episode Sybren shows some techniques to reorganise code, with the aim of improving the readability & understandability.

  • 00:00 Intro
  • 01:12 Investigating the Camera Background Image panel code
  • 02:31 Splitting the code that handles an image into a function
  • 05:30 A little analysis of the loop
  • 06:11 Splitting up the code further into functions
  • 07:44 The has_bg mystery and the final flattening
  • 13:55 Cognitive Complexity
  • 15:00 Conclusion

This video was made using Blender 3.0 alpha.

7 Comments

Join to comment publicly.

Miguel Ángel Pedreño Sánchez

4th June 2021 - 10:58

Very interesting and useful video. I'll put this in practise with my addons/scripts ^^ thank you again, Sybren

Oliver J Post

11th June 2021 - 21:31

Thanks! Applying these tips and tricks right away!

Darío Baldiviezo

30th June 2021 - 21:08

Cool! +1 for this type of content. Entertaining and useful

Steven Goodman

8th August 2021 - 11:05

I followed along & edited the code in 3.0 Alpha ... It works perfectly (I back up the original ;0)...  I'v gotta say, that was the best python tutorial in refactoring I have ever see in two score years. Well played Dr. Stüvel.

Sybren A. Stüvel

7th October 2021 - 10:25

@Steven Goodman Thank you so much!

Marty Fouts

30th October 2021 - 17:45

I've just finished all 20 videos and I must say as someone who has been developing software professionally since 1973 this is the best introduction to a programming language for non-developers that I've ever seen. That alone is a difficult accomplishment but to also set the introduction in the context of a fairly complex domain, blender/bpy, is a serious achievement.  Well done.

Sybren A. Stüvel

2nd November 2021 - 21:00

@Marty Fouts Thank you so much!

Blender Studio

The Creators Who Share.

Facebook Logo Twitter Logo YouTube Logo
  • Films
  • Blog
  • Training
Pipeline and Tools
  • Cloud Rig
  • Blender Kitsu
  • Contact Sheet Add-on
  • Blender Purge
  • Blender Cloud Services
Characters
  • Einar
  • Security Bot
  • Huginn
  • Pack Bot
Studio
  • Terms & Conditions
  • Privacy Policy
  • Contact
  • Remixing Music
  • Blender.org
Loading...