[Bf-blender-cvs] [e95b197e987] master: Cleanup: Add CLOG to wm_files_link.c

Bastien Montagne noreply at git.blender.org
Fri Aug 20 11:27:47 CEST 2021


Commit: e95b197e987d3ed5d9efb6b228a7bdb56e1bd7bc
Author: Bastien Montagne
Date:   Fri Aug 20 11:27:18 2021 +0200
Branches: master
https://developer.blender.org/rBe95b197e987d3ed5d9efb6b228a7bdb56e1bd7bc

Cleanup: Add CLOG to wm_files_link.c

===================================================================

M	source/blender/windowmanager/intern/wm_files_link.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index cdcb6c5163f..606c9252ff9 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -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);
       }
     }



More information about the Bf-blender-cvs mailing list