From a30bdcc142f1241a302107c637fd47be06073d76 Mon Sep 17 00:00:00 2001 From: Antonioya Date: Thu, 3 Jan 2019 18:10:39 +0100 Subject: Fix T60022: Crash when adding grease pencil object to a collection disabled in viewport. See D4163 Thanks to Habib Gahbiche (@zazizizou) for the fix. --- source/blender/editors/gpencil/gpencil_utils.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/gpencil/gpencil_utils.c') diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 4d6a7b547c6..f7fafb56d3a 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -1221,16 +1221,15 @@ Object *ED_gpencil_add_object(bContext *C, Scene *UNUSED(scene), const float loc /* define size */ BKE_object_obdata_size_init(ob, GP_OBGPENCIL_DEFAULT_SIZE); /* create default brushes and colors */ - ED_gpencil_add_defaults(C); + ED_gpencil_add_defaults(C, ob); return ob; } /* Helper function to create default colors and drawing brushes */ -void ED_gpencil_add_defaults(bContext *C) +void ED_gpencil_add_defaults(bContext *C, Object *ob) { Main *bmain = CTX_data_main(C); - Object *ob = CTX_data_active_object(C); ToolSettings *ts = CTX_data_tool_settings(C); /* first try to reuse default material */ -- cgit v1.2.3