[Bf-blender-cvs] [7c77d769dd3] geometry-nodes-curve-support: Geometry Nodes Curves: Add "owns direct data" functions
Hans Goudey
noreply at git.blender.org
Thu Apr 8 23:34:00 CEST 2021
Commit: 7c77d769dd38b74a446fe3c6072c105daa3c42b5
Author: Hans Goudey
Date: Thu Apr 8 16:00:14 2021 -0500
Branches: geometry-nodes-curve-support
https://developer.blender.org/rB7c77d769dd38b74a446fe3c6072c105daa3c42b5
Geometry Nodes Curves: Add "owns direct data" functions
===================================================================
M source/blender/blenkernel/BKE_geometry_set.hh
M source/blender/blenkernel/intern/geometry_component_curve.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index ce56e291d2d..1f59b7699af 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -457,6 +457,9 @@ class CurveComponent : public GeometryComponent {
bool is_empty() const final;
+ bool owns_direct_data() const override;
+ void ensure_owns_direct_data() override;
+
static constexpr inline GeometryComponentType static_type = GEO_COMPONENT_TYPE_CURVE;
private:
diff --git a/source/blender/blenkernel/intern/geometry_component_curve.cc b/source/blender/blenkernel/intern/geometry_component_curve.cc
index 6d567e68e00..ab0a31e6795 100644
--- a/source/blender/blenkernel/intern/geometry_component_curve.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curve.cc
@@ -97,6 +97,20 @@ bool CurveComponent::is_empty() const
return curve_ == nullptr;
}
+bool CurveComponent::owns_direct_data() const
+{
+ return ownership_ == GeometryOwnershipType::Owned;
+}
+
+void CurveComponent::ensure_owns_direct_data()
+{
+ BLI_assert(this->is_mutable());
+ if (ownership_ != GeometryOwnershipType::Owned) {
+ // curve_ = BKE_curve_copy_for_eval(curve_, false);
+ ownership_ = GeometryOwnershipType::Owned;
+ }
+}
+
/** \} */
/* -------------------------------------------------------------------- */
More information about the Bf-blender-cvs
mailing list