[Bf-blender-cvs] [a3e9ef0884f] soc-2020-info-editor: Refactor versioning to use CLOG instead of printf
Mateusz GrzeliÅski
noreply at git.blender.org
Wed Jul 1 17:43:39 CEST 2020
Commit: a3e9ef0884f58b0fd1e0664b39234c0062d74f6d
Author: Mateusz Grzeliński
Date: Wed Jul 1 16:33:56 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rBa3e9ef0884f58b0fd1e0664b39234c0062d74f6d
Refactor versioning to use CLOG instead of printf
===================================================================
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/readfile.h
M source/blender/blenloader/intern/versioning_250.c
M source/blender/blenloader/intern/versioning_270.c
M source/blender/blenloader/intern/versioning_legacy.c
===================================================================
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index bb62601487f..924a1b7de5e 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -243,6 +243,7 @@
/* Use GHash for restoring pointers by name */
#define USE_GHASH_RESTORE_POINTER
+CLG_LOGREF_DECLARE_GLOBAL(BLENLOADER_LOG_VERSIONING, "blenloader.versioning");
static CLG_LogRef BLENLOADER_LOG_READFILE = {"blenloader.readfile"};
static CLG_LogRef BLENLOADER_LOG_UNDO = {"blenloader.undo"};
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h
index f698d642e33..10b9a3c372d 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -30,6 +30,8 @@
#include "DNA_windowmanager_types.h" /* for ReportType */
#include "zlib.h"
+extern struct CLG_LogRef *BLENLOADER_LOG_VERSIONING;
+
struct GSet;
struct IDNameLib_Map;
struct Key;
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index de88d4c9945..2b99148c167 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -83,6 +83,7 @@
#include "readfile.h"
+#include <CLG_log.h>
#include <errno.h>
/* Make preferences read-only, use versioning_userdef.c. */
@@ -449,9 +450,7 @@ static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name)
BKE_lib_libblock_session_uuid_ensure(id);
- if (G.debug & G_DEBUG) {
- printf("Converted GPencil to ID: %s\n", id->name + 2);
- }
+ CLOG_INFO(BLENLOADER_LOG_VERSIONING, 1, "Converted GPencil to ID: %s", id->name + 2);
}
static void do_versions_gpencil_2_50(Main *main, bScreen *screen)
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 496c8353f85..6901c6a978a 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -82,6 +82,7 @@
#include "readfile.h"
#include "MEM_guardedalloc.h"
+#include <CLG_log.h>
/* Make preferences read-only, use versioning_userdef.c. */
#define U (*((const UserDef *)&U))
@@ -843,11 +844,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
ModifierData *md;
for (md = ob->modifiers.last; md != NULL; md = md->prev) {
if (BKE_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);
+ CLOG_WARN(BLENLOADER_LOG_VERSIONING,
+ "Object '%s' had several modifiers with the "
+ "same name, renamed one of them to '%s'",
+ ob->id.name + 2,
+ md->name);
}
}
}
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index ce472a97337..552adf3adcd 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -87,6 +87,7 @@
#include "PIL_time.h"
+#include <CLG_log.h>
#include <errno.h>
/* Make preferences read-only, use versioning_userdef.c. */
@@ -260,7 +261,7 @@ static void idproperties_fix_groups_lengths_recurse(IDProperty *prop)
}
if (prop->len != i) {
- printf("Found and fixed bad id property group length.\n");
+ CLOG_INFO(BLENLOADER_LOG_VERSIONING, 1, "Found and fixed bad id property group length");
prop->len = i;
}
}
@@ -1270,7 +1271,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (cam->ortho_scale == 0.0f) {
cam->ortho_scale = 256.0f / cam->lens;
if (cam->type == CAM_ORTHO) {
- printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
+ CLOG_INFO(BLENLOADER_LOG_VERSIONING,
+ 0,
+ "NOTE: ortho render has changed, tweak new Camera 'scale' value");
}
}
cam = cam->id.next;
@@ -2053,7 +2056,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
if (psys->pointcache) {
if (psys->pointcache->flag & PTCACHE_BAKED &&
(psys->pointcache->flag & PTCACHE_DISK_CACHE) == 0) {
- printf("Old memory cache isn't supported for particles, so re-bake the simulation!\n");
+ CLOG_WARN(
+ BLENLOADER_LOG_VERSIONING,
+ "Old memory cache isn't supported for particles, so re-bake the simulation!");
psys->pointcache->flag &= ~PTCACHE_BAKED;
}
}
@@ -2368,7 +2373,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
do_version_free_effects_245(&ob->effect);
- printf("Old particle system converted to new system.\n");
+ CLOG_INFO(BLENLOADER_LOG_VERSIONING, 0, "Old particle system converted to new system");
}
}
More information about the Bf-blender-cvs
mailing list