Blender  V3.3
geometry_component_edit_data.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include "BKE_curves.hh"
4 #include "BKE_geometry_set.hh"
5 
6 using namespace blender;
7 using namespace blender::bke;
8 
10 {
11 }
12 
14 {
16  if (curves_edit_hints_) {
17  new_component->curves_edit_hints_ = std::make_unique<CurvesEditHints>(*curves_edit_hints_);
18  }
19  return new_component;
20 }
21 
23 {
24  return true;
25 }
26 
28 {
29  /* Nothing to do. */
30 }
31 
33  GeometrySet &geometry)
34 {
35  /* This component should be created at the start of object evaluation if it's necessary. */
36  if (!geometry.has<GeometryComponentEditData>()) {
37  return;
38  }
39  GeometryComponentEditData &edit_component =
41  if (!edit_component.curves_edit_hints_) {
42  return;
43  }
44  if (edit_component.curves_edit_hints_->positions.has_value()) {
45  return;
46  }
47  const Curves *curves_id = geometry.get_curves_for_read();
48  if (curves_id == nullptr) {
49  return;
50  }
52  const int points_num = curves.points_num();
53  if (points_num != edit_component.curves_edit_hints_->curves_id_orig.geometry.point_num) {
54  return;
55  }
56  edit_component.curves_edit_hints_->positions.emplace(points_num);
57  edit_component.curves_edit_hints_->positions->as_mutable_span().copy_from(curves.positions());
58 }
Low-level operations for curves.
@ GEO_COMPONENT_TYPE_EDIT
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to curves
static void remember_deformed_curve_positions_if_necessary(GeometrySet &geometry)
std::unique_ptr< blender::bke::CurvesEditHints > curves_edit_hints_
GeometryComponent * copy() const final
static struct PartialUpdateUser * wrap(PartialUpdateUserImpl *user)
CurvesGeometry geometry
GeometryComponent & get_component_for_write(GeometryComponentType component_type)
bool has(const GeometryComponentType component_type) const
const Curves * get_curves_for_read() const