72 std::optional<Library *> ,
85 pointcloud_dst->
runtime->bounds_cache = pointcloud_src->
runtime->bounds_cache;
86 pointcloud_dst->
runtime->bounds_with_radius_cache =
87 pointcloud_src->
runtime->bounds_with_radius_cache;
88 pointcloud_dst->
runtime->bvh_cache = pointcloud_src->
runtime->bvh_cache;
89 if (pointcloud_src->
runtime->bake_materials) {
90 pointcloud_dst->
runtime->bake_materials =
91 std::make_unique<blender::bke::bake::BakeMaterialsList>(
92 *pointcloud_src->
runtime->bake_materials);
111 for (
int i = 0;
i < pointcloud->
totcol;
i++) {
243 pointcloud->attributes_for_write().add<
float3>(
255 pointcloud_dst->
runtime->bounds_cache = pointcloud_src->
runtime->bounds_cache;
256 pointcloud_dst->
runtime->bounds_with_radius_cache =
257 pointcloud_src->
runtime->bounds_with_radius_cache;
258 pointcloud_dst->
runtime->bvh_cache = pointcloud_src->
runtime->bvh_cache;
262std::optional<blender::Bounds<float3>> PointCloud::bounds_min_max(
const bool use_radius)
const
264 using namespace blender;
265 using namespace blender::bke;
270 this->
runtime->bounds_with_radius_cache.ensure([&](Bounds<float3> &r_bounds) {
271 const VArray<float> radius = this->radius();
272 if (
const std::optional radius_single = radius.
get_if_single()) {
273 r_bounds = *this->bounds_min_max(
false);
274 r_bounds.
pad(*radius_single);
278 r_bounds = *bounds::min_max_with_radii(this->positions(), radius_span);
282 this->
runtime->bounds_cache.ensure(
283 [&](Bounds<float3> &r_bounds) { r_bounds = *bounds::min_max(this->positions()); });
285 return use_radius ? this->
runtime->bounds_with_radius_cache.data() :
286 this->
runtime->bounds_cache.data();
289std::optional<int> PointCloud::material_index_max()
const
298 if (max_material_index.has_value()) {
299 max_material_index = std::clamp(*max_material_index, 0,
MAXMAT);
301 return max_material_index;
311 return blender::bke::AttributeAccessor(
this,
317 return blender::bke::MutableAttributeAccessor(
363 for (; md; md = md->
next) {
387 if (pointcloud !=
nullptr) {
412 if (pointcloud_eval ==
nullptr) {
417 const bool eval_is_owned = pointcloud_eval != pointcloud;
422void PointCloud::tag_positions_changed()
424 this->
runtime->bounds_cache.tag_dirty();
425 this->
runtime->bounds_with_radius_cache.tag_dirty();
426 this->
runtime->bvh_cache.tag_dirty();
429void PointCloud::tag_radii_changed()
431 this->
runtime->bounds_with_radius_cache.tag_dirty();
void BKE_animdata_free(ID *id, bool do_id_user)
CustomData interface, see also DNA_customdata_types.h.
void CustomData_reset(CustomData *data)
void CustomData_blend_read(BlendDataReader *reader, CustomData *data, int count)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
const char * BKE_idtype_idcode_to_name(short idcode)
void * BKE_libblock_alloc(Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
void BKE_id_free(Main *bmain, void *idv)
void BKE_libblock_init_empty(ID *id) ATTR_NONNULL(1)
ID * BKE_id_copy_ex(Main *bmain, const ID *id, ID **new_id_p, int flag)
void * BKE_id_new(Main *bmain, short type, const char *name)
void * BKE_id_new_nomain(short type, const char *name)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
void BKE_modifiers_clear_errors(Object *ob)
bool BKE_modifier_is_enabled(const Scene *scene, ModifierData *md, int required_mode)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
ModifierData * BKE_modifiers_get_virtual_modifierlist(const Object *ob, VirtualModifierData *data)
General operations, lookup, etc. for blender objects.
void BKE_object_eval_assign_data(Object *object, ID *data, bool is_owned)
void BKE_object_free_derived_caches(Object *ob)
General operations for point clouds.
void(* BKE_pointcloud_batch_cache_free_cb)(PointCloud *pointcloud)
void(* BKE_pointcloud_batch_cache_dirty_tag_cb)(PointCloud *pointcloud, int mode)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
void BLO_write_pointer_array(BlendWriter *writer, int64_t num, const void *data_ptr)
void BLO_read_pointer_array(BlendDataReader *reader, int64_t array_size, void **ptr_p)
#define BLT_I18NCONTEXT_ID_POINTCLOUD
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
#define DNA_struct_default_get(struct_name)
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
static const char * ATTR_POSITION
BMesh const char void * data
BPy_StructRNA * depsgraph
constexpr void copy_from(Span< T > values) const
std::optional< T > get_if_single() const
Span< T > get_internal_span() const
void replace(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_dupallocN(const void *vmemh)
GMutableSpan get_mutable_attribute(AttributeStorage &storage, const AttrDomain domain, const CPPType &cpp_type, const StringRef name, const int64_t domain_size, const void *custom_default_value)
void attribute_storage_blend_write_prepare(AttributeStorage &data, AttributeStorage::BlendWriteData &write_data)
std::optional< GSpan > get_span_attribute(const AttributeStorage &storage, const AttrDomain domain, const CPPType &cpp_type, const StringRef name, const int64_t domain_size)
const AttributeAccessorFunctions & pointcloud_attribute_accessor_functions()
GVArray get_varray_attribute(const AttributeStorage &storage, AttrDomain domain, const CPPType &cpp_type, StringRef name, int64_t domain_size, const void *default_value)
PointCloud * pointcloud_new_no_attributes(int totpoint)
std::optional< T > max(const VArray< T > &values)
VecBase< float, 3 > float3
PointCloud * BKE_pointcloud_add(Main *bmain, const char *name)
static void pointcloud_init_data(ID *id)
PointCloud * BKE_pointcloud_copy_for_eval(const PointCloud *pointcloud_src)
void BKE_pointcloud_nomain_to_pointcloud(PointCloud *pointcloud_src, PointCloud *pointcloud_dst)
static void pointcloud_free_data(ID *id)
static void pointcloud_foreach_id(ID *id, LibraryForeachIDData *data)
PointCloud * BKE_pointcloud_new_nomain(const int totpoint)
void BKE_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
void BKE_pointcloud_batch_cache_free(PointCloud *pointcloud)
static void pointcloud_foreach_working_space_color(ID *id, const IDTypeForeachColorFunctionCallback &fn)
static PointCloud * take_pointcloud_ownership_from_geometry_set(blender::bke::GeometrySet &geometry_set)
static void pointcloud_blend_write(BlendWriter *writer, ID *id, const void *id_address)
void BKE_pointcloud_data_update(Depsgraph *depsgraph, Scene *scene, Object *object)
static void pointcloud_blend_read_data(BlendDataReader *reader, ID *id)
void pointcloud_copy_parameters(const PointCloud &src, PointCloud &dst)
static void pointcloud_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
void(* BKE_pointcloud_batch_cache_free_cb)(PointCloud *pointcloud)
static void pointcloud_evaluate_modifiers(Depsgraph *depsgraph, Scene *scene, Object *object, blender::bke::GeometrySet &geometry_set)
void(* BKE_pointcloud_batch_cache_dirty_tag_cb)(PointCloud *pointcloud, int mode)
bool BKE_pointcloud_attribute_required(const PointCloud *, const blender::StringRef name)
struct Attribute * dna_attributes
void pad(const PaddingT &padding)
struct ModifierData * next
void(* modify_geometry_set)(ModifierData *md, const ModifierEvalContext *ctx, blender::bke::GeometrySet *geometry_set)
PointCloudRuntimeHandle * runtime
struct AttributeStorage attribute_storage
struct CustomData pdata_legacy
Vector<::Attribute, 16 > & attributes
GeometryComponent & get_component_for_write(GeometryComponent::Type component_type)
bool has(const GeometryComponent::Type component_type) const
static GeometrySet from_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void remove(const GeometryComponent::Type component_type)