[Bf-blender-cvs] [97a43c5452d] refactor-mesh-remove-pointers: Squashed commit of the following:

Hans Goudey noreply at git.blender.org
Sat Jul 23 02:28:03 CEST 2022


Commit: 97a43c5452d50643143a39bc6e08a3550dc4f8d3
Author: Hans Goudey
Date:   Fri Jul 22 19:27:58 2022 -0500
Branches: refactor-mesh-remove-pointers
https://developer.blender.org/rB97a43c5452d50643143a39bc6e08a3550dc4f8d3

Squashed commit of the following:

commit 33f9897ebe5848b6437e95fb934b6dbda8d58e3b
Merge: fcb6a57b8df 80b2fc59d11
Author: Hans Goudey <h.goudey at me.com>
Date:   Fri Jul 22 19:13:57 2022 -0500

    Merge branch 'master' into refactor-mesh-hide-generic

commit 80b2fc59d11d5814afe7e219c535525a8d494c17
Author: Hans Goudey <h.goudey at me.com>
Date:   Fri Jul 22 15:49:53 2022 -0500

    Fix T99873: Use evaluated vertex groups in armature modifier

    Geometry nodes has added the ability to modify mesh vertex groups
    during evaluation (see 3b6ee8cee7080af2). However, the armature
    modifier always uses the vertex groups from the original object.
    This is wrong for the modifier stack, where each modifier is meant
    to use the output of the previous.

    This commit makes the armature modifier use the evaluated vertex groups
    if they are available. Otherwise it uses the originals like before.

    Differential Revision: https://developer.blender.org/D15515

commit 7d8b651268df74157f89858eda9ddce9fd452138
Author: Clément Foucault <foucault.clem at gmail.com>
Date:   Fri Jul 22 21:03:06 2022 +0200

    EEVEE-Next: Add exposure awareness to denoising

    This uses the exposure to get a better approximation of the perceptual
    brighness of a sample before accumulating it.

    Note that we do not modify exposure of the image. Only the samples weights
    are computed differently.

commit 676a2f690c3e3fffe2e515208d4d308e0a96e8e6
Author: Clément Foucault <foucault.clem at gmail.com>
Date:   Fri Jul 22 20:32:17 2022 +0200

    EEVEE-Next: Fix render not working

    The swaps during accumulation were ignored because of the way the
    `SwapChain<>` implementation works.

    Using external references and updating them fixes the issue.

commit 35843ddcd80e5957656b157650da950f228d2808
Author: Hans Goudey <h.goudey at me.com>
Date:   Fri Jul 22 11:36:55 2022 -0500

    Fix T99835: Incorrect title case for two node names

commit 98395e0bdfc849e2d2770052c6e8651a42500608
Author: Hans Goudey <h.goudey at me.com>
Date:   Fri Jul 22 10:49:09 2022 -0500

    Cleanup: Use r_ prefix for boolean return parameters

    Also rearrange some lines to simplify logic.

commit c40971d79a887820d621705b29f65f833d9b9f52
Author: Hans Goudey <h.goudey at me.com>
Date:   Fri Jul 22 10:31:10 2022 -0500

    Fix T99873: Store named attribute node cannot write to vertex groups

    Since fd5e5dac8946b13599, the node would remove the attribute before
    adding it again, which lost the vertex group status of an attribute,
    meaning they were written as arbitrary attributes.

    Now, the node first tries to write to attributes with the same domain
    and data-type, which covers the vertex group case. Then it falls back
    to removing the attribute and adding it again. Even that can fail
    though, so I added an error message to make that a bit clearer.

    Differential Revision: https://developer.blender.org/D15514

commit e4eaf424b9ce4800e64d35ddfebe28f986b14647
Author: Germano Cavalcante <germano.costa at ig.com.br>
Date:   Fri Jul 22 12:17:22 2022 -0300

    Fix nodes not transforming

    Error in {rB98bf714b37c1}

commit 6bcda04d1f1cc396dcc188678997105b09231bde
Author: Hans Goudey <h.goudey at me.com>
Date:   Fri Jul 22 09:59:28 2022 -0500

    Geometry Nodes: Port sample curves node to new data-block

    Use the newer more generic sampling and interpolation functions
    developed recently (ab444a80a280) instead of the `CurveEval` type.
    Functions are split up a bit more internally, to allow a separate mode
    for supplying the curve index directly in the future (T92474).

    In one basic test, the performance seems mostly unchanged from 3.1.

    Differential Revision: https://developer.blender.org/D14621

commit 1f94b56d774440d08eb92f2a7a47b9a6a7aa7b84
Author: Jacques Lucke <jacques at blender.org>
Date:   Fri Jul 22 15:39:41 2022 +0200

    Curves: support sculpting on deformed curves

    Previously, curves sculpt tools only worked on original data. This was
    very limiting, because one could effectively only sculpt the curves when
    all procedural effects were turned off. This patch adds support for curves
    sculpting while looking the result of procedural effects (like deformation
    based on the surface mesh). This functionality is also known as "crazy space"
    support in Blender.

    For more details see D15407.

    Differential Revision: https://developer.blender.org/D15407

commit 98bf714b37c1f1b05a162b6ffdaca367b312de1f
Author: Germano Cavalcante <mano-wii>
Date:   Thu Jul 21 23:44:39 2022 -0300

    Refactor: arrange transform convert functions in 'TransConvertTypeInfo'

    Simplify the transform code by bundling the TransData creation, Data
    recalculation, and special updates into a single struct.

    So similar functions and parameters can be accessed without special
    type checks.

    Differential Revision: https://developer.blender.org/D15494

commit 185eeeaaac01bf24930f7e8b25c96f9fa9503073
Author: Campbell Barton <campbell at blender.org>
Date:   Fri Jul 22 22:13:10 2022 +1000

    GHOST/Wayland: Fix mouse wheel events for Sway Compositor (use seat v5)

    Bump the requested seat version to v5, use discreet scroll callback.

    Tested with gnome, river & sway.

commit 003dfae270781bfa642a2c5804fa190edd4dfca4
Author: Xavier Hallade <xavier.hallade at intel.com>
Date:   Fri Jul 22 13:00:46 2022 +0200

    Cycles: enable oneAPI in Linux release builds

    0f50ae131f54d51f778424d4c9655128cafbbefc didn't do it reliably
    since it was deactivated explicitly a bit above.

commit e0d4aede4da8a1f670f53fe597140111b9726234
Author: Campbell Barton <campbell at blender.org>
Date:   Fri Jul 22 16:49:37 2022 +1000

    BMesh: move bmesh_mesh to C++

    This allows parts of the code to be threaded more easily.

commit 95e60b4ffd6c325d2658f318d05ab52d712ca953
Author: Jacques Lucke <jacques at blender.org>
Date:   Fri Jul 22 12:33:08 2022 +0200

    Cleanup: move crazyspace.c to c++

    Doing this in preparation for D15407.

commit 087f27a52f7857887e90754d87a7a73715ebc3fb
Author: Campbell Barton <campbell at blender.org>
Date:   Fri Jul 22 13:57:04 2022 +1000

    Fix T87779: Asymmetric vertex positions in circles primitives

    Add sin_cos_from_fraction which ensures each quadrant has matching
    values when their sign is flipped.

commit 08c5d99e88ee3e9f807dfe69c188660eae347f31
Author: Campbell Barton <campbell at blender.org>
Date:   Fri Jul 22 13:05:26 2022 +1000

    Cleanup: add BKE_image_find_nearest_tile_with_offset

    Every caller BKE_image_find_nearest_tile was calculating the tile offset
    so add a version of this function that returns the offset too.

commit 72e249974aa7f6a3bd6d5c35c5d5e59cd1c3bded
Author: Campbell Barton <campbell at blender.org>
Date:   Fri Jul 22 12:25:10 2022 +1000

    Fix crash loading factory settings in image paint mode

    Loading factory settings left the region NULL, causing the brushes
    poll function to crash.

commit d3db38cfb1f223b81ab89c38bae0652a0d40c03e
Author: Campbell Barton <campbell at blender.org>
Date:   Fri Jul 22 12:23:33 2022 +1000

    Cleanup: quiet nonull-compare warnings with GCC

commit 77257405437336dbd91a481926013f8c747cacae
Author: Siddhartha Jejurkar <f20180617 at goa.bits-pilani.ac.in>
Date:   Fri Jul 22 10:47:28 2022 +1000

    UV: Edge support for select shortest path operator

    Calculating shortest path selection in UV edge mode was done using vertex
    path logic. Since the UV editor now supports proper edge selection [0],
    this approach can sometimes give incorrect results.

    This problem is now fixed by adding separate logic to calculate the
    shortest path in UV edge mode.

    Resolves T99344.

    [0]: ffaaa0bcbf477c30cf3665b9330bbbb767397169

    Reviewed By: campbellbarton

    Ref D15511.

commit aa1ffc093c4711a40932c854670730944008118b
Author: Hans Goudey <h.goudey at me.com>
Date:   Thu Jul 21 19:44:06 2022 -0500

    Fix T99884: Crash when converting to old curve type

    The conversion from Curves to CurveEval used an incorrect type
    for one of the builtin attributes. Also, an incorrect default was used
    for reading the nurbs_weight attribute.

commit fcb6a57b8dfdc9d18cb370f71f82d6f82f8d917d
Author: Hans Goudey <h.goudey at me.com>
Date:   Thu Jul 21 19:11:50 2022 -0500

    Fix BMesh conversion

commit d07a18e49b64d475f02b9edf24e3808adfbf4cfb
Author: Hans Goudey <h.goudey at me.com>
Date:   Thu Jul 21 19:09:34 2022 -0500

    Remove bad assert

commit 520cc7073a9ac8fd25425e7112f6c7d4dea6a43d
Author: Hans Goudey <h.goudey at me.com>
Date:   Thu Jul 21 19:09:23 2022 -0500

    Don't create layers when unnecessary

commit d39fde3662c792800945270a19612f81a4b8e8fd
Author: Hans Goudey <h.goudey at me.com>
Date:   Thu Jul 21 18:35:16 2022 -0500

    Parallelize flag copying

commit 76bdacec1bf299de6b36dbc6e45d7922ca15d969
Author: Hans Goudey <h.goudey at me.com>
Date:   Thu Jul 21 18:19:46 2022 -0500

    Cleanup variables names, add "finish" calls

commit e91eff347a9f855d3c0e757a94962078cd2e8d60
Author: Hans Goudey <h.goudey at me.com>
Date:   Thu Jul 21 18:12:35 2022 -0500

    Remove "new" in comment

===================================================================

M	build_files/cmake/config/blender_release.cmake
M	intern/ghost/intern/GHOST_SystemWayland.cpp
A	source/blender/blenkernel/BKE_crazyspace.hh
M	source/blender/blenkernel/BKE_curves.hh
M	source/blender/blenkernel/BKE_geometry_set.h
M	source/blender/blenkernel/BKE_geometry_set.hh
M	source/blender/blenkernel/BKE_image.h
M	source/blender/blenkernel/BKE_mesh_legacy_convert.h
M	source/blender/blenkernel/BKE_mesh_sample.hh
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/armature_deform.c
R076	source/blender/blenkernel/intern/crazyspace.c	source/blender/blenkernel/intern/crazyspace.cc
M	source/blender/blenkernel/intern/curve_eval.cc
M	source/blender/blenkernel/intern/curves.cc
M	source/blender/blenkernel/intern/customdata.cc
A	source/blender/blenkernel/intern/geometry_component_edit_data.cc
M	source/blender/blenkernel/intern/geometry_set.cc
M	source/blender/blenkernel/intern/image.cc
M	source/blender/blenkernel/intern/main_namemap.cc
M	source/blender/blenkernel/intern/mesh_evaluate.cc
M	source/blender/blenkernel/intern/mesh_legacy_convert.cc
M	source/blender/blenlib/BLI_kdopbvh.h
M	source/blender/blenlib/BLI_length_parameterize.hh
M	source/blender/blenlib/BLI_math_rotation.h
M	source/blender/blenlib/intern/math_rotation.c
M	source/blender/bmesh/CMakeLists.txt
R084	source/blender/bmesh/intern/bmesh_mesh.c	source/blender/bmesh/intern/bmesh_mesh.cc
M	source/blender/bmesh/intern/bmesh_mesh_convert.cc
M	source/blender/bmesh/operators/bmo_primitive.c
M	source/blender/bmesh/tools/bmesh_path_uv.c
M	source/blender/bmesh/tools/bmesh_path_uv.h
M	source/blender/draw/engines/eevee_next/eevee_film.cc
M	source/blender/draw/engines/eevee_next/eevee_film.hh
M	source/blender/draw/engines/eevee_next/eevee_shader_shared.hh
M	source/blender/draw/engines/eevee_next/shaders/eevee_film_lib.glsl
M	source/blender/editors/mesh/editface.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_add.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_comb.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_delete.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_density.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_intern.hh
M	source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_pinch.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_puff.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_selection_paint.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_slide.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_smooth.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_snake_hook.cc
M	source/blender/editors/sculpt_paint/paint_image.cc
M	source/blender/editors/space_node/node_draw.cc
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_convert.c
M	source/blender/editors/transform/transform_convert.h
M	source/blender/editors/transform/transform_convert_action.c
M	source/blender/editors/transform/transform_convert_armature.c
M	source/blender/editors/transform/transform_convert_cursor.c
M	source/blender/editors/transform/transform_convert_curve.c
M	source/blender/editors/transform/transform_convert_gpencil.c
M	source/blender/editors/transform/transform_convert_graph.c
M	source/blender/editors/transform/transform_convert_lattice.c
M	source/blender/editors/transform/transform_convert_mask.c
M	source/blender/editors/transform/transform_convert_mball.c
M	source/blender/editors/transform/transform_convert_mesh.c
M	source/blender/editors/transform/transform_convert_mesh_edge.c
M	source/blender/editors/transform/transform_convert_mesh_skin.c
M	source/blender/editors/transform/transform_convert_mesh_uv.c
M	source/blender/editors/transform/transform_convert_mesh_vert_cdata.c
M	source/blender/editors/transform/transform_convert_nla.c
M	source/blender/editors/transform/transform_convert_node.c
M	source/blender/editors/transform/transform_convert_object.c
M	source/blender/editors/transform/transform_convert_object_texspace.c
M	source/blender/editors/transform/transform_convert_paintcurve.c
M	source/blender/editors/transform/transform_convert_particle.c
M	source/blender/editors/transform/transform_convert_sculpt.c
M	source/blender/editors/transform/transform_convert_sequencer.c
M	source/blender/editors/transform/transform_convert_sequencer_image.c
M	source/blender/editors/transform/transform_convert_tracking.c
M	source/blender/editors/transform/transform_mode.c
M	source/blender/editors/transform/transform_mode_resize.c
M	source/blender/editors/transform/transform_mode_translate.c
M	source/blender/editors/transform/transform_snap.c
M	source/blender/editors/transform/transform_snap_sequencer.c
M	source/blender/editors/uvedit/uvedit_islands.c
M	source/blender/editors/uvedit/uvedit_path.c
M	source/blender/functions/FN_field.hh
M	source/blender/geometry/GEO_add_curves_on_mesh.hh
M	source/blender/geometry/intern/add_curves_on_mesh.cc
M	source/blender/geometry/intern/realize_instances.cc
M	source/blender/io/alembic/intern/abc_reader_object.cc
M	source/blender/modifiers/intern/MOD_decimate.c
M	source/blender/modifiers/intern/MOD_nodes.cc
M	source/blender/nodes/NOD_geometry_exec.hh
M	source/blender/nodes/NOD_geometry_nodes_eval_log.hh
M	source/blender/nodes/NOD_static_types.h
M	source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc
M	source/blender/nodes/geometry/nodes/node_geo_bounding_box.cc
M	source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_trim.cc
M	source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc
M	source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
M	source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
M	source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
M	source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc
M	source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc
M	source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
M	source/blender/nodes/geometry/nodes/node_geo_mesh_to_volume.cc
M	source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc
M	source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc
M	source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
M	source/blender/nodes/geometry/nodes/node_geo_transform.cc
M	source/blender/nodes/geometry/nodes/node_geo_volume_to_mesh.cc
M	source/blender/nodes/intern/geometry_nodes_eval_log.cc
M	source/blender/nodes/intern/node_geometry_exec.cc

===================================================================

diff --git a/build_files/cmake/config/blender_release.cmake b/build_files/cmake/config/blender_release.cmake
index b4609426069..2567e0b444a 100644
--- a/build_files/cmake/config/blender_release.cmake
+++ b/build_files/cmake/config/blender_release.cmake
@@ -78,11 +78,6 @@ if(UNIX AND NOT APPLE)
   set(WITH_PULSEAUDIO          ON  CACHE BOOL "" FORCE)
   set(WITH_X11_XINPUT          ON  CACHE BOOL "" FORCE)
   set(WITH_X11_XF86VMODE       ON  CACHE BOOL "" FORCE)
-
-  # Disable oneAPI on Linux for the time being.
-  # The AoT compilation takes too long to be used officially in the buildbot CI/CD and the JIT
-  # compilation has ABI compatibility issues when running builds made on centOS on Ubuntu.
-  set(WITH_CYCLES_DEVICE_ONEAPI OFF  CACHE BOOL "" FORCE)
 endif()
 if(NOT APPLE)
   set(WITH_XR_OPENXR              ON  CACHE BOOL "" FORCE)
@@ -93,6 +88,6 @@ if(NOT APPLE)
   set(WITH_CYCLES_HIP_BINARIES    ON  CACHE BOOL "" FORCE)
   set(WITH_CYCLES_DEVICE_ONEAPI   ON  CACHE BOOL "" FORCE)
 
-  # Disable AoT kernels compilations until buildbot can deliver them in a reasonabel time.
+  # Disable AoT kernels compilations until buildbot can deliver them in a reasonable time.
   set(WITH_CYCLES_ONEAPI_BINARIES OFF CACHE BOOL "" FORCE)
 endif()
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 07202ff972d..96f11aa2aa5 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1580,13 +1580,38 @@ static void pointer_handle_button(void *data,
   }
 }
 
-static void pointer_handle_axis(void *data,
+static void pointer_handle_axis(void * /*data*/,
                                 struct wl_pointer * /*wl_pointer*/,
                                 const uint32_t /*time*/,
                                 const uint32_t axis,
                                 const wl_fixed_t value)
 {
   CLOG_INFO(LOG, 2, "axis (axis=%u, value=%d)", axis, value);
+}
+
+static void pointer_handle_frame(void * /*data*/, struct wl_pointer * /*wl_pointer*/)
+{
+  CLOG_INFO(LOG, 2, "frame");
+}
+static void pointer_handle_axis_source(void * /*data*/,
+                                       struct wl_pointer * /*wl_pointer*/,
+                                       uint32_t axis_source)
+{
+  CLOG_INFO(LOG, 2, "axis_source (axis_source=%u)", axis_source);
+}
+static void pointer_handle_axis_stop(void * /*data*/,
+                                     struct wl_pointer * /*wl_pointer*/,
+                                     uint32_t /*time*/,
+                                     uint32_t axis)
+{
+  CLOG_INFO(LOG, 2, "axis_stop (axis=%u)", axis);
+}
+static void pointer_handle_axis_discrete(void *data,
+                                         struct wl_pointer * /*wl_pointer*/,
+                                         uint32_t axis,
+                                         int32_t discrete)
+{
+  CLOG_INFO(LOG, 2, "axis_discrete (axis=%u, discrete=%d)", axis, discrete);
 
   input_t *input = static_cast<input_t *>(data);
   if (axis != WL_POINTER_AXIS_VERTICAL_SCROLL) {
@@ -1596,7 +1621,7 @@ static void pointer_handle_axis(void *data,
   if (wl_surface *focus_surface = input->pointer.wl_surface) {
     GHOST_WindowWayland *win = ghost_wl_surface_user_data(focus_surface);
     input->system->pushEvent(new GHOST_EventWheel(
-        input->system->getMilliSeconds(), win, std::signbit(value) ? +1 : -1));
+        input->system->getMilliSeconds(), win, std::signbit(discrete) ? +1 : -1));
   }
 }
 
@@ -1606,6 +1631,10 @@ static const struct wl_pointer_listener pointer_listener = {
     pointer_handle_motion,
     pointer_handle_button,
     pointer_handle_axis,
+    pointer_handle_frame,
+    pointer_handle_axis_source,
+    pointer_handle_axis_stop,
+    pointer_handle_axis_discrete,
 };
 
 #undef LOG
@@ -2744,7 +2773,7 @@ static void global_handle_add(void *data,
     input->xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
     input->data_source = new data_source_t;
     input->wl_seat = static_cast<wl_seat *>(
-        wl_registry_bind(wl_registry, name, &wl_seat_interface, 4));
+        wl_registry_bind(wl_registry, name, &wl_seat_interface, 5));
     display->inputs.push_back(input);
     wl_seat_add_listener(input->wl_seat, &seat_listener, input);
   }
diff --git a/source/blender/blenkernel/BKE_crazyspace.hh b/source/blender/blenkernel/BKE_crazyspace.hh
new file mode 100644
index 00000000000..adebf0b7884
--- /dev/null
+++ b/source/blender/blenkernel/BKE_crazyspace.hh
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+/** \file
+ * \ingroup bke
+ */
+
+#pragma once
+
+#include "BLI_float3x3.hh"
+#include "BLI_math_vec_types.hh"
+#include "BLI_span.hh"
+
+struct Depsgraph;
+struct Object;
+
+namespace blender::bke::crazyspace {
+
+/**
+ * Contains information about how points have been deformed during evaluation.
+ * This allows mapping edits on evaluated data back to original data in some cases.
+ */
+struct GeometryDeformation {
+  /**
+   * Positions of the deformed points. This may also point to the original position if no
+   * deformation data is available.
+   */
+  Span<float3> positions;
+  /**
+   * Matrices that transform point translations on original data into corresponding translations in
+   * evaluated data. This may be empty if not available.
+   */
+  Span<float3x3> deform_mats;
+
+  float3 translation_from_deformed_to_original(const int position_i,
+                                               const float3 &translation) const
+  {
+    if (this->deform_mats.is_empty()) {
+      return translation;
+    }
+    const float3x3 &deform_mat = this->deform_mats[position_i];
+    return deform_mat.inverted() * translation;
+  }
+};
+
+/**
+ * During evaluation of the object, deformation data may have been generated for this object. This
+ * function either retrieves the deformation data from the evaluated object, or falls back to
+ * returning the original data.
+ */
+GeometryDeformation get_evaluated_curves_deformation(const Depsgraph &depsgraph,
+                                                     const Object &ob_orig);
+
+}  // namespace blender::bke::crazyspace
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh
index 68c90a45031..568899721a9 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -11,6 +11,7 @@
 
 #include <mutex>
 
+#include "BLI_float3x3.hh"
 #include "BLI_float4x4.hh"
 #include "BLI_generic_virtual_array.hh"
 #include "BLI_index_mask.hh"
@@ -414,6 +415,38 @@ class CurvesGeometry : public ::CurvesGeometry {
   }
 };
 
+/**
+ * Used to propagate deformation data through modifier evaluation so that sculpt tools can work on
+ * evaluated data.
+ */
+class CurvesEditHints {
+ public:
+  /**
+   * Original data that the edit hints below are meant to be used for.
+   */
+  const Curves &curves_id_orig;
+  /**
+   * Evaluated positions for the points in #curves_orig. If this is empty, the positions from the
+   * evaluated #Curves should be used if possible.
+   */
+  std::optional<Array<float3>> positions;
+  /**
+   * Matrices which transform point movement vectors from original data to corresponding movements
+   * of evaluated data.
+   */
+  std::optional<Array<float3x3>> deform_mats;
+
+  CurvesEditHints(const Curves &curves_id_orig) : curves_id_orig(curves_id_orig)
+  {
+  }
+
+  /**
+   * The edit hints have to correspond to the original curves, i.e. the number of deformed points
+   * is the same as the number of original points.
+   */
+  bool is_valid() const;
+};
+
 namespace curves {
 
 /* -------------------------------------------------------------------- */
diff --git a/source/blender/blenkernel/BKE_geometry_set.h b/source/blender/blenkernel/BKE_geometry_set.h
index a28e9e6bdf6..97e69f3fe1f 100644
--- a/source/blender/blenkernel/BKE_geometry_set.h
+++ b/source/blender/blenkernel/BKE_geometry_set.h
@@ -23,9 +23,10 @@ typedef enum GeometryComponentType {
   GEO_COMPONENT_TYPE_INSTANCES = 2,
   GEO_COMPONENT_TYPE_VOLUME = 3,
   GEO_COMPONENT_TYPE_CURVE = 4,
+  GEO_COMPONENT_TYPE_EDIT = 5,
 } GeometryComponentType;
 
-#define GEO_COMPONENT_TYPE_ENUM_SIZE 5
+#define GEO_COMPONENT_TYPE_ENUM_SIZE 6
 
 void BKE_geometry_set_free(struct GeometrySet *geometry_set);
 
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index 4108e2f7e2e..be2ec3e3dca 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -43,7 +43,8 @@ enum class GeometryOwnershipType {
 
 namespace blender::bke {
 class ComponentAttributeProviders;
-}
+class CurvesEditHints;
+}  // namespace blender::bke
 
 class GeometryComponent;
 
@@ -168,6 +169,12 @@ struct GeometrySet {
    * Remove all geometry components with types that are not in the provided list.
    */
   void keep_only(const blender::Span<GeometryComponentType> component_types);
+  /**
+   * Keeps the provided geometry types, but also instances and edit data.
+   * Instances must not be removed while using #modify_geometry_sets.
+   */
+  void keep_only_during_modify(const blender::Span<GeometryComponentType> component_types);
+  void remove_geometry_during_modify();
 
   void add(const GeometryComponent &component);
 
@@ -287,6 +294,10 @@ struct GeometrySet {
    * Returns a read-only curves data-block or null.
    */
   const Curves *get_curves_for_read() const;
+  /**
+   * Returns read-only curve edit hints or null.
+   */
+  const blender::bke::CurvesEditHints *get_curve_edit_hints_for_read() const;
 
   /**
    * Returns a mutable mesh or null. No ownership is transferred.
@@ -304,6 +315,10 @@ struct GeometrySet {
    * Returns a mutable curves data-block or null. No ownership is transferred.
    */
   Curves *get_curves_for_write();
+  /**
+   * Returns mutable curve edit hints or null.
+   */
+  blender::bke::CurvesEditHints *get_curve_edit_hints_for_write();
 
   /* Utility methods for replacement. */
   /**
@@ -825,3 +840,37 @@ class VolumeComponent : public GeometryComponent {
 
   static constexpr inline GeometryComponentType static_type = GEO_COMPONENT_TYPE_VOLUME;
 };
+


@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list