55 PointCloud *pointcloud = id_cast<PointCloud *>(
id);
63 std::optional<Library *> ,
68 PointCloud *pointcloud_dst = id_cast<PointCloud *>(id_dst);
69 const PointCloud *pointcloud_src = id_cast<const PointCloud *>(id_src);
70 pointcloud_dst->
mat = MEM_dupalloc(pointcloud_src->
mat);
91 PointCloud *pointcloud = id_cast<PointCloud *>(
id);
95 MEM_SAFE_DELETE(pointcloud->
mat);
101 PointCloud *pointcloud = id_cast<PointCloud *>(
id);
102 for (
int i = 0; i < pointcloud->
totcol; i++) {
110 PointCloud *pointcloud = id_cast<PointCloud *>(
id);
117 PointCloud *pointcloud = id_cast<PointCloud *>(
id);
124 [&](
const AttrDomain ) { return pointcloud->totpoint; },
154 PointCloud *pointcloud = id_cast<PointCloud *>(
id);
167 .id_code = PointCloud::id_type,
172 .name =
"PointCloud",
173 .name_plural =
N_(
"pointclouds"),
176 .asset_type_info =
nullptr,
181 .make_local =
nullptr,
183 .foreach_cache =
nullptr,
184 .foreach_path =
nullptr,
186 .foreach_asset_weak_reference =
nullptr,
187 .owner_pointer_get =
nullptr,
191 .blend_read_after_liblink =
nullptr,
193 .blend_read_undo_preserve =
nullptr,
195 .lib_override_apply_post =
nullptr,
235 pointcloud->
type = type;
238 pointcloud->attributes_for_write().add<
float3>(
248 pointcloud_dst->
type = pointcloud_src->
type;
261std::optional<Bounds<float3>> PointCloud::bounds_min_max(
const bool use_radius)
const
270 if (
const std::optional radius_single =
radius.get_if_single()) {
271 r_bounds = *this->bounds_min_max(
false);
272 r_bounds.
pad(*radius_single);
275 const Span radius_span =
radius.get_internal_span();
281 [&](Bounds<float3> &r_bounds) { r_bounds = *
bounds::min_max(this->positions()); });
287std::optional<int> PointCloud::material_index_max()
const
296 if (max_material_index.has_value()) {
297 max_material_index = std::clamp(*max_material_index, 0,
MAXMAT);
299 return max_material_index;
331 MEM_SAFE_DELETE(dst.
mat);
341 const int old_totpoint = pointcloud.
totpoint;
343 if (size == old_totpoint) {
350 if (old_totpoint == 0) {
357 if (size > old_totpoint) {
391 for (; md; md = md->
next) {
414 if (pointcloud !=
nullptr) {
439 if (pointcloud_eval ==
nullptr) {
444 const bool eval_is_owned = pointcloud_eval != pointcloud;
446 object->runtime->geometry_set_eval =
new bke::GeometrySet(std::move(geometry_set));
449void PointCloud::tag_positions_changed()
456void PointCloud::tag_radii_changed()
493 pointcloud->
type = type;
CustomData interface, see also DNA_customdata_types.h.
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
General operations for point clouds.
#define BLT_I18NCONTEXT_ID_POINTCLOUD
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define INIT_DEFAULT_STRUCT_AFTER(struct_dst, member)
void generated_ptr(int64_t offset)
static constexpr IndexRange from_begin_end(const int64_t begin, const int64_t end)
constexpr MutableSpan()=default
void blend_read(BlendDataReader &reader)
void resize(AttrDomain domain, int64_t new_size)
void blend_write(BlendWriter &writer, const BlendWriteData &write_data)
void foreach_working_space_color(const IDTypeForeachColorFunctionCallback &fn)
void count_memory(MemoryCounter &memory) const
bool add(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
void replace(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
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 fill_attribute_range_default(MutableAttributeAccessor dst_attributes, AttrDomain domain, const AttributeFilter &attribute_filter, IndexRange range)
std::optional< GSpan > get_span_attribute(const AttributeStorage &storage, const AttrDomain domain, const CPPType &cpp_type, const StringRef name, const int64_t domain_size)
PointCloud * pointcloud_new_no_attributes(PointCloudType type, int totpoint)
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)
void attribute_storage_blend_write_prepare(AttributeStorage &data, bool use_5_0_compatibility, FunctionRef< int(AttrDomain)> get_domain_size, AttributeStorage::BlendWriteData &write_data)
constexpr StringRef ATTR_POSITION
std::optional< Bounds< T > > min_max_with_radii(const Span< T > values, const Span< RadiusT > radii)
std::optional< Bounds< T > > min_max(const std::optional< Bounds< T > > &a, const T &b)
std::optional< T > max(const VArray< T > &values)
constexpr StringRefNull radius
PointCloud * BKE_pointcloud_copy_for_eval(const PointCloud *pointcloud_src)
const char * BKE_idtype_idcode_to_name(short idcode)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static void pointcloud_foreach_working_space_color(ID *id, const IDTypeForeachColorFunctionCallback &fn)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void BKE_pointcloud_nomain_to_pointcloud(PointCloud *pointcloud_src, PointCloud *pointcloud_dst)
void BKE_pointcloud_material_remap(PointCloud *pointcloud, const unsigned int *remap, int remap_num)
static PointCloud * take_pointcloud_ownership_from_geometry_set(bke::GeometrySet &geometry_set)
void BLO_read_pointer_array_and_validate_size(BlendDataReader *reader, T **ptr_p, SizeT *array_size)
void BKE_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
void BKE_object_eval_assign_data(Object *object, ID *data, bool is_owned)
static void pointcloud_foreach_id(ID *id, LibraryForeachIDData *data)
void(*) BKE_pointcloud_batch_cache_dirty_tag_cb(PointCloud *pointcloud, int mode)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
static void pointcloud_evaluate_modifiers(Depsgraph *depsgraph, Scene *scene, Object *object, bke::GeometrySet &geometry_set)
static void pointcloud_blend_write(BlendWriter *writer, ID *id, const void *id_address)
void(*) BKE_pointcloud_batch_cache_free_cb(PointCloud *pointcloud)
void BKE_object_free_derived_caches(Object *ob)
void CustomData_reset(CustomData *data)
static void pointcloud_blend_read_data(BlendDataReader *reader, ID *id)
BMesh const char void * data
void BKE_animdata_free(ID *id, bool do_id_user)
PointCloud * BKE_pointcloud_add(Main *bmain, const char *name)
ModifierData * BKE_modifiers_get_virtual_modifierlist(const Object *ob, VirtualModifierData *data)
void pointcloud_copy_parameters(const PointCloud &src, PointCloud &dst)
void BKE_libblock_init_empty(ID *id) ATTR_NONNULL(1)
void BKE_modifiers_clear_errors(Object *ob)
static void pointcloud_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
void BKE_id_free(Main *bmain, void *idv)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
void * BKE_id_new_nomain(short type, const char *name)
static void pointcloud_free_data(ID *id)
void BKE_pointcloud_batch_cache_free(PointCloud *pointcloud)
void pointcloud_resize(PointCloud &pointcloud, int size)
PointCloud * BKE_pointcloud_new_nomain(PointCloudType type, int totpoint)
void(*) BKE_gsplat_batch_cache_free_cb(PointCloud *pointcloud)
void BKE_material_attr_indices_remap(bke::MutableAttributeAccessor attributes, const unsigned int *remap, int remap_num)
static void pointcloud_init_data(ID *id)
static const char * ATTR_POSITION
ID * BKE_id_copy_ex(Main *bmain, const ID *id, ID **new_id_p, int flag)
VecBase< float, 3 > float3
void BKE_pointcloud_data_update(Depsgraph *depsgraph, Scene *scene, Object *object)
bool BKE_modifier_is_enabled(const Scene *scene, ModifierData *md, int required_mode)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
void * BKE_id_new(Main *bmain, short type, const char *name)
void(*) BKE_gsplat_batch_cache_dirty_tag_cb(PointCloud *pointcloud, int mode)
void * BKE_libblock_alloc(Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
void CustomData_blend_read(BlendDataReader *reader, CustomData *data, int count)
bool BKE_pointcloud_attribute_required(const PointCloud *pointcloud, StringRef name)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
struct Attribute * dna_attributes
void write_pointer_array(int64_t num, const void *data)
void generated_pointer_tag(const void *data)
void write_id_struct(const void *id_address, const T *id, BlendStructWriterTypedFn< T > fn=nullptr)
void pad(const PaddingT &padding)
struct ModifierData * next
void(*) modify_geometry_set(ModifierData *md, const ModifierEvalContext *ctx, bke::GeometrySet *geometry_set)
draw::GSplatBatchCache * gsplat_batch_cache
struct CustomData pdata_legacy
bke::PointCloudRuntime * runtime
draw::PointCloudBatchCache * pointcloud_batch_cache
struct AttributeStorage attribute_storage
Vector< blender::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)
SharedCache< Bounds< float3 > > bounds_with_radius_cache
SharedCache< bke::bvh::Tree > bvh_cache
std::unique_ptr< bake::BakeMaterialsList > bake_materials
SharedCache< Bounds< float3 > > bounds_cache