diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-10-19 18:05:15 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-10-19 18:05:15 +0400 |
commit | 010062c4c7e08d7f320cfc2a34073b563a490ef3 (patch) | |
tree | 3e3437f17f69830828ffa0103c5725e9e0d5461e /add_curve_sapling/utils.py | |
parent | 4fbfb59acc93148d2c2c808f1bc9a138ffa4532a (diff) |
Fix #32923: curve sapling did not support generating uv coordinates yet for
rectangular leaves since bmesh.
Diffstat (limited to 'add_curve_sapling/utils.py')
-rw-r--r-- | add_curve_sapling/utils.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/add_curve_sapling/utils.py b/add_curve_sapling/utils.py index 2aae8a62..cba70ab0 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 = [] |