diff options
author | Jacques Lucke <jacques@blender.org> | 2022-03-19 12:57:40 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-03-19 12:57:40 +0300 |
commit | 8711483632823524019a6cc95575c5a4ba5aa831 (patch) | |
tree | 76c2f8355d0fce66f4f9e35b5ec1282960e51209 /source/blender/blenkernel/intern/attribute_access.cc | |
parent | 3e16f3b3ef4b8f385b30fe4a1e00860620f610ee (diff) |
BLI: generalize converting CPPType to static type
Previously, the conversion was done manually for a fixed set of types.
Now, there is a more general utility that can be used in other contexts
(outside of geometry nodes attribute processing) as well.
Diffstat (limited to 'source/blender/blenkernel/intern/attribute_access.cc')
-rw-r--r-- | source/blender/blenkernel/intern/attribute_access.cc | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc index 50e35c3c7c2..8fbab8dde25 100644 --- a/source/blender/blenkernel/intern/attribute_access.cc +++ b/source/blender/blenkernel/intern/attribute_access.cc @@ -54,55 +54,6 @@ std::ostream &operator<<(std::ostream &stream, const AttributeIDRef &attribute_i return stream; } -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); -} - static int attribute_data_type_complexity(const CustomDataType data_type) { switch (data_type) { |