[Bf-blender-cvs] [0fcf9b2] master: Fix rna paint update callbacks assuming meshes

Campbell Barton noreply at git.blender.org
Wed Dec 24 04:53:36 CET 2014


Commit: 0fcf9b26725863030023f4529acfd6fa2bec2969
Author: Campbell Barton
Date:   Wed Dec 24 14:51:35 2014 +1100
Branches: master
https://developer.blender.org/rB0fcf9b26725863030023f4529acfd6fa2bec2969

Fix rna paint update callbacks assuming meshes

===================================================================

M	source/blender/makesrna/intern/rna_sculpt_paint.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 0463250..8e83543 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))




More information about the Bf-blender-cvs mailing list