Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguitargeek <johnny.matthews@gmail.com>2021-10-03 01:33:25 +0300
committerguitargeek <johnny.matthews@gmail.com>2021-10-03 01:34:47 +0300
commit34cf33eb12099d3a1940de070d7dc7e88e3bebc7 (patch)
treef44f9a3a31d0df86608cdb80519d65c429213fb5 /source/blender/blenloader/intern/versioning_300.c
parent54927caf4fcf214428e2fcb05d378d96fde54025 (diff)
Geometry Nodes: Switch Node Fields Update
This update of the Switch node allows for field compatible types to be switched through the node. This includes the following: Float, Int, Bool, String, Vector, and Color The remaining types are processed with the orginal code: Geometry, Object, Collection, Texture, and Material Because the old types require a diffent "switch" socket than the field types, versioning for old files is included to move links of those types to a new switch socket. Once fields of other types are supported, this node can be updated to support them as well. Differential Revision: https://developer.blender.org/D12642
Diffstat (limited to 'source/blender/blenloader/intern/versioning_300.c')
-rw-r--r--source/blender/blenloader/intern/versioning_300.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 11b6ad9b8ea..5b436d59213 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -617,6 +617,32 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports))
do_versions_idproperty_ui_data(bmain);
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 300, 32)) {
+ /* Update Switch Node Non-Fields switch input to Switch_001. */
+ LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
+ if (ntree->type != NTREE_GEOMETRY) {
+ continue;
+ }
+
+ LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
+ if (link->tonode->type == GEO_NODE_SWITCH) {
+ if (STREQ(link->tosock->identifier, "Switch")) {
+ bNode *to_node = link->tonode;
+
+ uint8_t mode = ((NodeSwitch *)to_node->storage)->input_type;
+ if (ELEM(mode,
+ SOCK_GEOMETRY,
+ SOCK_OBJECT,
+ SOCK_COLLECTION,
+ SOCK_TEXTURE,
+ SOCK_MATERIAL)) {
+ link->tosock = link->tosock->next;
+ }
+ }
+ }
+ }
+ }
+ }
/**
* Versioning code until next subversion bump goes here.
*