Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2021-02-19 19:18:12 +0300
committerAntonio Vazquez <blendergit@gmail.com>2021-02-19 19:41:28 +0300
commit6bba830589860c32a2543b14cd2c9bcd2b9e4948 (patch)
tree079027534dc4c6ea10d49816cde608c751602476 /source/blender/makesrna
parent2441886c58e1258645195214e0aa1987c29f0c35 (diff)
GPencil: Interpolate Tools refactor
Following with the changes included to interpolate strokes of different number of points, a full review has been done in the interpolation tools. * Interpolate now is a tool and not an operator. It was not logic to have this tool as a button. * Interpolate tool parameters have been moved to topbar. * Interpolate popover has been removed from topbar and interpolate `Sequence` operator has been moved to grease pencil menu. * Interpolate Sequence now include a Redo panel. * Interpolate tool now allows to select the strokes by pairs. This allows to interpolate any stroke with any stroke and not as before that it was only possible by drawing order. If no stroke is selected, the interpolation is done as before. * Now is possible interpolate again if a previous keyframe exist. Before, it was impossible to interpolate two times in same frame and this made impossible to do the interpolation by groups of frames. * New automatic option to `Flip strokes` if the stroke and end are not in the right position. Also the flip can be set manually for corner cases. * Cleanup of menus related to interpolate. * Fixed some bugs and removed parameters from scene because now all are tool or operator contained. * Some code cleanup and function renames. This commit also includes the some codebase to future implementation of the concept `Vertex Active` that now does not exist in grease pencil.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c10
-rw-r--r--source/blender/makesrna/intern/rna_scene.c81
2 files changed, 9 insertions, 82 deletions
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 5437c93ef61..631ab1c4671 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -717,7 +717,7 @@ static void rna_GPencil_stroke_point_select_set(PointerRNA *ptr, const bool valu
}
/* Check if the stroke should be selected or not... */
- BKE_gpencil_stroke_sync_selection(gps);
+ BKE_gpencil_stroke_sync_selection(gpd, gps);
}
}
@@ -933,6 +933,7 @@ static void rna_GPencil_stroke_close(ID *id,
static void rna_GPencil_stroke_select_set(PointerRNA *ptr, const bool value)
{
+ bGPdata *gpd = (bGPdata *)ptr->owner_id;
bGPDstroke *gps = ptr->data;
bGPDspoint *pt;
int i;
@@ -940,9 +941,11 @@ static void rna_GPencil_stroke_select_set(PointerRNA *ptr, const bool value)
/* set new value */
if (value) {
gps->flag |= GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(gpd, gps, false);
}
else {
gps->flag &= ~GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_set(NULL, gps, true);
}
/* ensure that the stroke's points are selected in the same way */
@@ -1744,6 +1747,11 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna)
RNA_def_property_ui_text(
prop, "Vertex Fill Color", "Color used to mix with fill color to get final color");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Selection Index */
+ prop = RNA_def_property(srna, "select_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "select_index");
+ RNA_def_property_ui_text(prop, "Select Index", "Index of selection used for interpolation");
}
static void rna_def_gpencil_strokes_api(BlenderRNA *brna, PropertyRNA *cprop)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 9479d15c2cc..8c01b28df5a 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -735,27 +735,6 @@ static void rna_GPencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UN
ED_gpencil_tag_scene_gpencil(scene);
}
-/* Grease Pencil Interpolation settings */
-static char *rna_GPencilInterpolateSettings_path(PointerRNA *UNUSED(ptr))
-{
- return BLI_strdup("tool_settings.gpencil_interpolate");
-}
-
-static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value)
-{
- GP_Interpolate_Settings *settings = (GP_Interpolate_Settings *)ptr->data;
-
- /* NOTE: This cast should be fine, as we have a small + finite set of values
- * (#eGP_Interpolate_Type) that should fit well within a char.
- */
- settings->type = (char)value;
-
- /* init custom interpolation curve here now the first time it's used */
- if ((settings->type == GP_IPO_CURVEMAP) && (settings->custom_ipo == NULL)) {
- settings->custom_ipo = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
- }
-}
-
static void rna_Gpencil_extend_selection(bContext *C, PointerRNA *UNUSED(ptr))
{
/* Extend selection to all points in all selected strokes. */
@@ -2688,69 +2667,10 @@ static void rna_def_gpencil_interpolate(BlenderRNA *brna)
srna = RNA_def_struct(brna, "GPencilInterpolateSettings", NULL);
RNA_def_struct_sdna(srna, "GP_Interpolate_Settings");
- RNA_def_struct_path_func(srna, "rna_GPencilInterpolateSettings_path");
RNA_def_struct_ui_text(srna,
"Grease Pencil Interpolate Settings",
"Settings for Grease Pencil interpolation tools");
- /* flags */
- prop = RNA_def_property(srna, "interpolate_all_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ALL_LAYERS);
- RNA_def_property_ui_text(
- prop, "Interpolate All Layers", "Interpolate all layers, not only active");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "interpolate_selected_only", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ONLY_SELECTED);
- RNA_def_property_ui_text(prop,
- "Interpolate Selected Strokes",
- "Interpolate only selected strokes in the original frame");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* interpolation type */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_interpolation_mode_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_GPencilInterpolateSettings_type_set", NULL);
- RNA_def_property_ui_text(
- 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");
- RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_easing_items);
- RNA_def_property_ui_text(
- prop,
- "Easing",
- "Which ends of the segment between the preceding and following grease pencil frames "
- "easing interpolation is applied to");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* easing options */
- prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "back");
- RNA_def_property_ui_text(prop, "Back", "Amount of overshoot for 'back' easing");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_range(prop, 0.0f, FLT_MAX); /* only positive values... */
- RNA_def_property_ui_text(
- prop, "Amplitude", "Amount to boost elastic bounces for 'elastic' easing");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "period");
- RNA_def_property_ui_text(prop, "Period", "Time between bounces for elastic easing");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
/* custom curvemap */
prop = RNA_def_property(srna, "interpolation_curve", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "custom_ipo");
@@ -2759,7 +2679,6 @@ static void rna_def_gpencil_interpolate(BlenderRNA *brna)
prop,
"Interpolation Curve",
"Custom curve to control 'sequence' interpolation between Grease Pencil frames");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
}
static void rna_def_transform_orientation(BlenderRNA *brna)