From 010062c4c7e08d7f320cfc2a34073b563a490ef3 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel <brechtvanlommel@pandora.be> Date: Fri, 19 Oct 2012 14:05:15 +0000 Subject: [PATCH] Fix #32923: curve sapling did not support generating uv coordinates yet for rectangular leaves since bmesh. --- add_curve_sapling/utils.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/add_curve_sapling/utils.py b/add_curve_sapling/utils.py index 2aae8a624..cba70ab06 100644 --- a/add_curve_sapling/utils.py +++ b/add_curve_sapling/utils.py @@ -761,15 +761,19 @@ def addTree(props): bpy.context.scene.objects.link(leafObj) leafObj.parent = treeOb leafMesh.from_pydata(leafVerts,(),leafFaces) - leafMesh.validate() - ''' - # TODO: Broken after Bmesh merger, disable for now since default uvs are OK if leafShape == 'rect': - uv = leafMesh.uv_textures.new("leafUV") - for tf in uv.data: - tf.uv1, tf.uv2, tf.uv3, tf.uv4 = Vector((1, 0)), Vector((1, 1)), Vector((1 - leafScaleX, 1)), Vector((1 - leafScaleX, 0)) - ''' + leafMesh.uv_textures.new("leafUV") + uvlayer = leafMesh.uv_layers.active.data + + for i in range(0, len(leafFaces)): + uvlayer[i*4 + 0].uv = Vector((1, 0)) + uvlayer[i*4 + 1].uv = Vector((1, 1)) + uvlayer[i*4 + 2].uv = Vector((1 - leafScaleX, 1)) + uvlayer[i*4 + 3].uv = Vector((1 - leafScaleX, 0)) + + leafMesh.validate() + # This can be used if we need particle leaves # if (storeN == levels-1) and leaves: # normalList = [] -- GitLab