[Bf-blender-cvs] [104c84a793a] greasepencil-object: GPencil: New filter in Onion by keyframe type

Antonioya noreply at git.blender.org
Thu May 16 12:04:14 CEST 2019


Commit: 104c84a793ace3b45d52a8c397a3b1f6897d2927
Author: Antonioya
Date:   Thu May 16 12:02:48 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB104c84a793ace3b45d52a8c397a3b1f6897d2927

GPencil: New filter in Onion by keyframe type

This new filter allows to select only some type of keyframe (keyframe, breakdown, etc).

This was a request of artists that are used to work with other 2D softwares.

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

M	release/scripts/startup/bl_ui/properties_data_gpencil.py
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/makesdna/DNA_gpencil_types.h
M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index e96ec95786f..2fcf7132d51 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -267,7 +267,9 @@ class DATA_PT_gpencil_onion_skinning(DataButtonsPanel, Panel):
             col = layout.column(align=True)
             col.prop(gpd, "ghost_before_range", text="Keyframes Before")
             col.prop(gpd, "ghost_after_range", text="Keyframes After")
-
+        elif gpd.onion_mode == 'SELECTED':
+            col.prop(gpd, "onion_keyframe_type")
+ 
 
 class DATA_PT_gpencil_onion_skinning_custom_colors(DataButtonsPanel, Panel):
     bl_parent_id = "DATA_PT_gpencil_onion_skinning"
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index b2d96a7114d..e029f7c7398 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1186,6 +1186,7 @@ static void gpencil_draw_onionskins(GpencilBatchCache *cache,
   int last = gpf->framenum;
 
   colflag = (bool)gpd->onion_flag & GP_ONION_GHOST_PREVCOL;
+  const short onion_keytype = gpd->onion_keytype;
 
   /* -------------------------------
    * 1) Draw Previous Frames First
@@ -1206,6 +1207,12 @@ static void gpencil_draw_onionskins(GpencilBatchCache *cache,
     if ((mode == GP_ONION_MODE_SELECTED) && ((gf->flag & GP_FRAME_SELECT) == 0)) {
       continue;
     }
+    /* verify keyframe type */
+    if ((mode == GP_ONION_MODE_SELECTED) && (onion_keytype > -1)) {
+      if (gf->key_type != onion_keytype) {
+        continue;
+      }
+    }
     /* absolute range */
     if (mode == GP_ONION_MODE_ABSOLUTE) {
       if ((gpf->framenum - gf->framenum) > step) {
@@ -1262,6 +1269,12 @@ static void gpencil_draw_onionskins(GpencilBatchCache *cache,
     if ((mode == GP_ONION_MODE_SELECTED) && ((gf->flag & GP_FRAME_SELECT) == 0)) {
       continue;
     }
+    /* verify keyframe type */
+    if ((mode == GP_ONION_MODE_SELECTED) && (onion_keytype > -1)) {
+      if (gf->key_type != onion_keytype) {
+        continue;
+      }
+    }
     /* absolute range */
     if (mode == GP_ONION_MODE_ABSOLUTE) {
       if ((gf->framenum - gpf->framenum) > step) {
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 82fca695558..fd42e9b53a5 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -532,7 +532,8 @@ typedef struct bGPdata {
 
   /** Draw mode for strokes (eGP_DrawMode). */
   short draw_mode;
-  char _pad3[2];
+  /** Keyframe type for onion filter  (eBezTriple_KeyframeType plus All option) */
+  short onion_keytype;
 
   bGPgrid grid;
 
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 737dbe36d17..751dcd40f94 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -76,6 +76,36 @@ static EnumPropertyItem rna_enum_gpencil_onion_modes_items[] = {
     {0, NULL, 0, NULL, NULL},
 };
 
+const EnumPropertyItem rna_enum_onion_keyframe_type_items[] = {
+    {-1, "ALL", ICON_ACTION, "All Types", "Include all Keyframe types"},
+    {BEZT_KEYTYPE_KEYFRAME,
+     "KEYFRAME",
+     ICON_KEYTYPE_KEYFRAME_VEC,
+     "Keyframe",
+     "Normal keyframe - e.g. for key poses"},
+    {BEZT_KEYTYPE_BREAKDOWN,
+     "BREAKDOWN",
+     ICON_KEYTYPE_BREAKDOWN_VEC,
+     "Breakdown",
+     "A breakdown pose - e.g. for transitions between key poses"},
+    {BEZT_KEYTYPE_MOVEHOLD,
+     "MOVING_HOLD",
+     ICON_KEYTYPE_MOVING_HOLD_VEC,
+     "Moving Hold",
+     "A keyframe that is part of a moving hold"},
+    {BEZT_KEYTYPE_EXTREME,
+     "EXTREME",
+     ICON_KEYTYPE_EXTREME_VEC,
+     "Extreme",
+     "An 'extreme' pose, or some other purpose as needed"},
+    {BEZT_KEYTYPE_JITTER,
+     "JITTER",
+     ICON_KEYTYPE_JITTER_VEC,
+     "Jitter",
+     "A filler or baked keyframe for keying on ones, or some other purpose as needed"},
+    {0, NULL, 0, NULL, NULL},
+};
+
 static const EnumPropertyItem rna_enum_gplayer_move_type_items[] = {
     {-1, "UP", 0, "Up", ""},
     {1, "DOWN", 0, "Down", ""},
@@ -1791,6 +1821,12 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Mode", "Mode to display frames");
   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
 
+  prop = RNA_def_property(srna, "onion_keyframe_type", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "onion_keytype");
+  RNA_def_property_enum_items(prop, rna_enum_onion_keyframe_type_items);
+  RNA_def_property_ui_text(prop, "Type", "Type of keyframe (for filtering)");
+  RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
   prop = RNA_def_property(srna, "use_onion_fade", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_ONION_FADE);
   RNA_def_property_ui_text(



More information about the Bf-blender-cvs mailing list