Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-08-08 17:56:56 +0300
committerAntonioya <blendergit@gmail.com>2018-08-08 17:56:56 +0300
commit5c4fd526124c348c8f324a2d0a384958c6e793b8 (patch)
tree4147a301d31e79e16a584769e61a506721a0ca6f /source/blender/editors/gpencil/gpencil_add_stroke.c
parent78a6fa1a7294d73a4f35b08d569d03f1afdd71ac (diff)
Fix T56220: Adding Grease Object crashes if link Material is set to Object
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_add_stroke.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_add_stroke.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c b/source/blender/editors/gpencil/gpencil_add_stroke.c
index f932f98ac1d..c5020593bcb 100644
--- a/source/blender/editors/gpencil/gpencil_add_stroke.c
+++ b/source/blender/editors/gpencil/gpencil_add_stroke.c
@@ -55,11 +55,10 @@ typedef struct ColorTemplate {
/* Add color an ensure duplications (matched by name) */
static int gp_stroke_material(Main *bmain, Object *ob, const ColorTemplate *pct)
{
- Material *ma = NULL;
- Material ***matar = give_matarar(ob);
short *totcol = give_totcolp(ob);
+ Material *ma = NULL;
for (short i = 0; i < *totcol; i++) {
- ma = (*matar)[i];
+ ma = give_current_material(ob, i + 1);
if (STREQ(ma->id.name, pct->name)) {
return i;
}
@@ -73,7 +72,7 @@ static int gp_stroke_material(Main *bmain, Object *ob, const ColorTemplate *pct)
copy_v4_v4(ma->gp_style->stroke_rgba, pct->line);
copy_v4_v4(ma->gp_style->fill_rgba, pct->fill);
- return BKE_object_material_slot_find_index(ob, ma) - 1;
+ return BKE_gpencil_get_material_index(ob, ma) - 1;
}
/* ***************************************************************** */