From f8c0d63cdb3df8bbce3cd28236ab4a283d6ae7a0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 17 Aug 2020 17:20:12 +1000 Subject: [PATCH] Cleanup: split BPY_extern_python into it's own header Currently BPY_extern.h includes too much mixed functionality. --- source/blender/python/BPY_extern.h | 6 --- source/blender/python/BPY_extern_python.h | 40 +++++++++++++++++++ source/blender/python/intern/bpy_interface.c | 1 + .../blender/windowmanager/intern/wm_files.c | 1 + .../windowmanager/intern/wm_init_exit.c | 1 + source/creator/creator_args.c | 1 + source/creator/creator_signals.c | 2 +- 7 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 source/blender/python/BPY_extern_python.h diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 7bcf96116b9..3fc4df270d5 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -50,12 +50,6 @@ void BPY_pyconstraint_update(struct Object *owner, struct bConstraint *con); int BPY_is_pyconstraint(struct Text *text); // void BPY_free_pyconstraint_links(struct Text *text); -void BPY_python_start(int argc, const char **argv); -void BPY_python_end(void); -void BPY_python_reset(struct bContext *C); -void BPY_python_use_system_env(void); -void BPY_python_backtrace(/* FILE */ void *file); - /* global interpreter lock */ typedef void *BPy_ThreadStatePtr; diff --git a/source/blender/python/BPY_extern_python.h b/source/blender/python/BPY_extern_python.h new file mode 100644 index 00000000000..d6033f86d37 --- /dev/null +++ b/source/blender/python/BPY_extern_python.h @@ -0,0 +1,40 @@ +/* + * 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 python + * + * Functionality relating to Python setup & tear down. + */ + +#pragma once + +struct bContext; + +#ifdef __cplusplus +extern "C" { +#endif + +/* bpy_interface.c */ +void BPY_python_start(int argc, const char **argv); +void BPY_python_end(void); +void BPY_python_reset(struct bContext *C); +void BPY_python_use_system_env(void); +void BPY_python_backtrace(/* FILE */ void *file); + +#ifdef __cplusplus +} /* extern "C" */ +#endif diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index c311041e4cb..098f6202d9b 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -62,6 +62,7 @@ #endif #include "BPY_extern.h" +#include "BPY_extern_python.h" #include "../generic/py_capi_utils.h" diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index ef4f2b4a62a..a8d393cfbae 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -122,6 +122,7 @@ #ifdef WITH_PYTHON # include "BPY_extern.h" +# include "BPY_extern_python.h" #endif #include "DEG_depsgraph.h" diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 03e84f098c0..075469743ec 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -85,6 +85,7 @@ #ifdef WITH_PYTHON # include "BPY_extern.h" +# include "BPY_extern_python.h" #endif #include "GHOST_C-api.h" diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index b8e99899821..cd19ecd6ebc 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -62,6 +62,7 @@ # ifdef WITH_PYTHON # include "BPY_extern.h" +# include "BPY_extern_python.h" # endif # include "RE_engine.h" diff --git a/source/creator/creator_signals.c b/source/creator/creator_signals.c index ad0b7b2547d..29e12a96fe1 100644 --- a/source/creator/creator_signals.c +++ b/source/creator/creator_signals.c @@ -60,7 +60,7 @@ # include # ifdef WITH_PYTHON -# include "BPY_extern.h" /* BPY_python_backtrace */ +# include "BPY_extern_python.h" /* BPY_python_backtrace */ # endif # include "creator_intern.h" /* own include */