diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-07-20 15:09:46 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-08-12 05:10:44 +0400 |
commit | 2843aa1501c5aabebe1701c88cd30b501e6b4aa5 (patch) | |
tree | bc3bb5aa825f63c73e4f6264ad1851fd52088437 | |
parent | cc33d731856560896362f94d11cb16f66ca4d3d7 (diff) |
Freestyle: Fix for error handling in SCENE_OT_freestyle_stroke_material_create.
-rw-r--r-- | source/blender/editors/render/render_shading.c | 8 | ||||
-rw-r--r-- | source/blender/freestyle/FRS_freestyle.h | 3 | ||||
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp | 11 |
3 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 021e4aaf339..5c3bd8f9eae 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -1254,8 +1254,14 @@ static int freestyle_stroke_material_create_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); + FreestyleLineStyle *linestyle = BKE_linestyle_active_from_scene(scene); - FRS_create_stroke_material(C, bmain, scene); + if (!linestyle) { + BKE_report(op->reports, RPT_ERROR, "No active line style in the current scene"); + return OPERATOR_CANCELLED; + } + + FRS_create_stroke_material(C, bmain, linestyle); return OPERATOR_FINISHED; } diff --git a/source/blender/freestyle/FRS_freestyle.h b/source/blender/freestyle/FRS_freestyle.h index c3bf854447c..3777f8dfd49 100644 --- a/source/blender/freestyle/FRS_freestyle.h +++ b/source/blender/freestyle/FRS_freestyle.h @@ -32,6 +32,7 @@ extern "C" { struct Render; struct Material; struct FreestyleConfig; +struct FreestyleLineStyle; struct bContext; extern struct Scene *freestyle_scene; @@ -59,7 +60,7 @@ void FRS_move_active_lineset_up(struct FreestyleConfig *config); void FRS_move_active_lineset_down(struct FreestyleConfig *config); /* Testing */ -struct Material *FRS_create_stroke_material(struct bContext *C, struct Main *bmain, struct Scene *scene); +struct Material *FRS_create_stroke_material(struct bContext *C, struct Main *bmain, struct FreestyleLineStyle *linestyle); #ifdef __cplusplus } diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 1c8df35cb3e..bba4f58b922 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -735,16 +735,9 @@ void FRS_move_active_lineset_down(FreestyleConfig *config) // Testing -Material *FRS_create_stroke_material(bContext *C, Main *bmain, Scene *scene) +Material *FRS_create_stroke_material(bContext *C, Main *bmain, struct FreestyleLineStyle *linestyle) { - FreestyleLineStyle *linestyle = BKE_linestyle_active_from_scene(scene); - Material *ma; - - if (!linestyle) { - cout << "FRS_create_stroke_material: No active line style in the current scene" << endl; - return NULL; - } - ma = BlenderStrokeRenderer::GetStrokeShader(C, bmain, linestyle->nodetree, true); + Material *ma = BlenderStrokeRenderer::GetStrokeShader(C, bmain, linestyle->nodetree, true); ma->id.us = 0; return ma; } |