[Bf-blender-cvs] [c4f99aab6a6] greasepencil-object: Rename flag

Falk David noreply at git.blender.org
Mon Feb 7 18:35:14 CET 2022


Commit: c4f99aab6a64f5d4c490bb0eb3c5a190560f6571
Author: Falk David
Date:   Thu Feb 3 16:21:38 2022 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc4f99aab6a64f5d4c490bb0eb3c5a190560f6571

Rename flag

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenkernel/intern/gpencil_update_cache.c
M	source/blender/editors/gpencil/gpencil_undo.c
M	source/blender/makesdna/DNA_gpencil_types.h

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index d7a83b17036..75a2eededfc 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -3004,7 +3004,7 @@ void BKE_gpencil_update_on_write(bGPdata *gpd_orig, bGPdata *gpd_eval)
   gpd_eval->flag |= GP_DATA_CACHE_IS_DIRTY;
 
   /* TODO: This might cause issues when we have multiple depsgraphs? */
-  if ((gpd_orig->flag & GP_DATA_UPDATE_CACHE_UNDO_ENCODED) ||
+  if ((gpd_orig->flag & GP_DATA_UPDATE_CACHE_DISPOSABLE) || !GPENCIL_ANY_MODE(gpd_orig) ||
       !U.experimental.use_gpencil_undo_system) {
     BKE_gpencil_free_update_cache(gpd_orig);
   }
diff --git a/source/blender/blenkernel/intern/gpencil_update_cache.c b/source/blender/blenkernel/intern/gpencil_update_cache.c
index 61d68bab37f..255e6186e87 100644
--- a/source/blender/blenkernel/intern/gpencil_update_cache.c
+++ b/source/blender/blenkernel/intern/gpencil_update_cache.c
@@ -478,7 +478,7 @@ void BKE_gpencil_free_update_cache(bGPdata *gpd)
     update_cache_free(gpd_cache);
     gpd->runtime.update_cache = NULL;
   }
-  gpd->flag &= ~GP_DATA_UPDATE_CACHE_UNDO_ENCODED;
+  gpd->flag &= ~GP_DATA_UPDATE_CACHE_DISPOSABLE;
 }
 
 void BKE_gpencil_free_update_cache_and_data(GPencilUpdateCache *gpd_cache)
diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c
index c025f3a7541..e7d2614081a 100644
--- a/source/blender/editors/gpencil/gpencil_undo.c
+++ b/source/blender/editors/gpencil/gpencil_undo.c
@@ -464,7 +464,7 @@ static bool gpencil_undosys_step_encode(struct bContext *C,
   }
 
   gpencil_data_to_undo_data(gpd, us->undo_data);
-  gpd->flag |= GP_DATA_UPDATE_CACHE_UNDO_ENCODED;
+  gpd->flag |= GP_DATA_UPDATE_CACHE_DISPOSABLE;
   return true;
 }
 
@@ -494,9 +494,10 @@ static void gpencil_undosys_step_decode(struct bContext *C,
 
   if (change_gpencil_mode(C, ob, undo_data->mode)) {
     if (is_final) {
-    DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
-    WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, NULL);
-    WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
+      gpd->flag |= GP_DATA_UPDATE_CACHE_DISPOSABLE;
+      DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+      WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, NULL);
+      WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
     }
     return;
   }
@@ -536,11 +537,11 @@ static void gpencil_undosys_step_decode(struct bContext *C,
 
     gpencil_undo_data_to_gpencil_data(undo_data, gpd, true);
   }
-  gpd->flag |= GP_DATA_UPDATE_CACHE_UNDO_ENCODED;
 
   if (is_final) {
-  DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
-  WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
+    gpd->flag |= GP_DATA_UPDATE_CACHE_DISPOSABLE;
+    DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
+    WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
   }
 }
 
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 44be45d705e..e6ae90489a5 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -326,7 +326,8 @@ typedef struct bGPDstroke {
   /** Curve used to edit the stroke using Bezier handlers. */
   struct bGPDcurve *editcurve;
 
-  /* NOTE: When adding new members, make sure to add them to BKE_gpencil_stroke_copy_settings as well! */
+  /* NOTE: When adding new members, make sure to add them to BKE_gpencil_stroke_copy_settings as
+   * well! */
 
   bGPDstroke_Runtime runtime;
   void *_pad5;
@@ -412,7 +413,8 @@ typedef struct bGPDframe {
   /** Keyframe type (eBezTriple_KeyframeType). */
   short key_type;
 
-  /* NOTE: When adding new members, make sure to add them to BKE_gpencil_frame_copy_settings as well! */
+  /* NOTE: When adding new members, make sure to add them to BKE_gpencil_frame_copy_settings as
+   * well! */
 
   bGPDframe_Runtime runtime;
 } bGPDframe;
@@ -537,7 +539,8 @@ typedef struct bGPDlayer {
   float layer_mat[4][4], layer_invmat[4][4];
   char _pad3[4];
 
-  /* NOTE: When adding new members, make sure to add them to BKE_gpencil_layer_copy_settings as well! */
+  /* NOTE: When adding new members, make sure to add them to BKE_gpencil_layer_copy_settings as
+   * well! */
 
   bGPDlayer_Runtime runtime;
 } bGPDlayer;
@@ -640,7 +643,6 @@ typedef struct bGPdata_Runtime {
   Brush *sbuffer_brush;
   struct GpencilBatchCache *gpencil_cache;
   struct LineartCache *lineart_cache;
-
   struct GPencilUpdateCache *update_cache;
 } bGPdata_Runtime;
 
@@ -735,7 +737,8 @@ typedef struct bGPdata {
 
   bGPgrid grid;
 
-  /* NOTE: When adding new members, make sure to add them to BKE_gpencil_data_copy_settings as well! */
+  /* NOTE: When adding new members, make sure to add them to BKE_gpencil_data_copy_settings as
+   * well! */
 
   bGPdata_Runtime runtime;
 } bGPdata;
@@ -807,8 +810,9 @@ typedef enum eGPdata_Flag {
   GP_DATA_CURVE_EDIT_MODE = (1 << 21),
   /* Use adaptive curve resolution */
   GP_DATA_CURVE_ADAPTIVE_RESOLUTION = (1 << 22),
-  /* Update cache was encoded by the undo system. */
-  GP_DATA_UPDATE_CACHE_UNDO_ENCODED = (1 << 23),
+  /* Update cache was fully dealt with and is ready to be freed. In this state, it should no longer
+     be written to (but still can be read). */
+  GP_DATA_UPDATE_CACHE_DISPOSABLE = (1 << 23),
 } eGPdata_Flag;
 
 /* gpd->onion_flag */



More information about the Bf-blender-cvs mailing list