[Bf-blender-cvs] [eedcf1876a6] master: Functions: introduce multi-function namespace
Jacques Lucke
noreply at git.blender.org
Sat Jan 7 17:34:34 CET 2023
Commit: eedcf1876a6651c38d8f4daa2e65d1fb81f77c5d
Author: Jacques Lucke
Date: Sat Jan 7 17:32:28 2023 +0100
Branches: master
https://developer.blender.org/rBeedcf1876a6651c38d8f4daa2e65d1fb81f77c5d
Functions: introduce multi-function namespace
This moves all multi-function related code in the `functions` module
into a new `multi_function` namespace. This is similar to how there
is a `lazy_function` namespace.
The main benefit of this is that many types names that were prefixed
with `MF` (for "multi function") can be simplified.
There is also a common shorthand for the `multi_function` namespace: `mf`.
This is also similar to lazy-functions where the shortened namespace
is called `lf`.
===================================================================
M source/blender/blenkernel/BKE_attribute.hh
M source/blender/blenkernel/BKE_node.h
M source/blender/blenkernel/BKE_type_conversions.hh
M source/blender/blenkernel/intern/geometry_component_curves.cc
M source/blender/blenkernel/intern/geometry_component_mesh.cc
M source/blender/blenkernel/intern/type_conversions.cc
M source/blender/functions/FN_field.hh
M source/blender/functions/FN_lazy_function.hh
M source/blender/functions/FN_multi_function.hh
M source/blender/functions/FN_multi_function_builder.hh
M source/blender/functions/FN_multi_function_context.hh
M source/blender/functions/FN_multi_function_data_type.hh
M source/blender/functions/FN_multi_function_param_type.hh
M source/blender/functions/FN_multi_function_params.hh
M source/blender/functions/FN_multi_function_procedure.hh
M source/blender/functions/FN_multi_function_procedure_builder.hh
M source/blender/functions/FN_multi_function_procedure_executor.hh
M source/blender/functions/FN_multi_function_procedure_optimization.hh
M source/blender/functions/FN_multi_function_signature.hh
M source/blender/functions/intern/field.cc
M source/blender/functions/intern/multi_function.cc
M source/blender/functions/intern/multi_function_builder.cc
M source/blender/functions/intern/multi_function_params.cc
M source/blender/functions/intern/multi_function_procedure.cc
M source/blender/functions/intern/multi_function_procedure_builder.cc
M source/blender/functions/intern/multi_function_procedure_executor.cc
M source/blender/functions/intern/multi_function_procedure_optimization.cc
M source/blender/functions/tests/FN_field_test.cc
M source/blender/functions/tests/FN_multi_function_procedure_test.cc
M source/blender/functions/tests/FN_multi_function_test.cc
M source/blender/functions/tests/FN_multi_function_test_common.hh
M source/blender/geometry/intern/resample_curves.cc
M source/blender/modifiers/intern/MOD_nodes.cc
M source/blender/nodes/NOD_geometry_nodes_lazy_function.hh
M source/blender/nodes/NOD_math_functions.hh
M source/blender/nodes/NOD_multi_function.hh
M source/blender/nodes/function/nodes/node_fn_align_euler_to_vector.cc
M source/blender/nodes/function/nodes/node_fn_boolean_math.cc
M source/blender/nodes/function/nodes/node_fn_combine_color.cc
M source/blender/nodes/function/nodes/node_fn_compare.cc
M source/blender/nodes/function/nodes/node_fn_float_to_int.cc
M source/blender/nodes/function/nodes/node_fn_input_bool.cc
M source/blender/nodes/function/nodes/node_fn_input_color.cc
M source/blender/nodes/function/nodes/node_fn_input_int.cc
M source/blender/nodes/function/nodes/node_fn_input_special_characters.cc
M source/blender/nodes/function/nodes/node_fn_input_string.cc
M source/blender/nodes/function/nodes/node_fn_input_vector.cc
M source/blender/nodes/function/nodes/node_fn_random_value.cc
M source/blender/nodes/function/nodes/node_fn_replace_string.cc
M source/blender/nodes/function/nodes/node_fn_rotate_euler.cc
M source/blender/nodes/function/nodes/node_fn_separate_color.cc
M source/blender/nodes/function/nodes/node_fn_slice_string.cc
M source/blender/nodes/function/nodes/node_fn_string_length.cc
M source/blender/nodes/function/nodes/node_fn_value_to_string.cc
M source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
M source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
M source/blender/nodes/geometry/nodes/node_geo_image_texture.cc
M source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
M source/blender/nodes/geometry/nodes/node_geo_proximity.cc
M source/blender/nodes/geometry/nodes/node_geo_raycast.cc
M source/blender/nodes/geometry/nodes/node_geo_sample_index.cc
M source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc
M source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc
M source/blender/nodes/geometry/nodes/node_geo_sample_uv_surface.cc
M source/blender/nodes/geometry/nodes/node_geo_switch.cc
M source/blender/nodes/intern/geometry_nodes_lazy_function.cc
M source/blender/nodes/shader/nodes/node_shader_clamp.cc
M source/blender/nodes/shader/nodes/node_shader_color_ramp.cc
M source/blender/nodes/shader/nodes/node_shader_curves.cc
M source/blender/nodes/shader/nodes/node_shader_map_range.cc
M source/blender/nodes/shader/nodes/node_shader_math.cc
M source/blender/nodes/shader/nodes/node_shader_mix.cc
M source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc
M source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc
M source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc
M source/blender/nodes/shader/nodes/node_shader_tex_brick.cc
M source/blender/nodes/shader/nodes/node_shader_tex_checker.cc
M source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc
M source/blender/nodes/shader/nodes/node_shader_tex_magic.cc
M source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc
M source/blender/nodes/shader/nodes/node_shader_tex_noise.cc
M source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc
M source/blender/nodes/shader/nodes/node_shader_tex_wave.cc
M source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc
M source/blender/nodes/shader/nodes/node_shader_value.cc
M source/blender/nodes/shader/nodes/node_shader_vector_math.cc
M source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_attribute.hh b/source/blender/blenkernel/BKE_attribute.hh
index 1eb352bfdda..0ff120328d3 100644
--- a/source/blender/blenkernel/BKE_attribute.hh
+++ b/source/blender/blenkernel/BKE_attribute.hh
@@ -17,7 +17,9 @@
struct Mesh;
struct PointCloud;
namespace blender::fn {
+namespace multi_function {
class MultiFunction;
+}
class GField;
} // namespace blender::fn
@@ -174,7 +176,7 @@ struct AttributeValidator {
/**
* Single input, single output function that corrects attribute values if necessary.
*/
- const fn::MultiFunction *function;
+ const fn::multi_function::MultiFunction *function;
operator bool() const
{
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 675328b15c4..47e198c9a12 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -107,9 +107,6 @@ class GeoNodeExecParams;
class NodeDeclarationBuilder;
class GatherLinkSearchOpParams;
} // namespace nodes
-namespace fn {
-class MFDataType;
-} // namespace fn
namespace realtime_compositor {
class Context;
class NodeOperation;
diff --git a/source/blender/blenkernel/BKE_type_conversions.hh b/source/blender/blenkernel/BKE_type_conversions.hh
index 1cca172e188..172cd414ab3 100644
--- a/source/blender/blenkernel/BKE_type_conversions.hh
+++ b/source/blender/blenkernel/BKE_type_conversions.hh
@@ -8,19 +8,19 @@
namespace blender::bke {
struct ConversionFunctions {
- const fn::MultiFunction *multi_function;
+ const mf::MultiFunction *multi_function;
void (*convert_single_to_initialized)(const void *src, void *dst);
void (*convert_single_to_uninitialized)(const void *src, void *dst);
};
class DataTypeConversions {
private:
- Map<std::pair<fn::MFDataType, fn::MFDataType>, ConversionFunctions> conversions_;
+ Map<std::pair<mf::DataType, mf::DataType>, ConversionFunctions> conversions_;
public:
- void add(fn::MFDataType from_type,
- fn::MFDataType to_type,
- const fn::MultiFunction &fn,
+ void add(mf::DataType from_type,
+ mf::DataType to_type,
+ const mf::MultiFunction &fn,
void (*convert_single_to_initialized)(const void *src, void *dst),
void (*convert_single_to_uninitialized)(const void *src, void *dst))
{
@@ -28,19 +28,18 @@ class DataTypeConversions {
{&fn, convert_single_to_initialized, convert_single_to_uninitialized});
}
- const ConversionFunctions *get_conversion_functions(fn::MFDataType from, fn::MFDataType to) const
+ const ConversionFunctions *get_conversion_functions(mf::DataType from, mf::DataType to) const
{
return conversions_.lookup_ptr({from, to});
}
const ConversionFunctions *get_conversion_functions(const CPPType &from, const CPPType &to) const
{
- return this->get_conversion_functions(fn::MFDataType::ForSingle(from),
- fn::MFDataType::ForSingle(to));
+ return this->get_conversion_functions(mf::DataType::ForSingle(from),
+ mf::DataType::ForSingle(to));
}
- const fn::MultiFunction *get_conversion_multi_function(fn::MFDataType from,
- fn::MFDataType to) const
+ const mf::MultiFunction *get_conversion_multi_function(mf::DataType from, mf::DataType to) const
{
const ConversionFunctions *functions = this->get_conversion_functions(from, to);
return functions ? functions->multi_function : nullptr;
@@ -49,7 +48,7 @@ class DataTypeConversions {
bool is_convertible(const CPPType &from_type, const CPPType &to_type) const
{
return conversions_.contains(
- {fn::MFDataType::ForSingle(from_type), fn::MFDataType::ForSingle(to_type)});
+ {mf::DataType::ForSingle(from_type), mf::DataType::ForSingle(to_type)});
}
void convert_to_uninitialized(const CPPType &from_type,
diff --git a/source/blender/blenkernel/intern/geometry_component_curves.cc b/source/blender/blenkernel/intern/geometry_component_curves.cc
index d1d0af2b725..075a6838704 100644
--- a/source/blender/blenkernel/intern/geometry_component_curves.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curves.cc
@@ -440,12 +440,12 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
make_array_write_attribute<float3>,
tag_component_positions_changed);
- static auto handle_type_clamp = fn::build_mf::SI1_SO<int8_t, int8_t>(
+ static auto handle_type_clamp = mf::build::SI1_SO<int8_t, int8_t>(
"Handle Type Validate",
[](int8_t value) {
return std::clamp<int8_t>(value, BEZIER_HANDLE_FREE, BEZIER_HANDLE_ALIGN);
},
- fn::build_mf::exec_presets::AllSpanOrSingle());
+ mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider handle_type_right("handle_type_right",
ATTR_DOMAIN_POINT,
CD_PROP_INT8,
@@ -484,10 +484,10 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
make_array_write_attribute<float>,
tag_component_positions_changed);
- static const auto nurbs_order_clamp = fn::build_mf::SI1_SO<int8_t, int8_t>(
+ static const auto nurbs_order_clamp = mf::build::SI1_SO<int8_t, int8_t>(
"NURBS Order Validate",
[](int8_t value) { return std::max<int8_t>(value, 0); },
- fn::build_mf::exec_presets::AllSpanOrSingle());
+ mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider nurbs_order("nurbs_order",
ATTR_DOMAIN_CURVE,
CD_PROP_INT8,
@@ -501,12 +501,12 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
tag_component_topology_changed,
AttributeValidator{&nurbs_order_clamp});
- static const auto normal_mode_clamp = fn::build_mf::SI1_SO<int8_t, int8_t>(
+ static const auto normal_mode_clamp = mf::build::SI1_SO<int8_t, int8_t>(
"Normal Mode Validate",
[](int8_t value) {
return std::clamp<int8_t>(value, NORMAL_MODE_MINIMUM_TWIST, NORMAL_MODE_Z_UP);
},
- fn::build_mf::exec_presets::AllSpanOrSingle());
+ mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider normal_mode("normal_mode",
ATTR_DOMAIN_CURVE,
CD_PROP_INT8,
@@ -520,12 +520,12 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
tag_component_normals_changed,
AttributeValidator{&normal_mode_clamp});
- static const auto knots_mode_clamp = fn::build_mf::SI1_SO<int8_t, int8_t>(
+ static const auto knots_mode_clamp = mf::build::SI1_SO<int8_t, int8_t>(
"Knots Mode Validate",
[](int8_t value) {
return std::clamp<int8_t>(value, NURBS_KNOT_MODE_NORMAL, NURBS_KNOT_MODE_ENDPOINT_BEZIER);
},
- fn::build_mf::exec_presets::AllSpanOrSingle());
+ mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider nurbs_knots_mode("knots_mode",
ATTR_DOMAIN_CURVE,
CD_PROP_INT8,
@@ -539,12 +539,12 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
tag_component_topology_changed,
AttributeValidator{&knots_mode_clamp});
- static const auto curve_type_clamp = fn::build_mf::SI1_SO<int8_t, int8_t>(
+ static const auto curve_type_clamp = mf::build::SI1_SO<int8_t, int8_t>(
"Curve Type Validate",
[](int8_t value) {
return std::clamp<int8_t>(value, CURVE_TYPE_CATMULL_ROM, CURVE_TYPES_NUM);
},
- fn::build_mf::exec_presets::AllSpanOrSingle());
+ mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider curve_type("curve_type",
ATTR_DOMAIN_CURVE,
CD_PROP_INT8,
@@ -558,10 +558,10 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
tag_component_curve_types_changed,
AttributeValidator{&curve_type_clamp});
- static const auto resolution_clamp = fn::build_mf::SI1_SO<int, int>(
+ static const auto resolution_clamp = mf::build::SI1_SO<int, int>(
"Resolution Validate",
[](int value) { return std::max<int>(value, 1); },
- fn::build_mf::exec_presets::AllSpanOrSingle());
+ mf::build::exec_presets::AllSpanOrSingle());
static BuiltinCustomDataLayerProvider resolution("resolution",
ATTR_DOMAIN_CURVE,
CD_PROP_INT32,
diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc
index b18bdc62d82..f587f2ced47 100644
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@ -1264,13 +1264,13 @@ static ComponentAttributeProviders create_attribute_providers_for_mesh()
make_array_write_attribute<int>,
nullptr);
- static const auto material_index_clamp = fn::build_mf::SI1_SO<int, int>(
+ static const auto material_index_clamp = mf::bui
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list