Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/function/nodes/legacy/node_fn_random_float.cc
| Show All 12 Lines | |||||
| * along with this program; if not, write to the Free Software Foundation, | * along with this program; if not, write to the Free Software Foundation, | ||||
| * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
| */ | */ | ||||
| #include "node_function_util.hh" | #include "node_function_util.hh" | ||||
| #include "BLI_hash.h" | #include "BLI_hash.h" | ||||
| namespace blender::nodes { | namespace blender::nodes::node_fn_random_float_cc { | ||||
| static void fn_node_legacy_random_float_declare(NodeDeclarationBuilder &b) | static void fn_node_legacy_random_float_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.is_function_node(); | b.is_function_node(); | ||||
| b.add_input<decl::Float>(N_("Min")).min(-10000.0f).max(10000.0f); | b.add_input<decl::Float>(N_("Min")).min(-10000.0f).max(10000.0f); | ||||
| b.add_input<decl::Float>(N_("Max")).default_value(1.0f).min(-10000.0f).max(10000.0f); | b.add_input<decl::Float>(N_("Max")).default_value(1.0f).min(-10000.0f).max(10000.0f); | ||||
| b.add_input<decl::Int>(N_("Seed")).min(-10000).max(10000); | b.add_input<decl::Int>(N_("Seed")).min(-10000).max(10000); | ||||
| b.add_output<decl::Float>(N_("Value")); | b.add_output<decl::Float>(N_("Value")); | ||||
| }; | }; | ||||
| } // namespace blender::nodes | |||||
| class RandomFloatFunction : public blender::fn::MultiFunction { | class RandomFloatFunction : public blender::fn::MultiFunction { | ||||
| public: | public: | ||||
| RandomFloatFunction() | RandomFloatFunction() | ||||
| { | { | ||||
| static blender::fn::MFSignature signature = create_signature(); | static blender::fn::MFSignature signature = create_signature(); | ||||
| this->set_signature(&signature); | this->set_signature(&signature); | ||||
| } | } | ||||
| Show All 28 Lines | |||||
| static void fn_node_legacy_random_float_build_multi_function( | static void fn_node_legacy_random_float_build_multi_function( | ||||
| blender::nodes::NodeMultiFunctionBuilder &builder) | blender::nodes::NodeMultiFunctionBuilder &builder) | ||||
| { | { | ||||
| static RandomFloatFunction fn; | static RandomFloatFunction fn; | ||||
| builder.set_matching_fn(fn); | builder.set_matching_fn(fn); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_fn_random_float_cc | |||||
| void register_node_type_fn_legacy_random_float() | void register_node_type_fn_legacy_random_float() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_fn_random_float_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| fn_node_type_base(&ntype, FN_NODE_LEGACY_RANDOM_FLOAT, "Random Float", 0, 0); | fn_node_type_base(&ntype, FN_NODE_LEGACY_RANDOM_FLOAT, "Random Float", 0); | ||||
| ntype.declare = blender::nodes::fn_node_legacy_random_float_declare; | ntype.declare = file_ns::fn_node_legacy_random_float_declare; | ||||
| ntype.build_multi_function = fn_node_legacy_random_float_build_multi_function; | ntype.build_multi_function = file_ns::fn_node_legacy_random_float_build_multi_function; | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||