Clean the code a bit

This commit is contained in:
CJSatnarine
2023-12-29 12:46:29 -05:00
parent 9e465259ac
commit c530a0fbc6

View File

@@ -1,7 +1,6 @@
#Imports. #Imports.
import bpy; import bpy;
# Variables:
# Size of each cube. # Size of each cube.
size = 1; size = 1;
# Setting the x, y, and z positions. # Setting the x, y, and z positions.
@@ -55,6 +54,7 @@ def spawnGround():
# Change the base colour. # Change the base colour.
materialNodes['Principled BSDF'].inputs['Base Color'].default_value = (0.056, 0.439, 0.059, 1.0); materialNodes['Principled BSDF'].inputs['Base Color'].default_value = (0.056, 0.439, 0.059, 1.0);
# Function to spawn trees on the grass. # Function to spawn trees on the grass.
def spawnTree(): def spawnTree():
print("Tree has spawned."); print("Tree has spawned.");
@@ -62,16 +62,12 @@ def spawnTree():
# Calling the functions: # Calling the functions:
cleanScene(); cleanScene();
spawnGround(); spawnGround();
spawnTree; spawnTree();
# Shows that the code ran. # Shows that the code ran.
print("The code ran."); print("The code ran.");
# Notes: # Notes:
# - For loop for the grid:
# - x is for creating cubes in the x axis.
# - y is for creating cubes in the y 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 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.