51#define GEO_COMPONENT_TYPE_ENUM_SIZE 7
101 virtual std::optional<AttributeAccessor>
attributes()
const;
125 void delete_self()
override;
126 void delete_data_only()
override;
154 std::array<GeometryComponentPtr, GEO_COMPONENT_TYPE_ENUM_SIZE> components_;
188 return components_[int(component_type)];
198 return static_cast<const Component *
>(
get_component(Component::static_type));
202 template<
typename Component>
bool has()
const
205 return this->
has(Component::static_type);
211 return components_[int(Component::static_type)];
215 template<
typename Component>
void remove()
218 return this->
remove(Component::static_type);
234 bool use_subdiv =
false)
const;
267 bool include_instances,
277 bool ignore_empty)
const;
466 return Span(a.components_) ==
Span(
b.components_) && a.name_ ==
b.name_ &&
467 a.bundle_ ==
b.bundle_;
484 template<
typename Component> Component *get_component_for_write_ptr()
487 return static_cast<Component *
>(get_component_for_write_ptr(Component::static_type));
497 Mesh *mesh_ =
nullptr;
506 void clear()
override;
564 void clear()
override;
597 std::optional<AttributeAccessor>
attributes()
const final;
610 Curves *curves_ =
nullptr;
618 mutable Curve *curve_for_render_ =
nullptr;
619 mutable Mutex curve_for_render_mutex_;
627 void clear()
override;
651 std::optional<AttributeAccessor>
attributes()
const final;
672 void clear()
override;
689 std::optional<AttributeAccessor>
attributes()
const final;
702 Volume *volume_ =
nullptr;
710 void clear()
override;
794 void clear() override;
822 void clear()
override;
void ensure_owns_direct_data() override
const Curve * get_curve_for_render() const
void count_memory(MemoryCounter &memory) const override
static constexpr GeometryComponent::Type static_type
void replace(Curves *curve, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
const Curves * get() const
GeometryComponentPtr copy() const override
bool is_empty() const final
std::optional< AttributeAccessor > attributes() const final
std::optional< MutableAttributeAccessor > attributes_for_write() final
bool owns_direct_data() const override
std::unique_ptr< GreasePencilEditHints > grease_pencil_edit_hints_
std::unique_ptr< MeshEditHints > mesh_edit_hints_
GeometryComponentPtr copy() const final
std::unique_ptr< GizmoEditHints > gizmo_edit_hints_
bool owns_direct_data() const final
void ensure_owns_direct_data() final
static constexpr GeometryComponent::Type static_type
std::unique_ptr< CurvesEditHints > curves_edit_hints_
static void remember_deformed_positions_if_necessary(GeometrySet &geometry)
GeometryComponentEditData()
int attribute_domain_size(AttrDomain domain) const
virtual std::optional< AttributeAccessor > attributes() const
~GeometryComponent() override=default
GeometryComponent(Type type)
virtual std::optional< MutableAttributeAccessor > attributes_for_write()
virtual bool is_empty() const
virtual void count_memory(MemoryCounter &memory) const
virtual void ensure_owns_direct_data()=0
virtual bool owns_direct_data() const =0
virtual GeometryComponentPtr copy() const =0
static GeometryComponentPtr create(Type component_type)
bool has_grease_pencil() const
std::optional< AttributeAccessor > attributes() const final
static constexpr GeometryComponent::Type static_type
std::optional< MutableAttributeAccessor > attributes_for_write() final
const GreasePencil * get() const
bool owns_direct_data() const override
GreasePencil * get_for_write()
GeometryComponentPtr copy() const override
void ensure_owns_direct_data() override
bool is_empty() const final
void replace(GreasePencil *grease_pencil, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
std::optional< MutableAttributeAccessor > attributes_for_write() final
static constexpr GeometryComponent::Type static_type
void ensure_owns_direct_data() override
void count_memory(MemoryCounter &memory) const override
Instances * get_for_write()
const Instances * get() const
bool is_empty() const final
GeometryComponentPtr copy() const override
bool owns_direct_data() const override
std::optional< AttributeAccessor > attributes() const final
void replace(Instances *instances, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
static constexpr GeometryComponent::Type static_type
void ensure_owns_direct_data() override
bool is_empty() const final
void replace(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
GeometryComponentPtr copy() const override
bool owns_direct_data() const override
void count_memory(MemoryCounter &memory) const override
std::optional< AttributeAccessor > attributes() const final
std::optional< MutableAttributeAccessor > attributes_for_write() final
GeometryComponentPtr copy() const override
void count_memory(MemoryCounter &memory) const override
static constexpr GeometryComponent::Type static_type
bool owns_direct_data() const override
void replace(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
const PointCloud * get() const
std::optional< MutableAttributeAccessor > attributes_for_write() final
bool is_empty() const final
bool has_pointcloud() const
void ensure_owns_direct_data() override
std::optional< AttributeAccessor > attributes() const final
PointCloud * get_for_write()
void count_memory(MemoryCounter &memory) const override
void ensure_owns_direct_data() override
static constexpr GeometryComponent::Type static_type
bool owns_direct_data() const override
GeometryComponentPtr copy() const override
void replace(Volume *volume, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
const Volume * get() const
A running instance of the engine.
ImplicitSharingPtr< GeometryComponent > GeometryComponentPtr
constexpr bool is_geometry_component_v
bool attribute_is_builtin_on_component_type(const GeometryComponent::Type type, StringRef name)
std::ostream & operator<<(std::ostream &stream, const GeometrySet &geometry_set)
ImplicitSharingPtr< Bundle > BundlePtr
unsigned __int64 uint64_t
BLI_STATIC_ASSERT(ARRAY_SIZE(data_mode_strings)==CTX_MODE_NUM+1, "Must have a string for each context mode") const char *CTX_data_mode_string(const bContext *C)
constexpr uint64_t get_default_hash(const T &v, const Args &...args)
void add(const StringRef name, const AttributeDomainAndType &kind)
Vector< AttributeDomainAndType, 16 > kinds
VectorSet< StringRef, 16 > names
GeometrySet & operator=(GeometrySet &&other)
bool owns_direct_data() const
void merge_bundle_from(const GeometrySet &other)
void ensure_owns_all_data()
void replace_volume(Volume *volume, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void keep_only(Span< GeometryComponent::Type > component_types)
const CurvesEditHints * get_curve_edit_hints() const
GeometryComponent & get_component_for_write(GeometryComponent::Type component_type)
GeometrySet & operator=(const GeometrySet &other)
void ensure_no_shared_components()
StringRefNull name() const
GeometryComponentPtr get_component_ptr(GeometryComponent::Type component_type) const
void set_name(std::string name)
FunctionRef< void( StringRef name, const AttributeMetaData &meta_data, const GeometryComponent &component)> AttributeForeachCallback
static GeometrySet from_grease_pencil(GreasePencil *grease_pencil, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
bool has_component() const
PointCloud * get_pointcloud_for_write()
static GeometrySet from_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
GizmoEditHints * get_gizmo_edit_hints_for_write()
void replace_instances(Instances *instances, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
Instances * get_instances_for_write()
const GreasePencil * get_grease_pencil() const
bool has_pointcloud() const
nodes::Bundle & bundle_for_write()
const Component * get_component() const
Component & get_component_for_write()
const GizmoEditHints * get_gizmo_edit_hints() const
Vector< const GeometryComponent * > get_components() const
const Volume * get_volume() const
std::optional< Bounds< float3 > > compute_boundbox_without_instances(bool use_radius=true, bool use_subdiv=false) const
static GeometrySet from_mesh(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
bool has(const GeometryComponent::Type component_type) const
void replace_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
Curves * get_curves_for_write()
const nodes::Bundle * bundle() const
static GeometrySet from_instances(std::unique_ptr< Instances > instances)
const GeometryComponent * get_component(GeometryComponent::Type component_type) const
bool has_realized_data() const
const Curves * get_curves() const
static GeometrySet from_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
const Instances * get_instances() const
bool has_grease_pencil() const
static GeometrySet from_volume(Volume *volume, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
bool has_instances() const
GeometrySet(const GeometrySet &other)
void copy_bundle_from(const GeometrySet &other)
void ensure_owns_direct_data()
GreasePencilEditHints * get_grease_pencil_edit_hints_for_write()
void replace_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
CurvesEditHints * get_curve_edit_hints_for_write()
friend bool operator==(const GeometrySet &a, const GeometrySet &b)
void count_memory(MemoryCounter &memory) const
const GreasePencilEditHints * get_grease_pencil_edit_hints() const
const PointCloud * get_pointcloud() const
const Mesh * get_mesh() const
void remove(const GeometryComponent::Type component_type)
void replace_mesh(Mesh *mesh, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
GreasePencil * get_grease_pencil_for_write()
Vector< GeometryComponent::Type > gather_component_types(bool include_instances, bool ignore_empty) const
const nodes::BundlePtr & bundle_ptr() const
Volume * get_volume_for_write()
void attribute_foreach(Span< GeometryComponent::Type > component_types, bool include_instances, AttributeForeachCallback callback) const
Mesh * get_mesh_for_write()
void add(const GeometryComponent &component)
void replace_grease_pencil(GreasePencil *grease_pencil, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
GeometrySet(GeometrySet &&other)
GeometryComponentPtr mesh_deform
GeometryComponentPtr mesh_cage