diff options
author | Hans Goudey <h.goudey@me.com> | 2021-02-12 22:25:45 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-02-12 22:25:45 +0300 |
commit | d4fd06d6ce89113310bb769f4777c9a4d77cb155 (patch) | |
tree | f94c3e05a65bca55a0e54f4c1fb72d9e23734e17 /source/blender/blenloader/intern | |
parent | d7c2c889a688067dab280fc137ad4c3c7ce4cb2b (diff) |
Geometry Nodes: Add operation setting to attribute randomize node
This commit adds a drop-down to the attribute randomize node to support
a few operations on the values of existing attributes: "Replace/Create"
(the existing behavior), "Add", "Subtract", and "Multiply".
At this point, the operations are limited by what is simple to implement.
More could be added in the future, but there isn't a strong use case
for more complex operations anyway, and a second math node can be used.
Differential Revision: https://developer.blender.org/D10269
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 78d60715aa5..74b3827ffd0 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -1704,6 +1704,25 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } FOREACH_NODETREE_END; } + + if (!MAIN_VERSION_ATLEAST(bmain, 293, 8)) { + FOREACH_NODETREE_BEGIN (bmain, ntree, id) { + if (ntree->type != NTREE_GEOMETRY) { + continue; + } + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + if (node->type == GEO_NODE_POINT_INSTANCE && node->storage == NULL) { + NodeAttributeRandomize *data = (NodeAttributeRandomize *)MEM_callocN( + sizeof(NodeAttributeRandomize), __func__); + data->data_type = node->custom1; + data->operation = GEO_NODE_ATTRIBUTE_RANDOMIZE_REPLACE_CREATE; + node->storage = data; + } + } + } + FOREACH_NODETREE_END; + } + /** * Versioning code until next subversion bump goes here. * |