Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-03-18 12:57:45 +0300
committerJacques Lucke <jacques@blender.org>2022-03-18 12:57:45 +0300
commit2252bc6a5527cd7360d1ccfe7a2d1bc640a8dfa6 (patch)
treebb6f8921b9977dc2c387b750a29aa6ded06ec5f9 /source/blender/blenkernel
parent7509a741166c97f5f87ed9e580eef6f99eb1e62a (diff)
BLI: move CPPType to blenlib
For more detail about `CPPType`, see `BLI_cpp_type.hh` and D14367. Differential Revision: https://developer.blender.org/D14367
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_attribute_access.hh4
-rw-r--r--source/blender/blenkernel/BKE_attribute_math.hh7
-rw-r--r--source/blender/blenkernel/BKE_geometry_set.hh6
-rw-r--r--source/blender/blenkernel/BKE_mesh_sample.hh1
-rw-r--r--source/blender/blenkernel/BKE_node.h4
-rw-r--r--source/blender/blenkernel/BKE_type_conversions.hh2
-rw-r--r--source/blender/blenkernel/intern/attribute_access.cc12
-rw-r--r--source/blender/blenkernel/intern/geometry_component_instances.cc4
8 files changed, 16 insertions, 24 deletions
diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh
index 500f386dcc0..e36163878a5 100644
--- a/source/blender/blenkernel/BKE_attribute_access.hh
+++ b/source/blender/blenkernel/BKE_attribute_access.hh
@@ -4,7 +4,6 @@
#include <mutex>
-#include "FN_cpp_type.hh"
#include "FN_generic_span.hh"
#include "FN_generic_virtual_array.hh"
@@ -166,7 +165,6 @@ using AttributeForeachCallback = blender::FunctionRef<bool(
namespace blender::bke {
-using fn::CPPType;
using fn::GVArray;
using fn::GVMutableArray;
@@ -390,7 +388,7 @@ class CustomDataAttributes {
template<typename T>
blender::VArray<T> get_for_read(const AttributeIDRef &attribute_id, const T &default_value) const
{
- const blender::fn::CPPType &cpp_type = blender::fn::CPPType::get<T>();
+ const blender::CPPType &cpp_type = blender::CPPType::get<T>();
const CustomDataType type = blender::bke::cpp_type_to_custom_data_type(cpp_type);
GVArray varray = this->get_for_read(attribute_id, type, &default_value);
return varray.typed<T>();
diff --git a/source/blender/blenkernel/BKE_attribute_math.hh b/source/blender/blenkernel/BKE_attribute_math.hh
index 42bff89922b..9e97979fde9 100644
--- a/source/blender/blenkernel/BKE_attribute_math.hh
+++ b/source/blender/blenkernel/BKE_attribute_math.hh
@@ -4,17 +4,14 @@
#include "BLI_array.hh"
#include "BLI_color.hh"
+#include "BLI_cpp_type.hh"
#include "BLI_math_vector.h"
#include "BLI_math_vector.hh"
#include "DNA_customdata_types.h"
-#include "FN_cpp_type.hh"
-
namespace blender::attribute_math {
-using fn::CPPType;
-
/**
* Utility function that simplifies calling a templated function based on a custom data type.
*/
@@ -50,7 +47,7 @@ inline void convert_to_static_type(const CustomDataType data_type, const Func &f
}
template<typename Func>
-inline void convert_to_static_type(const fn::CPPType &cpp_type, const Func &func)
+inline void convert_to_static_type(const CPPType &cpp_type, const Func &func)
{
if (cpp_type.is<float>()) {
func(float());
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index 0e121068cbc..372922a24d2 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -212,7 +212,7 @@ class GeometryComponent {
const AttributeDomain domain,
const T &default_value) const
{
- const blender::fn::CPPType &cpp_type = blender::fn::CPPType::get<T>();
+ const blender::CPPType &cpp_type = blender::CPPType::get<T>();
const CustomDataType type = blender::bke::cpp_type_to_custom_data_type(cpp_type);
return this->attribute_get_for_read(attribute_id, domain, type, &default_value)
.template typed<T>();
@@ -240,7 +240,7 @@ class GeometryComponent {
const AttributeDomain domain,
const T default_value)
{
- const blender::fn::CPPType &cpp_type = blender::fn::CPPType::get<T>();
+ const blender::CPPType &cpp_type = blender::CPPType::get<T>();
const CustomDataType data_type = blender::bke::cpp_type_to_custom_data_type(cpp_type);
return this->attribute_try_get_for_output(attribute_id, domain, data_type, &default_value);
}
@@ -260,7 +260,7 @@ class GeometryComponent {
blender::bke::OutputAttribute_Typed<T> attribute_try_get_for_output_only(
const blender::bke::AttributeIDRef &attribute_id, const AttributeDomain domain)
{
- const blender::fn::CPPType &cpp_type = blender::fn::CPPType::get<T>();
+ const blender::CPPType &cpp_type = blender::CPPType::get<T>();
const CustomDataType data_type = blender::bke::cpp_type_to_custom_data_type(cpp_type);
return this->attribute_try_get_for_output_only(attribute_id, domain, data_type);
}
diff --git a/source/blender/blenkernel/BKE_mesh_sample.hh b/source/blender/blenkernel/BKE_mesh_sample.hh
index 9fe5bd3c531..a51dc7eef2f 100644
--- a/source/blender/blenkernel/BKE_mesh_sample.hh
+++ b/source/blender/blenkernel/BKE_mesh_sample.hh
@@ -21,7 +21,6 @@ class OutputAttribute;
namespace blender::bke::mesh_surface_sample {
-using fn::CPPType;
using fn::GMutableSpan;
using fn::GSpan;
using fn::GVArray;
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 3e964b038c4..fa199300780 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -99,6 +99,7 @@ typedef struct bNodeSocketTemplate {
* However, achieving this requires quite a few changes currently. */
#ifdef __cplusplus
namespace blender {
+class CPPType;
namespace nodes {
class NodeMultiFunctionBuilder;
class GeoNodeExecParams;
@@ -106,12 +107,11 @@ class NodeDeclarationBuilder;
class GatherLinkSearchOpParams;
} // namespace nodes
namespace fn {
-class CPPType;
class MFDataType;
} // namespace fn
} // namespace blender
-using CPPTypeHandle = blender::fn::CPPType;
+using CPPTypeHandle = blender::CPPType;
using NodeMultiFunctionBuildFunction = void (*)(blender::nodes::NodeMultiFunctionBuilder &builder);
using NodeGeometryExecFunction = void (*)(blender::nodes::GeoNodeExecParams params);
using NodeDeclareFunction = void (*)(blender::nodes::NodeDeclarationBuilder &builder);
diff --git a/source/blender/blenkernel/BKE_type_conversions.hh b/source/blender/blenkernel/BKE_type_conversions.hh
index e66982aa04c..8d3b2730a9c 100644
--- a/source/blender/blenkernel/BKE_type_conversions.hh
+++ b/source/blender/blenkernel/BKE_type_conversions.hh
@@ -6,8 +6,6 @@
namespace blender::bke {
-using fn::CPPType;
-
struct ConversionFunctions {
const fn::MultiFunction *multi_function;
void (*convert_single_to_initialized)(const void *src, void *dst);
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index 2f07ee55d79..f79e8ee7653 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -54,7 +54,7 @@ std::ostream &operator<<(std::ostream &stream, const AttributeIDRef &attribute_i
return stream;
}
-const blender::fn::CPPType *custom_data_type_to_cpp_type(const CustomDataType type)
+const blender::CPPType *custom_data_type_to_cpp_type(const CustomDataType type)
{
switch (type) {
case CD_PROP_FLOAT:
@@ -77,7 +77,7 @@ const blender::fn::CPPType *custom_data_type_to_cpp_type(const CustomDataType ty
return nullptr;
}
-CustomDataType cpp_type_to_custom_data_type(const blender::fn::CPPType &type)
+CustomDataType cpp_type_to_custom_data_type(const blender::CPPType &type)
{
if (type.is<float>()) {
return CD_PROP_FLOAT;
@@ -1102,7 +1102,7 @@ std::optional<AttributeMetaData> GeometryComponent::attribute_get_meta_data(
}
static blender::fn::GVArray try_adapt_data_type(blender::fn::GVArray varray,
- const blender::fn::CPPType &to_type)
+ const blender::CPPType &to_type)
{
const blender::bke::DataTypeConversions &conversions =
blender::bke::get_implicit_type_conversions();
@@ -1127,7 +1127,7 @@ blender::fn::GVArray GeometryComponent::attribute_try_get_for_read(
}
}
- const blender::fn::CPPType *cpp_type = blender::bke::custom_data_type_to_cpp_type(data_type);
+ const blender::CPPType *cpp_type = blender::bke::custom_data_type_to_cpp_type(data_type);
BLI_assert(cpp_type != nullptr);
if (varray.type() != *cpp_type) {
varray = try_adapt_data_type(std::move(varray), *cpp_type);
@@ -1165,7 +1165,7 @@ blender::bke::ReadAttributeLookup GeometryComponent::attribute_try_get_for_read(
if (!attribute) {
return {};
}
- const blender::fn::CPPType *type = blender::bke::custom_data_type_to_cpp_type(data_type);
+ const blender::CPPType *type = blender::bke::custom_data_type_to_cpp_type(data_type);
BLI_assert(type != nullptr);
if (attribute.varray.type() == *type) {
return attribute;
@@ -1184,7 +1184,7 @@ blender::fn::GVArray GeometryComponent::attribute_get_for_read(const AttributeID
if (varray) {
return varray;
}
- const blender::fn::CPPType *type = blender::bke::custom_data_type_to_cpp_type(data_type);
+ const blender::CPPType *type = blender::bke::custom_data_type_to_cpp_type(data_type);
if (default_value == nullptr) {
default_value = type->default_value();
}
diff --git a/source/blender/blenkernel/intern/geometry_component_instances.cc b/source/blender/blenkernel/intern/geometry_component_instances.cc
index 0cb2b0e812b..75384b5c420 100644
--- a/source/blender/blenkernel/intern/geometry_component_instances.cc
+++ b/source/blender/blenkernel/intern/geometry_component_instances.cc
@@ -20,7 +20,7 @@
#include "attribute_access_intern.hh"
-#include "FN_cpp_type_make.hh"
+#include "BLI_cpp_type_make.hh"
using blender::float4x4;
using blender::IndexMask;
@@ -31,7 +31,7 @@ using blender::Span;
using blender::VectorSet;
using blender::fn::GSpan;
-MAKE_CPP_TYPE(InstanceReference, InstanceReference, CPPTypeFlags::None)
+BLI_CPP_TYPE_MAKE(InstanceReference, InstanceReference, CPPTypeFlags::None)
/* -------------------------------------------------------------------- */
/** \name Geometry Component Implementation