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:
authorLukas Stockner <lukas.stockner@freenet.de>2018-12-07 05:26:20 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2018-12-08 20:06:23 +0300
commite79bb957fc3d59a659d176cdd7f8b7faf5f0963f (patch)
tree4cf28ec1109363cc538fcc6c66ae1ecb5dce475d /source/blender/editors/animation/keyframing.c
parentaff9ccbade9ae74fb63becc842621eefef5abfa0 (diff)
User Interface: Add button color for indicating that the value differs from the interpolated one
One issue that especially newer users often run into is that they accidentally reset changes to the scene by switching frame without creating a keyframe first. Therefore, this commit adds a new color that is used to draw properties if their current value differs from the one that would be set when switching to this frame. This works both for existing keyframes as well as for currently interpolated frames. Unfortunately the flags in but->flag are full, so I had to move the new flag to but->drawflag and pass that to all relevant functions. I went with orange for the color since afaics it fits with the green and yellow that are currently used for keyframe states and since it's somewhat reddish to signify that there might be something to look out for here. Reviewers: campbellbarton, #user_interface, brecht Reviewed By: campbellbarton Subscribers: brecht, predoe Differential Revision: https://developer.blender.org/D3949
Diffstat (limited to 'source/blender/editors/animation/keyframing.c')
-rw-r--r--source/blender/editors/animation/keyframing.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 3e573d04d38..77dcc17c42a 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -2242,6 +2242,20 @@ bool fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
return false;
}
+/* Returns whether the current value of a given property differs from the interpolated value. */
+bool fcurve_is_changed(PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float frame)
+{
+ PathResolvedRNA anim_rna;
+ anim_rna.ptr = ptr;
+ anim_rna.prop = prop;
+ anim_rna.prop_index = fcu->array_index;
+
+ float fcurve_val = calculate_fcurve(&anim_rna, fcu, frame);
+ float cur_val = setting_get_rna_value(NULL, &ptr, prop, fcu->array_index, false);
+
+ return !compare_ff_relative(fcurve_val, cur_val, FLT_EPSILON, 64);
+}
+
/* Checks whether an Action has a keyframe for a given frame
* Since we're only concerned whether a keyframe exists, we can simply loop until a match is found...
*/