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/intern/geometry_set.cc
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/intern/geometry_set.cc')
-rw-r--r--source/blender/blenkernel/intern/geometry_set.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/geometry_set.cc b/source/blender/blenkernel/intern/geometry_set.cc
index c6fe8eebc7f..1a0ce4f0893 100644
--- a/source/blender/blenkernel/intern/geometry_set.cc
+++ b/source/blender/blenkernel/intern/geometry_set.cc
@@ -53,6 +53,8 @@ GeometryComponent *GeometryComponent::create(GeometryComponentType component_typ
return new VolumeComponent();
case GEO_COMPONENT_TYPE_CURVE:
return new CurveComponent();
+ case GEO_COMPONENT_TYPE_EDIT:
+ return new GeometryComponentEditData();
}
BLI_assert_unreachable();
return nullptr;
@@ -175,6 +177,20 @@ void GeometrySet::keep_only(const blender::Span<GeometryComponentType> component
}
}
+void GeometrySet::keep_only_during_modify(
+ const blender::Span<GeometryComponentType> component_types)
+{
+ Vector<GeometryComponentType> extended_types = component_types;
+ extended_types.append_non_duplicates(GEO_COMPONENT_TYPE_INSTANCES);
+ extended_types.append_non_duplicates(GEO_COMPONENT_TYPE_EDIT);
+ this->keep_only(extended_types);
+}
+
+void GeometrySet::remove_geometry_during_modify()
+{
+ this->keep_only_during_modify({});
+}
+
void GeometrySet::add(const GeometryComponent &component)
{
BLI_assert(!components_[component.type()]);
@@ -290,6 +306,13 @@ const Curves *GeometrySet::get_curves_for_read() const
return (component == nullptr) ? nullptr : component->get_for_read();
}
+const blender::bke::CurvesEditHints *GeometrySet::get_curve_edit_hints_for_read() const
+{
+ const GeometryComponentEditData *component =
+ this->get_component_for_read<GeometryComponentEditData>();
+ return (component == nullptr) ? nullptr : component->curves_edit_hints_.get();
+}
+
bool GeometrySet::has_pointcloud() const
{
const PointCloudComponent *component = this->get_component_for_read<PointCloudComponent>();
@@ -453,6 +476,16 @@ Curves *GeometrySet::get_curves_for_write()
return component == nullptr ? nullptr : component->get_for_write();
}
+blender::bke::CurvesEditHints *GeometrySet::get_curve_edit_hints_for_write()
+{
+ if (!this->has<GeometryComponentEditData>()) {
+ return nullptr;
+ }
+ GeometryComponentEditData &component =
+ this->get_component_for_write<GeometryComponentEditData>();
+ return component.curves_edit_hints_.get();
+}
+
void GeometrySet::attribute_foreach(const Span<GeometryComponentType> component_types,
const bool include_instances,
const AttributeForeachCallback callback) const
@@ -679,6 +712,8 @@ bool BKE_object_has_geometry_set_instances(const Object *ob)
case GEO_COMPONENT_TYPE_CURVE:
is_instance = !ELEM(ob->type, OB_CURVES_LEGACY, OB_FONT);
break;
+ case GEO_COMPONENT_TYPE_EDIT:
+ break;
}
if (is_instance) {
return true;