[Bf-blender-cvs] [97871e16ff4] master: GPencil: New option to set steps in Interpolate Sequence

Antonio Vazquez noreply at git.blender.org
Fri Sep 4 15:46:50 CEST 2020


Commit: 97871e16ff45393e964d4882b99a45e18cdc22ab
Author: Antonio Vazquez
Date:   Fri Sep 4 15:36:02 2020 +0200
Branches: master
https://developer.blender.org/rB97871e16ff45393e964d4882b99a45e18cdc22ab

GPencil: New option to set steps in Interpolate Sequence

Sometimes interpolate all frames is not convenient and it's better, for example, interpolate in twos.

The new parameter allows to define the number of frame for each step, by default is set to 1 as before.

{F8812621}

This is a request of animators to improve interpolate tools.

Reviewed By: mendio

Maniphest Tasks: T80190

Differential Revision: https://developer.blender.org/D8723
239b0b

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

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenloader/intern/versioning_290.c
M	source/blender/editors/gpencil/gpencil_interpolate.c
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index dfabf5e9d81..09744e44f35 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1702,6 +1702,7 @@ class VIEW3D_PT_tools_grease_pencil_interpolate(Panel):
 
         col = layout.column(align=True)
         col.label(text="Sequence Options:")
+        col.prop(settings, "step")
         col.prop(settings, "type")
         if settings.type == 'CUSTOM':
             # TODO: Options for loading/saving curve presets?
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 269c2083ef4..b970f18933f 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -546,6 +546,14 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
    * \note Keep this message at the bottom of the function.
    */
   {
+    /* Set the minimum sequence interpolate for grease pencil. */
+    if (!DNA_struct_elem_find(fd->filesdna, "GP_Interpolate_Settings", "int", "step")) {
+      LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+        ToolSettings *ts = scene->toolsettings;
+        ts->gp_interpolate.step = 1;
+      }
+    }
+
     /* Keep this block, even when empty. */
   }
 }
diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index 3a7029b1288..380dfd1a7a2 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -949,6 +949,7 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op)
 
   GP_Interpolate_Settings *ipo_settings = &ts->gp_interpolate;
   eGP_Interpolate_SettingsFlag flag = ipo_settings->flag;
+  const int step = ipo_settings->step;
 
   /* cannot interpolate if not between 2 frames */
   if (ELEM(NULL, actframe, actframe->next)) {
@@ -990,7 +991,7 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op)
     nextFrame = gpl->actframe->next;
 
     /* Loop over intermediary frames and create the interpolation */
-    for (cframe = prevFrame->framenum + 1; cframe < nextFrame->framenum; cframe++) {
+    for (cframe = prevFrame->framenum + step; cframe < nextFrame->framenum; cframe += step) {
       bGPDframe *interFrame = NULL;
       float factor;
 
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 93e690d0aba..219a7afa6c2 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1137,6 +1137,9 @@ typedef struct GP_Interpolate_Settings {
   float back;
   /** BEZT_IPO_ELASTIC. */
   float amplitude, period;
+  /* Step between sequence interpolated frames. */
+  int step;
+  char _pad[4];
 
   /** Custom interpolation curve (for use with GP_IPO_CURVEMAP). */
   struct CurveMapping *custom_ipo;
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index e470a8ddb85..65edaf0bcca 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2631,6 +2631,12 @@ static void rna_def_gpencil_interpolate(BlenderRNA *brna)
       prop, "Type", "Interpolation method to use the next time 'Interpolate Sequence' is run");
   RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
 
+  prop = RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
+  RNA_def_property_range(prop, 1, MAXFRAME);
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+  RNA_def_property_ui_text(prop, "Step", "Number of frames between generated interpolated frames");
+  RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
   /* easing */
   prop = RNA_def_property(srna, "easing", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_sdna(prop, NULL, "easing");



More information about the Bf-blender-cvs mailing list