Create layout for spawnTree function
This commit is contained in:
@@ -7,9 +7,9 @@ size = 1;
|
|||||||
# Setting the x, y, and z positions.
|
# Setting the x, y, and z positions.
|
||||||
x = y = z = size / 2;
|
x = y = z = size / 2;
|
||||||
# Setting the number of cubes in each coordinate.
|
# Setting the number of cubes in each coordinate.
|
||||||
xNum = 3;
|
xNum = 5;
|
||||||
yNum = 3;
|
yNum = 5;
|
||||||
zNum = 3;
|
zNum = 1;
|
||||||
# Setting the initial value for the number of cubes in each recursive call.
|
# Setting the initial value for the number of cubes in each recursive call.
|
||||||
cubeCount = 0;
|
cubeCount = 0;
|
||||||
# Setting the maximum amount of cubes that is needed to be created.
|
# Setting the maximum amount of cubes that is needed to be created.
|
||||||
@@ -44,8 +44,7 @@ def spawnGround():
|
|||||||
bpy.ops.mesh.primitive_cube_add(size = size, location = location, scale = (size, size, size));
|
bpy.ops.mesh.primitive_cube_add(size = size, location = location, scale = (size, size, size));
|
||||||
# Set the newly created cube as the active object.
|
# Set the newly created cube as the active object.
|
||||||
activeObject = bpy.context.active_object;
|
activeObject = bpy.context.active_object;
|
||||||
# Add a new material slot.
|
|
||||||
# bpy.ops.object.material_slot_add();
|
|
||||||
# Creating a new material and assigning it to the active cube.
|
# Creating a new material and assigning it to the active cube.
|
||||||
material = bpy.data.materials.new("Material");
|
material = bpy.data.materials.new("Material");
|
||||||
material.use_nodes = True;
|
material.use_nodes = True;
|
||||||
@@ -56,10 +55,14 @@ 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.
|
||||||
|
def spawnTree():
|
||||||
|
print("Tree has spawned.");
|
||||||
|
|
||||||
# Calling the functions:
|
# Calling the functions:
|
||||||
cleanScene();
|
cleanScene();
|
||||||
spawnGround();
|
spawnGround();
|
||||||
|
spawnTree;
|
||||||
|
|
||||||
# Shows that the code ran.
|
# Shows that the code ran.
|
||||||
print("The code ran.");
|
print("The code ran.");
|
||||||
|
Reference in New Issue
Block a user