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:
authorJulian Eisel <julian@blender.org>2022-03-14 18:39:42 +0300
committerJulian Eisel <julian@blender.org>2022-03-14 18:50:49 +0300
commit9b298cf3dbec9e246748448cc635a5055fe90c19 (patch)
treec9fb6ddaf16bec463d9d4dd5a65a8c9d285afc8f /source/blender/windowmanager
parentcff6eb65804da3a06bde3c9152bec26e01a24992 (diff)
RNA: Generate property declerations header, solving msg-bus C++ incompatibility
Lets `makesrna` generate a `RNA_prototypes.h` header with declarations for all RNA properties. This can be included in regular source files when needing to reference RNA properties statically. This solves an issue on MSVC with adding such declarations in functions, like we used to do. See 800fc1736748. Removes any such declarations and the related FIXME comments. Reviewed By: campbellbarton, LazyDodo, brecht Differential Revision: https://developer.blender.org/D13837
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/CMakeLists.txt4
-rw-r--r--source/blender/windowmanager/message_bus/wm_message_bus.h22
2 files changed, 5 insertions, 21 deletions
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index bd8e97e7177..73a5f1e6f8d 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -29,6 +29,8 @@ set(INC
# for writefile.c: dna_type_offsets.h
${CMAKE_BINARY_DIR}/source/blender/makesdna/intern
+ # RNA_prototypes.h
+ ${CMAKE_BINARY_DIR}/source/blender/makesrna
)
set(SRC
@@ -193,3 +195,5 @@ blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# Needed so we can use dna_type_offsets.h for defaults initialization.
add_dependencies(bf_windowmanager bf_dna)
+# RNA_prototypes.h
+add_dependencies(bf_windowmanager bf_rna)
diff --git a/source/blender/windowmanager/message_bus/wm_message_bus.h b/source/blender/windowmanager/message_bus/wm_message_bus.h
index c46f5d6df72..ccb9b92349a 100644
--- a/source/blender/windowmanager/message_bus/wm_message_bus.h
+++ b/source/blender/windowmanager/message_bus/wm_message_bus.h
@@ -6,6 +6,7 @@
#pragma once
+#include "RNA_prototypes.h"
#include "RNA_types.h"
#include <stdio.h>
@@ -230,23 +231,9 @@ void WM_msg_subscribe_ID(struct wmMsgBus *mbus,
const char *id_repr);
void WM_msg_publish_ID(struct wmMsgBus *mbus, struct ID *id);
-/* FIXME
- *
- * For C++ code, some of the following macros need to be called in functions wrapped in
- * `extern "C"` blocks. That is, the ones doing `extern PropertyRNA` declarations (trips up the
- * MSVC linker).
- * Although this shouldn't cause problems normally, if it does, the bits calling the macros can be
- * moved to a separate function wrapped in `extern "C"`.
- *
- * Obviously this should be fixed properly (by not relying on inline `extern` declarations).
- */
-
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_) \
{ \
wmMsgParams_RNA msg_key_params_ = {{0}}; \
- _WM_MESSAGE_EXTERN_BEGIN; \
- extern PropertyRNA rna_##type_##_##prop_; \
- _WM_MESSAGE_EXTERN_END; \
RNA_pointer_create(id_, &RNA_##type_, data_, &msg_key_params_.ptr); \
msg_key_params_.prop = &rna_##type_##_##prop_; \
WM_msg_publish_rna_params(mbus, &msg_key_params_); \
@@ -255,9 +242,6 @@ void WM_msg_publish_ID(struct wmMsgBus *mbus, struct ID *id);
#define WM_msg_subscribe_rna_prop(mbus, id_, data_, type_, prop_, value) \
{ \
wmMsgParams_RNA msg_key_params_ = {{0}}; \
- _WM_MESSAGE_EXTERN_BEGIN; \
- extern PropertyRNA rna_##type_##_##prop_; \
- _WM_MESSAGE_EXTERN_END; \
RNA_pointer_create(id_, &RNA_##type_, data_, &msg_key_params_.ptr); \
msg_key_params_.prop = &rna_##type_##_##prop_; \
WM_msg_subscribe_rna_params(mbus, &msg_key_params_, value, __func__); \
@@ -276,10 +260,6 @@ void WM_msg_publish_ID(struct wmMsgBus *mbus, struct ID *id);
((void)0)
#define WM_msg_subscribe_rna_anon_prop(mbus, type_, prop_, value) \
{ \
- _WM_MESSAGE_EXTERN_BEGIN; \
- extern PropertyRNA rna_##type_##_##prop_; \
- _WM_MESSAGE_EXTERN_END; \
-\
PointerRNA msg_ptr_ = {0, &RNA_##type_}; \
wmMsgParams_RNA msg_key_params_ = {{0}}; \
msg_key_params_.ptr = msg_ptr_; \