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>2019-01-03 20:10:39 +0300
committerAntonioya <blendergit@gmail.com>2019-01-03 20:12:25 +0300
commita30bdcc142f1241a302107c637fd47be06073d76 (patch)
treefb35779851e20dc36984d8d41139298e65b720c4 /source/blender/editors/gpencil
parent4b2198a96ac368fa5f2a353c7c148e015246cccf (diff)
Fix T60022: Crash when adding grease pencil object to a collection disabled in viewport.
See D4163 Thanks to Habib Gahbiche (@zazizizou) for the fix.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_add_monkey.c3
-rw-r--r--source/blender/editors/gpencil/gpencil_add_stroke.c3
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c6
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c5
4 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/editors/gpencil/gpencil_add_monkey.c b/source/blender/editors/gpencil/gpencil_add_monkey.c
index ce5d765ada4..21697995b9c 100644
--- a/source/blender/editors/gpencil/gpencil_add_monkey.c
+++ b/source/blender/editors/gpencil/gpencil_add_monkey.c
@@ -535,10 +535,9 @@ static const ColorTemplate gp_monkey_pct_pupils = {
/* Monkey API */
/* add a 2D Suzanne (original model created by Matias Mendiola) */
-void ED_gpencil_create_monkey(bContext *C, float mat[4][4])
+void ED_gpencil_create_monkey(bContext *C, Object *ob, float mat[4][4])
{
Main *bmain = CTX_data_main(C);
- Object *ob = CTX_data_active_object(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
int cfra_eval = (int)DEG_get_ctime(depsgraph);
bGPdata *gpd = (bGPdata *)ob->data;
diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c b/source/blender/editors/gpencil/gpencil_add_stroke.c
index 330f7a69e09..6df3638d859 100644
--- a/source/blender/editors/gpencil/gpencil_add_stroke.c
+++ b/source/blender/editors/gpencil/gpencil_add_stroke.c
@@ -213,10 +213,9 @@ static const ColorTemplate gp_stroke_material_grey = {
/* Stroke API */
/* add a Simple stroke with colors (original design created by Daniel M. Lara and Matias Mendiola) */
-void ED_gpencil_create_stroke(bContext *C, float mat[4][4])
+void ED_gpencil_create_stroke(bContext *C, Object *ob, float mat[4][4])
{
Main *bmain = CTX_data_main(C);
- Object *ob = CTX_data_active_object(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
int cfra_eval = (int)DEG_get_ctime(depsgraph);
bGPdata *gpd = (bGPdata *)ob->data;
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index a8cfe91740c..8afb0cafeb9 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -137,7 +137,8 @@ static int gp_data_add_exec(bContext *C, wmOperator *op)
*gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil"));
/* add default sets of colors and brushes */
- ED_gpencil_add_defaults(C);
+ Object *ob = CTX_data_active_object(C);
+ ED_gpencil_add_defaults(C, ob);
/* add new layer */
BKE_gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), true);
@@ -245,7 +246,8 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op)
*gpd_ptr = BKE_gpencil_data_addnew(bmain, DATA_("GPencil"));
/* add default sets of colors and brushes */
- ED_gpencil_add_defaults(C);
+ Object *ob = CTX_data_active_object(C);
+ ED_gpencil_add_defaults(C, ob);
}
}
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 */