Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-07-22 16:39:41 +0300
committerJacques Lucke <jacques@blender.org>2022-07-22 16:39:41 +0300
commit1f94b56d774440d08eb92f2a7a47b9a6a7aa7b84 (patch)
tree06928c94d524852c7031aa310d578691735dc0a8 /source/blender/blenkernel/BKE_geometry_set.hh
parent98bf714b37c1f1b05a162b6ffdaca367b312de1f (diff)
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
Diffstat (limited to 'source/blender/blenkernel/BKE_geometry_set.hh')
-rw-r--r--source/blender/blenkernel/BKE_geometry_set.hh51
1 files changed, 50 insertions, 1 deletions
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;
};
+
+/**
+ * When the original data is in some edit mode, we want to propagate some additional information
+ * through object evaluation. This information can be used by edit modes to support working on
+ * evaluated data.
+ *
+ * This component is added at the beginning of modifier evaluation.
+ */
+class GeometryComponentEditData final : public GeometryComponent {
+ public:
+ /**
+ * Information about how original curves are manipulated during evaluation. This data is used so
+ * that curve sculpt tools can work on evaluated data. It is not stored in #CurveComponent
+ * because the data remains valid even when there is no actual curves geometry anymore, for
+ * example, when the curves have been converted to a mesh.
+ */
+ std::unique_ptr<blender::bke::CurvesEditHints> curves_edit_hints_;
+
+ GeometryComponentEditData();
+
+ GeometryComponent *copy() const final;
+ bool owns_direct_data() const final;
+ void ensure_owns_direct_data() final;
+
+ /**
+ * The first node that does topology changing operations on curves should store the curve point
+ * positions it retrieved as input. Without this, information about the deformed positions is
+ * lost, which would make curves sculpt mode fall back to using original curve positions instead
+ * of deformed ones.
+ */
+ static void remember_deformed_curve_positions_if_necessary(GeometrySet &geometry);
+
+ static constexpr inline GeometryComponentType static_type = GEO_COMPONENT_TYPE_EDIT;
+};