Incorrect behaviour when editing aligned handles in curve editor #38594

Closed
opened 2014-02-11 15:05:40 +01:00 by Ignatz · 18 comments

Windows 7 Professional 64-bit w Service Pack 1
Display card: Nvidia GeForce GTX 760

Blender 2.69 - r60995

There is a bug editing aligned handles of an animation curve.

See attached file: “handle editing bug.blend”

To reproduce:

In the curve editor, select the right hand handle of the middle keyframe as in first image, “handle edit A.jpg”.

Now move press 'G' and move the handle to the position as indicated in the second image file, “handle edit B.jpg”

It will be seen that the behaviour of the handle on the opposite side of the keyframe anchor point is not moving correctly. It is as if the control point of the second handle wants to remain vertically locked to the frame it is on. This behviour is not correct and often leads to a wild overshoot of the bezier curve.

The correct behaviour of the handle on the opposite side when being edited is indicated in the last image, “handle edit C.jpg”. Here we see that the handle on the opposite side remains the same length (thus retaining the same 'tension') and simply rotates around the keyframe anchor point.

handle_editing_bug.blend

handle_edit_A.jpg

handle_edit_B.jpg

handle_edit_C.jpg

Windows 7 Professional 64-bit w Service Pack 1 Display card: Nvidia GeForce GTX 760 Blender 2.69 - r60995 There is a bug editing aligned handles of an animation curve. See attached file: “handle editing bug.blend” To reproduce: In the curve editor, select the right hand handle of the middle keyframe as in first image, “handle edit A.jpg”. Now move press 'G' and move the handle to the position as indicated in the second image file, “handle edit B.jpg” It will be seen that the behaviour of the handle on the opposite side of the keyframe anchor point is not moving correctly. It is as if the control point of the second handle wants to remain vertically locked to the frame it is on. This behviour is not correct and often leads to a wild overshoot of the bezier curve. The correct behaviour of the handle on the opposite side when being edited is indicated in the last image, “handle edit C.jpg”. Here we see that the handle on the opposite side remains the same length (thus retaining the same 'tension') and simply rotates around the keyframe anchor point. [handle_editing_bug.blend](https://archive.blender.org/developer/F76895/handle_editing_bug.blend) ![handle_edit_A.jpg](https://archive.blender.org/developer/F76896/handle_edit_A.jpg) ![handle_edit_B.jpg](https://archive.blender.org/developer/F76898/handle_edit_B.jpg) ![handle_edit_C.jpg](https://archive.blender.org/developer/F76900/handle_edit_C.jpg)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @ignatz

Added subscriber: @ignatz

#39911 was marked as duplicate of this issue

#39911 was marked as duplicate of this issue

Added subscriber: @JoshuaLeung

Added subscriber: @JoshuaLeung

Added subscriber: @brecht

Added subscriber: @brecht

I can't tell if this is intentional, for the other handle the X coordinate (time) stays the same, which may be useful in some cases? It's pretty easy to change but I'll let Joshua decide.

P15: (An Untitled Masterwork)

diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 8567a57..2fc9042 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -2904,6 +2904,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
 	float *p1, *p2, *p3, pt[3];
 	float dvec_a- [x], dvec_b[3];
 	float len, len_a, len_b;
+	float orig_len_ratio;
 	const float eps = 1e-5;
 
 	if (bezt->h1 == 0 && bezt->h2 == 0) {
@@ -2948,6 +2949,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
 	if (len_a == 0.0f) len_a = 1.0f;
 	if (len_b == 0.0f) len_b = 1.0f;
 
+	orig_len_ratio = len_a/len_b;
 
 	if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) || ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {    /* auto */
 		float tvec[3];
@@ -3056,15 +3058,11 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
 
 	len_b = len_v3v3(p2, p2 + 3);
 	len_a = len_v3v3(p2, p2 - 3);
-	if (len_a == 0.0f)
-		len_a = 1.0f;
-	if (len_b == 0.0f)
-		len_b = 1.0f;
 
 	if (bezt->f1 & SELECT) { /* order of calculation */
 		if (bezt->h2 == HD_ALIGN) { /* aligned */
 			if (len_a > eps) {
-				len = len_b / len_a;
+				len = 1.0f / orig_len_ratio;
 				p2- [x] = p2- [x] + len * (p2- [x] - p2[-3]);
 				p2- [x] = p2- [x] + len * (p2- [x] - p2[-2]);
 				p2- [x] = p2- [x] + len * (p2- [x] - p2[-1]);
@@ -3072,7 +3070,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
 		}
 		if (bezt->h1 == HD_ALIGN) {
 			if (len_b > eps) {
-				len = len_a / len_b;
+				len = orig_len_ratio;
 				p2[-3] = p2- [x] + len * (p2- [x] - p2[3]);
 				p2[-2] = p2- [x] + len * (p2- [x] - p2[4]);
 				p2[-1] = p2- [x] + len * (p2- [x] - p2[5]);
@@ -3082,7 +3080,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
 	else {
 		if (bezt->h1 == HD_ALIGN) {
 			if (len_b > eps) {
-				len = len_a / len_b;
+				len = 1.0f / orig_len_ratio;
 				p2[-3] = p2- [x] + len * (p2- [x] - p2[3]);
 				p2[-2] = p2- [x] + len * (p2- [x] - p2[4]);
 				p2[-1] = p2- [x] + len * (p2- [x] - p2[5]);
@@ -3090,7 +3088,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
 		}
 		if (bezt->h2 == HD_ALIGN) {   /* aligned */
 			if (len_a > eps) {
-				len = len_b / len_a;
+				len = orig_len_ratio;
 				p2- [x] = p2- [x] + len * (p2- [x] - p2[-3]);
 				p2- [x] = p2- [x] + len * (p2- [x] - p2[-2]);
 				p2- [x] = p2- [x] + len * (p2- [x] - p2[-1]);

I can't tell if this is intentional, for the other handle the X coordinate (time) stays the same, which may be useful in some cases? It's pretty easy to change but I'll let Joshua decide. [P15: (An Untitled Masterwork)](https://archive.blender.org/developer/P15.txt) ```diff diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 8567a57..2fc9042 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2904,6 +2904,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n float *p1, *p2, *p3, pt[3]; float dvec_a- [x], dvec_b[3]; float len, len_a, len_b; + float orig_len_ratio; const float eps = 1e-5; if (bezt->h1 == 0 && bezt->h2 == 0) { @@ -2948,6 +2949,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n if (len_a == 0.0f) len_a = 1.0f; if (len_b == 0.0f) len_b = 1.0f; + orig_len_ratio = len_a/len_b; if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) || ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { /* auto */ float tvec[3]; @@ -3056,15 +3058,11 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n len_b = len_v3v3(p2, p2 + 3); len_a = len_v3v3(p2, p2 - 3); - if (len_a == 0.0f) - len_a = 1.0f; - if (len_b == 0.0f) - len_b = 1.0f; if (bezt->f1 & SELECT) { /* order of calculation */ if (bezt->h2 == HD_ALIGN) { /* aligned */ if (len_a > eps) { - len = len_b / len_a; + len = 1.0f / orig_len_ratio; p2- [x] = p2- [x] + len * (p2- [x] - p2[-3]); p2- [x] = p2- [x] + len * (p2- [x] - p2[-2]); p2- [x] = p2- [x] + len * (p2- [x] - p2[-1]); @@ -3072,7 +3070,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n } if (bezt->h1 == HD_ALIGN) { if (len_b > eps) { - len = len_a / len_b; + len = orig_len_ratio; p2[-3] = p2- [x] + len * (p2- [x] - p2[3]); p2[-2] = p2- [x] + len * (p2- [x] - p2[4]); p2[-1] = p2- [x] + len * (p2- [x] - p2[5]); @@ -3082,7 +3080,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n else { if (bezt->h1 == HD_ALIGN) { if (len_b > eps) { - len = len_a / len_b; + len = 1.0f / orig_len_ratio; p2[-3] = p2- [x] + len * (p2- [x] - p2[3]); p2[-2] = p2- [x] + len * (p2- [x] - p2[4]); p2[-1] = p2- [x] + len * (p2- [x] - p2[5]); @@ -3090,7 +3088,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n } if (bezt->h2 == HD_ALIGN) { /* aligned */ if (len_a > eps) { - len = len_b / len_a; + len = orig_len_ratio; p2- [x] = p2- [x] + len * (p2- [x] - p2[-3]); p2- [x] = p2- [x] + len * (p2- [x] - p2[-2]); p2- [x] = p2- [x] + len * (p2- [x] - p2[-1]); ```
Author

If I might politely point out: There is no advantage for the the end of the opposing handle to remain pinned to some arbitrary point in time. As I have attempted to show, this leads to the tension of the handle (its length) fluctuating wildly. It also means that handle positioning becomes a two-step process - first moving the handle on one side of the keyframe anchor point and then afterwards (re)positioning the handle on the other side of the keyframe anchor point to bring it (and the motion curve) back into some reasonable position.

If I might politely point out: There is no advantage for the the end of the opposing handle to remain pinned to some arbitrary point in time. As I have attempted to show, this leads to the tension of the handle (its length) fluctuating wildly. It also means that handle positioning becomes a two-step process - first moving the handle on one side of the keyframe anchor point and then afterwards (re)positioning the handle on the other side of the keyframe anchor point to bring it (and the motion curve) back into some reasonable position.
Member

Added subscriber: @BassamKurdali

Added subscriber: @BassamKurdali
Joshua Leung was assigned by Sergey Sharybin 2014-02-17 10:41:45 +01:00

Added subscriber: @Sergey

Added subscriber: @Sergey

Please have a look into the patch :)

Please have a look into the patch :)
Member

Added subscriber: @koilz

Added subscriber: @koilz
Member

◀ Merged tasks: #39911.

◀ Merged tasks: #39911.

This issue was referenced by blender/blender-addons-contrib@0985bb483d

This issue was referenced by blender/blender-addons-contrib@0985bb483df8ce7bb887fa636853245dd598a877

This issue was referenced by 0985bb483d

This issue was referenced by 0985bb483df8ce7bb887fa636853245dd598a877
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Member

Closed by commit 0985bb483d.

Closed by commit 0985bb483d.

Added subscriber: @ideasman42

Added subscriber: @ideasman42

This fix caused #40186, leaving this closed.

For now just leave this as a known limitation in the system.

This fix caused #40186, leaving this closed. For now just leave this as a known limitation in the system.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#38594
No description provided.