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:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-10-01 21:38:44 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-10-02 20:42:37 +0300
commitaabd8701e98595bae57d59344ed5d127b8b0f7db (patch)
tree5f4bc9ecb2f5b23dfbcb2ab6556b22b3970556cf /source/blender
parentd1a1302b01f445f9c877d6b8c51f6c561e0fda16 (diff)
Implement a user preference for the default Auto Handle Smoothing mode.
The default was changed with an initial implementation of the feature. With the feedback from animators, having a behavior which affects curves outside of a changing range is not convenient for professional animators working on high quality character animation. On the other hand, automatic smoothing is better for casual animation of object motion. This change adds an ability to change the default via User Preferences. Differential Revision: https://developer.blender.org/D5875
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenkernel/intern/nla.c4
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c14
-rw-r--r--source/blender/collada/AnimationImporter.cpp2
-rw-r--r--source/blender/collada/BCAnimationCurve.cpp2
-rw-r--r--source/blender/editors/animation/drivers.c2
-rw-r--r--source/blender/editors/animation/keyframing.c2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h4
-rw-r--r--source/blender/makesrna/RNA_enum_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c31
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c7
11 files changed, 45 insertions, 26 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 21ef70b7bcd..7b879cc1a15 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -27,7 +27,7 @@
* \note Use #STRINGIFY() rather than defining with quotes.
*/
#define BLENDER_VERSION 281
-#define BLENDER_SUBVERSION 12
+#define BLENDER_SUBVERSION 13
/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 2cc1083aba3..09581debd99 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1488,7 +1488,7 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
/* set default flags */
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
- fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL;
+ fcu->auto_smoothing = U.auto_smoothing_new;
/* store path - make copy, and store that */
fcu->rna_path = BLI_strdupn("influence", 9);
@@ -1515,7 +1515,7 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
/* set default flags */
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
- fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL;
+ fcu->auto_smoothing = U.auto_smoothing_new;
/* store path - make copy, and store that */
fcu->rna_path = BLI_strdupn("strip_time", 10);
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index e769e72d8e1..3eaf45954f3 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -30,6 +30,7 @@
#include "DNA_windowmanager_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
+#include "DNA_anim_types.h"
#include "BKE_addon.h"
#include "BKE_colorband.h"
@@ -624,15 +625,20 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
userdef->filebrowser_display_type = USER_TEMP_SPACE_DISPLAY_WINDOW;
}
+ if (!USER_VERSION_ATLEAST(281, 13)) {
+ userdef->auto_smoothing_new = FCURVE_SMOOTH_CONT_ACCEL;
+
+ if (userdef->file_space_data.display_type == FILE_DEFAULTDISPLAY) {
+ memcpy(
+ &userdef->file_space_data, &U_default.file_space_data, sizeof(userdef->file_space_data));
+ }
+ }
+
/**
* Include next version bump.
*/
{
/* pass */
- if (userdef->file_space_data.display_type == FILE_DEFAULTDISPLAY) {
- memcpy(
- &userdef->file_space_data, &U_default.file_space_data, sizeof(userdef->file_space_data));
- }
}
if (userdef->pixelsize == 0.0f) {
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 79593f07383..47325c4dece 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -104,7 +104,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
fcu->flag = (FCURVE_VISIBLE | FCURVE_AUTO_HANDLES | FCURVE_SELECTED);
fcu->array_index = 0;
- fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL;
+ fcu->auto_smoothing = U.auto_smoothing_new;
for (unsigned int j = 0; j < curve->getKeyCount(); j++) {
BezTriple bez;
diff --git a/source/blender/collada/BCAnimationCurve.cpp b/source/blender/collada/BCAnimationCurve.cpp
index bf32ec9148c..f944a77196c 100644
--- a/source/blender/collada/BCAnimationCurve.cpp
+++ b/source/blender/collada/BCAnimationCurve.cpp
@@ -383,7 +383,7 @@ void BCAnimationCurve::adjust_range(const int frame_index)
void BCAnimationCurve::add_value(const float val, const int frame_index)
{
FCurve *fcu = get_edit_fcurve();
- fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL;
+ fcu->auto_smoothing = U.auto_smoothing_new;
insert_vert_fcurve(fcu, frame_index, val, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_NOFLAGS);
if (fcu->totvert == 1) {
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 61c8da08954..64f7fe034dc 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -111,7 +111,7 @@ struct FCurve *alloc_driver_fcurve(const char rna_path[],
FCurve *fcu = MEM_callocN(sizeof(FCurve), "FCurve");
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
- fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL;
+ fcu->auto_smoothing = U.auto_smoothing_new;
/* store path - make copy, and store that */
if (rna_path) {
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 0f8b8742659..8203a9131fa 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -202,7 +202,7 @@ FCurve *verify_fcurve(Main *bmain,
fcu = MEM_callocN(sizeof(FCurve), "FCurve");
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
- fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL;
+ fcu->auto_smoothing = U.auto_smoothing_new;
if (BLI_listbase_is_empty(&act->curves)) {
fcu->flag |= FCURVE_ACTIVE; /* first one added active */
}
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 75f29695eb3..b9f43c0e579 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -728,11 +728,13 @@ typedef struct UserDef {
short curssize;
/** #eColorPicker_Types. */
short color_picker_type;
+ /** Curve smoothing type for newly added F-Curves. */
+ char auto_smoothing_new;
/** Interpolation mode for newly added F-Curves. */
char ipo_new;
/** Handle types for newly added keyframes. */
char keyhandles_new;
- char _pad11[3];
+ char _pad11[2];
/** #eZoomFrame_Mode. */
char view_frame_type;
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index e72a55b5a9e..458f031ceae 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -90,6 +90,7 @@ extern const EnumPropertyItem rna_enum_color_sets_items[];
extern const EnumPropertyItem rna_enum_beztriple_keyframe_type_items[];
extern const EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[];
extern const EnumPropertyItem rna_enum_beztriple_interpolation_easing_items[];
+extern const EnumPropertyItem rna_enum_fcurve_auto_smoothing_items[];
extern const EnumPropertyItem rna_enum_keyframe_handle_type_items[];
extern const EnumPropertyItem rna_enum_driver_target_rotation_mode_items[];
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 254f3bc3710..424bb4a492f 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -76,6 +76,22 @@ const EnumPropertyItem rna_enum_fmodifier_type_items[] = {
{0, NULL, 0, NULL, NULL},
};
+const EnumPropertyItem rna_enum_fcurve_auto_smoothing_items[] = {
+ {FCURVE_SMOOTH_NONE,
+ "NONE",
+ 0,
+ "None",
+ "Automatic handles only take immediately adjacent keys into account"},
+ {FCURVE_SMOOTH_CONT_ACCEL,
+ "CONT_ACCEL",
+ 0,
+ "Continuous Acceleration",
+ "Automatic handles are adjusted to avoid jumps in acceleration, resulting "
+ "in smoother curves. However, key changes may affect interpolation over a "
+ "larger stretch of the curve"},
+ {0, NULL, 0, NULL, NULL},
+};
+
const EnumPropertyItem rna_enum_beztriple_keyframe_type_items[] = {
{BEZT_KEYTYPE_KEYFRAME,
"KEYFRAME",
@@ -2258,19 +2274,6 @@ static void rna_def_fcurve(BlenderRNA *brna)
"Use custom hand-picked color for F-Curve"},
{0, NULL, 0, NULL, NULL},
};
- static EnumPropertyItem prop_mode_smoothing_items[] = {
- {FCURVE_SMOOTH_NONE,
- "NONE",
- 0,
- "None",
- "Auto handles only take adjacent keys into account (legacy mode)"},
- {FCURVE_SMOOTH_CONT_ACCEL,
- "CONT_ACCEL",
- 0,
- "Continuous Acceleration",
- "Auto handles are placed to avoid jumps in acceleration"},
- {0, NULL, 0, NULL, NULL},
- };
srna = RNA_def_struct(brna, "FCurve", NULL);
RNA_def_struct_ui_text(srna, "F-Curve", "F-Curve defining values of a period of time");
@@ -2350,7 +2353,7 @@ static void rna_def_fcurve(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
prop = RNA_def_property(srna, "auto_smoothing", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_mode_smoothing_items);
+ RNA_def_property_enum_items(prop, rna_enum_fcurve_auto_smoothing_items);
RNA_def_property_ui_text(
prop, "Auto Handle Smoothing", "Algorithm used to compute automatic handles");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FCurve_update_data");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index f08a3ce93a1..07ce07710b1 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -4657,6 +4657,13 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
"Color for newly added transformation F-Curves (Location, Rotation, Scale) "
"and also Color is based on the transform axis");
+ prop = RNA_def_property(srna, "fcurve_new_auto_smoothing", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_fcurve_auto_smoothing_items);
+ RNA_def_property_enum_sdna(prop, NULL, "auto_smoothing_new");
+ RNA_def_property_ui_text(prop,
+ "New Curve Smoothing Mode",
+ "Auto Handle Smoothing mode used for newly added F-Curves");
+
prop = RNA_def_property(srna, "keyframe_new_interpolation_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_mode_items);
RNA_def_property_enum_sdna(prop, NULL, "ipo_new");