Cleanup: move panel runtime data out of dna header

This commit is contained in:
Jacques Lucke 2023-10-11 11:48:37 +02:00
parent c393d2a4d9
commit 613a0ad651
2 changed files with 25 additions and 24 deletions

View File

@ -339,6 +339,29 @@ enum {
PANEL_TYPE_NO_SEARCH = (1 << 7),
};
typedef struct Panel_Runtime {
/* Applied to Panel.ofsx, but saved separately so we can track changes between redraws. */
int region_ofsx;
char _pad[4];
/**
* Pointer for storing which data the panel corresponds to.
* Useful when there can be multiple instances of the same panel type.
*
* \note A panel and its sub-panels share the same custom data pointer.
* This avoids freeing the same pointer twice when panels are removed.
*/
struct PointerRNA *custom_data_ptr;
/* Pointer to the panel's block. Useful when changes to panel #uiBlocks
* need some context from traversal of the panel "tree". */
struct uiBlock *block;
/* Non-owning pointer. The context is stored in the block. */
struct bContextStore *context;
} Panel_Runtime;
/* #uiList types. */
/** Draw an item in the `ui_list`. */

View File

@ -31,6 +31,7 @@ struct uiList;
struct wmDrawBuffer;
struct wmTimer;
struct wmTooltipState;
struct Panel_Runtime;
/* TODO: Doing this is quite ugly :)
* Once the top-bar is merged bScreen should be refactored to use ScrAreaMap. */
@ -120,29 +121,6 @@ typedef struct ScrAreaMap {
ListBase areabase;
} ScrAreaMap;
typedef struct Panel_Runtime {
/* Applied to Panel.ofsx, but saved separately so we can track changes between redraws. */
int region_ofsx;
char _pad[4];
/**
* Pointer for storing which data the panel corresponds to.
* Useful when there can be multiple instances of the same panel type.
*
* \note A panel and its sub-panels share the same custom data pointer.
* This avoids freeing the same pointer twice when panels are removed.
*/
struct PointerRNA *custom_data_ptr;
/* Pointer to the panel's block. Useful when changes to panel #uiBlocks
* need some context from traversal of the panel "tree". */
struct uiBlock *block;
/* Non-owning pointer. The context is stored in the block. */
struct bContextStore *context;
} Panel_Runtime;
/** The part from uiBlock that needs saved in file. */
typedef struct Panel {
struct Panel *next, *prev;
@ -172,7 +150,7 @@ typedef struct Panel {
/** Sub panels. */
ListBase children;
Panel_Runtime *runtime;
struct Panel_Runtime *runtime;
} Panel;
/**