[Bf-blender-cvs] [47df163b6cd] master: GPencil: Verify brush is valid for grease pencil

Antonioya noreply at git.blender.org
Sun May 5 09:11:00 CEST 2019


Commit: 47df163b6cd9074d1e41e268911cbab943fb6a80
Author: Antonioya
Date:   Sun May 5 09:10:44 2019 +0200
Branches: master
https://developer.blender.org/rB47df163b6cd9074d1e41e268911cbab943fb6a80

GPencil: Verify brush is valid for grease pencil

Usually the brush type is correct, but for some old files the brush could be a not valid type. In this case, returns the object active material.

This is related to T61413

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

M	source/blender/blenkernel/intern/gpencil.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index c82b2c377fa..439005ca1b4 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1109,7 +1109,8 @@ Material *BKE_gpencil_object_material_new(Main *bmain, Object *ob, const char *n
 /* Returns the material for a brush with respect to its pinned state. */
 Material *BKE_gpencil_object_material_get_from_brush(Object *ob, Brush *brush)
 {
-  if ((brush) && (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED)) {
+  if ((brush) && (brush->gpencil_settings) &&
+      (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED)) {
     Material *ma = BKE_gpencil_brush_material_get(brush);
     return ma;
   }



More information about the Bf-blender-cvs mailing list