[Bf-blender-cvs] [e7c36ce43cf] master: GPencil: Disable Multiframe edition when play animation

Antonio Vazquez noreply at git.blender.org
Thu Jan 14 11:05:42 CET 2021


Commit: e7c36ce43cf6a3359518d0f55ac1d51d5f19b104
Author: Antonio Vazquez
Date:   Thu Jan 14 10:43:31 2021 +0100
Branches: master
https://developer.blender.org/rBe7c36ce43cf6a3359518d0f55ac1d51d5f19b104

GPencil: Disable Multiframe edition when play animation

When the multiframe is enabled, playing animation must be disabled or the animation is not visible,

{F9527854}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9930

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h
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 f68a390db64..c7ca82c92fc 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2519,7 +2519,7 @@ void BKE_gpencil_visible_stroke_iter(ViewLayer *view_layer,
                                      int cfra)
 {
   bGPdata *gpd = (bGPdata *)ob->data;
-  const bool is_multiedit = GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
+  const bool is_multiedit = ((GPENCIL_MULTIEDIT_SESSIONS_ON(gpd)) && (!GPENCIL_PLAY_ON(gpd)));
   const bool is_onion = do_onion && ((gpd->flag & GP_DATA_STROKE_WEIGHTMODE) == 0);
   const bool is_drawing = (gpd->runtime.sbuffer_used > 0);
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 20044fbe3ce..b6f0817adb3 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -214,6 +214,7 @@ void GPENCIL_cache_init(void *ved)
                                  NULL :
                              false;
     pd->do_onion = show_onion && !hide_overlay && !playing;
+    pd->playing = playing;
     /* Save simplify flags (can change while drawing, so it's better to save). */
     Scene *scene = draw_ctx->scene;
     pd->simplify_fill = GPENCIL_SIMPLIFY_FILL(scene, playing);
@@ -241,6 +242,7 @@ void GPENCIL_cache_init(void *ved)
     pd->simplify_fill = false;
     pd->simplify_fx = false;
     pd->fade_layer_opacity = -1.0f;
+    pd->playing = false;
   }
 
   {
@@ -617,7 +619,7 @@ void GPENCIL_cache_populate(void *ved, Object *ob)
     /* Special case for rendering onion skin. */
     bGPdata *gpd = (bGPdata *)ob->data;
     bool do_onion = (!pd->is_render) ? pd->do_onion : (gpd->onion_flag & GP_ONION_GHOST_ALWAYS);
-
+    gpd->runtime.playing = (short)pd->playing;
     BKE_gpencil_visible_stroke_iter(is_final_render ? pd->view_layer : NULL,
                                     ob,
                                     gpencil_layer_cache_populate,
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index d0bd56b42dd..2b07ea53187 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -342,6 +342,8 @@ typedef struct GPENCIL_PrivateData {
 
   /* Display onion skinning */
   bool do_onion;
+  /* Playing animation */
+  bool playing;
   /* simplify settings */
   bool simplify_fill;
   bool simplify_fx;
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 949b0bb5bf5..e1786304fbb 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -574,7 +574,9 @@ typedef struct bGPdata_Runtime {
   /** Temp stroke used for drawing. */
   struct bGPDstroke *sbuffer_gps;
 
-  char _pad[2];
+  /** Animation playing flag. */
+  short playing;
+
   /** Material index of the stroke. */
   short matid;
 
@@ -840,6 +842,8 @@ typedef enum eGP_DrawMode {
   ((flag & (GP_VERTEX_MASK_SELECTMODE_POINT | GP_VERTEX_MASK_SELECTMODE_STROKE | \
             GP_VERTEX_MASK_SELECTMODE_SEGMENT)))
 
+#define GPENCIL_PLAY_ON(gpd) ((gpd) && ((gpd)->runtime.playing == 1))
+
 #ifdef __cplusplus
 }
 #endif



More information about the Bf-blender-cvs mailing list