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:
authorJulian Eisel <eiseljulian@gmail.com>2019-11-22 18:46:15 +0300
committerJulian Eisel <eiseljulian@gmail.com>2019-11-22 18:54:43 +0300
commitb037ba2665f4b08d91e0d7d1b350c8bb562ca320 (patch)
treeb9957cc53e449b599a4aee110e845a032aa5a46f /source/blender/blenkernel/intern/fcurve.c
parent177dfc6384b926dd19e3b7e98a995ccb4da9167c (diff)
UI: Changes to Graph Editor selection and transform
When introducing "drag-all-selected" support all over Blender, we figured this wouldn't work well with the Graph Editor selection/transform behavior. Hence, William and I worked on the following changes, although we used this chance to improve the behavior in general too. For more info see T70634. * Handles now always move with the key, regardless if they are selected or not. * Selecting the key doesn't select the handles anymore, their selection is separate. * Multiple keys and handles can now be dragged. * Dragging a handle moves all selected handles **on the same side**. * Tweak-dragging any handle can never affect any keyframe location, only handles. * G/R/S should behave as before. * Changing the handle type with a key selected always applies the change to both handles. * Box selection with Ctrl+Drag now allows deselecting handles (used to act on entire triple only). * Box selection //Include Handles// option now only acts on visible handles, wasn't the case with Only Selected Keyframes Handles enabled. * Box selection //Include Handles// is now enabled by default in all bundled keymaps. The changes have been tested for some days by the animators here in the Blender Animation Studio. Some changes are based on their feedback. Also, this improves/adds comments for related code. Differential Revision: https://developer.blender.org/D6235 Reviewed by: Sybren Stüvel, William Reynish
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r--source/blender/blenkernel/intern/fcurve.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 0f4845a32c0..3876033eaaa 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1036,10 +1036,14 @@ static BezTriple *cycle_offset_triple(
return out;
}
-/* This function recalculates the handles of an F-Curve
- * If the BezTriples have been rearranged, sort them first before using this.
+/**
+ * Variant of #calchandles_fcurve() that allows calculating based on a different select flag.
+ *
+ * \param sel_flag: The flag (bezt.f1/2/3) value to use to determine selection. Usually `SELECT`,
+ * but may want to use a different one at times (if caller does not operate on
+ * selection).
*/
-void calchandles_fcurve(FCurve *fcu)
+void calchandles_fcurve_ex(FCurve *fcu, eBezTriple_Flag handle_sel_flag)
{
BezTriple *bezt, *prev, *next;
int a = fcu->totvert;
@@ -1075,7 +1079,7 @@ void calchandles_fcurve(FCurve *fcu)
}
/* calculate auto-handles */
- BKE_nurb_handle_calc(bezt, prev, next, true, fcu->auto_smoothing);
+ BKE_nurb_handle_calc_ex(bezt, prev, next, handle_sel_flag, true, fcu->auto_smoothing);
/* for automatic ease in and out */
if (BEZT_IS_AUTOH(bezt) && !cycle) {
@@ -1121,7 +1125,29 @@ void calchandles_fcurve(FCurve *fcu)
}
}
-void testhandles_fcurve(FCurve *fcu, const bool use_handle)
+/**
+ * This function recalculates the handles of an F-Curve. Acts based on selection with `SELECT`
+ * flag. To use a different flag, use #calchandles_fcurve_ex().
+ *
+ * If the BezTriples have been rearranged, sort them first before using this.
+ */
+void calchandles_fcurve(FCurve *fcu)
+{
+ calchandles_fcurve_ex(fcu, SELECT);
+}
+
+/**
+ * Update handles, making sure the handle-types are valid (e.g. correctly deduced from an "Auto"
+ * type), and recalculating their position vectors.
+ * Use when something has changed handle positions.
+ *
+ * \param sel_flag: The flag (bezt.f1/2/3) value to use to determine selection. Usually `SELECT`,
+ * but may want to use a different one at times (if caller does not operate on
+ * selection).
+ * \param use_handle: Check selection state of individual handles, otherwise always update both
+ * handles if the key is selected.
+ */
+void testhandles_fcurve(FCurve *fcu, eBezTriple_Flag sel_flag, const bool use_handle)
{
BezTriple *bezt;
unsigned int a;
@@ -1133,11 +1159,11 @@ void testhandles_fcurve(FCurve *fcu, const bool use_handle)
/* loop over beztriples */
for (a = 0, bezt = fcu->bezt; a < fcu->totvert; a++, bezt++) {
- BKE_nurb_bezt_handle_test(bezt, use_handle);
+ BKE_nurb_bezt_handle_test(bezt, sel_flag, use_handle);
}
/* recalculate handles */
- calchandles_fcurve(fcu);
+ calchandles_fcurve_ex(fcu, sel_flag);
}
/* This function sorts BezTriples so that they are arranged in chronological order,