[Bf-blender-cvs] [ef39d85d7c9] master: Fix T104121: Grease pencil clear function in python not updated in viewport
Amelie Fondevilla
noreply at git.blender.org
Thu Jan 26 09:17:03 CET 2023
Commit: ef39d85d7c94c28e952683c0ddd0f3b7435b8460
Author: Amelie Fondevilla
Date: Wed Jan 25 17:00:10 2023 +0100
Branches: master
https://developer.blender.org/rBef39d85d7c94c28e952683c0ddd0f3b7435b8460
Fix T104121: Grease pencil clear function in python not updated in viewport
The clear functions for grease pencil data/frame/layer
was not followed by immediate update in the viewport.
Some notifiers were missing in the rna definition of these functions,
which are added in by this patch.
Reviewed By: Antonio Vazquez
Differential Revision: https://developer.blender.org/D17120
===================================================================
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 544a7f73cab..dd608ce9acb 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1101,17 +1101,23 @@ static void rna_GPencil_layer_mask_remove(bGPDlayer *gpl,
WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
-static void rna_GPencil_frame_clear(bGPDframe *frame)
+static void rna_GPencil_frame_clear(ID *id, bGPDframe *frame)
{
BKE_gpencil_free_strokes(frame);
+ bGPdata *gpd = (bGPdata *)id;
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+
WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
-static void rna_GPencil_layer_clear(bGPDlayer *layer)
+static void rna_GPencil_layer_clear(ID *id, bGPDlayer *layer)
{
BKE_gpencil_free_frames(layer);
+ bGPdata *gpd = (bGPdata *)id;
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+
WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
@@ -1119,6 +1125,8 @@ static void rna_GPencil_clear(bGPdata *gpd)
{
BKE_gpencil_free_layers(&gpd->layers);
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+
WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
@@ -1841,6 +1849,7 @@ static void rna_def_gpencil_frame(BlenderRNA *brna)
/* API */
func = RNA_def_function(srna, "clear", "rna_GPencil_frame_clear");
RNA_def_function_ui_description(func, "Remove all the grease pencil frame data");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
}
static void rna_def_gpencil_frames_api(BlenderRNA *brna, PropertyRNA *cprop)
@@ -2304,6 +2313,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
/* Layers API */
func = RNA_def_function(srna, "clear", "rna_GPencil_layer_clear");
RNA_def_function_ui_description(func, "Remove all the grease pencil layer data");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
}
static void rna_def_gpencil_layers_api(BlenderRNA *brna, PropertyRNA *cprop)
More information about the Bf-blender-cvs
mailing list