From 22a3eb47ec7c39b0cd230e945d694c03cd59c133 Mon Sep 17 00:00:00 2001 From: Leon Schittek Date: Fri, 24 Mar 2023 12:47:54 +0100 Subject: [PATCH 1/3] Fix #106097: Don't offset child nodes when pasting Nodes inside of frames where pasted with an offset from the cursor. Since the location of nodes is in parent space, child nodes don't need to be offset separately. Pull Request: https://projects.blender.org/blender/blender/pulls/106099 --- source/blender/editors/space_node/clipboard.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_node/clipboard.cc b/source/blender/editors/space_node/clipboard.cc index 95c1c25e343..177d3a45c4b 100644 --- a/source/blender/editors/space_node/clipboard.cc +++ b/source/blender/editors/space_node/clipboard.cc @@ -263,8 +263,11 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) const float2 offset = (mouse_location - center) / UI_DPI_FAC; for (bNode *new_node : node_map.values()) { - new_node->locx += offset.x; - new_node->locy += offset.y; + /* Skip the offset for parented nodes since the location is in parent space. */ + if (new_node->parent == nullptr) { + new_node->locx += offset.x; + new_node->locy += offset.y; + } } } From d78550634a7953e0beec64804b85586da0d503e6 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Fri, 24 Mar 2023 13:52:54 +0100 Subject: [PATCH 2/3] Fix: Crash when trying to get FCurve segments of baked curve When using the slider operators in the Graph Editor the code would try to access `FCurve.bezt` without checking that exists. When the curve is baked that is a null pointer. Pull Request: https://projects.blender.org/blender/blender/pulls/106102 --- source/blender/editors/animation/keyframes_general.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 13bd1966eaf..55bc9b8c587 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -279,6 +279,12 @@ static bool find_fcurve_segment(FCurve *fcu, ListBase find_fcurve_segments(FCurve *fcu) { ListBase segments = {NULL, NULL}; + + /* Ignore baked curves. */ + if (!fcu->bezt) { + return segments; + } + int segment_start_idx = 0; int segment_len = 0; int current_index = 0; From d5d8246441a5bdc63c4c1a12d9dce8fcc3bb8e72 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Fri, 24 Mar 2023 14:18:00 +0100 Subject: [PATCH 3/3] Fix #106095: FCurves not drawn when Extrapolation is disabled Bug introduced by c2c67079190acc558d662a02fbf5a149acbbbaf8 Fixing it by undoing the changes to the if statements at the start of the FCurve drawing functions. This keeps the intended behavior of the previous path, while fixing the drawing Pull Request: https://projects.blender.org/blender/blender/pulls/106100 --- source/blender/editors/space_graph/graph_draw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index f315690a50d..bc71437112d 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -704,7 +704,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, const uint shdr_pos, const bool draw_extrapolation) { - if (!draw_extrapolation) { + if (!draw_extrapolation && fcu->totvert == 1) { return; } @@ -817,7 +817,7 @@ static bool fcurve_can_use_simple_bezt_drawing(FCurve *fcu) static void draw_fcurve_curve_bezts( bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, uint pos, const bool draw_extrapolation) { - if (!draw_extrapolation) { + if (!draw_extrapolation && fcu->totvert == 1) { return; }