diff options
author | Antonioya <blendergit@gmail.com> | 2018-12-12 21:48:24 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-12-12 21:48:24 +0300 |
commit | 9c5d1042244e833704cad5b50ab89c7792448f33 (patch) | |
tree | 93ce46fab31c29f2bb527af218bbd66d9babf74e /source/blender/draw/engines/gpencil | |
parent | 80ad2f8cf6bf6612f629491057d8588787440e20 (diff) |
Fix T59248: Crash in Grease Pencil Edit mode when adding Annotation
Diffstat (limited to 'source/blender/draw/engines/gpencil')
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_draw_utils.c | 40 | ||||
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_engine.c | 4 |
2 files changed, 25 insertions, 19 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c index fe950d2a228..2450f9419bf 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@ -1387,28 +1387,32 @@ static void DRW_gpencil_shgroups_create( } case eGpencilBatchGroupType_Edit: { - const int len = elm->vertex_idx - start_edit; - /* use always the same group */ - DRW_shgroup_call_range_add( - stl->g_data->shgrps_edit_point, - cache->b_edit.batch, - (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, - start_edit, len); - - start_edit = elm->vertex_idx; + if (stl->g_data->shgrps_edit_point) { + const int len = elm->vertex_idx - start_edit; + /* use always the same group */ + DRW_shgroup_call_range_add( + stl->g_data->shgrps_edit_point, + cache->b_edit.batch, + (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, + start_edit, len); + + start_edit = elm->vertex_idx; + } break; } case eGpencilBatchGroupType_Edlin: { - const int len = elm->vertex_idx - start_edlin; - /* use always the same group */ - DRW_shgroup_call_range_add( - stl->g_data->shgrps_edit_line, - cache->b_edlin.batch, - (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, - start_edlin, len); - - start_edlin = elm->vertex_idx; + if (stl->g_data->shgrps_edit_line) { + const int len = elm->vertex_idx - start_edlin; + /* use always the same group */ + DRW_shgroup_call_range_add( + stl->g_data->shgrps_edit_line, + cache->b_edlin.batch, + (!cache_ob->is_dup_ob) ? gpf->runtime.viewmatrix : cache_ob->obmat, + start_edlin, len); + + start_edlin = elm->vertex_idx; + } break; } default: diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index 483d6a80991..11bb5c76257 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -719,6 +719,8 @@ void GPENCIL_draw_scene(void *ved) Object *obact = draw_ctx->obact; const bool playing = stl->storage->is_playing; const bool is_render = stl->storage->is_render; + bGPdata *gpd_act = (obact) && (obact->type == OB_GPENCIL) ? (bGPdata *)obact->data : NULL; + const bool is_edit = GPENCIL_ANY_EDIT_MODE(gpd_act); /* paper pass to display a comfortable area to draw over complex scenes with geometry */ if ((!is_render) && (obact) && (obact->type == OB_GPENCIL)) { @@ -875,7 +877,7 @@ void GPENCIL_draw_scene(void *ved) } } /* edit points */ - if ((!is_render) && (!playing)) { + if ((!is_render) && (!playing) && (is_edit)) { DRW_draw_pass(psl->edit_pass); } } |