Skip to content

yohimbo/blenderDonutTutorialButInPython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 

Repository files navigation

Blender Donut Tutorial But In Python

The classic Blender Guru tutorial but entirely in a python script.

This is the creation of a juicy, overflowing donut 🍩 in the classic blender tutorial manner. The big difference is here it is made entirely by script rather than by mouse or by tablet.

Why? Why not? But also - shouldn't we be able to treat blender models and environments the same way we treat our code - by saving it in stages and states in git?

If you can script it, script it.

The code

import bpy 
from math import *

Import the blender python package and math because it always comes up.

Object Parameters

First we set the donut 🍩 settings to initial state. A fat donut 🍩 as Blender Guru states:

bpy.ops.mesh.primitive_torus_add(major_segments=40,minor_segments=16,major_radius=0.91,minor_radius=0.61)
  • Major Segments, Number of segments for the main ring of the torus 🐂
  • Minor Segments, Number of segments for the minor ring of the torus 🐂
  • Major Radius, Radius from the origin to the center of the cross sections
  • Minor Radius, Radius of the torus’ cross section

Next we need to select the object to begin working with it so we have donut!!!! donut = bpy.context.active_object

Real World Measurements & Applying Scale

bpy.ops.transform.resize(value=(0.033,0.033,0.033))

bpy.ops.object.transform_apply(scale=True)

Flat and Smooth Shading

bpy.ops.object.shade_smooth()

Subsurf Modifier

The full list of Object Modifier Type Items -> here

bpy.ops.object.modifier_add(type='SUBSURF')

Proportional Editing

About

The classic Blender Guru tutorial but entirely in a python script

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages