Fix T50634: Hair Primitive as Triangles + Hair shader with a texture = crash
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 27 Feb 2017 14:11:51 +0000 (15:11 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 27 Feb 2017 14:21:14 +0000 (15:21 +0100)
Attributes were not resized after pushing new triangles to the mesh.

intern/cycles/blender/blender_curves.cpp

index 7365f39aaaec2ad81ac9ba961702591aec330a8d..ffa5b6769173b440c52c301cbaac7e4a0fb25690 100644 (file)
@@ -411,6 +411,7 @@ static void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData,
                }
        }
 
+       mesh->resize_mesh(mesh->verts.size(), mesh->triangles.size());
        mesh->attributes.remove(ATTR_STD_VERTEX_NORMAL);
        mesh->attributes.remove(ATTR_STD_FACE_NORMAL);
        mesh->add_face_normals();
@@ -545,6 +546,7 @@ static void ExportCurveTriangleGeometry(Mesh *mesh,
                }
        }
 
+       mesh->resize_mesh(mesh->verts.size(), mesh->triangles.size());
        mesh->attributes.remove(ATTR_STD_VERTEX_NORMAL);
        mesh->attributes.remove(ATTR_STD_FACE_NORMAL);
        mesh->add_face_normals();