Versioning code to correct socket naming after

340b76b42c

Reported by formerly Old_Demon on blenderartists.

Apparently this caused old files to lose their links to material sockets
(noob own mistake from inexperience with node system).

This should either be included in release with version checking being
set to version 2.73 and subversion 10, without tweaking the
BKE_blender.h file

OR

340b76b42c should be reverted for this
release.

Thanks to Lukas for checking this out.
This commit is contained in:
Antonis Ryakiotakis 2015-03-23 18:33:50 +01:00
parent b13770215c
commit 1b71279adc
2 changed files with 28 additions and 1 deletions

View File

@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 274
#define BLENDER_SUBVERSION 1
#define BLENDER_SUBVERSION 2
/* Several breakages with 270, e.g. constraint deg vs rad */
#define BLENDER_MINVERSION 270
#define BLENDER_MINSUBVERSION 5

View File

@ -673,4 +673,31 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
}
if (!MAIN_VERSION_ATLEAST(main, 274, 2)) {
FOREACH_NODETREE(main, ntree, id) {
bNode *node;
bNodeSocket *sock;
for (node = ntree->nodes.first; node; node = node->next) {
if (node->type == SH_NODE_MATERIAL) {
for (sock = node->inputs.first; sock; sock = sock->next) {
if (STREQ(sock->name, "Refl")) {
BLI_strncpy(sock->name, "DiffuseIntensity", sizeof(sock->name));
}
}
}
else if (node->type == SH_NODE_MATERIAL_EXT) {
for (sock = node->outputs.first; sock; sock = sock->next) {
if (STREQ(sock->name, "Refl")) {
BLI_strncpy(sock->name, "DiffuseIntensity", sizeof(sock->name));
}
else if (STREQ(sock->name, "Ray Mirror")) {
BLI_strncpy(sock->name, "Reflectivity", sizeof(sock->name));
}
}
}
}
} FOREACH_NODETREE_END
}
}