[Bf-blender-cvs] [0c26a44c765] master: Blenloader: expose BLO_reportf_wrap in api

Jacques Lucke noreply at git.blender.org
Fri Nov 6 15:13:38 CET 2020


Commit: 0c26a44c765a11bca4e99cff4866397cf357c41e
Author: Jacques Lucke
Date:   Fri Nov 6 15:07:10 2020 +0100
Branches: master
https://developer.blender.org/rB0c26a44c765a11bca4e99cff4866397cf357c41e

Blenloader: expose BLO_reportf_wrap in api

This function is used by a couple of functions that are moved out of blenloader.

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

M	source/blender/blenloader/BLO_read_write.h
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/readfile.h

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

diff --git a/source/blender/blenloader/BLO_read_write.h b/source/blender/blenloader/BLO_read_write.h
index 17869f7103a..fb7ae7d1e8d 100644
--- a/source/blender/blenloader/BLO_read_write.h
+++ b/source/blender/blenloader/BLO_read_write.h
@@ -43,6 +43,8 @@
 /* for SDNA_TYPE_FROM_STRUCT() macro */
 #include "dna_type_offsets.h"
 
+#include "DNA_windowmanager_types.h" /* for ReportType */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -240,6 +242,13 @@ void BLO_expand_id(BlendExpander *expander, struct ID *id);
 
 #define BLO_expand(expander, id) BLO_expand_id(expander, (struct ID *)id)
 
+/* Report API
+ * ===================
+ */
+
+void BLO_reportf_wrap(struct ReportList *reports, ReportType type, const char *format, ...)
+    ATTR_PRINTF_FORMAT(3, 4);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5d3dca639bb..690b94708a0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -294,7 +294,7 @@ typedef struct BHeadN {
  * bit kludge but better than doubling up on prints,
  * we could alternatively have a versions of a report function which forces printing - campbell
  */
-void blo_reportf_wrap(ReportList *reports, ReportType type, const char *format, ...)
+void BLO_reportf_wrap(ReportList *reports, ReportType type, const char *format, ...)
 {
   char fixed_buf[1024]; /* should be long enough */
 
@@ -2948,7 +2948,7 @@ static void lib_link_object(BlendLibReader *reader, Object *ob)
   else {
     if (ob->instance_collection != NULL) {
       ID *id = BLO_read_get_new_id_address(reader, ob->id.lib, &ob->instance_collection->id);
-      blo_reportf_wrap(reader->fd->reports,
+      BLO_reportf_wrap(reader->fd->reports,
                        RPT_WARNING,
                        TIP_("Non-Empty object '%s' cannot duplicate collection '%s' "
                             "anymore in Blender 2.80, removed instancing"),
@@ -3288,7 +3288,7 @@ static void direct_link_modifiers(BlendDataReader *reader, ListBase *lb, Object
     bool is_allocated = false;
 
     if (md->type == eModifierType_Fluidsim) {
-      blo_reportf_wrap(
+      BLO_reportf_wrap(
           reader->fd->reports,
           RPT_WARNING,
           TIP_("Possible data loss when saving this file! %s modifier is deprecated (Object: %s)"),
@@ -3298,7 +3298,7 @@ static void direct_link_modifiers(BlendDataReader *reader, ListBase *lb, Object
       is_allocated = true;
     }
     else if (md->type == eModifierType_Smoke) {
-      blo_reportf_wrap(
+      BLO_reportf_wrap(
           reader->fd->reports,
           RPT_WARNING,
           TIP_("Possible data loss when saving this file! %s modifier is deprecated (Object: %s)"),
@@ -3874,7 +3874,7 @@ static void lib_link_scene(BlendLibReader *reader, Scene *sce)
     BLO_read_id_address(reader, sce->id.lib, &base_legacy->object);
 
     if (base_legacy->object == NULL) {
-      blo_reportf_wrap(reader->fd->reports,
+      BLO_reportf_wrap(reader->fd->reports,
                        RPT_WARNING,
                        TIP_("LIB: object lost from scene: '%s'"),
                        sce->id.name + 2);
@@ -4525,7 +4525,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
   for (newmain = fd->mainlist->first; newmain; newmain = newmain->next) {
     if (newmain->curlib) {
       if (BLI_path_cmp(newmain->curlib->filepath_abs, lib->filepath_abs) == 0) {
-        blo_reportf_wrap(fd->reports,
+        BLO_reportf_wrap(fd->reports,
                          RPT_WARNING,
                          TIP_("Library '%s', '%s' had multiple instances, save and reload!"),
                          lib->filepath,
@@ -5918,7 +5918,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old)
     if (libmain->curlib == NULL) {
       const char *idname = blo_bhead_id_name(fd, bhead);
 
-      blo_reportf_wrap(fd->reports,
+      BLO_reportf_wrap(fd->reports,
                        RPT_WARNING,
                        TIP_("LIB: Data refers to main .blend file: '%s' from %s"),
                        idname,
@@ -7028,7 +7028,7 @@ static void read_library_linked_id(
   }
 
   if (!is_valid) {
-    blo_reportf_wrap(reports,
+    BLO_reportf_wrap(reports,
                      RPT_ERROR,
                      TIP_("LIB: %s: '%s' is directly linked from '%s' (parent '%s'), but is a "
                           "non-linkable data type"),
@@ -7047,7 +7047,7 @@ static void read_library_linked_id(
     read_libblock(fd, mainvar, bhead, id->tag, false, r_id);
   }
   else {
-    blo_reportf_wrap(reports,
+    BLO_reportf_wrap(reports,
                      RPT_WARNING,
                      TIP_("LIB: %s: '%s' missing from '%s', parent '%s'"),
                      BKE_idtype_idcode_to_name(GS(id->name)),
@@ -7152,7 +7152,7 @@ static FileData *read_library_file_data(FileData *basefd,
     /* Read packed file. */
     PackedFile *pf = mainptr->curlib->packedfile;
 
-    blo_reportf_wrap(basefd->reports,
+    BLO_reportf_wrap(basefd->reports,
                      RPT_INFO,
                      TIP_("Read packed library:  '%s', parent '%s'"),
                      mainptr->curlib->filepath,
@@ -7164,7 +7164,7 @@ static FileData *read_library_file_data(FileData *basefd,
   }
   else {
     /* Read file on disk. */
-    blo_reportf_wrap(basefd->reports,
+    BLO_reportf_wrap(basefd->reports,
                      RPT_INFO,
                      TIP_("Read library:  '%s', '%s', parent '%s'"),
                      mainptr->curlib->filepath_abs,
@@ -7206,7 +7206,7 @@ static FileData *read_library_file_data(FileData *basefd,
   }
 
   if (fd == NULL) {
-    blo_reportf_wrap(
+    BLO_reportf_wrap(
         basefd->reports, RPT_WARNING, TIP_("Cannot find lib '%s'"), mainptr->curlib->filepath_abs);
   }
 
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h
index 57d6779d1cb..353f9a4a068 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -173,9 +173,6 @@ const char *blo_bhead_id_name(const FileData *fd, const BHead *bhead);
 
 /* do versions stuff */
 
-void blo_reportf_wrap(struct ReportList *reports, ReportType type, const char *format, ...)
-    ATTR_PRINTF_FORMAT(3, 4);
-
 void blo_do_versions_dna(struct SDNA *sdna, const int versionfile, const int subversionfile);
 
 void blo_do_versions_oldnewmap_insert(struct OldNewMap *onm,



More information about the Bf-blender-cvs mailing list