diff options
Diffstat (limited to 'source/blender/blenkernel/intern/pointcloud.c')
-rw-r--r-- | source/blender/blenkernel/intern/pointcloud.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/pointcloud.c b/source/blender/blenkernel/intern/pointcloud.c index 6ec305a971c..02f318445ac 100644 --- a/source/blender/blenkernel/intern/pointcloud.c +++ b/source/blender/blenkernel/intern/pointcloud.c @@ -53,8 +53,8 @@ static void pointcloud_random(PointCloud *pointcloud); -static const char *POINTCLOUD_ATTR_POSITION = "Position"; -static const char *POINTCLOUD_ATTR_RADIUS = "Radius"; +const char *POINTCLOUD_ATTR_POSITION = "Position"; +const char *POINTCLOUD_ATTR_RADIUS = "Radius"; static void pointcloud_init_data(ID *id) { @@ -70,15 +70,7 @@ static void pointcloud_init_data(ID *id) NULL, pointcloud->totpoint, POINTCLOUD_ATTR_POSITION); - CustomData_add_layer_named(&pointcloud->pdata, - CD_PROP_FLOAT, - CD_CALLOC, - NULL, - pointcloud->totpoint, - POINTCLOUD_ATTR_RADIUS); BKE_pointcloud_update_customdata_pointers(pointcloud); - - pointcloud_random(pointcloud); } static void pointcloud_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag) @@ -221,6 +213,23 @@ void *BKE_pointcloud_add(Main *bmain, const char *name) return pointcloud; } +void *BKE_pointcloud_add_default(Main *bmain, const char *name) +{ + PointCloud *pointcloud = BKE_libblock_alloc(bmain, ID_PT, name, 0); + + pointcloud_init_data(&pointcloud->id); + + CustomData_add_layer_named(&pointcloud->pdata, + CD_PROP_FLOAT, + CD_CALLOC, + NULL, + pointcloud->totpoint, + POINTCLOUD_ATTR_RADIUS); + pointcloud_random(pointcloud); + + return pointcloud; +} + PointCloud *BKE_pointcloud_copy(Main *bmain, const PointCloud *pointcloud) { PointCloud *pointcloud_copy; |