Beginner Blender Python Exercise: Using If Statements in For Loops (part 2)

preview_player
Показать описание

In this second video we will go over use cases of the ‘if’ flow control statement used with Python ‘for’ loops.

Beginner Blender Python Exercise: Introduction to If Statements (part 1)

00:00 - Intro
00:46 - Setup Workspace
01:51 - Create a for loop
02:43 - Randomly select an ico sphere or a cube
05:15 - Half ico spheres and half cubes
06:27 - Different code - same result
07:21 - Exercise #1
08:46 - Exercise #2
09:57 - Outro

Intro Music
Fiery Trails - Silent Partner

Background Music
Where To - Birocratic

Outro Music
Geographer - Easy Shake

#blender #python #scripting
Рекомендации по теме
Комментарии
Автор

You're a real gem to us, if possible can you please create a playlist (tutorials) of making a full working addon for blender (in one zip file), it would be great for your channel as well because of limited resources out there.

Regards.

Faheecho
Автор

hey i loved you channel, i activated notifications to watch more of them, feels really great to revise some programming concepts and observe more possible python utilities in blender

chicao.do.blender
Автор

The hardest part for me in python blender scripting that how can i identify the vertexes and faces. in 3ds max we hade faceID but in blender i never find it. Any advice?

fenyess
Автор

Hey i recently start coding and i come cross this:

***Operator Simple***

class
"""Tooltip"""
bl_idname = "mesh.myop"
bl_label = "My Operator"
bl_options = {"REGISTER", "UNDO"}

#Creating Type property
type : IntProperty(
name = "Type",
description = "0 = Cube 1 = Sphere 2= IcoSphere",
default = 0,
min = 0,
max = 3
) # it's C code so i don't know what cause error, trying making property based on if statement.
if type == 3:
#Creating Subdivision property
subdiv : IntProperty(
name = "Subdivision",
description = "Subdivision Number",
default = 2,
min = 1,
max = 5
)
def execute(self, context):
if self.type == 0:
bpy.ops.mesh.primitive_cube_add(size=2, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
elif self.type == 1:
bpy.ops.mesh.primitive_uv_sphere_add(radius=1, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
elif self.type == 2:
bpy.ops.mesh.primitive_ico_sphere_add(subdivisions=self.subdiv, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
return {'FINISHED'}

***Operator Simple***

Maybe you have idea what's going on and what cause error.

binsgbv