diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp index aa18ca7d7cb..9e90bf1b625 100644 --- a/intern/cycles/render/attribute.cpp +++ b/intern/cycles/render/attribute.cpp @@ -101,9 +101,9 @@ ustring Attribute::standard_name(Attribute::Standard std) /* Attribute Set */ -AttributeSet::AttributeSet(Mesh *mesh_) +AttributeSet::AttributeSet() { - mesh = mesh_; + mesh = NULL; } AttributeSet::~AttributeSet() @@ -133,7 +133,8 @@ Attribute *AttributeSet::add(ustring name, TypeDesc type, Attribute::Element ele else if(element == Attribute::CORNER) attr->set(name, type, element); - attr->reserve(mesh->verts.size(), mesh->triangles.size()); + if(mesh) + attr->reserve(mesh->verts.size(), mesh->triangles.size()); return attr; } diff --git a/intern/cycles/render/attribute.h b/intern/cycles/render/attribute.h index aef215d6c0c..7af4657daa3 100644 --- a/intern/cycles/render/attribute.h +++ b/intern/cycles/render/attribute.h @@ -94,7 +94,7 @@ public: Mesh *mesh; list attributes; - AttributeSet(Mesh *mesh); + AttributeSet(); ~AttributeSet(); Attribute *add(ustring name, TypeDesc type, Attribute::Element element); diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index cd533f24058..a7eb365f983 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -38,7 +38,6 @@ CCL_NAMESPACE_BEGIN /* Mesh */ Mesh::Mesh() -: attributes(this) { need_update = true; transform_applied = false; @@ -49,6 +48,8 @@ Mesh::Mesh() tri_offset = 0; vert_offset = 0; + + attributes.mesh = this; } Mesh::~Mesh()