From 91e4bcd204b85ba84fdaa9575dac43484643cda4 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 24 Sep 2024 11:30:38 +0200 Subject: [PATCH] Refactor: Move BPY `intern` `bpy_rna` headers to proper C++ ones. --- source/blender/freestyle/CMakeLists.txt | 2 +- .../freestyle/intern/python/BPy_Freestyle.cpp | 2 +- source/blender/io/usd/hydra/material.cc | 2 +- source/blender/io/usd/intern/usd_hook.cc | 2 +- .../makesrna/intern/rna_internal_types.hh | 1 + .../blender/python/generic/idprop_py_api.cc | 6 +-- source/blender/python/intern/CMakeLists.txt | 24 +++++------ source/blender/python/intern/bpy.cc | 8 ++-- .../blender/python/intern/bpy_app_handlers.cc | 2 +- source/blender/python/intern/bpy_driver.cc | 4 +- .../blender/python/intern/bpy_gizmo_wrap.cc | 2 +- source/blender/python/intern/bpy_interface.cc | 2 +- .../blender/python/intern/bpy_library_load.cc | 2 +- .../python/intern/bpy_library_write.cc | 2 +- source/blender/python/intern/bpy_msgbus.cc | 2 +- source/blender/python/intern/bpy_operator.cc | 2 +- .../python/intern/bpy_operator_wrap.cc | 2 +- source/blender/python/intern/bpy_props.cc | 2 +- source/blender/python/intern/bpy_rna.cc | 6 +-- .../python/intern/{bpy_rna.h => bpy_rna.hh} | 43 ++++++++----------- source/blender/python/intern/bpy_rna_anim.cc | 4 +- .../{bpy_rna_anim.h => bpy_rna_anim.hh} | 8 ---- source/blender/python/intern/bpy_rna_array.cc | 2 +- .../blender/python/intern/bpy_rna_callback.cc | 4 +- ...bpy_rna_callback.h => bpy_rna_callback.hh} | 8 ---- .../blender/python/intern/bpy_rna_context.cc | 4 +- .../{bpy_rna_context.h => bpy_rna_context.hh} | 8 ---- source/blender/python/intern/bpy_rna_data.cc | 4 +- .../{bpy_rna_data.h => bpy_rna_data.hh} | 8 ---- .../blender/python/intern/bpy_rna_driver.cc | 4 +- source/blender/python/intern/bpy_rna_driver.h | 33 -------------- .../blender/python/intern/bpy_rna_driver.hh | 26 +++++++++++ source/blender/python/intern/bpy_rna_gizmo.cc | 4 +- .../{bpy_rna_gizmo.h => bpy_rna_gizmo.hh} | 8 ---- .../python/intern/bpy_rna_id_collection.cc | 4 +- ..._collection.h => bpy_rna_id_collection.hh} | 8 ---- .../blender/python/intern/bpy_rna_operator.cc | 2 +- ...bpy_rna_operator.h => bpy_rna_operator.hh} | 8 ---- source/blender/python/intern/bpy_rna_text.cc | 4 +- .../{bpy_rna_text.h => bpy_rna_text.hh} | 8 ---- .../python/intern/bpy_rna_types_capi.cc | 18 ++++---- ...rna_types_capi.h => bpy_rna_types_capi.hh} | 8 ---- source/blender/python/intern/bpy_rna_ui.cc | 4 +- .../intern/{bpy_rna_ui.h => bpy_rna_ui.hh} | 8 ---- .../python/intern/bpy_utils_previews.cc | 2 +- source/blender/render/hydra/python.cc | 2 +- 46 files changed, 112 insertions(+), 207 deletions(-) rename source/blender/python/intern/{bpy_rna.h => bpy_rna.hh} (92%) rename source/blender/python/intern/{bpy_rna_anim.h => bpy_rna_anim.hh} (90%) rename source/blender/python/intern/{bpy_rna_callback.h => bpy_rna_callback.hh} (87%) rename source/blender/python/intern/{bpy_rna_context.h => bpy_rna_context.hh} (78%) rename source/blender/python/intern/{bpy_rna_data.h => bpy_rna_data.hh} (78%) delete mode 100644 source/blender/python/intern/bpy_rna_driver.h create mode 100644 source/blender/python/intern/bpy_rna_driver.hh rename source/blender/python/intern/{bpy_rna_gizmo.h => bpy_rna_gizmo.hh} (73%) rename source/blender/python/intern/{bpy_rna_id_collection.h => bpy_rna_id_collection.hh} (83%) rename source/blender/python/intern/{bpy_rna_operator.h => bpy_rna_operator.hh} (76%) rename source/blender/python/intern/{bpy_rna_text.h => bpy_rna_text.hh} (79%) rename source/blender/python/intern/{bpy_rna_types_capi.h => bpy_rna_types_capi.hh} (73%) rename source/blender/python/intern/{bpy_rna_ui.h => bpy_rna_ui.hh} (75%) diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt index abdbd004eae..d1adeedbab8 100644 --- a/source/blender/freestyle/CMakeLists.txt +++ b/source/blender/freestyle/CMakeLists.txt @@ -566,7 +566,7 @@ if(WITH_PYTHON_MODULE) endif() if(WITH_PYTHON_SAFETY) - # For bpy_rna.h access. + # For bpy_rna.hh access. add_definitions(-DWITH_PYTHON_SAFETY) endif() diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index a22d624cbfb..909159acfd7 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -38,7 +38,7 @@ #include "FRS_freestyle.h" #include "RNA_access.hh" #include "RNA_prototypes.hh" -#include "bpy_rna.h" /* pyrna_struct_CreatePyObject() */ +#include "bpy_rna.hh" /* pyrna_struct_CreatePyObject() */ #include "../generic/py_capi_utils.h" /* #PyC_UnicodeFromBytes */ diff --git a/source/blender/io/usd/hydra/material.cc b/source/blender/io/usd/hydra/material.cc index 8e7e4a43af3..137b0592d8b 100644 --- a/source/blender/io/usd/hydra/material.cc +++ b/source/blender/io/usd/hydra/material.cc @@ -30,7 +30,7 @@ #include "DEG_depsgraph_query.hh" -#include "bpy_rna.h" +#include "bpy_rna.hh" #include "hydra_scene_delegate.hh" #include "image.hh" diff --git a/source/blender/io/usd/intern/usd_hook.cc b/source/blender/io/usd/intern/usd_hook.cc index 23af1061856..237cb39678a 100644 --- a/source/blender/io/usd/intern/usd_hook.cc +++ b/source/blender/io/usd/intern/usd_hook.cc @@ -21,7 +21,7 @@ #include "RNA_access.hh" #include "RNA_prototypes.hh" #include "RNA_types.hh" -#include "bpy_rna.h" +#include "bpy_rna.hh" #include #include diff --git a/source/blender/makesrna/intern/rna_internal_types.hh b/source/blender/makesrna/intern/rna_internal_types.hh index 2a725f423bb..d0be2901c55 100644 --- a/source/blender/makesrna/intern/rna_internal_types.hh +++ b/source/blender/makesrna/intern/rna_internal_types.hh @@ -14,6 +14,7 @@ #include "DNA_listBase.h" #include "RNA_access.hh" +#include "RNA_define.hh" #include "RNA_types.hh" struct BlenderRNA; diff --git a/source/blender/python/generic/idprop_py_api.cc b/source/blender/python/generic/idprop_py_api.cc index 21e68361a18..40794f3f082 100644 --- a/source/blender/python/generic/idprop_py_api.cc +++ b/source/blender/python/generic/idprop_py_api.cc @@ -29,9 +29,9 @@ #include "python_utildefines.h" -extern "C" bool pyrna_id_FromPyObject(PyObject *obj, ID **id); -extern "C" PyObject *pyrna_id_CreatePyObject(ID *id); -extern "C" bool pyrna_id_CheckPyObject(PyObject *obj); +extern bool pyrna_id_FromPyObject(PyObject *obj, ID **id); +extern PyObject *pyrna_id_CreatePyObject(ID *id); +extern bool pyrna_id_CheckPyObject(PyObject *obj); /* Currently there is no need to expose this publicly. */ static PyObject *BPy_IDGroup_IterKeys_CreatePyObject(BPy_IDProperty *group, const bool reversed); diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index c671af02364..26fbedb12d2 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -98,18 +98,18 @@ set(SRC bpy_operator_wrap.h bpy_path.h bpy_props.h - bpy_rna.h - bpy_rna_anim.h - bpy_rna_callback.h - bpy_rna_context.h - bpy_rna_data.h - bpy_rna_driver.h - bpy_rna_gizmo.h - bpy_rna_id_collection.h - bpy_rna_operator.h - bpy_rna_text.h - bpy_rna_types_capi.h - bpy_rna_ui.h + bpy_rna.hh + bpy_rna_anim.hh + bpy_rna_callback.hh + bpy_rna_context.hh + bpy_rna_data.hh + bpy_rna_driver.hh + bpy_rna_gizmo.hh + bpy_rna_id_collection.hh + bpy_rna_operator.hh + bpy_rna_text.hh + bpy_rna_types_capi.hh + bpy_rna_ui.hh bpy_traceback.h bpy_utils_previews.h bpy_utils_units.h diff --git a/source/blender/python/intern/bpy.cc b/source/blender/python/intern/bpy.cc index 1b014db04ad..6e2e5a1f46f 100644 --- a/source/blender/python/intern/bpy.cc +++ b/source/blender/python/intern/bpy.cc @@ -39,10 +39,10 @@ #include "bpy_library.h" #include "bpy_operator.h" #include "bpy_props.h" -#include "bpy_rna.h" -#include "bpy_rna_data.h" -#include "bpy_rna_gizmo.h" -#include "bpy_rna_types_capi.h" +#include "bpy_rna.hh" +#include "bpy_rna_data.hh" +#include "bpy_rna_gizmo.hh" +#include "bpy_rna_types_capi.hh" #include "bpy_utils_previews.h" #include "bpy_utils_units.h" diff --git a/source/blender/python/intern/bpy_app_handlers.cc b/source/blender/python/intern/bpy_app_handlers.cc index 7ba170aefcf..8edbe6a403c 100644 --- a/source/blender/python/intern/bpy_app_handlers.cc +++ b/source/blender/python/intern/bpy_app_handlers.cc @@ -18,7 +18,7 @@ #include "RNA_access.hh" #include "bpy_app_handlers.h" -#include "bpy_rna.h" +#include "bpy_rna.hh" #include "../generic/python_utildefines.h" diff --git a/source/blender/python/intern/bpy_driver.cc b/source/blender/python/intern/bpy_driver.cc index ff9a18a8239..077125c8382 100644 --- a/source/blender/python/intern/bpy_driver.cc +++ b/source/blender/python/intern/bpy_driver.cc @@ -26,12 +26,12 @@ #include "RNA_access.hh" #include "RNA_prototypes.hh" -#include "bpy_rna_driver.h" /* For #pyrna_driver_get_variable_value. */ +#include "bpy_rna_driver.hh" /* For #pyrna_driver_get_variable_value. */ #include "bpy_intern_string.h" #include "bpy_driver.h" -#include "bpy_rna.h" +#include "bpy_rna.hh" #include "BPY_extern.h" diff --git a/source/blender/python/intern/bpy_gizmo_wrap.cc b/source/blender/python/intern/bpy_gizmo_wrap.cc index a3c0c59f211..1d624e474d6 100644 --- a/source/blender/python/intern/bpy_gizmo_wrap.cc +++ b/source/blender/python/intern/bpy_gizmo_wrap.cc @@ -26,7 +26,7 @@ #include "bpy_gizmo_wrap.h" /* own include */ #include "bpy_intern_string.h" -#include "bpy_rna.h" +#include "bpy_rna.hh" #include "../generic/py_capi_rna.h" #include "../generic/python_compat.h" diff --git a/source/blender/python/intern/bpy_interface.cc b/source/blender/python/intern/bpy_interface.cc index 137b37120a3..eac619aac05 100644 --- a/source/blender/python/intern/bpy_interface.cc +++ b/source/blender/python/intern/bpy_interface.cc @@ -38,7 +38,7 @@ #include "bpy_intern_string.h" #include "bpy_path.h" #include "bpy_props.h" -#include "bpy_rna.h" +#include "bpy_rna.hh" #include "bpy_traceback.h" #include "bpy_app_translations.h" diff --git a/source/blender/python/intern/bpy_library_load.cc b/source/blender/python/intern/bpy_library_load.cc index 0753f35c597..49bdd2eb621 100644 --- a/source/blender/python/intern/bpy_library_load.cc +++ b/source/blender/python/intern/bpy_library_load.cc @@ -46,7 +46,7 @@ #ifdef USE_RNA_DATABLOCKS # include "RNA_access.hh" -# include "bpy_rna.h" +# include "bpy_rna.hh" #endif struct BPy_Library { diff --git a/source/blender/python/intern/bpy_library_write.cc b/source/blender/python/intern/bpy_library_write.cc index 91f3ffc68ed..706927744fc 100644 --- a/source/blender/python/intern/bpy_library_write.cc +++ b/source/blender/python/intern/bpy_library_write.cc @@ -30,7 +30,7 @@ #include "bpy_capi_utils.h" #include "bpy_library.h" /* Declaration for #BPY_library_load_method_def */ -#include "bpy_rna.h" +#include "bpy_rna.hh" #include "../generic/py_capi_utils.h" #include "../generic/python_compat.h" diff --git a/source/blender/python/intern/bpy_msgbus.cc b/source/blender/python/intern/bpy_msgbus.cc index a5677df770b..2db4da40e5a 100644 --- a/source/blender/python/intern/bpy_msgbus.cc +++ b/source/blender/python/intern/bpy_msgbus.cc @@ -25,7 +25,7 @@ #include "RNA_access.hh" #include "bpy_capi_utils.h" -#include "bpy_rna.h" +#include "bpy_rna.hh" #include "bpy_msgbus.h" /* own include */ diff --git a/source/blender/python/intern/bpy_operator.cc b/source/blender/python/intern/bpy_operator.cc index 12181ed6788..ea933a9692d 100644 --- a/source/blender/python/intern/bpy_operator.cc +++ b/source/blender/python/intern/bpy_operator.cc @@ -29,7 +29,7 @@ #include "bpy_capi_utils.h" #include "bpy_operator.h" #include "bpy_operator_wrap.h" -#include "bpy_rna.h" /* for setting argument properties & type method `get_rna_type`. */ +#include "bpy_rna.hh" /* for setting argument properties & type method `get_rna_type`. */ #include "RNA_access.hh" #include "RNA_enum_types.hh" diff --git a/source/blender/python/intern/bpy_operator_wrap.cc b/source/blender/python/intern/bpy_operator_wrap.cc index abceadd5ea5..9d4b8ffdc90 100644 --- a/source/blender/python/intern/bpy_operator_wrap.cc +++ b/source/blender/python/intern/bpy_operator_wrap.cc @@ -24,7 +24,7 @@ #include "bpy_intern_string.h" #include "bpy_operator_wrap.h" /* own include */ -#include "bpy_rna.h" +#include "bpy_rna.hh" static void operator_properties_init(wmOperatorType *ot) { diff --git a/source/blender/python/intern/bpy_props.cc b/source/blender/python/intern/bpy_props.cc index 72e86ac0f5b..b2bef2ba352 100644 --- a/source/blender/python/intern/bpy_props.cc +++ b/source/blender/python/intern/bpy_props.cc @@ -25,7 +25,7 @@ #include "bpy_capi_utils.h" #include "bpy_props.h" -#include "bpy_rna.h" +#include "bpy_rna.hh" #include "RNA_access.hh" #include "RNA_define.hh" /* for defining our own rna */ diff --git a/source/blender/python/intern/bpy_rna.cc b/source/blender/python/intern/bpy_rna.cc index cdd3659259d..68bfe029cc3 100644 --- a/source/blender/python/intern/bpy_rna.cc +++ b/source/blender/python/intern/bpy_rna.cc @@ -33,9 +33,9 @@ #include "bpy_capi_utils.h" #include "bpy_intern_string.h" #include "bpy_props.h" -#include "bpy_rna.h" -#include "bpy_rna_anim.h" -#include "bpy_rna_callback.h" +#include "bpy_rna.hh" +#include "bpy_rna_anim.hh" +#include "bpy_rna_callback.hh" #ifdef USE_PYRNA_INVALIDATE_WEAKREF # include "BLI_ghash.h" diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.hh similarity index 92% rename from source/blender/python/intern/bpy_rna.h rename to source/blender/python/intern/bpy_rna.hh index 456ffee2b99..3b840cd474b 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.hh @@ -9,6 +9,7 @@ #pragma once /* --- bpy build options --- */ +#include "intern/rna_internal_types.hh" #ifdef WITH_PYTHON_SAFETY /** @@ -54,10 +55,6 @@ struct ID; -#ifdef __cplusplus -extern "C" { -#endif - /** * Sub-classes of #pyrna_struct_Type which support idprop definitions use this as a meta-class. * \note tp_base member is set to `&PyType_Type` on initialization. @@ -111,15 +108,15 @@ extern PyTypeObject pyrna_func_Type; /* 'in_weakreflist' MUST be aligned */ -typedef struct { +struct BPy_DummyPointerRNA { PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS PyObject *in_weakreflist; #endif PointerRNA ptr; -} BPy_DummyPointerRNA; +}; -typedef struct BPy_StructRNA { +struct BPy_StructRNA { PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS PyObject *in_weakreflist; @@ -135,18 +132,18 @@ typedef struct BPy_StructRNA { /** Needed in some cases if ptr.data is created on the fly, free when deallocating. */ bool freeptr; #endif /* PYRNA_FREE_SUPPORT */ -} BPy_StructRNA; +}; -typedef struct { +struct BPy_PropertyRNA { PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS PyObject *in_weakreflist; #endif PointerRNA ptr; PropertyRNA *prop; -} BPy_PropertyRNA; +}; -typedef struct { +struct BPy_PropertyArrayRNA { PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS PyObject *in_weakreflist; @@ -159,9 +156,9 @@ typedef struct { int arraydim; /** Array first item offset, e.g. if face.uv is [4][2], arrayoffset for face.uv[n] is 2n. */ int arrayoffset; -} BPy_PropertyArrayRNA; +}; -typedef struct { +struct BPy_PropertyCollectionIterRNA { PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS PyObject *in_weakreflist; @@ -169,16 +166,16 @@ typedef struct { /* collection iterator specific parts */ CollectionPropertyIterator iter; -} BPy_PropertyCollectionIterRNA; +}; -typedef struct { +struct BPy_FunctionRNA { PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS PyObject *in_weakreflist; #endif PointerRNA ptr; FunctionRNA *func; -} BPy_FunctionRNA; +}; StructRNA *srna_from_self(PyObject *self, const char *error_prefix); StructRNA *pyrna_struct_as_srna(PyObject *self, bool parent, const char *error_prefix); @@ -196,15 +193,15 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr); PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop); /* extern'd by other modules which don't deal closely with RNA */ -PyObject *pyrna_id_CreatePyObject(struct ID *id); -bool pyrna_id_FromPyObject(PyObject *obj, struct ID **id); +PyObject *pyrna_id_CreatePyObject(ID *id); +bool pyrna_id_FromPyObject(PyObject *obj, ID **id); bool pyrna_id_CheckPyObject(PyObject *obj); /* operators also need this to set args */ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, bool all_args, const char *error_prefix); PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop); -int pyrna_deferred_register_class(struct StructRNA *srna, PyTypeObject *py_class); +int pyrna_deferred_register_class(StructRNA *srna, PyTypeObject *py_class); const PointerRNA *pyrna_struct_as_ptr(PyObject *py_obj, const StructRNA *srna); const PointerRNA *pyrna_struct_as_ptr_or_null(PyObject *py_obj, const StructRNA *srna); @@ -233,9 +230,7 @@ int pyrna_struct_as_ptr_parse(PyObject *o, void *p); */ int pyrna_struct_as_ptr_or_null_parse(PyObject *o, void *p); -void pyrna_struct_type_extend_capi(struct StructRNA *srna, - struct PyMethodDef *method, - struct PyGetSetDef *getset); +void pyrna_struct_type_extend_capi(StructRNA *srna, PyMethodDef *method, PyGetSetDef *getset); /* Called before stopping Python. */ @@ -283,7 +278,3 @@ extern PyMethodDef meth_bpy_owner_id_set; extern PyMethodDef meth_bpy_owner_id_get; extern BPy_StructRNA *bpy_context_module; - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_rna_anim.cc b/source/blender/python/intern/bpy_rna_anim.cc index a6b59ab7196..4b16c5bb539 100644 --- a/source/blender/python/intern/bpy_rna_anim.cc +++ b/source/blender/python/intern/bpy_rna_anim.cc @@ -42,8 +42,8 @@ #include "WM_types.hh" #include "bpy_capi_utils.h" -#include "bpy_rna.h" -#include "bpy_rna_anim.h" +#include "bpy_rna.hh" +#include "bpy_rna_anim.hh" #include "../generic/py_capi_rna.h" #include "../generic/python_utildefines.h" diff --git a/source/blender/python/intern/bpy_rna_anim.h b/source/blender/python/intern/bpy_rna_anim.hh similarity index 90% rename from source/blender/python/intern/bpy_rna_anim.h rename to source/blender/python/intern/bpy_rna_anim.hh index e08c286b24e..190a8ff0c48 100644 --- a/source/blender/python/intern/bpy_rna_anim.h +++ b/source/blender/python/intern/bpy_rna_anim.hh @@ -8,10 +8,6 @@ * \ingroup pythonintern */ -#ifdef __cplusplus -extern "C" { -#endif - extern char pyrna_struct_keyframe_insert_doc[]; extern char pyrna_struct_keyframe_delete_doc[]; extern char pyrna_struct_driver_add_doc[]; @@ -21,7 +17,3 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyObject *kw); PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args); PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args); - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_rna_array.cc b/source/blender/python/intern/bpy_rna_array.cc index 3dac6827d80..9d37a8578ce 100644 --- a/source/blender/python/intern/bpy_rna_array.cc +++ b/source/blender/python/intern/bpy_rna_array.cc @@ -16,7 +16,7 @@ #include "RNA_types.hh" -#include "bpy_rna.h" +#include "bpy_rna.hh" #include "MEM_guardedalloc.h" diff --git a/source/blender/python/intern/bpy_rna_callback.cc b/source/blender/python/intern/bpy_rna_callback.cc index be85f8aea81..5bac2df1e9c 100644 --- a/source/blender/python/intern/bpy_rna_callback.cc +++ b/source/blender/python/intern/bpy_rna_callback.cc @@ -29,8 +29,8 @@ #include "BPY_extern.h" /* For public API. */ #include "bpy_capi_utils.h" -#include "bpy_rna.h" -#include "bpy_rna_callback.h" /* Own include. */ +#include "bpy_rna.hh" +#include "bpy_rna_callback.hh" /* Own include. */ /* Use this to stop other capsules from being mis-used. */ static const char *rna_capsual_id = "RNA_HANDLE"; diff --git a/source/blender/python/intern/bpy_rna_callback.h b/source/blender/python/intern/bpy_rna_callback.hh similarity index 87% rename from source/blender/python/intern/bpy_rna_callback.h rename to source/blender/python/intern/bpy_rna_callback.hh index dc63f4593c5..e30602daf33 100644 --- a/source/blender/python/intern/bpy_rna_callback.h +++ b/source/blender/python/intern/bpy_rna_callback.hh @@ -10,10 +10,6 @@ struct BPy_StructRNA; -#ifdef __cplusplus -extern "C" { -#endif - #if 0 PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args); PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args); @@ -21,7 +17,3 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args); PyObject *pyrna_callback_classmethod_add(PyObject *self, PyObject *args); PyObject *pyrna_callback_classmethod_remove(PyObject *self, PyObject *args); - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_rna_context.cc b/source/blender/python/intern/bpy_rna_context.cc index 54719f0c457..c6ed3b8e322 100644 --- a/source/blender/python/intern/bpy_rna_context.cc +++ b/source/blender/python/intern/bpy_rna_context.cc @@ -21,14 +21,14 @@ #include "WM_api.hh" #include "WM_types.hh" -#include "bpy_rna_context.h" +#include "bpy_rna_context.hh" #include "../generic/python_compat.h" #include "RNA_access.hh" #include "RNA_prototypes.hh" -#include "bpy_rna.h" +#include "bpy_rna.hh" /* -------------------------------------------------------------------- */ /** \name Private Utility Functions diff --git a/source/blender/python/intern/bpy_rna_context.h b/source/blender/python/intern/bpy_rna_context.hh similarity index 78% rename from source/blender/python/intern/bpy_rna_context.h rename to source/blender/python/intern/bpy_rna_context.hh index e988ff4f875..1a4e7e5ed29 100644 --- a/source/blender/python/intern/bpy_rna_context.h +++ b/source/blender/python/intern/bpy_rna_context.hh @@ -8,14 +8,6 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - extern PyMethodDef BPY_rna_context_temp_override_method_def; void bpy_rna_context_types_init(void); - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_rna_data.cc b/source/blender/python/intern/bpy_rna_data.cc index 52560910045..35c28b43ad0 100644 --- a/source/blender/python/intern/bpy_rna_data.cc +++ b/source/blender/python/intern/bpy_rna_data.cc @@ -28,8 +28,8 @@ #include "RNA_access.hh" #include "RNA_prototypes.hh" -#include "bpy_rna.h" -#include "bpy_rna_data.h" +#include "bpy_rna.hh" +#include "bpy_rna_data.hh" struct BPy_DataContext { PyObject_HEAD /* Required Python macro. */ diff --git a/source/blender/python/intern/bpy_rna_data.h b/source/blender/python/intern/bpy_rna_data.hh similarity index 78% rename from source/blender/python/intern/bpy_rna_data.h rename to source/blender/python/intern/bpy_rna_data.hh index f03c76122f3..6af6a16eff6 100644 --- a/source/blender/python/intern/bpy_rna_data.h +++ b/source/blender/python/intern/bpy_rna_data.hh @@ -8,14 +8,6 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - int BPY_rna_data_context_type_ready(void); extern PyMethodDef BPY_rna_data_context_method_def; - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_rna_driver.cc b/source/blender/python/intern/bpy_rna_driver.cc index 8db248cb3cd..b811e70f026 100644 --- a/source/blender/python/intern/bpy_rna_driver.cc +++ b/source/blender/python/intern/bpy_rna_driver.cc @@ -20,9 +20,9 @@ #include "RNA_access.hh" -#include "bpy_rna.h" +#include "bpy_rna.hh" -#include "bpy_rna_driver.h" /* own include */ +#include "bpy_rna_driver.hh" /* own include */ PyObject *pyrna_driver_get_variable_value(const AnimationEvalContext *anim_eval_context, ChannelDriver *driver, diff --git a/source/blender/python/intern/bpy_rna_driver.h b/source/blender/python/intern/bpy_rna_driver.h deleted file mode 100644 index 5d67e2735b2..00000000000 --- a/source/blender/python/intern/bpy_rna_driver.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-FileCopyrightText: 2023 Blender Authors - * - * SPDX-License-Identifier: GPL-2.0-or-later */ - -#pragma once - -/** \file - * \ingroup pythonintern - */ - -struct ChannelDriver; -struct DriverTarget; -struct PathResolvedRNA; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * A version of #driver_get_variable_value which returns a #PyObject. - */ -PyObject *pyrna_driver_get_variable_value(const struct AnimationEvalContext *anim_eval_context, - struct ChannelDriver *driver, - struct DriverVar *dvar, - struct DriverTarget *dtar); - -PyObject *pyrna_driver_self_from_anim_rna(struct PathResolvedRNA *anim_rna); -bool pyrna_driver_is_equal_anim_rna(const struct PathResolvedRNA *anim_rna, - const PyObject *py_anim_rna); - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_rna_driver.hh b/source/blender/python/intern/bpy_rna_driver.hh new file mode 100644 index 00000000000..fcfd2bfc615 --- /dev/null +++ b/source/blender/python/intern/bpy_rna_driver.hh @@ -0,0 +1,26 @@ +/* SPDX-FileCopyrightText: 2023 Blender Authors + * + * SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +/** \file + * \ingroup pythonintern + */ + +struct AnimationEvalContext; +struct ChannelDriver; +struct DriverTarget; +struct DriverVar; +struct PathResolvedRNA; + +/** + * A version of #driver_get_variable_value which returns a #PyObject. + */ +PyObject *pyrna_driver_get_variable_value(const AnimationEvalContext *anim_eval_context, + ChannelDriver *driver, + DriverVar *dvar, + DriverTarget *dtar); + +PyObject *pyrna_driver_self_from_anim_rna(PathResolvedRNA *anim_rna); +bool pyrna_driver_is_equal_anim_rna(const PathResolvedRNA *anim_rna, const PyObject *py_anim_rna); diff --git a/source/blender/python/intern/bpy_rna_gizmo.cc b/source/blender/python/intern/bpy_rna_gizmo.cc index b41ffbf54f8..edd5b5b455d 100644 --- a/source/blender/python/intern/bpy_rna_gizmo.cc +++ b/source/blender/python/intern/bpy_rna_gizmo.cc @@ -19,7 +19,7 @@ #include "WM_types.hh" #include "bpy_capi_utils.h" -#include "bpy_rna_gizmo.h" +#include "bpy_rna_gizmo.hh" #include "../generic/py_capi_utils.h" #include "../generic/python_compat.h" @@ -27,7 +27,7 @@ #include "RNA_access.hh" #include "RNA_prototypes.hh" -#include "bpy_rna.h" +#include "bpy_rna.hh" /* -------------------------------------------------------------------- */ /** \name Parsing Utility Functions diff --git a/source/blender/python/intern/bpy_rna_gizmo.h b/source/blender/python/intern/bpy_rna_gizmo.hh similarity index 73% rename from source/blender/python/intern/bpy_rna_gizmo.h rename to source/blender/python/intern/bpy_rna_gizmo.hh index 8146cea696f..86f59781a24 100644 --- a/source/blender/python/intern/bpy_rna_gizmo.h +++ b/source/blender/python/intern/bpy_rna_gizmo.hh @@ -8,12 +8,4 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - bool BPY_rna_gizmo_module(PyObject *); - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_rna_id_collection.cc b/source/blender/python/intern/bpy_rna_id_collection.cc index 7646257c9c1..93d314c19ba 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.cc +++ b/source/blender/python/intern/bpy_rna_id_collection.cc @@ -28,7 +28,7 @@ #include "WM_api.hh" #include "WM_types.hh" -#include "bpy_rna_id_collection.h" +#include "bpy_rna_id_collection.hh" #include "../generic/py_capi_rna.h" #include "../generic/py_capi_utils.h" @@ -36,7 +36,7 @@ #include "RNA_enum_types.hh" -#include "bpy_rna.h" +#include "bpy_rna.hh" struct IDUserMapData { /** We loop over data-blocks that this ID points to (do build a reverse lookup table) */ diff --git a/source/blender/python/intern/bpy_rna_id_collection.h b/source/blender/python/intern/bpy_rna_id_collection.hh similarity index 83% rename from source/blender/python/intern/bpy_rna_id_collection.h rename to source/blender/python/intern/bpy_rna_id_collection.hh index 0b89eceeddf..586c50e57ca 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.h +++ b/source/blender/python/intern/bpy_rna_id_collection.hh @@ -8,14 +8,6 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - extern PyMethodDef BPY_rna_id_collection_user_map_method_def; extern PyMethodDef BPY_rna_id_collection_batch_remove_method_def; extern PyMethodDef BPY_rna_id_collection_orphans_purge_method_def; - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_rna_operator.cc b/source/blender/python/intern/bpy_rna_operator.cc index 21f5d840666..973be37584f 100644 --- a/source/blender/python/intern/bpy_rna_operator.cc +++ b/source/blender/python/intern/bpy_rna_operator.cc @@ -19,7 +19,7 @@ #include "BPY_extern.h" #include "bpy_capi_utils.h" -#include "bpy_rna_operator.h" /* Own include, #BPY_rna_operator_poll_message_set_method_def. */ +#include "bpy_rna_operator.hh" /* Own include, #BPY_rna_operator_poll_message_set_method_def. */ /* -------------------------------------------------------------------- */ /** \name Operator `poll_message_set` Method diff --git a/source/blender/python/intern/bpy_rna_operator.h b/source/blender/python/intern/bpy_rna_operator.hh similarity index 76% rename from source/blender/python/intern/bpy_rna_operator.h rename to source/blender/python/intern/bpy_rna_operator.hh index b8f286baa7e..eeced684898 100644 --- a/source/blender/python/intern/bpy_rna_operator.h +++ b/source/blender/python/intern/bpy_rna_operator.hh @@ -8,12 +8,4 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - extern PyMethodDef BPY_rna_operator_poll_message_set_method_def; - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_rna_text.cc b/source/blender/python/intern/bpy_rna_text.cc index 6fe476964c8..c16d37e178d 100644 --- a/source/blender/python/intern/bpy_rna_text.cc +++ b/source/blender/python/intern/bpy_rna_text.cc @@ -20,8 +20,8 @@ #include "../generic/python_compat.h" -#include "bpy_rna.h" -#include "bpy_rna_text.h" /* Declare #BPY_rna_region_as_string_method_def. */ +#include "bpy_rna.hh" +#include "bpy_rna_text.hh" /* Declare #BPY_rna_region_as_string_method_def. */ /* -------------------------------------------------------------------- */ /** \name Data structures. diff --git a/source/blender/python/intern/bpy_rna_text.h b/source/blender/python/intern/bpy_rna_text.hh similarity index 79% rename from source/blender/python/intern/bpy_rna_text.h rename to source/blender/python/intern/bpy_rna_text.hh index d8f801e9f63..7fd854db5c1 100644 --- a/source/blender/python/intern/bpy_rna_text.h +++ b/source/blender/python/intern/bpy_rna_text.hh @@ -8,13 +8,5 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - extern PyMethodDef BPY_rna_region_as_string_method_def; extern PyMethodDef BPY_rna_region_from_string_method_def; - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_rna_types_capi.cc b/source/blender/python/intern/bpy_rna_types_capi.cc index 74c54939de7..3fe52a686af 100644 --- a/source/blender/python/intern/bpy_rna_types_capi.cc +++ b/source/blender/python/intern/bpy_rna_types_capi.cc @@ -22,16 +22,16 @@ #include "BLI_utildefines.h" #include "bpy_library.h" -#include "bpy_rna.h" -#include "bpy_rna_callback.h" -#include "bpy_rna_context.h" -#include "bpy_rna_data.h" -#include "bpy_rna_id_collection.h" -#include "bpy_rna_text.h" -#include "bpy_rna_types_capi.h" -#include "bpy_rna_ui.h" +#include "bpy_rna.hh" +#include "bpy_rna_callback.hh" +#include "bpy_rna_context.hh" +#include "bpy_rna_data.hh" +#include "bpy_rna_id_collection.hh" +#include "bpy_rna_text.hh" +#include "bpy_rna_types_capi.hh" +#include "bpy_rna_ui.hh" -#include "bpy_rna_operator.h" +#include "bpy_rna_operator.hh" #include "../generic/py_capi_utils.h" diff --git a/source/blender/python/intern/bpy_rna_types_capi.h b/source/blender/python/intern/bpy_rna_types_capi.hh similarity index 73% rename from source/blender/python/intern/bpy_rna_types_capi.h rename to source/blender/python/intern/bpy_rna_types_capi.hh index 75b319ca5d4..92e8329f354 100644 --- a/source/blender/python/intern/bpy_rna_types_capi.h +++ b/source/blender/python/intern/bpy_rna_types_capi.hh @@ -8,12 +8,4 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - void BPY_rna_types_extend_capi(void); - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_rna_ui.cc b/source/blender/python/intern/bpy_rna_ui.cc index 8ac4c5b68b0..058334c8b53 100644 --- a/source/blender/python/intern/bpy_rna_ui.cc +++ b/source/blender/python/intern/bpy_rna_ui.cc @@ -16,8 +16,8 @@ #include "UI_interface.hh" -#include "bpy_rna.h" -#include "bpy_rna_ui.h" /* Declare #BPY_rna_uilayout_introspect_method_def. */ +#include "bpy_rna.hh" +#include "bpy_rna_ui.hh" /* Declare #BPY_rna_uilayout_introspect_method_def. */ PyDoc_STRVAR( /* Wrap. */ diff --git a/source/blender/python/intern/bpy_rna_ui.h b/source/blender/python/intern/bpy_rna_ui.hh similarity index 75% rename from source/blender/python/intern/bpy_rna_ui.h rename to source/blender/python/intern/bpy_rna_ui.hh index ff5f3ac63e1..5d228dc36c6 100644 --- a/source/blender/python/intern/bpy_rna_ui.h +++ b/source/blender/python/intern/bpy_rna_ui.hh @@ -8,12 +8,4 @@ #pragma once -#ifdef __cplusplus -extern "C" { -#endif - extern PyMethodDef BPY_rna_uilayout_introspect_method_def; - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/python/intern/bpy_utils_previews.cc b/source/blender/python/intern/bpy_utils_previews.cc index d55b2ff4602..811a8bdfea4 100644 --- a/source/blender/python/intern/bpy_utils_previews.cc +++ b/source/blender/python/intern/bpy_utils_previews.cc @@ -19,7 +19,7 @@ #include "RNA_access.hh" #include "RNA_prototypes.hh" -#include "bpy_rna.h" +#include "bpy_rna.hh" #include "bpy_utils_previews.h" #include "../generic/py_capi_utils.h" diff --git a/source/blender/render/hydra/python.cc b/source/blender/render/hydra/python.cc index 11a4522645a..8c5f5ea3c6f 100644 --- a/source/blender/render/hydra/python.cc +++ b/source/blender/render/hydra/python.cc @@ -11,7 +11,7 @@ #include "RE_engine.h" #include "../generic/py_capi_utils.h" -#include "bpy_rna.h" +#include "bpy_rna.hh" #include "BKE_context.hh"