[Bf-blender-cvs] [322c03f13cb] master: Move callbacks API from BLI to BKE

Sergey Sharybin noreply at git.blender.org
Mon Sep 9 14:28:00 CEST 2019


Commit: 322c03f13cb5a756902f310c2a34cf78825fe02d
Author: Sergey Sharybin
Date:   Thu Sep 5 15:52:38 2019 +0200
Branches: master
https://developer.blender.org/rB322c03f13cb5a756902f310c2a34cf78825fe02d

Move callbacks API from BLI to BKE

Preparing for the bigger changes which will be related on passing
dependency graph to various callbacks which need it.

Differential Revision: https://developer.blender.org/D5725

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

R056	source/blender/blenlib/BLI_callbacks.h	source/blender/blenkernel/BKE_callbacks.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/blender.c
R081	source/blender/blenlib/intern/callbacks.c	source/blender/blenkernel/intern/callbacks.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenlib/BLI_timer.h
M	source/blender/blenlib/CMakeLists.txt
M	source/blender/blenlib/intern/fileops.c
M	source/blender/editors/undo/ed_undo.c
M	source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
M	source/blender/python/intern/bpy_app_handlers.c
M	source/blender/render/intern/source/pipeline.c
M	source/blender/windowmanager/intern/wm_files.c
M	source/blender/windowmanager/intern/wm_init_exit.c
M	source/creator/creator.c

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

diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenkernel/BKE_callbacks.h
similarity index 56%
rename from source/blender/blenlib/BLI_callbacks.h
rename to source/blender/blenkernel/BKE_callbacks.h
index 4d9fc66a806..380ce30668d 100644
--- a/source/blender/blenlib/BLI_callbacks.h
+++ b/source/blender/blenkernel/BKE_callbacks.h
@@ -15,11 +15,11 @@
  */
 
 /** \file
- * \ingroup bli
+ * \ingroup bke
  */
 
-#ifndef __BLI_CALLBACKS_H__
-#define __BLI_CALLBACKS_H__
+#ifndef __BKE_CALLBACKS_H__
+#define __BKE_CALLBACKS_H__
 
 struct ID;
 struct Main;
@@ -32,29 +32,29 @@ struct Main;
  *   For handling jobs (which may in turn cause other handlers to be called).
  */
 typedef enum {
-  BLI_CB_EVT_FRAME_CHANGE_PRE,
-  BLI_CB_EVT_FRAME_CHANGE_POST,
-  BLI_CB_EVT_RENDER_PRE,
-  BLI_CB_EVT_RENDER_POST,
-  BLI_CB_EVT_RENDER_WRITE,
-  BLI_CB_EVT_RENDER_STATS,
-  BLI_CB_EVT_RENDER_INIT,
-  BLI_CB_EVT_RENDER_COMPLETE,
-  BLI_CB_EVT_RENDER_CANCEL,
-  BLI_CB_EVT_LOAD_PRE,
-  BLI_CB_EVT_LOAD_POST,
-  BLI_CB_EVT_SAVE_PRE,
-  BLI_CB_EVT_SAVE_POST,
-  BLI_CB_EVT_UNDO_PRE,
-  BLI_CB_EVT_UNDO_POST,
-  BLI_CB_EVT_REDO_PRE,
-  BLI_CB_EVT_REDO_POST,
-  BLI_CB_EVT_DEPSGRAPH_UPDATE_PRE,
-  BLI_CB_EVT_DEPSGRAPH_UPDATE_POST,
-  BLI_CB_EVT_VERSION_UPDATE,
-  BLI_CB_EVT_LOAD_FACTORY_USERDEF_POST,
-  BLI_CB_EVT_LOAD_FACTORY_STARTUP_POST,
-  BLI_CB_EVT_TOT,
+  BKE_CB_EVT_FRAME_CHANGE_PRE,
+  BKE_CB_EVT_FRAME_CHANGE_POST,
+  BKE_CB_EVT_RENDER_PRE,
+  BKE_CB_EVT_RENDER_POST,
+  BKE_CB_EVT_RENDER_WRITE,
+  BKE_CB_EVT_RENDER_STATS,
+  BKE_CB_EVT_RENDER_INIT,
+  BKE_CB_EVT_RENDER_COMPLETE,
+  BKE_CB_EVT_RENDER_CANCEL,
+  BKE_CB_EVT_LOAD_PRE,
+  BKE_CB_EVT_LOAD_POST,
+  BKE_CB_EVT_SAVE_PRE,
+  BKE_CB_EVT_SAVE_POST,
+  BKE_CB_EVT_UNDO_PRE,
+  BKE_CB_EVT_UNDO_POST,
+  BKE_CB_EVT_REDO_PRE,
+  BKE_CB_EVT_REDO_POST,
+  BKE_CB_EVT_DEPSGRAPH_UPDATE_PRE,
+  BKE_CB_EVT_DEPSGRAPH_UPDATE_POST,
+  BKE_CB_EVT_VERSION_UPDATE,
+  BKE_CB_EVT_LOAD_FACTORY_USERDEF_POST,
+  BKE_CB_EVT_LOAD_FACTORY_STARTUP_POST,
+  BKE_CB_EVT_TOT,
 } eCbEvent;
 
 typedef struct bCallbackFuncStore {
@@ -64,10 +64,10 @@ typedef struct bCallbackFuncStore {
   short alloc;
 } bCallbackFuncStore;
 
-void BLI_callback_exec(struct Main *bmain, struct ID *self, eCbEvent evt);
-void BLI_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt);
+void BKE_callback_exec(struct Main *bmain, struct ID *self, eCbEvent evt);
+void BKE_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt);
 
-void BLI_callback_global_init(void);
-void BLI_callback_global_finalize(void);
+void BKE_callback_global_init(void);
+void BKE_callback_global_finalize(void);
 
-#endif /* __BLI_CALLBACKS_H__ */
+#endif /* __BKE_CALLBACKS_H__ */
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 669abff6599..a1c47ba6d06 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -83,6 +83,7 @@ set(SRC
   intern/brush.c
   intern/bvhutils.c
   intern/cachefile.c
+  intern/callbacks.c
   intern/camera.c
   intern/cdderivedmesh.c
   intern/cloth.c
@@ -243,6 +244,7 @@ set(SRC
   BKE_brush.h
   BKE_bvhutils.h
   BKE_cachefile.h
+  BKE_callbacks.h
   BKE_camera.h
   BKE_ccg.h
   BKE_cdderivedmesh.h
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 805c098d238..ac432bf0b64 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -32,7 +32,6 @@
 #include "BLI_string.h"
 #include "BLI_listbase.h"
 #include "BLI_utildefines.h"
-#include "BLI_callbacks.h"
 
 #include "IMB_imbuf.h"
 #include "IMB_moviecache.h"
@@ -44,6 +43,7 @@
 #include "BKE_blendfile.h"
 #include "BKE_brush.h"
 #include "BKE_cachefile.h"
+#include "BKE_callbacks.h"
 #include "BKE_global.h"
 #include "BKE_idprop.h"
 #include "BKE_image.h"
@@ -95,7 +95,7 @@ void BKE_blender_free(void)
   BKE_brush_system_exit();
   RE_texture_rng_exit();
 
-  BLI_callback_global_finalize();
+  BKE_callback_global_finalize();
 
   IMB_moviecache_destruct();
 
diff --git a/source/blender/blenlib/intern/callbacks.c b/source/blender/blenkernel/intern/callbacks.c
similarity index 81%
rename from source/blender/blenlib/intern/callbacks.c
rename to source/blender/blenkernel/intern/callbacks.c
index c4f93a9831d..cbecba2efe1 100644
--- a/source/blender/blenlib/intern/callbacks.c
+++ b/source/blender/blenkernel/intern/callbacks.c
@@ -15,18 +15,19 @@
  */
 
 /** \file
- * \ingroup bli
+ * \ingroup bke
  */
 
 #include "BLI_utildefines.h"
 #include "BLI_listbase.h"
-#include "BLI_callbacks.h"
+
+#include "BKE_callbacks.h"
 
 #include "MEM_guardedalloc.h"
 
-static ListBase callback_slots[BLI_CB_EVT_TOT] = {{NULL}};
+static ListBase callback_slots[BKE_CB_EVT_TOT] = {{NULL}};
 
-void BLI_callback_exec(struct Main *bmain, struct ID *self, eCbEvent evt)
+void BKE_callback_exec(struct Main *bmain, struct ID *self, eCbEvent evt)
 {
   ListBase *lb = &callback_slots[evt];
   bCallbackFuncStore *funcstore;
@@ -36,22 +37,22 @@ void BLI_callback_exec(struct Main *bmain, struct ID *self, eCbEvent evt)
   }
 }
 
-void BLI_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt)
+void BKE_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt)
 {
   ListBase *lb = &callback_slots[evt];
   BLI_addtail(lb, funcstore);
 }
 
-void BLI_callback_global_init(void)
+void BKE_callback_global_init(void)
 {
   /* do nothing */
 }
 
 /* call on application exit */
-void BLI_callback_global_finalize(void)
+void BKE_callback_global_finalize(void)
 {
   eCbEvent evt;
-  for (evt = 0; evt < BLI_CB_EVT_TOT; evt++) {
+  for (evt = 0; evt < BKE_CB_EVT_TOT; evt++) {
     ListBase *lb = &callback_slots[evt];
     bCallbackFuncStore *funcstore;
     bCallbackFuncStore *funcstore_next;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index b0e0f9f1efc..c55aa1b835c 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -48,7 +48,7 @@
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
-#include "BLI_callbacks.h"
+#include "BKE_callbacks.h"
 #include "BLI_string.h"
 #include "BLI_string_utils.h"
 #include "BLI_threads.h"
@@ -1554,7 +1554,7 @@ static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool on
 
   bool run_callbacks = DEG_id_type_any_updated(depsgraph);
   if (run_callbacks) {
-    BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_DEPSGRAPH_UPDATE_PRE);
+    BKE_callback_exec(bmain, &scene->id, BKE_CB_EVT_DEPSGRAPH_UPDATE_PRE);
   }
 
   for (int pass = 0; pass < 2; pass++) {
@@ -1572,7 +1572,7 @@ static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool on
     BKE_scene_update_sound(depsgraph, bmain);
     /* Notify python about depsgraph update. */
     if (run_callbacks) {
-      BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_DEPSGRAPH_UPDATE_POST);
+      BKE_callback_exec(bmain, &scene->id, BKE_CB_EVT_DEPSGRAPH_UPDATE_POST);
     }
     /* Inform editors about possible changes. */
     DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, false);
@@ -1607,7 +1607,7 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph, Main *bmain)
   ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
 
   /* Keep this first. */
-  BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_FRAME_CHANGE_PRE);
+  BKE_callback_exec(bmain, &scene->id, BKE_CB_EVT_FRAME_CHANGE_PRE);
 
   for (int pass = 0; pass < 2; pass++) {
     /* Update animated image textures for particles, modifiers, gpu, etc,
@@ -1629,7 +1629,7 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph, Main *bmain)
 
     /* Notify editors and python about recalc. */
     if (pass == 0) {
-      BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_FRAME_CHANGE_POST);
+      BKE_callback_exec(bmain, &scene->id, BKE_CB_EVT_FRAME_CHANGE_POST);
     }
 
     /* Inform editors about possible changes. */
diff --git a/source/blender/blenlib/BLI_timer.h b/source/blender/blenlib/BLI_timer.h
index 959ac4a2b2b..56cafb1bd36 100644
--- a/source/blender/blenlib/BLI_timer.h
+++ b/source/blender/blenlib/BLI_timer.h
@@ -50,7 +50,7 @@ void BLI_timer_execute(void);
 
 void BLI_timer_free(void);
 
-/* This function is to be called next to BLI_CB_EVT_LOAD_PRE, to make sure the module
+/* This function is to be called next to BKE_CB_EVT_LOAD_PRE, to make sure the module
  * is properly configured for the new file. */
 void BLI_timer_on_file_load(void);
 
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 7f6e9d49b17..73652e18a56 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -61,7 +61,6 @@ set(SRC
   intern/bitmap_draw_2d.c
   intern/boxpack_2d.c
   intern/buffer.c
-  intern/callbacks.c
   intern/convexhull_2d.c
   intern/delaunay_2d.c
   intern/dynlib.c
@@ -145,7 +144,6 @@ set(SRC
   BLI_blenlib.h
   BLI_boxpack_2d.h
   BLI_buffer.h
-  BLI_callbacks.h
   BLI_compiler_attrs.h
   BLI_compiler_compat.h
   BLI_compiler_typecheck.h
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index c203c45bb93..4c1f08f0117 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -35,8 +35,8 @@
 #ifdef WIN32
 #  include <io.h>
 #  include "BLI_winstuff.h"
-#  include "BLI_callbacks.h"
 #  include "BLI_fileops_types.h"
+#  include "BKE_callbacks.h"
 #  include "utf_winfunc.h"
 #  include "utfconv.h"
 #else
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index dac420ff2e4..df927726e82 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -31,12 +31,12 @@
 #include "DNA_object_types.h"
 
 #include "BLI_utildefines.h"
-#include "BLI_callbacks.h"
 #include "BLI_listbase.h"
 
 #include "BLT_translation.h"
 
 #include "BKE_blender_undo.h"
+#include "BKE_callbacks.h"
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
@@ -172,8 +172,8 @@ static int ed_undo_step_impl(
     /* Note: ignore grease pencil for now. */
     Main *bmain = CTX_data_main(C);
     wm->o

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list