46 static auto exec_preset = mf::build::exec_presets::AllSpanOrSingle();
47 static auto round_fn = mf::build::SI1_SO<float, int>(
48 "Round", [](
float a) {
return int(
round(a)); }, exec_preset);
49 static auto floor_fn = mf::build::SI1_SO<float, int>(
50 "Floor", [](
float a) {
return int(
floor(a)); }, exec_preset);
51 static auto ceil_fn = mf::build::SI1_SO<float, int>(
52 "Ceiling", [](
float a) {
return int(
ceil(a)); }, exec_preset);
53 static auto trunc_fn = mf::build::SI1_SO<float, int>(
54 "Truncate", [](
float a) {
return int(
trunc(a)); }, exec_preset);
79 switch (rounding_mode) {
81 return "float_to_int_round";
83 return "float_to_int_floor";
85 return "float_to_int_ceil";
87 return "float_to_int_truncate";
102 if (name ==
nullptr) {
114 ntype.
ui_name =
"Float to Integer";
116 "Convert the given floating-point number to an integer, with a choice of methods";
#define NODE_CLASS_CONVERTER
#define FN_NODE_FLOAT_TO_INT
#define CTX_N_(context, msgid)
#define BLT_I18NCONTEXT_ID_NODETREE
#define CTX_IFACE_(context, msgid)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define BLI_assert_unreachable()
void set_matching_fn(const mf::MultiFunction *fn)
void node_register_type(bNodeType &ntype)
static void node_label(const bNodeTree *, const bNode *node, char *label, int label_maxncpy)
static void node_declare(NodeDeclarationBuilder &b)
static void node_layout(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_register()
static int node_gpu_material(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static const mf::MultiFunction * get_multi_function(const bNode &bnode)
static const char * gpu_shader_get_name(const FloatToIntRoundingMode rounding_mode)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void fn_cmp_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
const EnumPropertyItem rna_enum_node_float_to_int_items[]
@ FN_NODE_FLOAT_TO_INT_FLOOR
@ FN_NODE_FLOAT_TO_INT_CEIL
@ FN_NODE_FLOAT_TO_INT_TRUNCATE
@ FN_NODE_FLOAT_TO_INT_ROUND
bool RNA_enum_name(const EnumPropertyItem *item, const int value, const char **r_name)
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
void(*) labelfunc(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy)
NodeGPUExecFunction gpu_fn
NodeMultiFunctionBuildFunction build_multi_function
const char * enum_name_legacy
NodeDeclareFunction declare
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)