diff options
author | Jacques Lucke <jacques@blender.org> | 2021-05-14 12:22:02 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-05-14 12:23:25 +0300 |
commit | 2871fadcad30fd9c5103022b782d986772301533 (patch) | |
tree | d7d62006e3d52546f3f06cca3e5e856f7fe880cd /source/blender/blenloader | |
parent | a9393178624865c8505a7cfa3089cf33155abe7c (diff) |
Geometry Nodes: use texture socket in Attribute Sample Texture node
There is a new Texture data-block socket that we can use in Geometry
Nodes now. This commit replaces the texture property of a node and
gives it a texture input socket instead. That increases flexibility.
The texture socket still has some limitations that will be lifted in the
next couple of days (e.g. it's not supported by the switch node and
cannot be exposed the a modifier yet).
Differential Revision: https://developer.blender.org/D11222
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_300.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index ae2371402e4..8c5e86eadd3 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -31,6 +31,7 @@ #include "BKE_lib_id.h" #include "BKE_main.h" +#include "BKE_node.h" #include "BLO_readfile.h" #include "readfile.h" @@ -57,6 +58,30 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports)) */ { /* Keep this block, even when empty. */ + + /* Use new texture socket in Attribute Sample Texture node. */ + LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) { + if (ntree->type != NTREE_GEOMETRY) { + continue; + } + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + if (node->type != GEO_NODE_ATTRIBUTE_SAMPLE_TEXTURE) { + continue; + } + if (node->id == NULL) { + continue; + } + LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) { + if (socket->type == SOCK_TEXTURE) { + bNodeSocketValueTexture *socket_value = (bNodeSocketValueTexture *) + socket->default_value; + socket_value->value = (Tex *)node->id; + break; + } + } + node->id = NULL; + } + } } } |