diff options
author | OmarSquircleArt <omar.squircleart@gmail.com> | 2019-09-09 22:06:55 +0300 |
---|---|---|
committer | OmarSquircleArt <omar.squircleart@gmail.com> | 2019-09-09 22:06:55 +0300 |
commit | f2176b3ff3c5df9ab43d1b0489e3bb350d1015f6 (patch) | |
tree | f64f3e8453f4c54de37ecd625f6796b43bccd398 /source/blender/blenloader/intern/versioning_cycles.c | |
parent | c2d37929b4aaaef87bad1d2e90cc76d0c4765e8d (diff) |
Shading: Extend Musgrave node to other dimensions.
This patch extends Musgrave noise to operate in 1D, 2D, 3D, and 4D
space. The Color output was also removed because it was identical
to the Fac output.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D5566
Diffstat (limited to 'source/blender/blenloader/intern/versioning_cycles.c')
-rw-r--r-- | source/blender/blenloader/intern/versioning_cycles.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index d4d940daba5..98f8820e4ad 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -911,6 +911,34 @@ static void update_mapping_node_inputs_and_properties(bNodeTree *ntree) } } +/* The Musgrave node now has a dimension property. This property should + * be initialized to 3 by default. + */ +static void update_musgrave_node_dimensions(bNodeTree *ntree) +{ + for (bNode *node = ntree->nodes.first; node; node = node->next) { + if (node->type == SH_NODE_TEX_MUSGRAVE) { + NodeTexMusgrave *tex = (NodeTexMusgrave *)node->storage; + tex->dimensions = 3; + } + } +} + +/* The Color output of the Musgrave node has been removed. Previously, this + * output was just equal to the Fac output. To correct this, we move links + * from the Color output to the Fac output if they exist. + */ +static void update_musgrave_node_color_output(bNodeTree *ntree) +{ + LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) { + if (link->fromnode && link->fromnode->type == SH_NODE_TEX_MUSGRAVE) { + if (link->fromsock->type == SOCK_RGBA) { + link->fromsock = link->fromsock->next; + } + } + } +} + void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main *bmain) { /* Particle shape shared with Eevee. */ @@ -952,6 +980,15 @@ void blo_do_versions_cycles(FileData *UNUSED(fd), Library *UNUSED(lib), Main *bm } FOREACH_NODETREE_END; } + + if (!MAIN_VERSION_ATLEAST(bmain, 281, 10)) { + FOREACH_NODETREE_BEGIN (bmain, ntree, id) { + if (ntree->type == NTREE_SHADER) { + update_musgrave_node_color_output(ntree); + } + } + FOREACH_NODETREE_END; + } } void do_versions_after_linking_cycles(Main *bmain) @@ -1101,4 +1138,13 @@ void do_versions_after_linking_cycles(Main *bmain) } FOREACH_NODETREE_END; } + + if (!MAIN_VERSION_ATLEAST(bmain, 281, 10)) { + FOREACH_NODETREE_BEGIN (bmain, ntree, id) { + if (ntree->type == NTREE_SHADER) { + update_musgrave_node_dimensions(ntree); + } + } + FOREACH_NODETREE_END; + } } |