Activity
Mon
Wed
Fri
Sun
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
Jan
Feb
What is this?
Less
More

Memberships

CG Python Academy (Free)

1.1k members • Free

1 contribution to CG Python Academy (Free)
Capstone Project for Part 1
I made a script that clears the scene if there was anything superfluous), and adds two types of trees. With each click of the script, the trees are positioned differently, as well as their height. Script and screen import bpy import random green_plane = bpy.data.materials.new(name= "Trava") green_plane.diffuse_color = [0, 0.45, 0, 1] green_tree = bpy.data.materials.new(name= "Listva") green_tree.diffuse_color = [0, 0.7, 0, 1] brown_tree = bpy.data.materials.new(name= "Stvol") brown_tree.diffuse_color = [0.2, 0.1, 0, 1] green_black = bpy.data.materials.new(name= "Elka") green_black.diffuse_color = [0, 0.2, 0, 1] def clean_scene(): bpy.ops.object.select_all(action='SELECT') bpy.ops.object.delete() def add_plane(): bpy.ops.mesh.primitive_plane_add() plane = bpy.context.active_object plane.scale.x = 20 plane.scale.y = 20 plane.data.materials.append(green_plane) def add_tree(): for i in range(10): x = random.randint(-19, 19) y = random.randint(-19, 19) height = random.randint(4, 6) bpy.ops.mesh.primitive_cylinder_add(radius = 0.5, location = (x,y, height / 2), depth = height) cyl = bpy.context.active_object cyl.data.materials.append(brown_tree) bpy.ops.mesh.primitive_uv_sphere_add(location = (x,y, height), radius = 3) uv = bpy.context.active_object uv.data.materials.append(green_tree) for i in range(10): x = random.randint(-19, 19) y = random.randint(-19, 19) height = random.randint(4, 6) bpy.ops.mesh.primitive_cylinder_add(radius = 0.5, location = (x,y, height / 2), depth = height) cyl = bpy.context.active_object cyl.data.materials.append(brown_tree) bpy.ops.mesh.primitive_cone_add(location = (x,y, height), depth = height,radius1= 2) cone = bpy.context.active_object
Capstone Project for Part 1
1-1 of 1
Виктор Руф
1
3points to level up
Victor

Active 2d ago
Joined Dec 17, 2025
Powered by