[Bf-blender-cvs] [1abd909a92b] master: Cleanup: remove DNA_PRIVATE_WORKSPACE hacks.

Brecht Van Lommel noreply at git.blender.org
Tue Apr 2 13:42:54 CEST 2019


Commit: 1abd909a92b696eb556b071671314f35d5d5bde0
Author: Brecht Van Lommel
Date:   Tue Apr 2 13:21:21 2019 +0200
Branches: master
https://developer.blender.org/rB1abd909a92b696eb556b071671314f35d5d5bde0

Cleanup: remove DNA_PRIVATE_WORKSPACE hacks.

This is just not practical to do for the code as a whole, and having it as an
exception for one specific data structure is not that helpful. This has only
been in the way for me when refactoring code.

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

M	source/blender/blenkernel/intern/workspace.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/makesdna/DNA_workspace_types.h
M	source/blender/makesdna/intern/makesdna.c
M	source/blender/makesrna/intern/rna_workspace.c

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

diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index d4adc78f334..e264856acb2 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -18,9 +18,6 @@
  * \ingroup bke
  */
 
-/* allow accessing private members of DNA_workspace_types.h */
-#define DNA_PRIVATE_WORKSPACE_ALLOW
-
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index f6742ac55cd..eedd116d31f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -45,10 +45,6 @@
 
 /* allow readfile to use deprecated functionality */
 #define DNA_DEPRECATED_ALLOW
-/* Allow using DNA struct members that are marked as private for read/write.
- * Note: Each header that uses this needs to define its own way of handling
- * it. There's no generic implementation, direct use does nothing. */
-#define DNA_PRIVATE_READ_WRITE_ALLOW
 
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index ebc46d7573b..e0746c7c3dd 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -93,10 +93,6 @@
 
 /* allow writefile to use deprecated functionality (for forward compatibility code) */
 #define DNA_DEPRECATED_ALLOW
-/* Allow using DNA struct members that are marked as private for read/write.
- * Note: Each header that uses this needs to define its own way of handling
- * it. There's no generic implementation, direct use does nothing. */
-#define DNA_PRIVATE_READ_WRITE_ALLOW
 
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h
index 3212ddb335e..37277d7df8e 100644
--- a/source/blender/makesdna/DNA_workspace_types.h
+++ b/source/blender/makesdna/DNA_workspace_types.h
@@ -17,9 +17,7 @@
 /** \file
  * \ingroup DNA
  *
- * Use API in BKE_workspace.h!
- * Struct members marked with DNA_PRIVATE_WORKSPACE will throw a
- * warning saying it's deprecated when used outside of workspace.c.
+ * Use API in BKE_workspace.h to edit these.
  */
 
 #ifndef __DNA_WORKSPACE_TYPES_H__
@@ -27,25 +25,6 @@
 
 #include "DNA_scene_types.h"
 
-/* Same logic as DNA_DEPRECATED_ALLOW, but throws 'deprecated'
- * warnings if DNA_PRIVATE_WORKSPACE_ALLOW is not defined */
-#ifdef DNA_PRIVATE_WORKSPACE_ALLOW
-   /* allow use of private items */
-#  define DNA_PRIVATE_WORKSPACE
-#else
-#  ifndef DNA_PRIVATE_WORKSPACE
-#    define DNA_PRIVATE_WORKSPACE DNA_PRIVATE_ATTR
-#  endif
-#endif
-
-#ifdef DNA_PRIVATE_READ_WRITE_ALLOW
-#  define DNA_PRIVATE_WORKSPACE_READ_WRITE
-#else
-#  ifndef DNA_PRIVATE_WORKSPACE_READ_WRITE
-#    define DNA_PRIVATE_WORKSPACE_READ_WRITE DNA_PRIVATE_WORKSPACE
-#  endif
-#endif
-
 /* Currently testing, allow to disable. */
 #define USE_WORKSPACE_TOOL
 
@@ -111,25 +90,25 @@ typedef struct WorkSpaceLayout {
 	/* The name of this layout, we override the RNA name of the screen with this
 	 * (but not ID name itself) */
 	/** MAX_NAME. */
-	char name[64] DNA_PRIVATE_WORKSPACE;
+	char name[64];
 } WorkSpaceLayout;
 
 /** Optional tags, which features to use, aligned with #bAddon names by convention. */
 typedef struct wmOwnerID {
 	struct wmOwnerID *next, *prev;
 	/** MAX_NAME. */
-	char name[64] DNA_PRIVATE_WORKSPACE;
+	char name[64];
 } wmOwnerID;
 
 typedef struct WorkSpace {
 	ID id;
 
 	/** WorkSpaceLayout. */
-	ListBase layouts DNA_PRIVATE_WORKSPACE;
+	ListBase layouts;
 	/* Store for each hook (so for each window) which layout has
 	 * been activated the last time this workspace was visible. */
 	/** WorkSpaceDataRelation. */
-	ListBase hook_layout_relations DNA_PRIVATE_WORKSPACE_READ_WRITE;
+	ListBase hook_layout_relations;
 
 	/* Feature tagging (use for addons) */
 	/** #wmOwnerID. */
@@ -160,9 +139,6 @@ typedef struct WorkSpace {
 	char *status_text;
 } WorkSpace;
 
-/* internal struct, but exported for read/write */
-#if defined(DNA_PRIVATE_READ_WRITE_ALLOW) || defined(DNA_PRIVATE_WORKSPACE_ALLOW)
-
 /**
  * Generic (and simple/primitive) struct for storing a history of assignments/relations
  * of workspace data to non-workspace data in a listbase inside the workspace.
@@ -196,15 +172,13 @@ typedef struct WorkSpaceDataRelation {
 	void *value;
 } WorkSpaceDataRelation;
 
-#endif /* DNA_PRIVATE_WORKSPACE_READ_WRITE */
-
 /**
  * Little wrapper to store data that is going to be per window, but coming from the workspace.
  * It allows us to keep workspace and window data completely separate.
  */
 typedef struct WorkSpaceInstanceHook {
-	WorkSpace *active DNA_PRIVATE_WORKSPACE;
-	struct WorkSpaceLayout *act_layout DNA_PRIVATE_WORKSPACE;
+	WorkSpace *active;
+	struct WorkSpaceLayout *act_layout;
 
 	/* Needed because we can't change workspaces/layouts in running handler loop,
 	 * it would break context. */
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 4e16aec5fdc..2467a347295 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -617,17 +617,6 @@ static int preprocess_include(char *maindata, const int maindata_len)
 			a -= 13;
 			cp += 13;
 		}
-		else if (strncmp("DNA_PRIVATE_WORKSPACE", cp, 21) == 0) {
-			/* Check for DNA_PRIVATE_WORKSPACE_READ_WRITE */
-			if (strncmp("_READ_WRITE", cp + 21, 11) == 0) {
-				a -= 31;
-				cp += 31;
-			}
-			else {
-				a -= 20;
-				cp += 20;
-			}
-		}
 		else {
 			md[0] = cp[0];
 			md++;
diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c
index ab0af6c0a91..d075439fcee 100644
--- a/source/blender/makesrna/intern/rna_workspace.c
+++ b/source/blender/makesrna/intern/rna_workspace.c
@@ -33,8 +33,6 @@
 
 #include "rna_internal.h"
 
-/* Allow accessing private members of DNA_workspace_types.h */
-#define DNA_PRIVATE_WORKSPACE_ALLOW
 #include "DNA_workspace_types.h"
 
 #ifdef RNA_RUNTIME



More information about the Bf-blender-cvs mailing list