28 {
SOCK_VECTOR,
N_(
"Min"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX},
29 {
SOCK_VECTOR,
N_(
"Max"), 1.0f, 1.0f, 1.0f, 0.0f, -FLT_MAX, FLT_MAX},
30 {
SOCK_FLOAT,
N_(
"Min"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX},
31 {
SOCK_FLOAT,
N_(
"Max"), 1.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX},
32 {
SOCK_INT,
N_(
"Min"), 0.0f, 0.0f, 0.0f, 0.0f, -100000, 100000},
33 {
SOCK_INT,
N_(
"Max"), 100.0f, 0.0f, 0.0f, 0.0f, -100000, 100000},
34 {
SOCK_INT,
N_(
"Seed"), 0, 0, 0, 0, -10000, 10000},
47 uiItemR(layout,
ptr,
"data_type", 0,
"", ICON_NONE);
48 uiItemR(layout,
ptr,
"operation", 0,
"", ICON_NONE);
101 random_value_in_range<float>(
id,
seed,
static_cast<float>(
min),
static_cast<float>(
max)));
129 const T random_value = random_value_in_range<T>(ids[i],
seed,
min,
max);
130 span[i] = random_value;
135 const T random_value = random_value_in_range<T>(ids[i],
seed,
min,
max);
136 span[i] = span[i] + random_value;
141 const T random_value = random_value_in_range<T>(ids[i],
seed,
min,
max);
142 span[i] = span[i] - random_value;
147 const T random_value = random_value_in_range<T>(ids[i],
seed,
min,
max);
148 span[i] = span[i] * random_value;
166 span[i] = random_value;
173 const int domain_size =
component.attribute_domain_size(domain);
178 if (hash_attribute) {
180 const CPPType &cpp_type = hash_attribute->cpp_type();
181 fn::GSpan items = hash_attribute->get_span();
183 hashes[i] = cpp_type.
hash(items[i]);
203 if (result_attribute) {
204 return result_attribute->domain();
222 if (!
component.attribute_exists(attribute_name)) {
224 TIP_(
"No attribute with name \"") + attribute_name +
"\"");
232 attribute_name, domain, data_type);
251 const float min =
params.get_input<
float>(
"Min_001");
252 const float max =
params.get_input<
float>(
"Max_001");
253 randomize_attribute<float>(span.
typed<
float>(),
min,
max, hashes,
seed, operation);
261 const int min =
params.get_input<
int>(
"Min_002");
262 const int max =
params.get_input<
int>(
"Max_002");
263 randomize_attribute<int>(span.
typed<
int>(),
min,
max, hashes,
seed, operation);
278 const std::string attribute_name =
params.get_input<std::string>(
"Attribute");
279 if (attribute_name.empty()) {
280 params.set_output(
"Geometry", geometry_set);
283 const int seed =
params.get_input<
int>(
"Seed");
308 params.set_output(
"Geometry", geometry_set);
void nodeSetSocketAvailability(struct bNodeSocket *sock, bool is_available)
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
void node_type_update(struct bNodeType *ntype, void(*updatefunc)(struct bNodeTree *ntree, struct bNode *node))
#define GEO_NODE_ATTRIBUTE_RANDOMIZE
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
#define NODE_CLASS_ATTRIBUTE
void nodeRegisterType(struct bNodeType *ntype)
BLI_INLINE float BLI_hash_int_2d_to_float(uint32_t kx, uint32_t ky)
BLI_INLINE float BLI_hash_int_3d_to_float(uint32_t kx, uint32_t ky, uint32_t kz)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int round_fl_to_int(float a)
#define UNUSED_VARS_NDEBUG(...)
static uint8 component(Color32 c, uint i)
GeometryNodeAttributeRandomizeMode
@ GEO_NODE_ATTRIBUTE_RANDOMIZE_MULTIPLY
@ GEO_NODE_ATTRIBUTE_RANDOMIZE_SUBTRACT
@ GEO_NODE_ATTRIBUTE_RANDOMIZE_REPLACE_CREATE
@ GEO_NODE_ATTRIBUTE_RANDOMIZE_ADD
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
static unsigned long seed
void apply_span_and_save()
IndexRange index_range() const
constexpr IndexRange index_range() const
fn::GMutableSpan get_span_for_write_only()
fn::GMutableSpan get_span()
uint64_t hash(const void *value) const
MutableSpan< T > typed() const
void *(* MEM_callocN)(size_t len, const char *str)
GeometrySet geometry_set_realize_instances(const GeometrySet &geometry_set)
std::unique_ptr< ReadAttribute > ReadAttributePtr
static void randomize_attribute(MutableSpan< T > span, const T min, const T max, Span< uint32_t > ids, const uint32_t seed, const GeometryNodeAttributeRandomizeMode operation)
static void randomize_attribute_on_component(GeometryComponent &component, const GeoNodeExecParams ¶ms, StringRef attribute_name, const CustomDataType data_type, const GeometryNodeAttributeRandomizeMode operation, const int seed)
T random_value_in_range(const uint32_t id, const uint32_t seed, const T min, const T max)
static AttributeDomain get_result_domain(const GeometryComponent &component, StringRef source_name, StringRef result_name)
static void randomize_attribute_bool(MutableSpan< bool > span, Span< uint32_t > ids, const uint32_t seed, const GeometryNodeAttributeRandomizeMode operation)
static void geo_node_random_attribute_exec(GeoNodeExecParams params)
Array< uint32_t > get_geometry_element_ids_as_uints(const GeometryComponent &component, const AttributeDomain domain)
static void geo_node_attribute_randomize_update(bNodeTree *UNUSED(ntree), bNode *node)
void register_node_type_geo_attribute_randomize()
static bNodeSocketTemplate geo_node_attribute_randomize_in[]
static void geo_node_attribute_random_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void geo_node_attribute_randomize_init(bNodeTree *UNUSED(tree), bNode *node)
static bNodeSocketTemplate geo_node_attribute_randomize_out[]
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag)
void node_copy_standard_storage(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
GeometryComponent & get_component_for_write(GeometryComponentType component_type)
bool has(const GeometryComponentType component_type) const
Compact definition of a node socket.
struct bNodeSocket * next
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)