From c7eaea9e132afcbfed6d5df0a7514b5a2dde98bb Mon Sep 17 00:00:00 2001 From: CJSatnarine Date: Sun, 31 Dec 2023 13:15:36 -0500 Subject: [PATCH] Add colour to the tree trunk --- GenerateTerrain.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GenerateTerrain.py b/GenerateTerrain.py index 04c57ac..e4f5882 100644 --- a/GenerateTerrain.py +++ b/GenerateTerrain.py @@ -73,10 +73,13 @@ def buildTree(): while counter <= treeHeight: # Create the cube at that position. bpy.ops.mesh.primitive_cube_add(size = size, location = (treeXPos, treeYPos, treeZPos), scale = (size, size, size)) + # Save the active object + activeObject = bpy.context.active_object # Increase the z position by 1 for the next iteration treeZPos += 1 # Set the colour. - + treeTrunkColour = createMaterial(0.195465, 0.004988, 0.020193, 1) + assignMaterial(activeObject, treeTrunkColour) # increase the counter counter += 1