Blender  V3.3
pointcloud.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include "MEM_guardedalloc.h"
8 
9 #include "DNA_defaults.h"
10 #include "DNA_material_types.h"
11 #include "DNA_object_types.h"
12 #include "DNA_pointcloud_types.h"
13 
14 #include "BLI_bounds.hh"
15 #include "BLI_index_range.hh"
16 #include "BLI_listbase.h"
17 #include "BLI_math_vec_types.hh"
18 #include "BLI_rand.h"
19 #include "BLI_span.hh"
20 #include "BLI_string.h"
21 #include "BLI_task.hh"
22 #include "BLI_utildefines.h"
23 #include "BLI_vector.hh"
24 
25 #include "BKE_anim_data.h"
26 #include "BKE_customdata.h"
27 #include "BKE_geometry_set.hh"
28 #include "BKE_global.h"
29 #include "BKE_idtype.h"
30 #include "BKE_lib_id.h"
31 #include "BKE_lib_query.h"
32 #include "BKE_lib_remap.h"
33 #include "BKE_main.h"
34 #include "BKE_mesh_wrapper.h"
35 #include "BKE_modifier.h"
36 #include "BKE_object.h"
37 #include "BKE_pointcloud.h"
38 
39 #include "BLT_translation.h"
40 
41 #include "DEG_depsgraph_query.h"
42 
43 #include "BLO_read_write.h"
44 
45 using blender::float3;
47 using blender::Span;
48 using blender::Vector;
49 
50 /* PointCloud datablock */
51 
52 static void pointcloud_random(PointCloud *pointcloud);
53 
54 const char *POINTCLOUD_ATTR_POSITION = "position";
55 const char *POINTCLOUD_ATTR_RADIUS = "radius";
56 
57 static void pointcloud_init_data(ID *id)
58 {
59  PointCloud *pointcloud = (PointCloud *)id;
60  BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(pointcloud, id));
61 
63 
64  CustomData_reset(&pointcloud->pdata);
65  CustomData_add_layer_named(&pointcloud->pdata,
67  CD_CALLOC,
68  nullptr,
69  pointcloud->totpoint,
71 }
72 
73 static void pointcloud_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag)
74 {
75  PointCloud *pointcloud_dst = (PointCloud *)id_dst;
76  const PointCloud *pointcloud_src = (const PointCloud *)id_src;
77  pointcloud_dst->mat = static_cast<Material **>(MEM_dupallocN(pointcloud_src->mat));
78 
79  const eCDAllocType alloc_type = (flag & LIB_ID_COPY_CD_REFERENCE) ? CD_REFERENCE : CD_DUPLICATE;
80  CustomData_copy(&pointcloud_src->pdata,
81  &pointcloud_dst->pdata,
83  alloc_type,
84  pointcloud_dst->totpoint);
85 
86  pointcloud_dst->batch_cache = nullptr;
87 }
88 
89 static void pointcloud_free_data(ID *id)
90 {
91  PointCloud *pointcloud = (PointCloud *)id;
92  BKE_animdata_free(&pointcloud->id, false);
94  CustomData_free(&pointcloud->pdata, pointcloud->totpoint);
95  MEM_SAFE_FREE(pointcloud->mat);
96 }
97 
99 {
100  PointCloud *pointcloud = (PointCloud *)id;
101  for (int i = 0; i < pointcloud->totcol; i++) {
103  }
104 }
105 
106 static void pointcloud_blend_write(BlendWriter *writer, ID *id, const void *id_address)
107 {
108  PointCloud *pointcloud = (PointCloud *)id;
109 
110  Vector<CustomDataLayer, 16> point_layers;
111  CustomData_blend_write_prepare(pointcloud->pdata, point_layers);
112 
113  /* Write LibData */
114  BLO_write_id_struct(writer, PointCloud, id_address, &pointcloud->id);
115  BKE_id_blend_write(writer, &pointcloud->id);
116 
117  /* Direct data */
118  CustomData_blend_write(writer,
119  &pointcloud->pdata,
120  point_layers,
121  pointcloud->totpoint,
122  CD_MASK_ALL,
123  &pointcloud->id);
124 
125  BLO_write_pointer_array(writer, pointcloud->totcol, pointcloud->mat);
126  if (pointcloud->adt) {
127  BKE_animdata_blend_write(writer, pointcloud->adt);
128  }
129 }
130 
132 {
133  PointCloud *pointcloud = (PointCloud *)id;
134  BLO_read_data_address(reader, &pointcloud->adt);
135  BKE_animdata_blend_read_data(reader, pointcloud->adt);
136 
137  /* Geometry */
138  CustomData_blend_read(reader, &pointcloud->pdata, pointcloud->totpoint);
139 
140  /* Materials */
141  BLO_read_pointer_array(reader, (void **)&pointcloud->mat);
142 }
143 
144 static void pointcloud_blend_read_lib(BlendLibReader *reader, ID *id)
145 {
146  PointCloud *pointcloud = (PointCloud *)id;
147  for (int a = 0; a < pointcloud->totcol; a++) {
148  BLO_read_id_address(reader, pointcloud->id.lib, &pointcloud->mat[a]);
149  }
150 }
151 
152 static void pointcloud_blend_read_expand(BlendExpander *expander, ID *id)
153 {
154  PointCloud *pointcloud = (PointCloud *)id;
155  for (int a = 0; a < pointcloud->totcol; a++) {
156  BLO_expand(expander, pointcloud->mat[a]);
157  }
158 }
159 
161  /* id_code */ ID_PT,
162  /* id_filter */ FILTER_ID_PT,
163  /* main_listbase_index */ INDEX_ID_PT,
164  /* struct_size */ sizeof(PointCloud),
165  /* name */ "PointCloud",
166  /* name_plural */ "pointclouds",
167  /* translation_context */ BLT_I18NCONTEXT_ID_POINTCLOUD,
169  /* asset_type_info */ nullptr,
170 
171  /* init_data */ pointcloud_init_data,
172  /* copy_data */ pointcloud_copy_data,
173  /* free_data */ pointcloud_free_data,
174  /* make_local */ nullptr,
175  /* foreach_id */ pointcloud_foreach_id,
176  /* foreach_cache */ nullptr,
177  /* foreach_path */ nullptr,
178  /* owner_get */ nullptr,
179 
180  /* blend_write */ pointcloud_blend_write,
181  /* blend_read_data */ pointcloud_blend_read_data,
182  /* blend_read_lib */ pointcloud_blend_read_lib,
183  /* blend_read_expand */ pointcloud_blend_read_expand,
184 
185  /* blend_read_undo_preserve */ nullptr,
186 
187  /* lib_override_apply_post */ nullptr,
188 };
189 
190 static void pointcloud_random(PointCloud *pointcloud)
191 {
192  pointcloud->totpoint = 400;
193  CustomData_realloc(&pointcloud->pdata, pointcloud->totpoint);
194 
195  RNG *rng = BLI_rng_new(0);
196 
205 
206  for (const int i : positions.span.index_range()) {
207  positions.span[i] =
209  1.0f;
210  radii.span[i] = 0.05f * BLI_rng_get_float(rng);
211  }
212 
213  positions.finish();
214  radii.finish();
215 
216  BLI_rng_free(rng);
217 }
218 
219 void *BKE_pointcloud_add(Main *bmain, const char *name)
220 {
221  PointCloud *pointcloud = static_cast<PointCloud *>(BKE_id_new(bmain, ID_PT, name));
222 
223  return pointcloud;
224 }
225 
226 void *BKE_pointcloud_add_default(Main *bmain, const char *name)
227 {
228  PointCloud *pointcloud = static_cast<PointCloud *>(BKE_libblock_alloc(bmain, ID_PT, name, 0));
229 
230  pointcloud_init_data(&pointcloud->id);
231 
232  CustomData_add_layer_named(&pointcloud->pdata,
234  CD_CALLOC,
235  nullptr,
236  pointcloud->totpoint,
238  pointcloud_random(pointcloud);
239 
240  return pointcloud;
241 }
242 
244 {
245  PointCloud *pointcloud = static_cast<PointCloud *>(BKE_libblock_alloc(
247 
248  pointcloud_init_data(&pointcloud->id);
249 
250  pointcloud->totpoint = totpoint;
251 
252  CustomData_add_layer_named(&pointcloud->pdata,
254  CD_CALLOC,
255  nullptr,
256  pointcloud->totpoint,
258 
259  pointcloud->totpoint = totpoint;
260  CustomData_realloc(&pointcloud->pdata, pointcloud->totpoint);
261 
262  return pointcloud;
263 }
264 
265 static std::optional<blender::bounds::MinMaxResult<float3>> point_cloud_bounds(
266  const PointCloud &pointcloud)
267 {
271  blender::VArray<float> radii = attributes.lookup_or_default<float>(
273 
274  if (!(radii.is_single() && radii.get_internal_single() == 0.0f)) {
275  return blender::bounds::min_max_with_radii(positions, radii.get_internal_span());
276  }
278 }
279 
280 bool BKE_pointcloud_minmax(const PointCloud *pointcloud, float r_min[3], float r_max[3])
281 {
282  using namespace blender;
283 
284  const std::optional<bounds::MinMaxResult<float3>> min_max = point_cloud_bounds(*pointcloud);
285  if (!min_max) {
286  return false;
287  }
288 
289  copy_v3_v3(r_min, math::min(min_max->min, float3(r_min)));
290  copy_v3_v3(r_max, math::max(min_max->max, float3(r_max)));
291 
292  return true;
293 }
294 
296 {
297  BLI_assert(ob->type == OB_POINTCLOUD);
298 
299  if (ob->runtime.bb != nullptr && (ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) {
300  return ob->runtime.bb;
301  }
302 
303  if (ob->runtime.bb == nullptr) {
304  ob->runtime.bb = static_cast<BoundBox *>(MEM_callocN(sizeof(BoundBox), "pointcloud boundbox"));
305  }
306 
307  float3 min, max;
308  INIT_MINMAX(min, max);
309  if (ob->runtime.geometry_set_eval != nullptr) {
311  }
312  else {
313  const PointCloud *pointcloud = static_cast<PointCloud *>(ob->data);
314  BKE_pointcloud_minmax(pointcloud, min, max);
315  }
317 
318  return ob->runtime.bb;
319 }
320 
321 bool BKE_pointcloud_customdata_required(const PointCloud *UNUSED(pointcloud), const char *name)
322 {
323  return STREQ(name, POINTCLOUD_ATTR_POSITION);
324 }
325 
326 /* Dependency Graph */
327 
328 PointCloud *BKE_pointcloud_new_for_eval(const PointCloud *pointcloud_src, int totpoint)
329 {
330  PointCloud *pointcloud_dst = static_cast<PointCloud *>(BKE_id_new_nomain(ID_PT, nullptr));
331  CustomData_free(&pointcloud_dst->pdata, pointcloud_dst->totpoint);
332 
333  STRNCPY(pointcloud_dst->id.name, pointcloud_src->id.name);
334  pointcloud_dst->mat = static_cast<Material **>(MEM_dupallocN(pointcloud_src->mat));
335  pointcloud_dst->totcol = pointcloud_src->totcol;
336 
337  pointcloud_dst->totpoint = totpoint;
339  &pointcloud_src->pdata, &pointcloud_dst->pdata, CD_MASK_ALL, CD_CALLOC, totpoint);
340 
341  return pointcloud_dst;
342 }
343 
344 PointCloud *BKE_pointcloud_copy_for_eval(struct PointCloud *pointcloud_src, bool reference)
345 {
346  int flags = LIB_ID_COPY_LOCALIZE;
347 
348  if (reference) {
349  flags |= LIB_ID_COPY_CD_REFERENCE;
350  }
351 
352  PointCloud *result = (PointCloud *)BKE_id_copy_ex(nullptr, &pointcloud_src->id, nullptr, flags);
353  return result;
354 }
355 
357  struct Scene *scene,
358  Object *object,
359  GeometrySet &geometry_set)
360 {
361  /* Modifier evaluation modes. */
362  const bool use_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
363  const int required_mode = use_render ? eModifierMode_Render : eModifierMode_Realtime;
364  ModifierApplyFlag apply_flag = use_render ? MOD_APPLY_RENDER : MOD_APPLY_USECACHE;
365  const ModifierEvalContext mectx = {depsgraph, object, apply_flag};
366 
368 
369  /* Get effective list of modifiers to execute. Some effects like shape keys
370  * are added as virtual modifiers before the user created modifiers. */
371  VirtualModifierData virtualModifierData;
372  ModifierData *md = BKE_modifiers_get_virtual_modifierlist(object, &virtualModifierData);
373 
374  /* Evaluate modifiers. */
375  for (; md; md = md->next) {
377 
378  if (!BKE_modifier_is_enabled(scene, md, required_mode)) {
379  continue;
380  }
381 
382  if (mti->modifyGeometrySet) {
383  mti->modifyGeometrySet(md, &mectx, &geometry_set);
384  }
385  }
386 }
387 
389 {
390  if (!geometry_set.has<PointCloudComponent>()) {
391  return nullptr;
392  }
393  PointCloudComponent &pointcloud_component =
395  PointCloud *pointcloud = pointcloud_component.release();
396  if (pointcloud != nullptr) {
397  /* Add back, but as read-only non-owning component. */
398  pointcloud_component.replace(pointcloud, GeometryOwnershipType::ReadOnly);
399  }
400  else {
401  /* The component was empty, we can also remove it. */
402  geometry_set.remove<PointCloudComponent>();
403  }
404  return pointcloud;
405 }
406 
408 {
409  /* Free any evaluated data and restore original data. */
411 
412  /* Evaluate modifiers. */
413  PointCloud *pointcloud = static_cast<PointCloud *>(object->data);
414  GeometrySet geometry_set = GeometrySet::create_with_pointcloud(pointcloud,
416  pointcloud_evaluate_modifiers(depsgraph, scene, object, geometry_set);
417 
418  PointCloud *pointcloud_eval = take_pointcloud_ownership_from_geometry_set(geometry_set);
419 
420  /* If the geometry set did not contain a point cloud, we still create an empty one. */
421  if (pointcloud_eval == nullptr) {
422  pointcloud_eval = BKE_pointcloud_new_nomain(0);
423  }
424 
425  /* Assign evaluated object. */
426  const bool eval_is_owned = pointcloud_eval != pointcloud;
427  BKE_object_eval_assign_data(object, &pointcloud_eval->id, eval_is_owned);
428  object->runtime.geometry_set_eval = new GeometrySet(std::move(geometry_set));
429 }
430 
431 /* Draw Cache */
432 
433 void (*BKE_pointcloud_batch_cache_dirty_tag_cb)(PointCloud *pointcloud, int mode) = nullptr;
435 
437 {
438  if (pointcloud->batch_cache) {
439  BKE_pointcloud_batch_cache_dirty_tag_cb(pointcloud, mode);
440  }
441 }
442 
444 {
445  if (pointcloud->batch_cache) {
447  }
448 }
void BKE_animdata_free(struct ID *id, bool do_id_user)
Definition: anim_data.c:197
void BKE_animdata_blend_read_data(struct BlendDataReader *reader, struct AnimData *adt)
Definition: anim_data.c:1443
void BKE_animdata_blend_write(struct BlendWriter *writer, struct AnimData *adt)
Definition: anim_data.c:1421
@ ATTR_DOMAIN_POINT
Definition: BKE_attribute.h:27
CustomData interface, see also DNA_customdata_types.h.
void CustomData_free(struct CustomData *data, int totelem)
Definition: customdata.cc:2373
void CustomData_blend_read(struct BlendDataReader *reader, struct CustomData *data, int count)
Definition: customdata.cc:5215
eCDAllocType
@ CD_REFERENCE
@ CD_CALLOC
@ CD_DUPLICATE
void CustomData_copy(const struct CustomData *source, struct CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
void * CustomData_add_layer_named(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem, const char *name)
Definition: customdata.cc:2792
void CustomData_realloc(struct CustomData *data, int totelem)
Definition: customdata.cc:2307
void CustomData_reset(struct CustomData *data)
Definition: customdata.cc:2367
const char * BKE_idtype_idcode_to_name(short idcode)
Definition: idtype.c:142
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
Definition: BKE_idtype.h:39
@ LIB_ID_CREATE_LOCALIZE
Definition: BKE_lib_id.h:184
@ LIB_ID_COPY_CD_REFERENCE
Definition: BKE_lib_id.h:156
@ LIB_ID_COPY_LOCALIZE
Definition: BKE_lib_id.h:187
struct ID * BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, int flag)
void * BKE_libblock_alloc(struct Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
Definition: lib_id.c:1050
void * BKE_id_new_nomain(short type, const char *name)
Definition: lib_id.c:1173
void BKE_id_blend_write(struct BlendWriter *writer, struct ID *id)
Definition: lib_id.c:2008
void * BKE_id_new(struct Main *bmain, short type, const char *name)
Definition: lib_id.c:1159
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(_data, _id_super, _cb_flag)
@ IDWALK_CB_USER
Definition: BKE_lib_query.h:73
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
bool BKE_modifier_is_enabled(const struct Scene *scene, struct ModifierData *md, int required_mode)
struct ModifierData * BKE_modifiers_get_virtual_modifierlist(const struct Object *ob, struct VirtualModifierData *data)
void BKE_modifiers_clear_errors(struct Object *ob)
ModifierApplyFlag
Definition: BKE_modifier.h:113
@ MOD_APPLY_USECACHE
Definition: BKE_modifier.h:118
@ MOD_APPLY_RENDER
Definition: BKE_modifier.h:115
General operations, lookup, etc. for blender objects.
void BKE_boundbox_init_from_minmax(struct BoundBox *bb, const float min[3], const float max[3])
Definition: object.cc:3645
void BKE_object_free_derived_caches(struct Object *ob)
Definition: object.cc:1774
void BKE_object_eval_assign_data(struct Object *object, struct ID *data, bool is_owned)
Definition: object.cc:1745
General operations for point clouds.
#define BLI_assert(a)
Definition: BLI_assert.h:46
MINLINE void copy_v3_v3(float r[3], const float a[3])
Random number functions.
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
Definition: rand.cc:58
struct RNG * BLI_rng_new(unsigned int seed)
Definition: rand.cc:39
float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: rand.cc:93
#define STRNCPY(dst, src)
Definition: BLI_string.h:483
#define INIT_MINMAX(min, max)
#define UNUSED(x)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define STREQ(a, b)
#define BLO_read_data_address(reader, ptr_p)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_read_id_address(reader, lib, id_ptr_p)
#define BLO_expand(expander, id)
void BLO_read_pointer_array(BlendDataReader *reader, void **ptr_p)
Definition: readfile.c:5245
void BLO_write_pointer_array(BlendWriter *writer, uint num, const void *data_ptr)
Definition: writefile.c:1591
#define BLT_I18NCONTEXT_ID_POINTCLOUD
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
@ DAG_EVAL_RENDER
Definition: DEG_depsgraph.h:46
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
#define FILTER_ID_PT
Definition: DNA_ID.h:931
@ INDEX_ID_PT
Definition: DNA_ID.h:1030
@ ID_PT
Definition: DNA_ID_enums.h:82
#define CD_MASK_ALL
@ CD_PROP_FLOAT
@ CD_PROP_FLOAT3
#define DNA_struct_default_get(struct_name)
Definition: DNA_defaults.h:29
@ eModifierMode_Render
@ eModifierMode_Realtime
ModifierType
Object is a sort of wrapper for general info.
@ OB_POINTCLOUD
@ BOUNDBOX_DIRTY
struct PointCloud PointCloud
float float3[3]
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
void replace(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
GVArray lookup_or_default(const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type, const void *default_value=nullptr) const
GSpanAttributeWriter lookup_or_add_for_write_only_span(const AttributeIDRef &attribute_id, const eAttrDomain domain, const eCustomDataType data_type)
void CustomData_blend_write(BlendWriter *writer, CustomData *data, Span< CustomDataLayer > layers_to_write, int count, eCustomDataMask cddata_mask, ID *id)
Definition: customdata.cc:5108
void CustomData_blend_write_prepare(CustomData &data, Vector< CustomDataLayer, 16 > &layers_to_write)
Definition: customdata.cc:4253
Scene scene
const Depsgraph * depsgraph
SyclQueue void void size_t num_bytes void
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:28
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
static unsigned a[3]
Definition: RandGen.cpp:78
AttributeAccessor pointcloud_attributes(const PointCloud &pointcloud)
MutableAttributeAccessor pointcloud_attributes_for_write(PointCloud &pointcloud)
static std::optional< MinMaxResult< T > > min_max(Span< T > values)
Definition: BLI_bounds.hh:26
static std::optional< MinMaxResult< T > > min_max_with_radii(Span< T > values, Span< RadiusT > radii)
Definition: BLI_bounds.hh:53
T min(const T &a, const T &b)
T max(const T &a, const T &b)
vec_base< float, 3 > float3
MutableSpan< float3 > positions
MutableSpan< float > radii
bool BKE_pointcloud_minmax(const PointCloud *pointcloud, float r_min[3], float r_max[3])
Definition: pointcloud.cc:280
void BKE_pointcloud_data_update(struct Depsgraph *depsgraph, struct Scene *scene, Object *object)
Definition: pointcloud.cc:407
static void pointcloud_init_data(ID *id)
Definition: pointcloud.cc:57
static void pointcloud_evaluate_modifiers(struct Depsgraph *depsgraph, struct Scene *scene, Object *object, GeometrySet &geometry_set)
Definition: pointcloud.cc:356
static void pointcloud_free_data(ID *id)
Definition: pointcloud.cc:89
static void pointcloud_foreach_id(ID *id, LibraryForeachIDData *data)
Definition: pointcloud.cc:98
const char * POINTCLOUD_ATTR_RADIUS
Definition: pointcloud.cc:55
static void pointcloud_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag)
Definition: pointcloud.cc:73
PointCloud * BKE_pointcloud_new_for_eval(const PointCloud *pointcloud_src, int totpoint)
Definition: pointcloud.cc:328
void BKE_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
Definition: pointcloud.cc:436
void BKE_pointcloud_batch_cache_free(PointCloud *pointcloud)
Definition: pointcloud.cc:443
static PointCloud * take_pointcloud_ownership_from_geometry_set(GeometrySet &geometry_set)
Definition: pointcloud.cc:388
BoundBox * BKE_pointcloud_boundbox_get(Object *ob)
Definition: pointcloud.cc:295
PointCloud * BKE_pointcloud_copy_for_eval(struct PointCloud *pointcloud_src, bool reference)
Definition: pointcloud.cc:344
void * BKE_pointcloud_add_default(Main *bmain, const char *name)
Definition: pointcloud.cc:226
static std::optional< blender::bounds::MinMaxResult< float3 > > point_cloud_bounds(const PointCloud &pointcloud)
Definition: pointcloud.cc:265
bool BKE_pointcloud_customdata_required(const PointCloud *UNUSED(pointcloud), const char *name)
Definition: pointcloud.cc:321
IDTypeInfo IDType_ID_PT
Definition: pointcloud.cc:160
static void pointcloud_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: pointcloud.cc:106
static void pointcloud_blend_read_lib(BlendLibReader *reader, ID *id)
Definition: pointcloud.cc:144
static void pointcloud_blend_read_data(BlendDataReader *reader, ID *id)
Definition: pointcloud.cc:131
const char * POINTCLOUD_ATTR_POSITION
Definition: pointcloud.cc:54
static void pointcloud_random(PointCloud *pointcloud)
Definition: pointcloud.cc:190
PointCloud * BKE_pointcloud_new_nomain(const int totpoint)
Definition: pointcloud.cc:243
void(* BKE_pointcloud_batch_cache_free_cb)(PointCloud *pointcloud)
Definition: pointcloud.cc:434
void * BKE_pointcloud_add(Main *bmain, const char *name)
Definition: pointcloud.cc:219
void(* BKE_pointcloud_batch_cache_dirty_tag_cb)(PointCloud *pointcloud, int mode)
Definition: pointcloud.cc:433
static void pointcloud_blend_read_expand(BlendExpander *expander, ID *id)
Definition: pointcloud.cc:152
#define min(a, b)
Definition: sort.c:35
void remove(const GeometryComponentType component_type)
GeometryComponent & get_component_for_write(GeometryComponentType component_type)
bool has(const GeometryComponentType component_type) const
static GeometrySet create_with_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
bool compute_boundbox_without_instances(blender::float3 *r_min, blender::float3 *r_max) const
Definition: DNA_ID.h:368
struct Library * lib
Definition: DNA_ID.h:372
char name[66]
Definition: DNA_ID.h:378
Definition: BKE_main.h:121
struct ModifierData * next
void(* modifyGeometrySet)(struct ModifierData *md, const struct ModifierEvalContext *ctx, struct GeometrySet *geometry_set)
Definition: BKE_modifier.h:240
struct GeometrySet * geometry_set_eval
struct BoundBox * bb
Object_Runtime runtime
void * data
struct Material ** mat
struct AnimData * adt
struct CustomData pdata
Definition: rand.cc:33
float max