From 997624c7ddad836080e54d5b488169954bc77b35 Mon Sep 17 00:00:00 2001 From: Maxime Curioni Date: Wed, 8 Apr 2009 17:32:56 +0000 Subject: Corrected crash when calculating number of available style modules --- .../blender/freestyle/intern/app_blender/Controller.cpp | 1 + .../freestyle/intern/app_blender/FRS_freestyle.cpp | 2 +- source/blender/freestyle/intern/stroke/StyleModule.h | 17 +++++++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'source/blender/freestyle/intern') diff --git a/source/blender/freestyle/intern/app_blender/Controller.cpp b/source/blender/freestyle/intern/app_blender/Controller.cpp index f960b749ce6..ddb581438bd 100755 --- a/source/blender/freestyle/intern/app_blender/Controller.cpp +++ b/source/blender/freestyle/intern/app_blender/Controller.cpp @@ -632,6 +632,7 @@ void Controller::DrawStrokes() if(_ViewMap == 0) return; + cout << "\n=== Stroke drawing ===" << endl; _Chrono.start(); _Canvas->Draw(); real d = _Chrono.stop(); diff --git a/source/blender/freestyle/intern/app_blender/FRS_freestyle.cpp b/source/blender/freestyle/intern/app_blender/FRS_freestyle.cpp index 74414fbc844..95d0a5f7fa1 100644 --- a/source/blender/freestyle/intern/app_blender/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/app_blender/FRS_freestyle.cpp @@ -249,7 +249,7 @@ extern "C" { init_view(re); init_camera(re); - for(srl= (SceneRenderLayer *)re->scene->r.layers.first; srl; srl= srl->next) { + for(srl= (SceneRenderLayer *)G.scene->r.layers.first; srl; srl= srl->next) { if( !(srl->layflag & SCE_LAY_DISABLE) && srl->layflag & SCE_LAY_FRS && displayed_layer_count(srl) > 0 ) diff --git a/source/blender/freestyle/intern/stroke/StyleModule.h b/source/blender/freestyle/intern/stroke/StyleModule.h index 3d39e53515b..390a67d633d 100755 --- a/source/blender/freestyle/intern/stroke/StyleModule.h +++ b/source/blender/freestyle/intern/stroke/StyleModule.h @@ -61,12 +61,25 @@ public: cerr << "Error: no interpreter was found to execute the script" << endl; return NULL; } + + if (!_drawable) { + cerr << "Error: not drawable" << endl; + return NULL; + } + Operators::reset(); - if (_inter->interpretFile(_file_name)) + int errorCode; + if( errorCode = _inter->interpretFile(_file_name)) { + cerr << "Error: interpretation failed with code " << errorCode << endl; return NULL; + } + Operators::StrokesContainer* strokes_set = Operators::getStrokesSet(); - if (!_drawable || strokes_set->empty()) + if( strokes_set->empty() ) { + cerr << "Error: strokes set empty" << endl; return NULL; + } + StrokeLayer* sl = new StrokeLayer; for (Operators::StrokesContainer::iterator it = strokes_set->begin(); it != strokes_set->end(); -- cgit v1.2.3