Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-09-05 16:52:38 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-09-09 15:26:42 +0300
commit322c03f13cb5a756902f310c2a34cf78825fe02d (patch)
treec57f59635742304b7e6f6f0d0f28c3a01f2c2d2a /source/blender/blenlib
parent103d29e2b2c0053436d0cef649ee9c6a24b2cba8 (diff)
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
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_callbacks.h73
-rw-r--r--source/blender/blenlib/BLI_timer.h2
-rw-r--r--source/blender/blenlib/CMakeLists.txt2
-rw-r--r--source/blender/blenlib/intern/callbacks.c66
-rw-r--r--source/blender/blenlib/intern/fileops.c2
5 files changed, 2 insertions, 143 deletions
diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h
deleted file mode 100644
index 4d9fc66a806..00000000000
--- a/source/blender/blenlib/BLI_callbacks.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/** \file
- * \ingroup bli
- */
-
-#ifndef __BLI_CALLBACKS_H__
-#define __BLI_CALLBACKS_H__
-
-struct ID;
-struct Main;
-
-/**
- * Common suffix uses:
- * - ``_PRE/_POST``:
- * For handling discrete non-interactive events.
- * - ``_INIT/_COMPLETE/_CANCEL``:
- * 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,
-} eCbEvent;
-
-typedef struct bCallbackFuncStore {
- struct bCallbackFuncStore *next, *prev;
- void (*func)(struct Main *, struct ID *, void *arg);
- void *arg;
- short alloc;
-} bCallbackFuncStore;
-
-void BLI_callback_exec(struct Main *bmain, struct ID *self, eCbEvent evt);
-void BLI_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt);
-
-void BLI_callback_global_init(void);
-void BLI_callback_global_finalize(void);
-
-#endif /* __BLI_CALLBACKS_H__ */
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/callbacks.c b/source/blender/blenlib/intern/callbacks.c
deleted file mode 100644
index c4f93a9831d..00000000000
--- a/source/blender/blenlib/intern/callbacks.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/** \file
- * \ingroup bli
- */
-
-#include "BLI_utildefines.h"
-#include "BLI_listbase.h"
-#include "BLI_callbacks.h"
-
-#include "MEM_guardedalloc.h"
-
-static ListBase callback_slots[BLI_CB_EVT_TOT] = {{NULL}};
-
-void BLI_callback_exec(struct Main *bmain, struct ID *self, eCbEvent evt)
-{
- ListBase *lb = &callback_slots[evt];
- bCallbackFuncStore *funcstore;
-
- for (funcstore = lb->first; funcstore; funcstore = funcstore->next) {
- funcstore->func(bmain, self, funcstore->arg);
- }
-}
-
-void BLI_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt)
-{
- ListBase *lb = &callback_slots[evt];
- BLI_addtail(lb, funcstore);
-}
-
-void BLI_callback_global_init(void)
-{
- /* do nothing */
-}
-
-/* call on application exit */
-void BLI_callback_global_finalize(void)
-{
- eCbEvent evt;
- for (evt = 0; evt < BLI_CB_EVT_TOT; evt++) {
- ListBase *lb = &callback_slots[evt];
- bCallbackFuncStore *funcstore;
- bCallbackFuncStore *funcstore_next;
- for (funcstore = lb->first; funcstore; funcstore = funcstore_next) {
- funcstore_next = funcstore->next;
- BLI_remlink(lb, funcstore);
- if (funcstore->alloc) {
- MEM_freeN(funcstore);
- }
- }
- }
-}
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