From 9cc638fb161c1a9795dc3351520ad16c573b4f1f Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 28 May 2009 23:13:42 +0000 Subject: Context: Added a system for adding a "local" context in a UI layout. This way you can define for example within a modifier panel all operators to get the modifier in the context. In the layout code: uiLayoutSetContextPointer(layout, "modifier", &ptr) layout.set_context_pointer("modifier", md) In the operator: ptr = CTX_data_pointer_get(C, "modifier") md = context.modifier --- source/blender/blenkernel/BKE_context.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source/blender/blenkernel/BKE_context.h') diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index f08b14c7820..6a43f4ca25c 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -72,6 +72,20 @@ typedef struct bContextDataResult bContextDataResult; typedef int (*bContextDataCallback)(const bContext *C, const char *member, bContextDataResult *result); +typedef struct bContextStoreEntry { + struct bContextStoreEntry *next, *prev; + + char name[128]; + PointerRNA ptr; +} bContextStoreEntry; + +typedef struct bContextStore { + struct bContextStore *next, *prev; + + ListBase entries; + int used; +} bContextStore; + /* Context */ bContext *CTX_create(void); @@ -79,6 +93,14 @@ void CTX_free(bContext *C); bContext *CTX_copy(const bContext *C); +/* Stored Context */ + +bContextStore *CTX_store_add(ListBase *contexts, char *name, PointerRNA *ptr); +void CTX_store_set(bContext *C, bContextStore *store); +bContextStore *CTX_store_copy(bContextStore *store); +void CTX_store_free(bContextStore *store); +void CTX_store_free_list(ListBase *contexts); + /* Window Manager Context */ struct wmWindowManager *CTX_wm_manager(const bContext *C); -- cgit v1.2.3