Minor changes.

This commit is contained in:
CJSatnarine
2023-03-27 12:01:59 -04:00
parent e4735d048f
commit c7683e9124

View File

@@ -3,11 +3,10 @@ import bpy;
import random; import random;
# Variables: # Variables:
# Size of each cube.
size = 1; # Size of each cube. size = 1;
# Setting the x, y, and z positions.
x = y = z = size / 2; # Setting the x, y, and z positions. x = y = z = size / 2;
#Function to clean the scene. This removes all of the objects, collections, materials, particles, textures, images, curves, meshes, actions, nodes, and worlds from the scene. #Function to clean the scene. This removes all of the objects, collections, materials, particles, textures, images, curves, meshes, actions, nodes, and worlds from the scene.
def cleanScene(): def cleanScene():
@@ -25,8 +24,9 @@ def cleanScene():
bpy.ops.object.select_all(action = "SELECT"); bpy.ops.object.select_all(action = "SELECT");
bpy.ops.object.delete(); bpy.ops.object.delete();
# Iterate over each grid 'cell' we want a cube at. # Function to spawn the "ground" by creating several cubes using a nested for loop.
def spawnGround(): def spawnGround():
# Iterate over each grid "cell" we want a cube at.
for x in range(20): for x in range(20):
for y in range(20): for y in range(20):
for z in range(1): for z in range(1):
@@ -50,7 +50,7 @@ def spawnGround():
# Change the base colour. # Change the base colour.
materialNodes['Principled BSDF'].inputs['Base Color'].default_value = (1.0, 0.47, 1.0, 1.0); materialNodes['Principled BSDF'].inputs['Base Color'].default_value = (1.0, 0.47, 1.0, 1.0);
# Calls the functions: # Calling the functions:
cleanScene(); cleanScene();
spawnGround(); spawnGround();
@@ -60,4 +60,5 @@ spawnGround();
# - y is for creating cubes in the y axis. # - y is for creating cubes in the y axis.
# - z is for creating cubes in the z axis. # - z is for creating cubes in the z axis.
# - I need to add the materials to the cubes and somehow save it in the Blender program. # - I need to add the materials to the cubes and somehow save it in the Blender program.
# - I need to replace the nested for loop with a recursive function to spawn the ground.
# - I need to add a function to create a tree in a random position. This function will create cubes and put them in a way to look like a tree. It will also assign the correct materials to their proper cubes. # - I need to add a function to create a tree in a random position. This function will create cubes and put them in a way to look like a tree. It will also assign the correct materials to their proper cubes.