From d4fd06d6ce89113310bb769f4777c9a4d77cb155 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 12 Feb 2021 13:25:45 -0600 Subject: 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 --- source/blender/blenloader/intern/versioning_290.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source/blender/blenloader') 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. * -- cgit v1.2.3