diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp | 15 | ||||
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h | 2 |
2 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index a742a45ec12..51739cd4720 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -154,6 +154,9 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render* re, int render_count) : Str material->mode |= MA_TRANSP; material->mode |= MA_SHLESS; material->vcol_alpha = 1; + + // Reset serial mesh ID (used for BlenderStrokeRenderer::NewMesh()) + _mesh_id = 0xffffffff; } BlenderStrokeRenderer::~BlenderStrokeRenderer() @@ -211,6 +214,14 @@ float BlenderStrokeRenderer::get_stroke_vertex_z(void) const return -z; } +unsigned int BlenderStrokeRenderer::get_stroke_mesh_id(void) const +{ + unsigned mesh_id = _mesh_id; + BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this); + self->_mesh_id--; + return mesh_id; +} + void BlenderStrokeRenderer::RenderStrokeRep(StrokeRep *iStrokeRep) const { RenderStrokeRepBasic(iStrokeRep); @@ -473,7 +484,7 @@ Object *BlenderStrokeRenderer::NewMesh() const Object *ob; Base *base; char name[MAX_ID_NAME]; - static unsigned int mesh_id = 0xffffffff; + unsigned int mesh_id = get_stroke_mesh_id(); BLI_snprintf(name, MAX_ID_NAME, "0%08xOB", mesh_id); ob = BKE_object_add_only_object(G.main, OB_MESH, name); @@ -490,8 +501,6 @@ Object *BlenderStrokeRenderer::NewMesh() const #endif ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; - --mesh_id; - return ob; } diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h index 89bb20b4bed..fa6e83b853f 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h @@ -69,8 +69,10 @@ protected: Material *material; float _width, _height; float _z, _z_delta; + unsigned int _mesh_id; float get_stroke_vertex_z(void) const; + unsigned int get_stroke_mesh_id(void) const; }; #endif // __BLENDER_STROKE_RENDERER_H__ |