Cleanup: Add CLOG to wm_files_link.c

This commit is contained in:
Bastien Montagne
2021-08-20 11:27:18 +02:00
parent cea24b4b4a
commit e95b197e98

View File

@@ -30,6 +30,8 @@
#include <stdio.h>
#include <string.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
@@ -76,6 +78,8 @@
#include "wm_files.h"
static CLG_LogRef LOG = {"wm.files_link"};
/* -------------------------------------------------------------------- */
/** \name Link/Append Operator
* \{ */
@@ -315,7 +319,7 @@ static bool wm_link_append_item_poll(ReportList *reports,
short idcode;
if (!group || !name) {
printf("skipping %s\n", path);
CLOG_WARN(&LOG, "Skipping %s", path);
return false;
}
@@ -759,12 +763,12 @@ static void lib_relocate_do_remap(Main *bmain,
BLI_assert(new_id);
}
if (new_id) {
#ifdef PRINT_DEBUG
printf("before remap of %s, old_id users: %d, new_id users: %d\n",
old_id->name,
old_id->us,
new_id->us);
#endif
CLOG_INFO(&LOG,
4,
"Before remap of %s, old_id users: %d, new_id users: %d",
old_id->name,
old_id->us,
new_id->us);
BKE_libblock_remap_locked(bmain, old_id, new_id, remap_flags);
if (old_id->flag & LIB_FAKEUSER) {
@@ -772,12 +776,12 @@ static void lib_relocate_do_remap(Main *bmain,
id_fake_user_set(new_id);
}
#ifdef PRINT_DEBUG
printf("after remap of %s, old_id users: %d, new_id users: %d\n",
old_id->name,
old_id->us,
new_id->us);
#endif
CLOG_INFO(&LOG,
4,
"After remap of %s, old_id users: %d, new_id users: %d",
old_id->name,
old_id->us,
new_id->us);
/* In some cases, new_id might become direct link, remove parent of library in this case. */
if (new_id->lib->parent && (new_id->tag & LIB_TAG_INDIRECT) == 0) {
@@ -875,9 +879,7 @@ static void lib_relocate_do(bContext *C,
item = wm_link_append_data_item_add(lapp_data, id->name + 2, idcode, id);
BLI_bitmap_set_all(item->libraries, true, lapp_data->num_libraries);
#ifdef PRINT_DEBUG
printf("\tdatablock to seek for: %s\n", id->name);
#endif
CLOG_INFO(&LOG, 4, "Datablock to seek for: %s", id->name);
}
}
}
@@ -1117,9 +1119,7 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, bool do_reload)
}
if (BLI_path_cmp(lib->filepath_abs, path) == 0) {
#ifdef PRINT_DEBUG
printf("We are supposed to reload '%s' lib (%d)...\n", lib->filepath, lib->id.us);
#endif
CLOG_INFO(&LOG, 4, "We are supposed to reload '%s' lib (%d)", lib->filepath, lib->id.us);
do_reload = true;
@@ -1129,9 +1129,8 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, bool do_reload)
else {
int totfiles = 0;
#ifdef PRINT_DEBUG
printf("We are supposed to relocate '%s' lib to new '%s' one...\n", lib->filepath, libname);
#endif
CLOG_INFO(
&LOG, 4, "We are supposed to relocate '%s' lib to new '%s' one", lib->filepath, libname);
/* Check if something is indicated for relocate. */
prop = RNA_struct_find_property(op->ptr, "files");
@@ -1157,17 +1156,13 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, bool do_reload)
continue;
}
#ifdef PRINT_DEBUG
printf("\t candidate new lib to reload datablocks from: %s\n", path);
#endif
CLOG_INFO(&LOG, 4, "\tCandidate new lib to reload datablocks from: %s", path);
wm_link_append_data_library_add(lapp_data, path);
}
RNA_END;
}
else {
#ifdef PRINT_DEBUG
printf("\t candidate new lib to reload datablocks from: %s\n", path);
#endif
CLOG_INFO(&LOG, 4, "\tCandidate new lib to reload datablocks from: %s", path);
wm_link_append_data_library_add(lapp_data, path);
}
}