Cleanup: Remove most indirect includes of BKE_customdata.hh

Some common headers were including this. Separating the includes
will ideally lead to better conceptual separation between CustomData
and the attribute API too. Mostly the change is adding the file to
places where it was included indirectly before. But some code is
shuffled around to hopefully better places as well.
This commit is contained in:
Hans Goudey 2023-12-26 23:21:19 -05:00
parent dcbc5a3641
commit 06eda2a484
76 changed files with 174 additions and 109 deletions

View File

@ -30,6 +30,7 @@
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_attribute_math.hh" #include "BKE_attribute_math.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN

View File

@ -11,7 +11,7 @@
#include "BLI_sys_types.h" #include "BLI_sys_types.h"
#include "BKE_customdata.hh" #include "DNA_customdata_types.h"
namespace blender::bke { namespace blender::bke {
enum class AttrDomain : int8_t; enum class AttrDomain : int8_t;

View File

@ -76,6 +76,9 @@ class AttributeIDRef {
friend std::ostream &operator<<(std::ostream &stream, const AttributeIDRef &attribute_id); friend std::ostream &operator<<(std::ostream &stream, const AttributeIDRef &attribute_id);
}; };
const CPPType *custom_data_type_to_cpp_type(eCustomDataType type);
eCustomDataType cpp_type_to_custom_data_type(const CPPType &type);
/** /**
* Contains information about an attribute in a geometry component. * Contains information about an attribute in a geometry component.
* More information can be added in the future. E.g. whether the attribute is builtin and how it is * More information can be added in the future. E.g. whether the attribute is builtin and how it is

View File

@ -16,7 +16,7 @@
#include "BLI_math_vector.hh" #include "BLI_math_vector.hh"
#include "BLI_offset_indices.hh" #include "BLI_offset_indices.hh"
#include "BKE_customdata.hh" #include "BKE_attribute.hh"
namespace blender::bke::attribute_math { namespace blender::bke::attribute_math {

View File

@ -24,6 +24,8 @@
#include "BKE_attribute_math.hh" #include "BKE_attribute_math.hh"
#include "BKE_curves.h" #include "BKE_curves.h"
struct BlendDataReader;
struct BlendWriter;
struct MDeformVert; struct MDeformVert;
namespace blender::bke { namespace blender::bke {
class AnonymousAttributePropagationInfo; class AnonymousAttributePropagationInfo;

View File

@ -31,8 +31,6 @@ struct CustomDataTransferLayerMap;
struct ID; struct ID;
struct MeshPairRemap; struct MeshPairRemap;
using eCustomDataMask = uint64_t;
/* These names are used as prefixes for UV layer names to find the associated boolean /* These names are used as prefixes for UV layer names to find the associated boolean
* layers. They should never be longer than 2 chars, as #MAX_CUSTOMDATA_LAYER_NAME * layers. They should never be longer than 2 chars, as #MAX_CUSTOMDATA_LAYER_NAME
* has 4 extra bytes above what can be used for the base layer name, and these * has 4 extra bytes above what can be used for the base layer name, and these
@ -801,7 +799,5 @@ void CustomData_debug_info_from_layers(const CustomData *data, const char *inden
#endif /* !NDEBUG */ #endif /* !NDEBUG */
namespace blender::bke { namespace blender::bke {
const CPPType *custom_data_type_to_cpp_type(eCustomDataType type);
eCustomDataType cpp_type_to_custom_data_type(const CPPType &type);
std::optional<VolumeGridType> custom_data_type_to_volume_grid_type(eCustomDataType type); std::optional<VolumeGridType> custom_data_type_to_volume_grid_type(eCustomDataType type);
} // namespace blender::bke } // namespace blender::bke

View File

@ -8,7 +8,6 @@
#pragma once #pragma once
#include "BKE_customdata.hh"
#include "BLI_compiler_compat.h" #include "BLI_compiler_compat.h"
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -8,8 +8,6 @@
* \ingroup bke * \ingroup bke
* \brief display list (or rather multi purpose list) stuff. * \brief display list (or rather multi purpose list) stuff.
*/ */
#include "BKE_customdata.hh"
#include "DNA_customdata_types.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -8,10 +8,11 @@
*/ */
#include "BLI_compiler_attrs.h" #include "BLI_compiler_attrs.h"
#include "BLI_math_matrix_types.hh" #include "BLI_math_matrix_types.hh"
#include "BLI_span.hh"
#include "DNA_modifier_types.h" /* Needed for all enum type definitions. */ #include "DNA_modifier_types.h" /* Needed for all enum type definitions. */
#include "BKE_customdata.hh" #include "DNA_customdata_types.h"
namespace blender::bke { namespace blender::bke {
struct GeometrySet; struct GeometrySet;

View File

@ -18,7 +18,6 @@
# include "DNA_pointcloud_types.h" # include "DNA_pointcloud_types.h"
# include "BKE_customdata.hh"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
@ -51,20 +50,6 @@ struct PointCloudRuntime {
} // namespace blender::bke } // namespace blender::bke
inline blender::Span<blender::float3> PointCloud::positions() const
{
return {static_cast<const blender::float3 *>(
CustomData_get_layer_named(&this->pdata, CD_PROP_FLOAT3, "position")),
this->totpoint};
}
inline blender::MutableSpan<blender::float3> PointCloud::positions_for_write()
{
return {static_cast<blender::float3 *>(CustomData_get_layer_named_for_write(
&this->pdata, CD_PROP_FLOAT3, "position", this->totpoint)),
this->totpoint};
}
#endif #endif
void *BKE_pointcloud_add(struct Main *bmain, const char *name); void *BKE_pointcloud_add(struct Main *bmain, const char *name);

View File

@ -8,12 +8,9 @@
#include "BKE_customdata.hh" #include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_geometry_set.hh" #include "BKE_geometry_set.hh"
#include "BKE_mesh.hh"
#include "BKE_pointcloud.h"
#include "BKE_type_conversions.hh" #include "BKE_type_conversions.hh"
#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h"
#include "DNA_pointcloud_types.h"
#include "BLI_array_utils.hh" #include "BLI_array_utils.hh"
#include "BLI_color.hh" #include "BLI_color.hh"
@ -32,6 +29,74 @@
namespace blender::bke { namespace blender::bke {
const blender::CPPType *custom_data_type_to_cpp_type(const eCustomDataType type)
{
switch (type) {
case CD_PROP_FLOAT:
return &CPPType::get<float>();
case CD_PROP_FLOAT2:
return &CPPType::get<float2>();
case CD_PROP_FLOAT3:
return &CPPType::get<float3>();
case CD_PROP_INT32:
return &CPPType::get<int>();
case CD_PROP_INT32_2D:
return &CPPType::get<int2>();
case CD_PROP_COLOR:
return &CPPType::get<ColorGeometry4f>();
case CD_PROP_BOOL:
return &CPPType::get<bool>();
case CD_PROP_INT8:
return &CPPType::get<int8_t>();
case CD_PROP_BYTE_COLOR:
return &CPPType::get<ColorGeometry4b>();
case CD_PROP_QUATERNION:
return &CPPType::get<math::Quaternion>();
case CD_PROP_STRING:
return &CPPType::get<MStringProperty>();
default:
return nullptr;
}
}
eCustomDataType cpp_type_to_custom_data_type(const blender::CPPType &type)
{
if (type.is<float>()) {
return CD_PROP_FLOAT;
}
if (type.is<float2>()) {
return CD_PROP_FLOAT2;
}
if (type.is<float3>()) {
return CD_PROP_FLOAT3;
}
if (type.is<int>()) {
return CD_PROP_INT32;
}
if (type.is<int2>()) {
return CD_PROP_INT32_2D;
}
if (type.is<ColorGeometry4f>()) {
return CD_PROP_COLOR;
}
if (type.is<bool>()) {
return CD_PROP_BOOL;
}
if (type.is<int8_t>()) {
return CD_PROP_INT8;
}
if (type.is<ColorGeometry4b>()) {
return CD_PROP_BYTE_COLOR;
}
if (type.is<math::Quaternion>()) {
return CD_PROP_QUATERNION;
}
if (type.is<MStringProperty>()) {
return CD_PROP_STRING;
}
return static_cast<eCustomDataType>(-1);
}
std::ostream &operator<<(std::ostream &stream, const AttributeIDRef &attribute_id) std::ostream &operator<<(std::ostream &stream, const AttributeIDRef &attribute_id)
{ {
if (attribute_id) { if (attribute_id) {

View File

@ -5,6 +5,7 @@
#include "BKE_bake_items.hh" #include "BKE_bake_items.hh"
#include "BKE_bake_items_serialize.hh" #include "BKE_bake_items_serialize.hh"
#include "BKE_curves.hh" #include "BKE_curves.hh"
#include "BKE_customdata.hh"
#include "BKE_instances.hh" #include "BKE_instances.hh"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"

View File

@ -27,6 +27,7 @@
#include "BKE_bvhutils.hh" #include "BKE_bvhutils.hh"
#include "BKE_cloth.hh" #include "BKE_cloth.hh"
#include "BKE_customdata.hh"
#include "BKE_effect.h" #include "BKE_effect.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"

View File

@ -11,6 +11,7 @@
#include "BKE_attribute_math.hh" #include "BKE_attribute_math.hh"
#include "BKE_curves.hh" #include "BKE_curves.hh"
#include "BKE_customdata.hh"
#include "BKE_geometry_set.hh" #include "BKE_geometry_set.hh"
#include "BKE_material.h" #include "BKE_material.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"

View File

@ -7,6 +7,7 @@
*/ */
#include "BKE_curves_utils.hh" #include "BKE_curves_utils.hh"
#include "BKE_customdata.hh"
namespace blender::bke::curves { namespace blender::bke::curves {

View File

@ -5294,36 +5294,6 @@ namespace blender::bke {
/** \name Custom Data C++ API /** \name Custom Data C++ API
* \{ */ * \{ */
const blender::CPPType *custom_data_type_to_cpp_type(const eCustomDataType type)
{
switch (type) {
case CD_PROP_FLOAT:
return &CPPType::get<float>();
case CD_PROP_FLOAT2:
return &CPPType::get<float2>();
case CD_PROP_FLOAT3:
return &CPPType::get<float3>();
case CD_PROP_INT32:
return &CPPType::get<int>();
case CD_PROP_INT32_2D:
return &CPPType::get<int2>();
case CD_PROP_COLOR:
return &CPPType::get<ColorGeometry4f>();
case CD_PROP_BOOL:
return &CPPType::get<bool>();
case CD_PROP_INT8:
return &CPPType::get<int8_t>();
case CD_PROP_BYTE_COLOR:
return &CPPType::get<ColorGeometry4b>();
case CD_PROP_QUATERNION:
return &CPPType::get<math::Quaternion>();
case CD_PROP_STRING:
return &CPPType::get<MStringProperty>();
default:
return nullptr;
}
}
std::optional<VolumeGridType> custom_data_type_to_volume_grid_type(const eCustomDataType type) std::optional<VolumeGridType> custom_data_type_to_volume_grid_type(const eCustomDataType type)
{ {
switch (type) { switch (type) {
@ -5340,44 +5310,6 @@ std::optional<VolumeGridType> custom_data_type_to_volume_grid_type(const eCustom
} }
} }
eCustomDataType cpp_type_to_custom_data_type(const blender::CPPType &type)
{
if (type.is<float>()) {
return CD_PROP_FLOAT;
}
if (type.is<float2>()) {
return CD_PROP_FLOAT2;
}
if (type.is<float3>()) {
return CD_PROP_FLOAT3;
}
if (type.is<int>()) {
return CD_PROP_INT32;
}
if (type.is<int2>()) {
return CD_PROP_INT32_2D;
}
if (type.is<ColorGeometry4f>()) {
return CD_PROP_COLOR;
}
if (type.is<bool>()) {
return CD_PROP_BOOL;
}
if (type.is<int8_t>()) {
return CD_PROP_INT8;
}
if (type.is<ColorGeometry4b>()) {
return CD_PROP_BYTE_COLOR;
}
if (type.is<math::Quaternion>()) {
return CD_PROP_QUATERNION;
}
if (type.is<MStringProperty>()) {
return CD_PROP_STRING;
}
return static_cast<eCustomDataType>(-1);
}
/** \} */ /** \} */
} // namespace blender::bke } // namespace blender::bke

View File

@ -7,6 +7,7 @@
#include "BLI_string.h" #include "BLI_string.h"
#include "BKE_curves.hh" #include "BKE_curves.hh"
#include "BKE_customdata.hh"
#include "BKE_grease_pencil.hh" #include "BKE_grease_pencil.hh"
#include "BKE_idtype.h" #include "BKE_idtype.h"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"

View File

@ -7,6 +7,7 @@
#include "BLI_task.hh" #include "BLI_task.hh"
#include "BKE_attribute_math.hh" #include "BKE_attribute_math.hh"
#include "BKE_customdata.hh"
#include "BKE_geometry_set.hh" #include "BKE_geometry_set.hh"
#include "BKE_instances.hh" #include "BKE_instances.hh"

View File

@ -12,6 +12,7 @@
#include "BLI_threads.h" #include "BLI_threads.h"
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
namespace blender::bke { namespace blender::bke {

View File

@ -9,6 +9,7 @@
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_attribute_math.hh" #include "BKE_attribute_math.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
namespace blender::bke { namespace blender::bke {

View File

@ -52,6 +52,7 @@
#include "BKE_cloth.hh" #include "BKE_cloth.hh"
#include "BKE_collection.h" #include "BKE_collection.h"
#include "BKE_colortools.hh" #include "BKE_colortools.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_displist.h" #include "BKE_displist.h"
#include "BKE_effect.h" #include "BKE_effect.h"

View File

@ -47,6 +47,7 @@
#include "BKE_boids.h" #include "BKE_boids.h"
#include "BKE_collision.h" #include "BKE_collision.h"
#include "BKE_colortools.hh" #include "BKE_colortools.hh"
#include "BKE_customdata.hh"
#include "BKE_effect.h" #include "BKE_effect.h"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"
#include "BKE_lib_query.h" #include "BKE_lib_query.h"

View File

@ -47,6 +47,7 @@
using blender::float3; using blender::float3;
using blender::IndexRange; using blender::IndexRange;
using blender::MutableSpan;
using blender::Span; using blender::Span;
using blender::Vector; using blender::Vector;
@ -197,6 +198,20 @@ static void pointcloud_random(PointCloud *pointcloud)
BLI_rng_free(rng); BLI_rng_free(rng);
} }
Span<float3> PointCloud::positions() const
{
return {static_cast<const float3 *>(
CustomData_get_layer_named(&this->pdata, CD_PROP_FLOAT3, "position")),
this->totpoint};
}
MutableSpan<float3> PointCloud::positions_for_write()
{
return {static_cast<float3 *>(CustomData_get_layer_named_for_write(
&this->pdata, CD_PROP_FLOAT3, "position", this->totpoint)),
this->totpoint};
}
void *BKE_pointcloud_add(Main *bmain, const char *name) void *BKE_pointcloud_add(Main *bmain, const char *name)
{ {
PointCloud *pointcloud = static_cast<PointCloud *>(BKE_id_new(bmain, ID_PT, name)); PointCloud *pointcloud = static_cast<PointCloud *>(BKE_id_new(bmain, ID_PT, name));

View File

@ -52,6 +52,7 @@
#include "BKE_collection.h" #include "BKE_collection.h"
#include "BKE_collision.h" #include "BKE_collision.h"
#include "BKE_curve.hh" #include "BKE_curve.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_effect.h" #include "BKE_effect.h"
#include "BKE_global.h" #include "BKE_global.h"
@ -2678,7 +2679,7 @@ static void mesh_to_softbody(Object *ob)
{ {
SoftBody *sb; SoftBody *sb;
Mesh *mesh = static_cast<Mesh *>(ob->data); Mesh *mesh = static_cast<Mesh *>(ob->data);
const vec2i *edge = static_cast<const vec2i *>( const blender::int2 *edge = static_cast<const blender::int2 *>(
CustomData_get_layer_named(&mesh->edge_data, CD_PROP_INT32_2D, ".edge_verts")); CustomData_get_layer_named(&mesh->edge_data, CD_PROP_INT32_2D, ".edge_verts"));
BodyPoint *bp; BodyPoint *bp;
BodySpring *bs; BodySpring *bs;

View File

@ -13,6 +13,7 @@
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_mesh_mapping.hh" #include "BKE_mesh_mapping.hh"
#include "BKE_subdiv.hh" #include "BKE_subdiv.hh"

View File

@ -34,6 +34,7 @@
#include "BKE_ccg.h" #include "BKE_ccg.h"
#include "BKE_cdderivedmesh.h" #include "BKE_cdderivedmesh.h"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_mesh_mapping.hh" #include "BKE_mesh_mapping.hh"
#include "BKE_modifier.hh" #include "BKE_modifier.hh"

View File

@ -55,6 +55,7 @@
#include "BKE_anim_visualization.h" #include "BKE_anim_visualization.h"
#include "BKE_armature.hh" #include "BKE_armature.hh"
#include "BKE_colortools.hh" #include "BKE_colortools.hh"
#include "BKE_customdata.hh"
#include "BKE_global.h" /* for G */ #include "BKE_global.h" /* for G */
#include "BKE_lib_id.h" #include "BKE_lib_id.h"
#include "BKE_main.hh" #include "BKE_main.hh"

View File

@ -52,6 +52,7 @@
#include "BLT_translation.h" #include "BLT_translation.h"
#include "BKE_anim_visualization.h" #include "BKE_anim_visualization.h"
#include "BKE_customdata.hh"
#include "BKE_image.h" #include "BKE_image.h"
#include "BKE_main.hh" /* for Main */ #include "BKE_main.hh" /* for Main */
#include "BKE_mesh.hh" /* for ME_ defines (patching) */ #include "BKE_mesh.hh" /* for ME_ defines (patching) */

View File

@ -51,6 +51,7 @@
#include "BKE_anim_data.h" #include "BKE_anim_data.h"
#include "BKE_animsys.h" #include "BKE_animsys.h"
#include "BKE_colortools.hh" #include "BKE_colortools.hh"
#include "BKE_customdata.hh"
#include "BKE_fcurve_driver.h" #include "BKE_fcurve_driver.h"
#include "BKE_main.hh" #include "BKE_main.hh"
#include "BKE_mask.h" #include "BKE_mask.h"

View File

@ -52,6 +52,7 @@
#include "BKE_colortools.hh" #include "BKE_colortools.hh"
#include "BKE_cryptomatte.h" #include "BKE_cryptomatte.h"
#include "BKE_curve.hh" #include "BKE_curve.hh"
#include "BKE_customdata.hh"
#include "BKE_fcurve.h" #include "BKE_fcurve.h"
#include "BKE_gpencil_legacy.h" #include "BKE_gpencil_legacy.h"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"

View File

@ -63,6 +63,7 @@
#include "BKE_colortools.hh" #include "BKE_colortools.hh"
#include "BKE_curve.hh" #include "BKE_curve.hh"
#include "BKE_curves.hh" #include "BKE_curves.hh"
#include "BKE_customdata.hh"
#include "BKE_data_transfer.h" #include "BKE_data_transfer.h"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_fcurve.h" #include "BKE_fcurve.h"

View File

@ -54,6 +54,7 @@
#include "BKE_action.h" #include "BKE_action.h"
#include "BKE_armature.hh" #include "BKE_armature.hh"
#include "BKE_constraint.h" #include "BKE_constraint.h"
#include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_fcurve.h" #include "BKE_fcurve.h"
#include "BKE_lattice.hh" #include "BKE_lattice.hh"

View File

@ -5,6 +5,7 @@
#include "BLI_string.h" #include "BLI_string.h"
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "draw_attributes.hh" #include "draw_attributes.hh"

View File

@ -28,6 +28,7 @@
#include "BKE_crazyspace.hh" #include "BKE_crazyspace.hh"
#include "BKE_curves.hh" #include "BKE_curves.hh"
#include "BKE_customdata.hh"
#include "BKE_geometry_set.hh" #include "BKE_geometry_set.hh"
#include "GPU_batch.h" #include "GPU_batch.h"

View File

@ -22,6 +22,7 @@
#include "BKE_action.h" #include "BKE_action.h"
#include "BKE_armature.hh" #include "BKE_armature.hh"
#include "BKE_attribute.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_mesh_iterators.hh" #include "BKE_mesh_iterators.hh"
@ -200,6 +201,7 @@ static void envelope_bone_weighting(Object *ob,
const int *selected, const int *selected,
float scale) float scale)
{ {
using namespace blender;
/* Create vertex group weights from envelopes */ /* Create vertex group weights from envelopes */
bool use_topology = (mesh->editflag & ME_EDIT_MIRROR_TOPO) != 0; bool use_topology = (mesh->editflag & ME_EDIT_MIRROR_TOPO) != 0;
@ -211,8 +213,8 @@ static void envelope_bone_weighting(Object *ob,
use_mask = true; use_mask = true;
} }
const bool *select_vert = (const bool *)CustomData_get_layer_named( const bke::AttributeAccessor attributes = mesh->attributes();
&mesh->vert_data, CD_PROP_BOOL, ".select_vert"); const VArray select_vert = *attributes.lookup<bool>(".select_vert", bke::AttrDomain::Point);
/* for each vertex in the mesh */ /* for each vertex in the mesh */
for (int i = 0; i < mesh->verts_num; i++) { for (int i = 0; i < mesh->verts_num; i++) {

View File

@ -25,6 +25,7 @@
#include "BLT_translation.h" #include "BLT_translation.h"
#include "BKE_attribute.hh"
#include "BKE_bvhutils.hh" #include "BKE_bvhutils.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_mesh_runtime.hh" #include "BKE_mesh_runtime.hh"
@ -641,6 +642,7 @@ void heat_bone_weighting(Object *ob,
const int *selected, const int *selected,
const char **error_str) const char **error_str)
{ {
using namespace blender;
LaplacianSystem *sys; LaplacianSystem *sys;
blender::int3 *corner_tris; blender::int3 *corner_tris;
float solution, weight; float solution, weight;
@ -651,6 +653,7 @@ void heat_bone_weighting(Object *ob,
const blender::Span<blender::float3> vert_positions = mesh->vert_positions(); const blender::Span<blender::float3> vert_positions = mesh->vert_positions();
const blender::OffsetIndices faces = mesh->faces(); const blender::OffsetIndices faces = mesh->faces();
const blender::Span<int> corner_verts = mesh->corner_verts(); const blender::Span<int> corner_verts = mesh->corner_verts();
const bke::AttributeAccessor attributes = mesh->attributes();
bool use_vert_sel = (mesh->editflag & ME_EDIT_PAINT_VERT_SEL) != 0; bool use_vert_sel = (mesh->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
bool use_face_sel = (mesh->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; bool use_face_sel = (mesh->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
@ -666,8 +669,8 @@ void heat_bone_weighting(Object *ob,
/* (added selectedVerts content for vertex mask, they used to just equal 1) */ /* (added selectedVerts content for vertex mask, they used to just equal 1) */
if (use_vert_sel) { if (use_vert_sel) {
const bool *select_vert = (const bool *)CustomData_get_layer_named( const VArray select_vert = *attributes.lookup_or_default<bool>(
&mesh->vert_data, CD_PROP_BOOL, ".select_vert"); ".select_vert", bke::AttrDomain::Point, false);
if (select_vert) { if (select_vert) {
for (const int i : faces.index_range()) { for (const int i : faces.index_range()) {
for (const int vert : corner_verts.slice(faces[i])) { for (const int vert : corner_verts.slice(faces[i])) {
@ -677,8 +680,8 @@ void heat_bone_weighting(Object *ob,
} }
} }
else if (use_face_sel) { else if (use_face_sel) {
const bool *select_poly = (const bool *)CustomData_get_layer_named( const VArray select_poly = *attributes.lookup_or_default<bool>(
&mesh->face_data, CD_PROP_BOOL, ".select_poly"); ".select_poly", bke::AttrDomain::Face, false);
if (select_poly) { if (select_poly) {
for (const int i : faces.index_range()) { for (const int i : faces.index_range()) {
if (select_poly[i]) { if (select_poly[i]) {

View File

@ -32,6 +32,7 @@
#include "BKE_bvhutils.hh" #include "BKE_bvhutils.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_curves.hh" #include "BKE_curves.hh"
#include "BKE_customdata.hh"
#include "BKE_geometry_set.hh" #include "BKE_geometry_set.hh"
#include "BKE_layer.h" #include "BKE_layer.h"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"

View File

@ -16,6 +16,7 @@
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_geometry_set.hh" #include "BKE_geometry_set.hh"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"

View File

@ -22,6 +22,7 @@
#include "BKE_compute_contexts.hh" #include "BKE_compute_contexts.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_curves.hh" #include "BKE_curves.hh"
#include "BKE_customdata.hh"
#include "BKE_editmesh.hh" #include "BKE_editmesh.hh"
#include "BKE_geometry_set.hh" #include "BKE_geometry_set.hh"
#include "BKE_layer.h" #include "BKE_layer.h"

View File

@ -14,6 +14,7 @@
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_editmesh.hh" #include "BKE_editmesh.hh"
#include "BKE_layer.h" #include "BKE_layer.h"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"

View File

@ -54,6 +54,7 @@
#include "BKE_curve.hh" #include "BKE_curve.hh"
#include "BKE_curve_to_mesh.hh" #include "BKE_curve_to_mesh.hh"
#include "BKE_curves.h" #include "BKE_curves.h"
#include "BKE_customdata.hh"
#include "BKE_displist.h" #include "BKE_displist.h"
#include "BKE_duplilist.h" #include "BKE_duplilist.h"
#include "BKE_effect.h" #include "BKE_effect.h"

View File

@ -26,6 +26,7 @@
#include "BKE_blender.h" #include "BKE_blender.h"
#include "BKE_cdderivedmesh.h" #include "BKE_cdderivedmesh.h"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_image.h" #include "BKE_image.h"
#include "BKE_material.h" #include "BKE_material.h"

View File

@ -17,6 +17,7 @@
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_data_transfer.h" #include "BKE_data_transfer.h"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_mesh_mapping.hh" #include "BKE_mesh_mapping.hh"

View File

@ -30,6 +30,7 @@
#include "BKE_bvhutils.hh" #include "BKE_bvhutils.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_layer.h" #include "BKE_layer.h"
#include "BKE_main.hh" #include "BKE_main.hh"

View File

@ -25,6 +25,7 @@
#include "BKE_bvhutils.hh" #include "BKE_bvhutils.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_layer.h" #include "BKE_layer.h"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"

View File

@ -40,6 +40,7 @@
#include "BKE_ccg.h" #include "BKE_ccg.h"
#include "BKE_colortools.hh" #include "BKE_colortools.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_image.h" #include "BKE_image.h"
#include "BKE_key.h" #include "BKE_key.h"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"

View File

@ -16,6 +16,7 @@
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_object.hh" #include "BKE_object.hh"

View File

@ -32,7 +32,6 @@
#include "render_types.h" #include "render_types.h"
#include "BKE_customdata.hh"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"
#include "BKE_material.h" #include "BKE_material.h"
#include "BKE_mesh.h" #include "BKE_mesh.h"

View File

@ -10,6 +10,7 @@
#include "BLI_listbase.h" #include "BLI_listbase.h"
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_geometry_fields.hh" #include "BKE_geometry_fields.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"

View File

@ -8,6 +8,7 @@
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_attribute_math.hh" #include "BKE_attribute_math.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_mesh_mapping.hh" #include "BKE_mesh_mapping.hh"

View File

@ -28,6 +28,7 @@
#include "BLT_translation.h" #include "BLT_translation.h"
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"
#include "BKE_main.hh" #include "BKE_main.hh"
#include "BKE_material.h" #include "BKE_material.h"

View File

@ -11,6 +11,7 @@
#include "BLI_vector_set.hh" #include "BLI_vector_set.hh"
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_material.h" #include "BKE_material.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_mesh_runtime.hh" #include "BKE_mesh_runtime.hh"

View File

@ -190,6 +190,10 @@ typedef enum eCustomDataType {
CD_NUMTYPES = 53, CD_NUMTYPES = 53,
} eCustomDataType; } eCustomDataType;
#ifdef __cplusplus
using eCustomDataMask = uint64_t;
#endif
/* Bits for eCustomDataMask */ /* Bits for eCustomDataMask */
#define CD_MASK_MDEFORMVERT (1 << CD_MDEFORMVERT) #define CD_MASK_MDEFORMVERT (1 << CD_MDEFORMVERT)
#define CD_MASK_MFACE (1 << CD_MFACE) #define CD_MASK_MFACE (1 << CD_MFACE)

View File

@ -198,13 +198,15 @@ static float rna_CurvePoint_radius_get(PointerRNA *ptr)
static void rna_CurvePoint_radius_set(PointerRNA *ptr, float value) static void rna_CurvePoint_radius_set(PointerRNA *ptr, float value)
{ {
using namespace blender;
Curves *curves = rna_curves(ptr); Curves *curves = rna_curves(ptr);
float *radii = static_cast<float *>(CustomData_get_layer_named_for_write( bke::MutableAttributeAccessor attributes = curves->geometry.wrap().attributes_for_write();
&curves->geometry.point_data, CD_PROP_FLOAT, "radius", curves->geometry.point_num)); bke::AttributeWriter radii = attributes.lookup_or_add_for_write<float>("radius",
if (radii == nullptr) { bke::AttrDomain::Point);
if (!radii) {
return; return;
} }
radii[rna_CurvePoint_index_get_const(ptr)] = value; radii.varray.set(rna_CurvePoint_index_get_const(ptr), value);
} }
static char *rna_CurvePoint_path(const PointerRNA *ptr) static char *rna_CurvePoint_path(const PointerRNA *ptr)

View File

@ -25,6 +25,7 @@
#include "BKE_animsys.h" #include "BKE_animsys.h"
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_curveprofile.h" #include "BKE_curveprofile.h"
#include "BKE_customdata.hh"
#include "BKE_data_transfer.h" #include "BKE_data_transfer.h"
#include "BKE_dynamicpaint.h" #include "BKE_dynamicpaint.h"
#include "BKE_effect.h" #include "BKE_effect.h"

View File

@ -141,6 +141,7 @@ static const EnumPropertyItem part_fluid_type_items[] = {
# include "BKE_boids.h" # include "BKE_boids.h"
# include "BKE_cloth.hh" # include "BKE_cloth.hh"
# include "BKE_context.hh" # include "BKE_context.hh"
# include "BKE_customdata.hh"
# include "BKE_deform.h" # include "BKE_deform.h"
# include "BKE_effect.h" # include "BKE_effect.h"
# include "BKE_material.h" # include "BKE_material.h"

View File

@ -29,6 +29,7 @@
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_curve.hh" #include "BKE_curve.hh"
#include "BKE_customdata.hh"
#include "BKE_displist.h" #include "BKE_displist.h"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"
#include "BKE_lib_query.h" #include "BKE_lib_query.h"

View File

@ -25,6 +25,7 @@
#include "DEG_depsgraph_query.hh" #include "DEG_depsgraph_query.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_modifier.hh" #include "BKE_modifier.hh"
#include "BKE_particle.h" #include "BKE_particle.h"

View File

@ -27,6 +27,7 @@
#include "BKE_cloth.hh" #include "BKE_cloth.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_effect.h" #include "BKE_effect.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_key.h" #include "BKE_key.h"

View File

@ -27,6 +27,7 @@
#include "DNA_screen_types.h" #include "DNA_screen_types.h"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_lattice.hh" #include "BKE_lattice.hh"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"

View File

@ -22,6 +22,7 @@
#include "BKE_cdderivedmesh.h" #include "BKE_cdderivedmesh.h"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_modifier.hh" #include "BKE_modifier.hh"
#include "BKE_multires.hh" #include "BKE_multires.hh"

View File

@ -26,6 +26,7 @@
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"
#include "BKE_lib_query.h" #include "BKE_lib_query.h"

View File

@ -22,6 +22,7 @@
#include "DNA_screen_types.h" #include "DNA_screen_types.h"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_modifier.hh" #include "BKE_modifier.hh"

View File

@ -26,6 +26,7 @@
#include "DNA_screen_types.h" #include "DNA_screen_types.h"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_effect.h" #include "BKE_effect.h"
#include "BKE_lattice.hh" #include "BKE_lattice.hh"
#include "BKE_lib_query.h" #include "BKE_lib_query.h"

View File

@ -28,6 +28,7 @@
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"
#include "BKE_lib_query.h" #include "BKE_lib_query.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"

View File

@ -20,6 +20,7 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_particle.h" #include "BKE_particle.h"

View File

@ -17,6 +17,7 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_particle.h" #include "BKE_particle.h"

View File

@ -26,6 +26,7 @@
#include "BKE_attribute.hh" #include "BKE_attribute.hh"
#include "BKE_camera.h" #include "BKE_camera.h"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_lib_query.h" #include "BKE_lib_query.h"
#include "BKE_material.h" #include "BKE_material.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"

View File

@ -24,6 +24,7 @@
#include "BKE_action.h" /* BKE_pose_channel_find_name */ #include "BKE_action.h" /* BKE_pose_channel_find_name */
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_lib_query.h" #include "BKE_lib_query.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"

View File

@ -26,6 +26,7 @@
#include "BKE_colortools.hh" /* CurveMapping. */ #include "BKE_colortools.hh" /* CurveMapping. */
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_lib_query.h" #include "BKE_lib_query.h"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"

View File

@ -30,6 +30,7 @@
#include "DNA_screen_types.h" #include "DNA_screen_types.h"
#include "BKE_context.hh" #include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.h" #include "BKE_deform.h"
#include "BKE_modifier.hh" #include "BKE_modifier.hh"
#include "BKE_screen.hh" #include "BKE_screen.hh"

View File

@ -9,6 +9,7 @@
#include "DNA_pointcloud_types.h" #include "DNA_pointcloud_types.h"
#include "BKE_customdata.hh"
#include "BKE_grease_pencil.hh" #include "BKE_grease_pencil.hh"
#include "BKE_instances.hh" #include "BKE_instances.hh"
#include "BKE_pointcloud.h" #include "BKE_pointcloud.h"

View File

@ -10,6 +10,7 @@
#include "DNA_mesh_types.h" #include "DNA_mesh_types.h"
#include "BKE_attribute_math.hh" #include "BKE_attribute_math.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_mesh_mapping.hh" #include "BKE_mesh_mapping.hh"
#include "BKE_mesh_runtime.hh" #include "BKE_mesh_runtime.hh"

View File

@ -9,6 +9,7 @@
#include "DNA_pointcloud_types.h" #include "DNA_pointcloud_types.h"
#include "BKE_attribute_math.hh" #include "BKE_attribute_math.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "BKE_pointcloud.h" #include "BKE_pointcloud.h"

View File

@ -7,6 +7,7 @@
#include "DNA_pointcloud_types.h" #include "DNA_pointcloud_types.h"
#include "BKE_attribute_math.hh" #include "BKE_attribute_math.hh"
#include "BKE_customdata.hh"
#include "BKE_mesh.hh" #include "BKE_mesh.hh"
#include "node_geometry_util.hh" #include "node_geometry_util.hh"

View File

@ -21,6 +21,7 @@
#include "BKE_DerivedMesh.hh" #include "BKE_DerivedMesh.hh"
#include "BKE_ccg.h" #include "BKE_ccg.h"
#include "BKE_customdata.hh"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_image.h" #include "BKE_image.h"
#include "BKE_lib_id.h" #include "BKE_lib_id.h"