From 9842ecb6b8ef0353bbbeeeec3a3335ffa9bbafba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Mon, 10 Feb 2025 11:53:48 +0100 Subject: [PATCH 1/3] Fix #134309: Grease Pencil: SVG export crashes on constructive modifiers The use of `GeometryDeformation` is incorrect for computing the bounds: It contains _evaluated_ positions for the _original_ points, but does not match the size of evaluated geometry after constructive modifiers like Line-Art. For the bounds the evaluated positions should be used as-is. Pull Request: https://projects.blender.org/blender/blender/pulls/134325 --- .../io/grease_pencil/intern/grease_pencil_io.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/source/blender/io/grease_pencil/intern/grease_pencil_io.cc b/source/blender/io/grease_pencil/intern/grease_pencil_io.cc index c6d67e5a9bd..5d091e842ae 100644 --- a/source/blender/io/grease_pencil/intern/grease_pencil_io.cc +++ b/source/blender/io/grease_pencil/intern/grease_pencil_io.cc @@ -193,13 +193,11 @@ static IndexMask get_visible_strokes(const Object &object, strokes.curves_range(), GrainSize(512), memory, is_visible_curve); } -static std::optional> compute_drawing_bounds( +static std::optional> compute_screen_space_drawing_bounds( const ARegion ®ion, const RegionView3D &rv3d, const Object &object, - const Object &object_eval, const int layer_index, - const int frame_number, const bke::greasepencil::Drawing &drawing) { using bke::greasepencil::Drawing; @@ -215,11 +213,9 @@ static std::optional> compute_drawing_bounds( const Layer &layer = *grease_pencil.layers()[layer_index]; const float4x4 layer_to_world = layer.to_world_space(object); - const bke::crazyspace::GeometryDeformation deformation = - bke::crazyspace::get_evaluated_grease_pencil_drawing_deformation( - &object_eval, object, layer_index, frame_number); const VArray radii = drawing.radii(); const bke::CurvesGeometry &strokes = drawing.strokes(); + const Span positions = strokes.positions(); IndexMaskMemory curve_mask_memory; const IndexMask curve_mask = get_visible_strokes(object, drawing, curve_mask_memory); @@ -232,8 +228,7 @@ static std::optional> compute_drawing_bounds( } for (const int point_i : points) { - const float3 pos_world = math::transform_point(layer_to_world, - deformation.positions[point_i]); + const float3 pos_world = math::transform_point(layer_to_world, positions[point_i]); float2 screen_co; eV3DProjStatus result = ED_view3d_project_float_global( ®ion, pos_world, screen_co, V3D_PROJ_TEST_NOP); @@ -276,8 +271,8 @@ static std::optional> compute_objects_bounds( continue; } - std::optional> layer_bounds = compute_drawing_bounds( - region, rv3d, *info.object, *object_eval, layer_index, frame_number, *drawing); + std::optional> layer_bounds = compute_screen_space_drawing_bounds( + region, rv3d, *info.object, layer_index, *drawing); full_bounds = bounds::merge(full_bounds, layer_bounds); } From e6260ac9f5b174fddbd49fee80ce41c4e4a1c680 Mon Sep 17 00:00:00 2001 From: Habib Gahbiche Date: Mon, 10 Feb 2025 17:56:22 +0100 Subject: [PATCH 2/3] Fix #134107: Snapping while resizing nodes not working The grid size varied depending on the UI scale. This caused unintended behavior with snapping while resizing nodes. Pull Request: https://projects.blender.org/blender/blender/pulls/134123 --- source/blender/editors/space_node/node_edit.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index 683b180e2a4..533ea703449 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -1016,10 +1016,12 @@ wmKeyMap *node_resize_modal_keymap(wmKeyConfig *keyconf) return keymap; } -/* Compute the nearest 1D coordinate corresponding to the nearest grid in node. */ +/* Compute the nearest 1D coordinate corresponding to the nearest grid in node editors. */ static float nearest_node_grid_coord(float co) { - float grid_size = grid_size_get(); + /* Size and location of nodes are independent of UI scale, so grid size should be independent of + * UI scale as well. */ + float grid_size = grid_size_get() / UI_SCALE_FAC; float rest = fmod(co, grid_size); float offset = rest - grid_size / 2 >= 0 ? grid_size : 0; From 92c89b504b62abd0fe44e362dda760aaaf49b9df Mon Sep 17 00:00:00 2001 From: Nicola Date: Mon, 10 Feb 2025 18:54:05 +0100 Subject: [PATCH 3/3] Fix: Ignore original plane and normal when brush type is Plane The `Plane` brush type does not use the original plane/normal parameters. However, these parameters can be incorrectly retained when switching type to `Plane` from another brush type where they were enabled. This commit ensures that they are ignored for the `Plane` brush type. Pull Request: https://projects.blender.org/blender/blender/pulls/134255 --- source/blender/editors/sculpt_paint/sculpt.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index 34570ffe625..3075ca5c5aa 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -2957,9 +2957,14 @@ void calc_brush_plane(const Depsgraph &depsgraph, zero_v3(r_area_co); zero_v3(r_area_no); + const bool use_original_plane = (brush.flag & BRUSH_ORIGINAL_PLANE) && + brush.sculpt_brush_type != SCULPT_BRUSH_TYPE_PLANE; + const bool use_original_normal = (brush.flag & BRUSH_ORIGINAL_NORMAL) && + brush.sculpt_brush_type != SCULPT_BRUSH_TYPE_PLANE; + if (SCULPT_stroke_is_main_symmetry_pass(*ss.cache) && - (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache) || - !(brush.flag & BRUSH_ORIGINAL_PLANE) || !(brush.flag & BRUSH_ORIGINAL_NORMAL))) + (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache) || !use_original_plane || + !use_original_normal)) { switch (brush.sculpt_plane) { case SCULPT_DISP_DIR_VIEW: @@ -2994,9 +2999,7 @@ void calc_brush_plane(const Depsgraph &depsgraph, } /* For area normal. */ - if (!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache) && - (brush.flag & BRUSH_ORIGINAL_NORMAL)) - { + if (!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache) && use_original_normal) { copy_v3_v3(r_area_no, ss.cache->sculpt_normal); } else { @@ -3004,9 +3007,7 @@ void calc_brush_plane(const Depsgraph &depsgraph, } /* For flatten center. */ - if (!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache) && - (brush.flag & BRUSH_ORIGINAL_PLANE)) - { + if (!SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache) && use_original_plane) { copy_v3_v3(r_area_co, ss.cache->last_center); } else {