[Bf-blender-cvs] [abdaf2a4f50] blender-v2.82-release: Fix T53704: Error scaling f-curve handles by -1
Campbell Barton
noreply at git.blender.org
Thu Jan 16 16:43:25 CET 2020
Commit: abdaf2a4f509f79bf2f0eb231341858045957573
Author: Campbell Barton
Date: Fri Jan 17 02:31:05 2020 +1100
Branches: blender-v2.82-release
https://developer.blender.org/rBabdaf2a4f509f79bf2f0eb231341858045957573
Fix T53704: Error scaling f-curve handles by -1
The last handle wasn't corrected, also, there is no reason
to flip the handles while sorting (checking the same handles many times)
move this into it's own loop.
===================================================================
M source/blender/blenkernel/intern/fcurve.c
===================================================================
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 3876033eaaa..08687ef8cee 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1171,16 +1171,16 @@ void testhandles_fcurve(FCurve *fcu, eBezTriple_Flag sel_flag, const bool use_ha
*/
void sort_time_fcurve(FCurve *fcu)
{
- bool ok = true;
/* keep adjusting order of beztriples until nothing moves (bubble-sort) */
- while (ok) {
- ok = 0;
+ if (fcu->bezt) {
+ BezTriple *bezt;
+ uint a;
- /* currently, will only be needed when there are beztriples */
- if (fcu->bezt) {
- BezTriple *bezt;
- unsigned int a;
+ bool ok = true;
+ while (ok) {
+ ok = 0;
+ /* currently, will only be needed when there are beztriples */
/* loop over ALL points to adjust position in array and recalculate handles */
for (a = 0, bezt = fcu->bezt; a < fcu->totvert; a++, bezt++) {
@@ -1191,20 +1191,22 @@ void sort_time_fcurve(FCurve *fcu)
SWAP(BezTriple, *bezt, *(bezt + 1));
ok = 1;
}
-
- /* if either one of both of the points exceeds crosses over the keyframe time... */
- if ((bezt->vec[0][0] > bezt->vec[1][0]) && (bezt->vec[2][0] < bezt->vec[1][0])) {
- /* swap handles if they have switched sides for some reason */
- swap_v2_v2(bezt->vec[0], bezt->vec[2]);
- }
- else {
- /* clamp handles */
- CLAMP_MAX(bezt->vec[0][0], bezt->vec[1][0]);
- CLAMP_MIN(bezt->vec[2][0], bezt->vec[1][0]);
- }
}
}
}
+
+ for (a = 0, bezt = fcu->bezt; a < fcu->totvert; a++, bezt++) {
+ /* if either one of both of the points exceeds crosses over the keyframe time... */
+ if ((bezt->vec[0][0] > bezt->vec[1][0]) && (bezt->vec[2][0] < bezt->vec[1][0])) {
+ /* swap handles if they have switched sides for some reason */
+ swap_v2_v2(bezt->vec[0], bezt->vec[2]);
+ }
+ else {
+ /* clamp handles */
+ CLAMP_MAX(bezt->vec[0][0], bezt->vec[1][0]);
+ CLAMP_MIN(bezt->vec[2][0], bezt->vec[1][0]);
+ }
+ }
}
}
More information about the Bf-blender-cvs
mailing list