[Bf-blender-cvs] [657f709] hair_system: Enable "generated" coordinates for hair curves in Cycles.

Lukas Tönne noreply at git.blender.org
Thu Aug 14 20:51:02 CEST 2014


Commit: 657f7099f4cab1e3f91349d319c93732a9d130de
Author: Lukas Tönne
Date:   Thu Aug 14 20:50:17 2014 +0200
Branches: hair_system
https://developer.blender.org/rB657f7099f4cab1e3f91349d319c93732a9d130de

Enable "generated" coordinates for hair curves in Cycles.

Also includes a fix for attributes: the buffer retrieved for attributes
is not automatically resized when hair curves try to add the same
attribute as particles at a later time ... This should have more robust
behavior!

===================================================================

M	intern/cycles/blender/blender_curves.cpp

===================================================================

diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp
index cdb8d81..51adb0e 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -1019,6 +1019,7 @@ bool BlenderSync::sync_particle_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b
 			mesh_texture_space(b_mesh, loc, size);
 
 			if(primitive == CURVE_TRIANGLES) {
+				mesh->attributes.reserve(); /* make sure the buffer size is correct, in case the attribute already exists */
 				Attribute *attr_generated = mesh->attributes.add(ATTR_STD_GENERATED);
 				float3 *generated = attr_generated->data_float3();
 
@@ -1026,6 +1027,7 @@ bool BlenderSync::sync_particle_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b
 					generated[i] = mesh->verts[i]*size - loc;
 			}
 			else {
+				mesh->curve_attributes.reserve(); /* make sure the buffer size is correct, in case the attribute already exists */
 				Attribute *attr_generated = mesh->curve_attributes.add(ATTR_STD_GENERATED);
 				float3 *generated = attr_generated->data_float3();
 				size_t i = 0;
@@ -1175,15 +1177,15 @@ bool BlenderSync::sync_hair_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob,
 				ExportHairCurveSegments(scene, mesh, b_mod_hair.hair_system());
 		}
 
-#if 0
 		/* generated coordinates from first key. we should ideally get this from
-	 * blender to handle deforming objects */
+		 * blender to handle deforming objects */
 		if(!motion) {
 			if(mesh->need_attribute(scene, ATTR_STD_GENERATED)) {
 				float3 loc, size;
 				mesh_texture_space(b_mesh, loc, size);
 				
 				if(primitive == CURVE_TRIANGLES) {
+					mesh->attributes.reserve(); /* make sure the buffer size is correct, in case the attribute already exists */
 					Attribute *attr_generated = mesh->attributes.add(ATTR_STD_GENERATED);
 					float3 *generated = attr_generated->data_float3();
 					
@@ -1191,6 +1193,7 @@ bool BlenderSync::sync_hair_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob,
 						generated[i] = mesh->verts[i]*size - loc;
 				}
 				else {
+					mesh->curve_attributes.reserve(); /* make sure the buffer size is correct, in case the attribute already exists */
 					Attribute *attr_generated = mesh->curve_attributes.add(ATTR_STD_GENERATED);
 					float3 *generated = attr_generated->data_float3();
 					size_t i = 0;
@@ -1203,6 +1206,7 @@ bool BlenderSync::sync_hair_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob,
 			}
 		}
 		
+#if 0
 		/* create vertex color attributes */
 		if(!motion) {
 			BL::Mesh::tessface_vertex_colors_iterator l;




More information about the Bf-blender-cvs mailing list