From 0fcf9b26725863030023f4529acfd6fa2bec2969 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 24 Dec 2014 14:51:35 +1100 Subject: Fix rna paint update callbacks assuming meshes --- source/blender/makesrna/intern/rna_sculpt_paint.c | 27 ++++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 0463250d1bb..8e83543812d 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -304,22 +304,27 @@ static void rna_ImaPaint_viewport_update(Main *UNUSED(bmain), Scene *UNUSED(scen static void rna_ImaPaint_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { Object *ob = OBACT; - - /* of course we need to invalidate here */ - BKE_texpaint_slots_refresh_object(scene, ob); - /* we assume that changing the current mode will invalidate the uv layers so we need to refresh display */ - GPU_drawobject_free(ob->derivedFinal); - BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); - WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); + if (ob && ob->type == OB_MESH) { + /* of course we need to invalidate here */ + BKE_texpaint_slots_refresh_object(scene, ob); + + /* we assume that changing the current mode will invalidate the uv layers so we need to refresh display */ + GPU_drawobject_free(ob->derivedFinal); + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); + } } static void rna_ImaPaint_stencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { - Object *ob = OBACT; - GPU_drawobject_free(ob->derivedFinal); - BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); - WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); + Object *ob = OBACT; + + if (ob && ob->type == OB_MESH) { + GPU_drawobject_free(ob->derivedFinal); + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); + } } static void rna_ImaPaint_canvas_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) -- cgit v1.2.3