diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-03-28 22:12:45 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-03-28 22:12:45 +0400 |
commit | e2cb63574485efb2a9ccde1f0b15a29d086dd194 (patch) | |
tree | 207bffc5149603e39e75f3afab97e10bdd1a3def /source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp | |
parent | 840ba8e8e74c74088aabf8185b91fd5e32302fee (diff) |
Slightly reduced the memory consumption during stroke rendering by
removing ListBase BlenderStrokeRenderer::objects and relying on
Base freestyle_scene::base instead.
Diffstat (limited to 'source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp')
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index c7b4b681958..7672a448bba 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -15,6 +15,7 @@ extern "C" { #include "DNA_listBase.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" +#include "DNA_object_types.h" #include "DNA_screen_types.h" #include "BKE_customdata.h" @@ -42,8 +43,6 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render* re, int render_count) // Scene.New("FreestyleStrokes") old_scene = re->scene; - objects.first = objects.last = NULL; - ListBase lb; char name[22]; snprintf(name, sizeof(name), "FRS%d_%s", render_count, re->scene->id.name+2); @@ -78,8 +77,6 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render* re, int render_count) object_camera->loc[2] = 1.0; freestyle_scene->camera = object_camera; - - store_object(object_camera); // Material material = add_material("stroke_material"); @@ -91,16 +88,16 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render* re, int render_count) BlenderStrokeRenderer::~BlenderStrokeRenderer(){ - if(0 != _textureManager) - { - delete _textureManager; - _textureManager = 0; - } + if(0 != _textureManager) + { + delete _textureManager; + _textureManager = 0; + } // release objects and data blocks - LinkData *link = (LinkData *)objects.first; - while(link) { - Object *ob = (Object *)link->data; + Base *b = (Base *)freestyle_scene->base.first; + while(b) { + Object *ob = b->object; void *data = ob->data; char name[24]; strcpy(name, ob->id.name); @@ -113,13 +110,14 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer(){ case OB_CAMERA: free_libblock( &G.main->object, ob ); free_libblock( &G.main->camera, data ); + freestyle_scene->camera = NULL; break; default: cerr << "Warning: unexpected object in the scene: " << name[0] << name[1] << ":" << (name+2) << endl; } - link = link->next; + b = b->next; } - BLI_freelistN( &objects ); + BLI_freelistN( &freestyle_scene->base ); // release material free_libblock( &G.main->mat, material ); @@ -127,13 +125,6 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer(){ set_scene_bg( old_scene ); } -void BlenderStrokeRenderer::store_object(Object *ob) const { - - LinkData *link = (LinkData *)MEM_callocN(sizeof(LinkData), "temporary object" ); - link->data = ob; - BLI_addhead(const_cast<ListBase *>(&objects), link); -} - float BlenderStrokeRenderer::get_stroke_vertex_z(void) const { float z = _z; BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this); @@ -210,8 +201,6 @@ void BlenderStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const{ MEM_freeN(mesh->bb); mesh->bb= NULL; mesh->id.us = 0; - - store_object(object_mesh); #if 1 // me.materials = [mat] |