[Bf-blender-cvs] [ddfec085148] master: GPencil: Fix unreported missing update after removing stroke from python

Antonio Vazquez noreply at git.blender.org
Sat Apr 11 19:04:10 CEST 2020


Commit: ddfec0851484fa735b60279743c892bf1952c538
Author: Antonio Vazquez
Date:   Sat Apr 11 19:02:58 2020 +0200
Branches: master
https://developer.blender.org/rBddfec0851484fa735b60279743c892bf1952c538

GPencil: Fix unreported missing update after removing stroke from python

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

M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 94814003e99..4a20df048bd 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -716,10 +716,13 @@ static bGPDstroke *rna_GPencil_stroke_new(bGPDframe *frame)
   return stroke;
 }
 
-static void rna_GPencil_stroke_remove(bGPDframe *frame,
+static void rna_GPencil_stroke_remove(ID *id,
+                                      bGPDframe *frame,
                                       ReportList *reports,
                                       PointerRNA *stroke_ptr)
 {
+  bGPdata *gpd = (bGPdata *)id;
+
   bGPDstroke *stroke = stroke_ptr->data;
   if (BLI_findindex(&frame->strokes, stroke) == -1) {
     BKE_report(reports, RPT_ERROR, "Stroke not found in grease pencil frame");
@@ -729,7 +732,8 @@ static void rna_GPencil_stroke_remove(bGPDframe *frame,
   BLI_freelinkN(&frame->strokes, stroke);
   RNA_POINTER_INVALIDATE(stroke_ptr);
 
-  WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+  DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
+  WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 }
 
 static void rna_GPencil_stroke_close(ID *id,
@@ -1282,7 +1286,7 @@ static void rna_def_gpencil_strokes_api(BlenderRNA *brna, PropertyRNA *cprop)
 
   func = RNA_def_function(srna, "remove", "rna_GPencil_stroke_remove");
   RNA_def_function_ui_description(func, "Remove a grease pencil stroke");
-  RNA_def_function_flag(func, FUNC_USE_REPORTS);
+  RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
   parm = RNA_def_pointer(func, "stroke", "GPencilStroke", "Stroke", "The stroke to remove");
   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
   RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);



More information about the Bf-blender-cvs mailing list