Fix issue with some files having non-unique modifier names

Originally the files are coming from ancient early-2.4x epoch, but in
theory such setups might have been re-saved multiple times already with
more recent blender versions.

So the verisoning code is applied on all the files, including very
recent ones.

Bumped subversion, because this check si not really cheap.
This commit is contained in:
Sergey Sharybin 2015-02-13 13:51:10 +05:00
parent 67fa545ed0
commit 46151a6a69
2 changed files with 16 additions and 1 deletions

@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 273
#define BLENDER_SUBVERSION 7
#define BLENDER_SUBVERSION 8
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 270
#define BLENDER_MINSUBVERSION 5

@ -51,6 +51,7 @@
#include "DNA_genfile.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_screen.h"
@ -602,4 +603,18 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
}
if (!MAIN_VERSION_ATLEAST(main, 273, 8)) {
Object *ob;
for (ob = main->object.first; ob != NULL; ob = ob->id.next) {
ModifierData *md;
for (md = ob->modifiers.last; md != NULL; md = md->prev) {
if (modifier_unique_name(&ob->modifiers, md)) {
printf("Warning: Object '%s' had several modifiers with the "
"same name, renamed one of them to '%s'.\n",
ob->id.name + 2, md->name);
}
}
}
}
}