26 b.add_input<
decl::Int>(
"Min",
"Min_002").min(-100000).
max(100000);
33 .make_available([](
bNode &node) { node_storage(node).data_type =
CD_PROP_BOOL; });
89 switch (socket.
type) {
115 bNode &node =
params.add_node(
"FunctionNodeRandomValue");
116 node_storage(node).data_type = *type;
117 params.update_and_connect_available_socket(node,
"Min");
120 bNode &node =
params.add_node(
"FunctionNodeRandomValue");
121 node_storage(node).data_type = *type;
122 params.update_and_connect_available_socket(node,
"Max");
129 bNode &node =
params.add_node(
"FunctionNodeRandomValue");
130 node_storage(node).data_type = *type;
131 params.update_and_connect_available_socket(node,
"Value");
143 static auto fn = mf::build::SI4_SO<float3, float3, int, int, float3>(
149 return float3(
x,
y,
z) * (max_value - min_value) + min_value;
151 mf::build::exec_presets::SomeSpanOrSingle<2>());
156 static auto fn = mf::build::SI4_SO<float, float, int, int, float>(
158 [](
float min_value,
float max_value,
int id,
int seed) ->
float {
160 return value * (max_value - min_value) + min_value;
162 mf::build::exec_presets::SomeSpanOrSingle<2>());
167 static auto fn = mf::build::SI4_SO<int, int, int, int, int>(
169 [](
int min_value,
int max_value,
int id,
int seed) ->
int {
170 if (min_value > max_value) {
171 std::swap(min_value, max_value);
174 return min_value +
hash % (max_value - min_value + 1);
176 mf::build::exec_presets::SomeSpanOrSingle<2>());
181 static auto fn = mf::build::SI3_SO<float, int, int, bool>(
183 [](
float probability,
int id,
int seed) ->
bool {
186 mf::build::exec_presets::SomeSpanOrSingle<1>());
202 ntype.
ui_name =
"Random Value";
#define NODE_CLASS_CONVERTER
#define NODE_STORAGE_FUNCS(StorageT)
#define FN_NODE_RANDOM_VALUE
#define BLI_assert_unreachable()
@ NODE_DEFAULT_INPUT_ID_INDEX_FIELD
#define NOD_REGISTER_NODE(REGISTER_FUNC)
BMesh const char void * data
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
static unsigned long seed
Vector< SocketDeclaration * > inputs
void set_matching_fn(const mf::MultiFunction *fn)
void * MEM_callocN(size_t len, const char *str)
void node_register_type(bNodeType &ntype)
void node_set_socket_availability(bNodeTree &ntree, bNodeSocket &sock, bool is_available)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
static void node_register()
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
static void fn_node_random_value_update(bNodeTree *ntree, bNode *node)
static void node_gather_link_search_ops(GatherLinkSearchOpParams ¶ms)
static void fn_node_random_value_init(bNodeTree *, bNode *node)
static std::optional< eCustomDataType > node_type_from_other_socket(const bNodeSocket &socket)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
void search_link_ops_for_declarations(GatherLinkSearchOpParams ¶ms, Span< SocketDeclaration * > declarations)
uint32_t hash(uint32_t kx)
float hash_to_float(uint32_t kx)
VecBase< float, 3 > float3
void fn_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
struct bNodeSocket * next
std::string ui_description
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeMultiFunctionBuildFunction build_multi_function
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
void(* updatefunc)(bNodeTree *ntree, bNode *node)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)