[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3870] trunk/py/scripts/addons/ add_curve_sapling/utils.py: Fix #32923: curve sapling did not support generating uv coordinates yet for
Brecht Van Lommel
brechtvanlommel at pandora.be
Fri Oct 19 16:05:15 CEST 2012
Revision: 3870
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3870
Author: blendix
Date: 2012-10-19 14:05:15 +0000 (Fri, 19 Oct 2012)
Log Message:
-----------
Fix #32923: curve sapling did not support generating uv coordinates yet for
rectangular leaves since bmesh.
Modified Paths:
--------------
trunk/py/scripts/addons/add_curve_sapling/utils.py
Modified: trunk/py/scripts/addons/add_curve_sapling/utils.py
===================================================================
--- trunk/py/scripts/addons/add_curve_sapling/utils.py 2012-10-19 10:02:13 UTC (rev 3869)
+++ trunk/py/scripts/addons/add_curve_sapling/utils.py 2012-10-19 14:05:15 UTC (rev 3870)
@@ -761,15 +761,19 @@
bpy.context.scene.objects.link(leafObj)
leafObj.parent = treeOb
leafMesh.from_pydata(leafVerts,(),leafFaces)
+
+ if leafShape == 'rect':
+ 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()
- '''
- # 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))
- '''
# This can be used if we need particle leaves
# if (storeN == levels-1) and leaves:
# normalList = []
More information about the Bf-extensions-cvs
mailing list