diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-14 23:19:44 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-14 23:19:44 +0400 |
commit | 9e3bf44011285917db1e1061a2f459722674b1b9 (patch) | |
tree | 812b5c8502142a593beb51d26135dbb12f23bc03 /source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp | |
parent | 190144ef6eae94b989c992595d043845242bd8e1 (diff) |
Fix for a static variable in BlenderStrokeRenderer::RenderStrokeRep() left after
quick trials of different approaches to performance improvement.
Diffstat (limited to 'source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp')
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp | 15 |
1 files changed, 12 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; } |