Commit: f6f832308235190d850918af55bbfe7b93e13d7f Author: Jacques Lucke Date: Sun Apr 7 17:17:29 2019 +0200 Branches: functions https://developer.blender.org/rBf6f832308235190d850918af55bbfe7b93e13d7f
Fix Sin operation in Float Math node The patch only fixed the python part. I added the c++ part. Differential Revision: https://developer.blender.org/D4658 =================================================================== M release/scripts/startup/function_nodes/nodes/float_math.py M source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp =================================================================== diff --git a/release/scripts/startup/function_nodes/nodes/float_math.py b/release/scripts/startup/function_nodes/nodes/float_math.py index aacd929b070..b9c583dd7b2 100644 --- a/release/scripts/startup/function_nodes/nodes/float_math.py +++ b/release/scripts/startup/function_nodes/nodes/float_math.py @@ -37,9 +37,10 @@ class FloatMathNode(bpy.types.Node, FunctionNode): builder.vectorized_input( "a", "use_list__a", "A", "A", "Float") - builder.vectorized_input( - "b", "use_list__b", - "B", "B", "Float") + if self.operation not in single_value_operations: + builder.vectorized_input( + "b", "use_list__b", + "B", "B", "Float") builder.vectorized_output( "result", ["use_list__a", "use_list__b"], diff --git a/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp b/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp index ab6a6abe3f6..bc834656178 100644 --- a/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp +++ b/source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp @@ -17,6 +17,8 @@ namespace FN { namespace DataFlowNodes { PointerRNA &node_rna, SmallVector<const char *> vectorize_prop_names) { + BLI_assert(original_fn->signature().inputs().size() == vectorize_prop_names.size()); + SmallVector<bool> vectorized_inputs; for (const char *prop_name : vectorize_prop_names) { char state[5]; @@ -64,10 +66,20 @@ namespace FN { namespace DataFlowNodes { PointerRNA rna = builder.get_rna(bnode); int operation = RNA_enum_get(&rna, "operation"); - SharedFunction fn = get_vectorized_function( - get_float_math_function(operation), - rna, {"use_list__a", "use_list__b"}); - builder.insert_matching_function(fn, bnode); + SharedFunction &original_fn = get_float_math_function(operation); + uint input_amount = original_fn->signature().inputs().size(); + + if (input_amount == 1) { + SharedFunction fn = get_vectorized_function( + original_fn, rna, {"use_list__a"}); + builder.insert_matching_function(fn, bnode); + } + else { + BLI_assert(input_amount == 2); + SharedFunction fn = get_vectorized_function( + original_fn, rna, {"use_list__a", "use_list__b"}); + builder.insert_matching_function(fn, bnode); + } } static SharedFunction &get_vector_math_function(int operation) _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
