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`.
This commit is contained in:
@@ -133,7 +133,7 @@ static void align_rotations_fixed_pivot(IndexMask mask,
|
||||
});
|
||||
}
|
||||
|
||||
class MF_AlignEulerToVector : public fn::MultiFunction {
|
||||
class MF_AlignEulerToVector : public mf::MultiFunction {
|
||||
private:
|
||||
int main_axis_mode_;
|
||||
int pivot_axis_mode_;
|
||||
@@ -142,14 +142,14 @@ class MF_AlignEulerToVector : public fn::MultiFunction {
|
||||
MF_AlignEulerToVector(int main_axis_mode, int pivot_axis_mode)
|
||||
: main_axis_mode_(main_axis_mode), pivot_axis_mode_(pivot_axis_mode)
|
||||
{
|
||||
static fn::MFSignature signature = create_signature();
|
||||
static mf::Signature signature = create_signature();
|
||||
this->set_signature(&signature);
|
||||
}
|
||||
|
||||
static fn::MFSignature create_signature()
|
||||
static mf::Signature create_signature()
|
||||
{
|
||||
fn::MFSignature signature;
|
||||
fn::MFSignatureBuilder builder{"Align Euler to Vector", signature};
|
||||
mf::Signature signature;
|
||||
mf::SignatureBuilder builder{"Align Euler to Vector", signature};
|
||||
builder.single_input<float3>("Rotation");
|
||||
builder.single_input<float>("Factor");
|
||||
builder.single_input<float3>("Vector");
|
||||
@@ -158,7 +158,7 @@ class MF_AlignEulerToVector : public fn::MultiFunction {
|
||||
return signature;
|
||||
}
|
||||
|
||||
void call(IndexMask mask, fn::MFParams params, fn::MFContext /*context*/) const override
|
||||
void call(IndexMask mask, mf::MFParams params, mf::Context /*context*/) const override
|
||||
{
|
||||
const VArray<float3> &input_rotations = params.readonly_single_input<float3>(0, "Rotation");
|
||||
const VArray<float> &factors = params.readonly_single_input<float>(1, "Factor");
|
||||
|
||||
@@ -65,26 +65,26 @@ static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
|
||||
}
|
||||
}
|
||||
|
||||
static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
static const mf::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
{
|
||||
static auto exec_preset = fn::build_mf::exec_presets::AllSpanOrSingle();
|
||||
static auto and_fn = fn::build_mf::SI2_SO<bool, bool, bool>(
|
||||
static auto exec_preset = mf::build::exec_presets::AllSpanOrSingle();
|
||||
static auto and_fn = mf::build::SI2_SO<bool, bool, bool>(
|
||||
"And", [](bool a, bool b) { return a && b; }, exec_preset);
|
||||
static auto or_fn = fn::build_mf::SI2_SO<bool, bool, bool>(
|
||||
static auto or_fn = mf::build::SI2_SO<bool, bool, bool>(
|
||||
"Or", [](bool a, bool b) { return a || b; }, exec_preset);
|
||||
static auto not_fn = fn::build_mf::SI1_SO<bool, bool>(
|
||||
static auto not_fn = mf::build::SI1_SO<bool, bool>(
|
||||
"Not", [](bool a) { return !a; }, exec_preset);
|
||||
static auto nand_fn = fn::build_mf::SI2_SO<bool, bool, bool>(
|
||||
static auto nand_fn = mf::build::SI2_SO<bool, bool, bool>(
|
||||
"Not And", [](bool a, bool b) { return !(a && b); }, exec_preset);
|
||||
static auto nor_fn = fn::build_mf::SI2_SO<bool, bool, bool>(
|
||||
static auto nor_fn = mf::build::SI2_SO<bool, bool, bool>(
|
||||
"Nor", [](bool a, bool b) { return !(a || b); }, exec_preset);
|
||||
static auto xnor_fn = fn::build_mf::SI2_SO<bool, bool, bool>(
|
||||
static auto xnor_fn = mf::build::SI2_SO<bool, bool, bool>(
|
||||
"Equal", [](bool a, bool b) { return a == b; }, exec_preset);
|
||||
static auto xor_fn = fn::build_mf::SI2_SO<bool, bool, bool>(
|
||||
static auto xor_fn = mf::build::SI2_SO<bool, bool, bool>(
|
||||
"Not Equal", [](bool a, bool b) { return a != b; }, exec_preset);
|
||||
static auto imply_fn = fn::build_mf::SI2_SO<bool, bool, bool>(
|
||||
static auto imply_fn = mf::build::SI2_SO<bool, bool, bool>(
|
||||
"Imply", [](bool a, bool b) { return !a || b; }, exec_preset);
|
||||
static auto nimply_fn = fn::build_mf::SI2_SO<bool, bool, bool>(
|
||||
static auto nimply_fn = mf::build::SI2_SO<bool, bool, bool>(
|
||||
"Subtract", [](bool a, bool b) { return a && !b; }, exec_preset);
|
||||
|
||||
switch (bnode.custom1) {
|
||||
@@ -114,7 +114,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
|
||||
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
const fn::MultiFunction *fn = get_multi_function(builder.node());
|
||||
const mf::MultiFunction *fn = get_multi_function(builder.node());
|
||||
builder.set_matching_fn(fn);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,20 +49,20 @@ static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
static const mf::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
{
|
||||
const NodeCombSepColor &storage = node_storage(bnode);
|
||||
|
||||
static auto rgba_fn = fn::build_mf::SI4_SO<float, float, float, float, ColorGeometry4f>(
|
||||
static auto rgba_fn = mf::build::SI4_SO<float, float, float, float, ColorGeometry4f>(
|
||||
"RGB", [](float r, float g, float b, float a) { return ColorGeometry4f(r, g, b, a); });
|
||||
static auto hsva_fn = fn::build_mf::SI4_SO<float, float, float, float, ColorGeometry4f>(
|
||||
static auto hsva_fn = mf::build::SI4_SO<float, float, float, float, ColorGeometry4f>(
|
||||
"HSV", [](float h, float s, float v, float a) {
|
||||
ColorGeometry4f r_color;
|
||||
hsv_to_rgb(h, s, v, &r_color.r, &r_color.g, &r_color.b);
|
||||
r_color.a = a;
|
||||
return r_color;
|
||||
});
|
||||
static auto hsla_fn = fn::build_mf::SI4_SO<float, float, float, float, ColorGeometry4f>(
|
||||
static auto hsla_fn = mf::build::SI4_SO<float, float, float, float, ColorGeometry4f>(
|
||||
"HSL", [](float h, float s, float l, float a) {
|
||||
ColorGeometry4f color;
|
||||
hsl_to_rgb(h, s, l, &color.r, &color.g, &color.b);
|
||||
@@ -85,7 +85,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
|
||||
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
const fn::MultiFunction *fn = get_multi_function(builder.node());
|
||||
const mf::MultiFunction *fn = get_multi_function(builder.node());
|
||||
builder.set_matching_fn(fn);
|
||||
}
|
||||
|
||||
|
||||
@@ -164,45 +164,45 @@ static float component_average(float3 a)
|
||||
return (a.x + a.y + a.z) / 3.0f;
|
||||
}
|
||||
|
||||
static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
static const mf::MultiFunction *get_multi_function(const bNode &node)
|
||||
{
|
||||
const NodeFunctionCompare *data = (NodeFunctionCompare *)node.storage;
|
||||
|
||||
static auto exec_preset_all = fn::build_mf::exec_presets::AllSpanOrSingle();
|
||||
static auto exec_preset_first_two = fn::build_mf::exec_presets::SomeSpanOrSingle<0, 1>();
|
||||
static auto exec_preset_all = mf::build::exec_presets::AllSpanOrSingle();
|
||||
static auto exec_preset_first_two = mf::build::exec_presets::SomeSpanOrSingle<0, 1>();
|
||||
|
||||
switch (data->data_type) {
|
||||
case SOCK_FLOAT:
|
||||
switch (data->operation) {
|
||||
case NODE_COMPARE_LESS_THAN: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float, float, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float, float, bool>(
|
||||
"Less Than", [](float a, float b) { return a < b; }, exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_LESS_EQUAL: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float, float, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float, float, bool>(
|
||||
"Less Equal", [](float a, float b) { return a <= b; }, exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_GREATER_THAN: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float, float, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float, float, bool>(
|
||||
"Greater Than", [](float a, float b) { return a > b; }, exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_GREATER_EQUAL: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float, float, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float, float, bool>(
|
||||
"Greater Equal", [](float a, float b) { return a >= b; }, exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_EQUAL: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float, float, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float, float, float, bool>(
|
||||
"Equal",
|
||||
[](float a, float b, float epsilon) { return std::abs(a - b) <= epsilon; },
|
||||
exec_preset_first_two);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_NOT_EQUAL:
|
||||
static auto fn = fn::build_mf::SI3_SO<float, float, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float, float, float, bool>(
|
||||
"Not Equal",
|
||||
[](float a, float b, float epsilon) { return std::abs(a - b) > epsilon; },
|
||||
exec_preset_first_two);
|
||||
@@ -212,32 +212,32 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
case SOCK_INT:
|
||||
switch (data->operation) {
|
||||
case NODE_COMPARE_LESS_THAN: {
|
||||
static auto fn = fn::build_mf::SI2_SO<int, int, bool>(
|
||||
static auto fn = mf::build::SI2_SO<int, int, bool>(
|
||||
"Less Than", [](int a, int b) { return a < b; }, exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_LESS_EQUAL: {
|
||||
static auto fn = fn::build_mf::SI2_SO<int, int, bool>(
|
||||
static auto fn = mf::build::SI2_SO<int, int, bool>(
|
||||
"Less Equal", [](int a, int b) { return a <= b; }, exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_GREATER_THAN: {
|
||||
static auto fn = fn::build_mf::SI2_SO<int, int, bool>(
|
||||
static auto fn = mf::build::SI2_SO<int, int, bool>(
|
||||
"Greater Than", [](int a, int b) { return a > b; }, exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_GREATER_EQUAL: {
|
||||
static auto fn = fn::build_mf::SI2_SO<int, int, bool>(
|
||||
static auto fn = mf::build::SI2_SO<int, int, bool>(
|
||||
"Greater Equal", [](int a, int b) { return a >= b; }, exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_EQUAL: {
|
||||
static auto fn = fn::build_mf::SI2_SO<int, int, bool>(
|
||||
static auto fn = mf::build::SI2_SO<int, int, bool>(
|
||||
"Equal", [](int a, int b) { return a == b; }, exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_NOT_EQUAL: {
|
||||
static auto fn = fn::build_mf::SI2_SO<int, int, bool>(
|
||||
static auto fn = mf::build::SI2_SO<int, int, bool>(
|
||||
"Not Equal", [](int a, int b) { return a != b; }, exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
@@ -248,35 +248,35 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
case NODE_COMPARE_LESS_THAN:
|
||||
switch (data->mode) {
|
||||
case NODE_COMPARE_MODE_AVERAGE: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Less Than - Average",
|
||||
[](float3 a, float3 b) { return component_average(a) < component_average(b); },
|
||||
exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DOT_PRODUCT: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Less Than - Dot Product",
|
||||
[](float3 a, float3 b, float comp) { return math::dot(a, b) < comp; },
|
||||
exec_preset_first_two);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DIRECTION: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Less Than - Direction",
|
||||
[](float3 a, float3 b, float angle) { return angle_v3v3(a, b) < angle; },
|
||||
exec_preset_first_two);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_ELEMENT: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Less Than - Element-wise",
|
||||
[](float3 a, float3 b) { return a.x < b.x && a.y < b.y && a.z < b.z; },
|
||||
exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_LENGTH: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Less Than - Length",
|
||||
[](float3 a, float3 b) { return math::length(a) < math::length(b); },
|
||||
exec_preset_all);
|
||||
@@ -287,35 +287,35 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
case NODE_COMPARE_LESS_EQUAL:
|
||||
switch (data->mode) {
|
||||
case NODE_COMPARE_MODE_AVERAGE: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Less Equal - Average",
|
||||
[](float3 a, float3 b) { return component_average(a) <= component_average(b); },
|
||||
exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DOT_PRODUCT: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Less Equal - Dot Product",
|
||||
[](float3 a, float3 b, float comp) { return math::dot(a, b) <= comp; },
|
||||
exec_preset_first_two);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DIRECTION: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Less Equal - Direction",
|
||||
[](float3 a, float3 b, float angle) { return angle_v3v3(a, b) <= angle; },
|
||||
exec_preset_first_two);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_ELEMENT: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Less Equal - Element-wise",
|
||||
[](float3 a, float3 b) { return a.x <= b.x && a.y <= b.y && a.z <= b.z; },
|
||||
exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_LENGTH: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Less Equal - Length",
|
||||
[](float3 a, float3 b) { return math::length(a) <= math::length(b); },
|
||||
exec_preset_all);
|
||||
@@ -326,35 +326,35 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
case NODE_COMPARE_GREATER_THAN:
|
||||
switch (data->mode) {
|
||||
case NODE_COMPARE_MODE_AVERAGE: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Greater Than - Average",
|
||||
[](float3 a, float3 b) { return component_average(a) > component_average(b); },
|
||||
exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DOT_PRODUCT: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Greater Than - Dot Product",
|
||||
[](float3 a, float3 b, float comp) { return math::dot(a, b) > comp; },
|
||||
exec_preset_first_two);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DIRECTION: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Greater Than - Direction",
|
||||
[](float3 a, float3 b, float angle) { return angle_v3v3(a, b) > angle; },
|
||||
exec_preset_first_two);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_ELEMENT: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Greater Than - Element-wise",
|
||||
[](float3 a, float3 b) { return a.x > b.x && a.y > b.y && a.z > b.z; },
|
||||
exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_LENGTH: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Greater Than - Length",
|
||||
[](float3 a, float3 b) { return math::length(a) > math::length(b); },
|
||||
exec_preset_all);
|
||||
@@ -365,35 +365,35 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
case NODE_COMPARE_GREATER_EQUAL:
|
||||
switch (data->mode) {
|
||||
case NODE_COMPARE_MODE_AVERAGE: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Greater Equal - Average",
|
||||
[](float3 a, float3 b) { return component_average(a) >= component_average(b); },
|
||||
exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DOT_PRODUCT: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Greater Equal - Dot Product",
|
||||
[](float3 a, float3 b, float comp) { return math::dot(a, b) >= comp; },
|
||||
exec_preset_first_two);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DIRECTION: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Greater Equal - Direction",
|
||||
[](float3 a, float3 b, float angle) { return angle_v3v3(a, b) >= angle; },
|
||||
exec_preset_first_two);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_ELEMENT: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Greater Equal - Element-wise",
|
||||
[](float3 a, float3 b) { return a.x >= b.x && a.y >= b.y && a.z >= b.z; },
|
||||
exec_preset_all);
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_LENGTH: {
|
||||
static auto fn = fn::build_mf::SI2_SO<float3, float3, bool>(
|
||||
static auto fn = mf::build::SI2_SO<float3, float3, bool>(
|
||||
"Greater Equal - Length",
|
||||
[](float3 a, float3 b) { return math::length(a) >= math::length(b); },
|
||||
exec_preset_all);
|
||||
@@ -404,7 +404,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
case NODE_COMPARE_EQUAL:
|
||||
switch (data->mode) {
|
||||
case NODE_COMPARE_MODE_AVERAGE: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Equal - Average",
|
||||
[](float3 a, float3 b, float epsilon) {
|
||||
return abs(component_average(a) - component_average(b)) <= epsilon;
|
||||
@@ -413,7 +413,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DOT_PRODUCT: {
|
||||
static auto fn = fn::build_mf::SI4_SO<float3, float3, float, float, bool>(
|
||||
static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
|
||||
"Equal - Dot Product",
|
||||
[](float3 a, float3 b, float comp, float epsilon) {
|
||||
return abs(math::dot(a, b) - comp) <= epsilon;
|
||||
@@ -422,7 +422,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DIRECTION: {
|
||||
static auto fn = fn::build_mf::SI4_SO<float3, float3, float, float, bool>(
|
||||
static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
|
||||
"Equal - Direction",
|
||||
[](float3 a, float3 b, float angle, float epsilon) {
|
||||
return abs(angle_v3v3(a, b) - angle) <= epsilon;
|
||||
@@ -431,7 +431,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_ELEMENT: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Equal - Element-wise",
|
||||
[](float3 a, float3 b, float epsilon) {
|
||||
return abs(a.x - b.x) <= epsilon && abs(a.y - b.y) <= epsilon &&
|
||||
@@ -441,7 +441,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_LENGTH: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Equal - Length",
|
||||
[](float3 a, float3 b, float epsilon) {
|
||||
return abs(math::length(a) - math::length(b)) <= epsilon;
|
||||
@@ -454,7 +454,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
case NODE_COMPARE_NOT_EQUAL:
|
||||
switch (data->mode) {
|
||||
case NODE_COMPARE_MODE_AVERAGE: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Not Equal - Average",
|
||||
[](float3 a, float3 b, float epsilon) {
|
||||
return abs(component_average(a) - component_average(b)) > epsilon;
|
||||
@@ -463,7 +463,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DOT_PRODUCT: {
|
||||
static auto fn = fn::build_mf::SI4_SO<float3, float3, float, float, bool>(
|
||||
static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
|
||||
"Not Equal - Dot Product",
|
||||
[](float3 a, float3 b, float comp, float epsilon) {
|
||||
return abs(math::dot(a, b) - comp) >= epsilon;
|
||||
@@ -472,7 +472,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_DIRECTION: {
|
||||
static auto fn = fn::build_mf::SI4_SO<float3, float3, float, float, bool>(
|
||||
static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
|
||||
"Not Equal - Direction",
|
||||
[](float3 a, float3 b, float angle, float epsilon) {
|
||||
return abs(angle_v3v3(a, b) - angle) > epsilon;
|
||||
@@ -481,7 +481,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_ELEMENT: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Not Equal - Element-wise",
|
||||
[](float3 a, float3 b, float epsilon) {
|
||||
return abs(a.x - b.x) > epsilon || abs(a.y - b.y) > epsilon ||
|
||||
@@ -491,7 +491,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_MODE_LENGTH: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float3, float3, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
|
||||
"Not Equal - Length",
|
||||
[](float3 a, float3 b, float epsilon) {
|
||||
return abs(math::length(a) - math::length(b)) > epsilon;
|
||||
@@ -506,7 +506,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
case SOCK_RGBA:
|
||||
switch (data->operation) {
|
||||
case NODE_COMPARE_EQUAL: {
|
||||
static auto fn = fn::build_mf::SI3_SO<ColorGeometry4f, ColorGeometry4f, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<ColorGeometry4f, ColorGeometry4f, float, bool>(
|
||||
"Equal",
|
||||
[](ColorGeometry4f a, ColorGeometry4f b, float epsilon) {
|
||||
return abs(a.r - b.r) <= epsilon && abs(a.g - b.g) <= epsilon &&
|
||||
@@ -516,7 +516,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_NOT_EQUAL: {
|
||||
static auto fn = fn::build_mf::SI3_SO<ColorGeometry4f, ColorGeometry4f, float, bool>(
|
||||
static auto fn = mf::build::SI3_SO<ColorGeometry4f, ColorGeometry4f, float, bool>(
|
||||
"Not Equal",
|
||||
[](ColorGeometry4f a, ColorGeometry4f b, float epsilon) {
|
||||
return abs(a.r - b.r) > epsilon || abs(a.g - b.g) > epsilon ||
|
||||
@@ -526,7 +526,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_COLOR_BRIGHTER: {
|
||||
static auto fn = fn::build_mf::SI2_SO<ColorGeometry4f, ColorGeometry4f, bool>(
|
||||
static auto fn = mf::build::SI2_SO<ColorGeometry4f, ColorGeometry4f, bool>(
|
||||
"Brighter",
|
||||
[](ColorGeometry4f a, ColorGeometry4f b) {
|
||||
return rgb_to_grayscale(a) > rgb_to_grayscale(b);
|
||||
@@ -535,7 +535,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_COLOR_DARKER: {
|
||||
static auto fn = fn::build_mf::SI2_SO<ColorGeometry4f, ColorGeometry4f, bool>(
|
||||
static auto fn = mf::build::SI2_SO<ColorGeometry4f, ColorGeometry4f, bool>(
|
||||
"Darker",
|
||||
[](ColorGeometry4f a, ColorGeometry4f b) {
|
||||
return rgb_to_grayscale(a) < rgb_to_grayscale(b);
|
||||
@@ -548,12 +548,12 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
case SOCK_STRING:
|
||||
switch (data->operation) {
|
||||
case NODE_COMPARE_EQUAL: {
|
||||
static auto fn = fn::build_mf::SI2_SO<std::string, std::string, bool>(
|
||||
static auto fn = mf::build::SI2_SO<std::string, std::string, bool>(
|
||||
"Equal", [](std::string a, std::string b) { return a == b; });
|
||||
return &fn;
|
||||
}
|
||||
case NODE_COMPARE_NOT_EQUAL: {
|
||||
static auto fn = fn::build_mf::SI2_SO<std::string, std::string, bool>(
|
||||
static auto fn = mf::build::SI2_SO<std::string, std::string, bool>(
|
||||
"Not Equal", [](std::string a, std::string b) { return a != b; });
|
||||
return &fn;
|
||||
}
|
||||
@@ -565,7 +565,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &node)
|
||||
|
||||
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
const fn::MultiFunction *fn = get_multi_function(builder.node());
|
||||
const mf::MultiFunction *fn = get_multi_function(builder.node());
|
||||
builder.set_matching_fn(fn);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,16 +36,16 @@ static void node_label(const bNodeTree * /*tree*/, const bNode *node, char *labe
|
||||
BLI_strncpy(label, IFACE_(name), maxlen);
|
||||
}
|
||||
|
||||
static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
static const mf::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
{
|
||||
static auto exec_preset = fn::build_mf::exec_presets::AllSpanOrSingle();
|
||||
static auto round_fn = fn::build_mf::SI1_SO<float, int>(
|
||||
static auto exec_preset = mf::build::exec_presets::AllSpanOrSingle();
|
||||
static auto round_fn = mf::build::SI1_SO<float, int>(
|
||||
"Round", [](float a) { return int(round(a)); }, exec_preset);
|
||||
static auto floor_fn = fn::build_mf::SI1_SO<float, int>(
|
||||
static auto floor_fn = mf::build::SI1_SO<float, int>(
|
||||
"Floor", [](float a) { return int(floor(a)); }, exec_preset);
|
||||
static auto ceil_fn = fn::build_mf::SI1_SO<float, int>(
|
||||
static auto ceil_fn = mf::build::SI1_SO<float, int>(
|
||||
"Ceiling", [](float a) { return int(ceil(a)); }, exec_preset);
|
||||
static auto trunc_fn = fn::build_mf::SI1_SO<float, int>(
|
||||
static auto trunc_fn = mf::build::SI1_SO<float, int>(
|
||||
"Truncate", [](float a) { return int(trunc(a)); }, exec_preset);
|
||||
|
||||
switch (static_cast<FloatToIntRoundingMode>(bnode.custom1)) {
|
||||
@@ -65,7 +65,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
|
||||
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
const fn::MultiFunction *fn = get_multi_function(builder.node());
|
||||
const mf::MultiFunction *fn = get_multi_function(builder.node());
|
||||
builder.set_matching_fn(fn);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
const bNode &bnode = builder.node();
|
||||
NodeInputBool *node_storage = static_cast<NodeInputBool *>(bnode.storage);
|
||||
builder.construct_and_set_matching_fn<fn::CustomMF_Constant<bool>>(node_storage->boolean);
|
||||
builder.construct_and_set_matching_fn<mf::CustomMF_Constant<bool>>(node_storage->boolean);
|
||||
}
|
||||
|
||||
static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
|
||||
@@ -25,7 +25,7 @@ static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &
|
||||
const bNode &bnode = builder.node();
|
||||
NodeInputColor *node_storage = static_cast<NodeInputColor *>(bnode.storage);
|
||||
blender::ColorGeometry4f color = (ColorGeometry4f)node_storage->color;
|
||||
builder.construct_and_set_matching_fn<blender::fn::CustomMF_Constant<ColorGeometry4f>>(color);
|
||||
builder.construct_and_set_matching_fn<blender::mf::CustomMF_Constant<ColorGeometry4f>>(color);
|
||||
}
|
||||
|
||||
static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
|
||||
@@ -24,7 +24,7 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
const bNode &bnode = builder.node();
|
||||
NodeInputInt *node_storage = static_cast<NodeInputInt *>(bnode.storage);
|
||||
builder.construct_and_set_matching_fn<fn::CustomMF_Constant<int>>(node_storage->integer);
|
||||
builder.construct_and_set_matching_fn<mf::CustomMF_Constant<int>>(node_storage->integer);
|
||||
}
|
||||
|
||||
static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
|
||||
@@ -10,24 +10,24 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::String>(N_("Tab"));
|
||||
}
|
||||
|
||||
class MF_SpecialCharacters : public fn::MultiFunction {
|
||||
class MF_SpecialCharacters : public mf::MultiFunction {
|
||||
public:
|
||||
MF_SpecialCharacters()
|
||||
{
|
||||
static fn::MFSignature signature = create_signature();
|
||||
static mf::Signature signature = create_signature();
|
||||
this->set_signature(&signature);
|
||||
}
|
||||
|
||||
static fn::MFSignature create_signature()
|
||||
static mf::Signature create_signature()
|
||||
{
|
||||
fn::MFSignature signature;
|
||||
fn::MFSignatureBuilder builder{"Special Characters", signature};
|
||||
mf::Signature signature;
|
||||
mf::SignatureBuilder builder{"Special Characters", signature};
|
||||
builder.single_output<std::string>("Line Break");
|
||||
builder.single_output<std::string>("Tab");
|
||||
return signature;
|
||||
}
|
||||
|
||||
void call(IndexMask mask, fn::MFParams params, fn::MFContext /*context*/) const override
|
||||
void call(IndexMask mask, mf::MFParams params, mf::Context /*context*/) const override
|
||||
{
|
||||
MutableSpan<std::string> lb = params.uninitialized_single_output<std::string>(0, "Line Break");
|
||||
MutableSpan<std::string> tab = params.uninitialized_single_output<std::string>(1, "Tab");
|
||||
|
||||
@@ -23,7 +23,7 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
const bNode &bnode = builder.node();
|
||||
NodeInputString *node_storage = static_cast<NodeInputString *>(bnode.storage);
|
||||
std::string string = std::string((node_storage->string) ? node_storage->string : "");
|
||||
builder.construct_and_set_matching_fn<fn::CustomMF_Constant<std::string>>(std::move(string));
|
||||
builder.construct_and_set_matching_fn<mf::CustomMF_Constant<std::string>>(std::move(string));
|
||||
}
|
||||
|
||||
static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
|
||||
@@ -25,7 +25,7 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
const bNode &bnode = builder.node();
|
||||
NodeInputVector *node_storage = static_cast<NodeInputVector *>(bnode.storage);
|
||||
float3 vector(node_storage->vector);
|
||||
builder.construct_and_set_matching_fn<fn::CustomMF_Constant<float3>>(vector);
|
||||
builder.construct_and_set_matching_fn<mf::CustomMF_Constant<float3>>(vector);
|
||||
}
|
||||
|
||||
static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
|
||||
@@ -141,7 +141,7 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
|
||||
switch (data_type) {
|
||||
case CD_PROP_FLOAT3: {
|
||||
static auto fn = fn::build_mf::SI4_SO<float3, float3, int, int, float3>(
|
||||
static auto fn = mf::build::SI4_SO<float3, float3, int, int, float3>(
|
||||
"Random Vector",
|
||||
[](float3 min_value, float3 max_value, int id, int seed) -> float3 {
|
||||
const float x = noise::hash_to_float(seed, id, 0);
|
||||
@@ -149,23 +149,23 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
const float z = noise::hash_to_float(seed, id, 2);
|
||||
return float3(x, y, z) * (max_value - min_value) + min_value;
|
||||
},
|
||||
fn::build_mf::exec_presets::SomeSpanOrSingle<2>());
|
||||
mf::build::exec_presets::SomeSpanOrSingle<2>());
|
||||
builder.set_matching_fn(fn);
|
||||
break;
|
||||
}
|
||||
case CD_PROP_FLOAT: {
|
||||
static auto fn = fn::build_mf::SI4_SO<float, float, int, int, float>(
|
||||
static auto fn = mf::build::SI4_SO<float, float, int, int, float>(
|
||||
"Random Float",
|
||||
[](float min_value, float max_value, int id, int seed) -> float {
|
||||
const float value = noise::hash_to_float(seed, id);
|
||||
return value * (max_value - min_value) + min_value;
|
||||
},
|
||||
fn::build_mf::exec_presets::SomeSpanOrSingle<2>());
|
||||
mf::build::exec_presets::SomeSpanOrSingle<2>());
|
||||
builder.set_matching_fn(fn);
|
||||
break;
|
||||
}
|
||||
case CD_PROP_INT32: {
|
||||
static auto fn = fn::build_mf::SI4_SO<int, int, int, int, int>(
|
||||
static auto fn = mf::build::SI4_SO<int, int, int, int, int>(
|
||||
"Random Int",
|
||||
[](int min_value, int max_value, int id, int seed) -> int {
|
||||
const float value = noise::hash_to_float(id, seed);
|
||||
@@ -173,17 +173,17 @@ static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
* distribution for the first and last values (See T93591). */
|
||||
return floor(value * (max_value + 1 - min_value) + min_value);
|
||||
},
|
||||
fn::build_mf::exec_presets::SomeSpanOrSingle<2>());
|
||||
mf::build::exec_presets::SomeSpanOrSingle<2>());
|
||||
builder.set_matching_fn(fn);
|
||||
break;
|
||||
}
|
||||
case CD_PROP_BOOL: {
|
||||
static auto fn = fn::build_mf::SI3_SO<float, int, int, bool>(
|
||||
static auto fn = mf::build::SI3_SO<float, int, int, bool>(
|
||||
"Random Bool",
|
||||
[](float probability, int id, int seed) -> bool {
|
||||
return noise::hash_to_float(id, seed) <= probability;
|
||||
},
|
||||
fn::build_mf::exec_presets::SomeSpanOrSingle<1>());
|
||||
mf::build::exec_presets::SomeSpanOrSingle<1>());
|
||||
builder.set_matching_fn(fn);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -30,12 +30,10 @@ static std::string replace_all(const StringRefNull str,
|
||||
|
||||
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
static auto substring_fn =
|
||||
fn::build_mf::SI3_SO<std::string, std::string, std::string, std::string>(
|
||||
"Replace",
|
||||
[](const std::string &str, const std::string &find, const std::string &replace) {
|
||||
return replace_all(str, find, replace);
|
||||
});
|
||||
static auto substring_fn = mf::build::SI3_SO<std::string, std::string, std::string, std::string>(
|
||||
"Replace", [](const std::string &str, const std::string &find, const std::string &replace) {
|
||||
return replace_all(str, find, replace);
|
||||
});
|
||||
builder.set_matching_fn(&substring_fn);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
||||
uiItemR(layout, ptr, "space", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
static const mf::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
{
|
||||
static auto obj_euler_rot = fn::build_mf::SI2_SO<float3, float3, float3>(
|
||||
static auto obj_euler_rot = mf::build::SI2_SO<float3, float3, float3>(
|
||||
"Rotate Euler by Euler/Object", [](const float3 &input, const float3 &rotation) {
|
||||
float input_mat[3][3];
|
||||
eul_to_mat3(input_mat, input);
|
||||
@@ -66,7 +66,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
mat3_to_eul(result, mat_res);
|
||||
return result;
|
||||
});
|
||||
static auto obj_AA_rot = fn::build_mf::SI3_SO<float3, float3, float, float3>(
|
||||
static auto obj_AA_rot = mf::build::SI3_SO<float3, float3, float, float3>(
|
||||
"Rotate Euler by AxisAngle/Object",
|
||||
[](const float3 &input, const float3 &axis, float angle) {
|
||||
float input_mat[3][3];
|
||||
@@ -79,7 +79,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
mat3_to_eul(result, mat_res);
|
||||
return result;
|
||||
});
|
||||
static auto local_euler_rot = fn::build_mf::SI2_SO<float3, float3, float3>(
|
||||
static auto local_euler_rot = mf::build::SI2_SO<float3, float3, float3>(
|
||||
"Rotate Euler by Euler/Local", [](const float3 &input, const float3 &rotation) {
|
||||
float input_mat[3][3];
|
||||
eul_to_mat3(input_mat, input);
|
||||
@@ -91,7 +91,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
mat3_to_eul(result, mat_res);
|
||||
return result;
|
||||
});
|
||||
static auto local_AA_rot = fn::build_mf::SI3_SO<float3, float3, float, float3>(
|
||||
static auto local_AA_rot = mf::build::SI3_SO<float3, float3, float, float3>(
|
||||
"Rotate Euler by AxisAngle/Local", [](const float3 &input, const float3 &axis, float angle) {
|
||||
float input_mat[3][3];
|
||||
eul_to_mat3(input_mat, input);
|
||||
@@ -107,12 +107,12 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
short space = bnode.custom2;
|
||||
if (type == FN_NODE_ROTATE_EULER_TYPE_AXIS_ANGLE) {
|
||||
return space == FN_NODE_ROTATE_EULER_SPACE_OBJECT ?
|
||||
static_cast<const MultiFunction *>(&obj_AA_rot) :
|
||||
static_cast<const mf::MultiFunction *>(&obj_AA_rot) :
|
||||
&local_AA_rot;
|
||||
}
|
||||
if (type == FN_NODE_ROTATE_EULER_TYPE_EULER) {
|
||||
return space == FN_NODE_ROTATE_EULER_SPACE_OBJECT ?
|
||||
static_cast<const MultiFunction *>(&obj_euler_rot) :
|
||||
static_cast<const mf::MultiFunction *>(&obj_euler_rot) :
|
||||
&local_euler_rot;
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
@@ -121,7 +121,7 @@ static const fn::MultiFunction *get_multi_function(const bNode &bnode)
|
||||
|
||||
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
const fn::MultiFunction *fn = get_multi_function(builder.node());
|
||||
const mf::MultiFunction *fn = get_multi_function(builder.node());
|
||||
builder.set_matching_fn(fn);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,18 +37,18 @@ static void node_init(bNodeTree * /*tree*/, bNode *node)
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
class SeparateRGBAFunction : public fn::MultiFunction {
|
||||
class SeparateRGBAFunction : public mf::MultiFunction {
|
||||
public:
|
||||
SeparateRGBAFunction()
|
||||
{
|
||||
static fn::MFSignature signature = create_signature();
|
||||
static mf::Signature signature = create_signature();
|
||||
this->set_signature(&signature);
|
||||
}
|
||||
|
||||
static fn::MFSignature create_signature()
|
||||
static mf::Signature create_signature()
|
||||
{
|
||||
fn::MFSignature signature;
|
||||
fn::MFSignatureBuilder builder{"Separate Color", signature};
|
||||
mf::Signature signature;
|
||||
mf::SignatureBuilder builder{"Separate Color", signature};
|
||||
builder.single_input<ColorGeometry4f>("Color");
|
||||
builder.single_output<float>("Red");
|
||||
builder.single_output<float>("Green");
|
||||
@@ -57,7 +57,7 @@ class SeparateRGBAFunction : public fn::MultiFunction {
|
||||
return signature;
|
||||
}
|
||||
|
||||
void call(IndexMask mask, fn::MFParams params, fn::MFContext /*context*/) const override
|
||||
void call(IndexMask mask, mf::MFParams params, mf::Context /*context*/) const override
|
||||
{
|
||||
const VArray<ColorGeometry4f> &colors = params.readonly_single_input<ColorGeometry4f>(0,
|
||||
"Color");
|
||||
@@ -99,18 +99,18 @@ class SeparateRGBAFunction : public fn::MultiFunction {
|
||||
}
|
||||
};
|
||||
|
||||
class SeparateHSVAFunction : public fn::MultiFunction {
|
||||
class SeparateHSVAFunction : public mf::MultiFunction {
|
||||
public:
|
||||
SeparateHSVAFunction()
|
||||
{
|
||||
static fn::MFSignature signature = create_signature();
|
||||
static mf::Signature signature = create_signature();
|
||||
this->set_signature(&signature);
|
||||
}
|
||||
|
||||
static fn::MFSignature create_signature()
|
||||
static mf::Signature create_signature()
|
||||
{
|
||||
fn::MFSignature signature;
|
||||
fn::MFSignatureBuilder builder{"Separate Color", signature};
|
||||
mf::Signature signature;
|
||||
mf::SignatureBuilder builder{"Separate Color", signature};
|
||||
builder.single_input<ColorGeometry4f>("Color");
|
||||
builder.single_output<float>("Hue");
|
||||
builder.single_output<float>("Saturation");
|
||||
@@ -119,7 +119,7 @@ class SeparateHSVAFunction : public fn::MultiFunction {
|
||||
return signature;
|
||||
}
|
||||
|
||||
void call(IndexMask mask, fn::MFParams params, fn::MFContext /*context*/) const override
|
||||
void call(IndexMask mask, mf::MFParams params, mf::Context /*context*/) const override
|
||||
{
|
||||
const VArray<ColorGeometry4f> &colors = params.readonly_single_input<ColorGeometry4f>(0,
|
||||
"Color");
|
||||
@@ -140,18 +140,18 @@ class SeparateHSVAFunction : public fn::MultiFunction {
|
||||
}
|
||||
};
|
||||
|
||||
class SeparateHSLAFunction : public fn::MultiFunction {
|
||||
class SeparateHSLAFunction : public mf::MultiFunction {
|
||||
public:
|
||||
SeparateHSLAFunction()
|
||||
{
|
||||
static fn::MFSignature signature = create_signature();
|
||||
static mf::Signature signature = create_signature();
|
||||
this->set_signature(&signature);
|
||||
}
|
||||
|
||||
static fn::MFSignature create_signature()
|
||||
static mf::Signature create_signature()
|
||||
{
|
||||
fn::MFSignature signature;
|
||||
fn::MFSignatureBuilder builder{"Separate Color", signature};
|
||||
mf::Signature signature;
|
||||
mf::SignatureBuilder builder{"Separate Color", signature};
|
||||
builder.single_input<ColorGeometry4f>("Color");
|
||||
builder.single_output<float>("Hue");
|
||||
builder.single_output<float>("Saturation");
|
||||
@@ -160,7 +160,7 @@ class SeparateHSLAFunction : public fn::MultiFunction {
|
||||
return signature;
|
||||
}
|
||||
|
||||
void call(IndexMask mask, fn::MFParams params, fn::MFContext /*context*/) const override
|
||||
void call(IndexMask mask, mf::MFParams params, mf::Context /*context*/) const override
|
||||
{
|
||||
const VArray<ColorGeometry4f> &colors = params.readonly_single_input<ColorGeometry4f>(0,
|
||||
"Color");
|
||||
|
||||
@@ -16,7 +16,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
|
||||
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
static auto slice_fn = fn::build_mf::SI3_SO<std::string, int, int, std::string>(
|
||||
static auto slice_fn = mf::build::SI3_SO<std::string, int, int, std::string>(
|
||||
"Slice", [](const std::string &str, int a, int b) {
|
||||
const int len = BLI_strlen_utf8(str.c_str());
|
||||
const int start = BLI_str_utf8_offset_from_index(str.c_str(), std::clamp(a, 0, len));
|
||||
|
||||
@@ -16,7 +16,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
|
||||
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
static auto str_len_fn = fn::build_mf::SI1_SO<std::string, int>(
|
||||
static auto str_len_fn = mf::build::SI1_SO<std::string, int>(
|
||||
"String Length", [](const std::string &a) { return BLI_strlen_utf8(a.c_str()); });
|
||||
builder.set_matching_fn(&str_len_fn);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
|
||||
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
{
|
||||
static auto to_str_fn = fn::build_mf::SI2_SO<float, int, std::string>(
|
||||
static auto to_str_fn = mf::build::SI2_SO<float, int, std::string>(
|
||||
"Value To String", [](float a, int b) {
|
||||
std::stringstream stream;
|
||||
stream << std::fixed << std::setprecision(std::max(0, b)) << a;
|
||||
|
||||
Reference in New Issue
Block a user