Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/customdata.cc
| Show All 12 Lines | |||||
| /* Since we have versioning code here (CustomData_verify_versions()). */ | /* Since we have versioning code here (CustomData_verify_versions()). */ | ||||
| #define DNA_DEPRECATED_ALLOW | #define DNA_DEPRECATED_ALLOW | ||||
| #include "DNA_ID.h" | #include "DNA_ID.h" | ||||
| #include "DNA_customdata_types.h" | #include "DNA_customdata_types.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "BLI_bitmap.h" | #include "BLI_bitmap.h" | ||||
| #include "BLI_color.hh" | |||||
| #include "BLI_endian_switch.h" | #include "BLI_endian_switch.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_math_color_blend.h" | #include "BLI_math_color_blend.h" | ||||
| #include "BLI_math_vector.hh" | |||||
| #include "BLI_mempool.h" | #include "BLI_mempool.h" | ||||
| #include "BLI_path_util.h" | #include "BLI_path_util.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_string_utils.h" | #include "BLI_string_utils.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #ifndef NDEBUG | #ifndef NDEBUG | ||||
| # include "BLI_dynstr.h" | # include "BLI_dynstr.h" | ||||
| ▲ Show 20 Lines • Show All 5,197 Lines • ▼ Show 20 Lines | if (CustomData_has_layer(data, type)) { | ||||
| (const void *)pt, | (const void *)pt, | ||||
| size, | size, | ||||
| pt_size); | pt_size); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| #endif /* NDEBUG */ | #endif /* NDEBUG */ | ||||
| namespace blender::bke { | |||||
| const blender::CPPType *custom_data_type_to_cpp_type(const CustomDataType 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_COLOR: | |||||
| return &CPPType::get<ColorGeometry4f>(); | |||||
| case CD_PROP_BOOL: | |||||
| return &CPPType::get<bool>(); | |||||
| case CD_PROP_INT8: | |||||
| return &CPPType::get<int8_t>(); | |||||
| default: | |||||
| return nullptr; | |||||
| } | |||||
| return nullptr; | |||||
| } | |||||
| CustomDataType 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<ColorGeometry4f>()) { | |||||
| return CD_PROP_COLOR; | |||||
| } | |||||
| if (type.is<bool>()) { | |||||
| return CD_PROP_BOOL; | |||||
| } | |||||
| if (type.is<int8_t>()) { | |||||
| return CD_PROP_INT8; | |||||
| } | |||||
| return static_cast<CustomDataType>(-1); | |||||
| } | |||||
| } // namespace blender::bke | |||||