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:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-04-03 19:18:59 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-04-03 19:18:59 +0400
commit123f7d3eb3e7ba14c05e4097a57119bf75e08019 (patch)
tree2cb3eacdc38914e43a509cdd168c921a9174344d /source/blender/blenkernel/intern/context.c
parentf137ba074abb599ea2b4226f47a4234cb6995f1e (diff)
Popup menu layout inherits context store from button.
When adding extra context data in a layout using uiLayoutSetContextPointer, this info was not inherited by popup menus generated in this layout. While operators from regular buttons work fine, the data is missing in operators from menus and such. This patch copies the bContextStore from buttons to the new uiLayout used for popups.
Diffstat (limited to 'source/blender/blenkernel/intern/context.c')
-rw-r--r--source/blender/blenkernel/intern/context.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index a725b5f4c52..e9dd4d01b0e 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -141,6 +141,35 @@ bContextStore *CTX_store_add(ListBase *contexts, const char *name, PointerRNA *p
return ctx;
}
+bContextStore *CTX_store_add_all(ListBase *contexts, bContextStore *context)
+{
+ bContextStoreEntry *entry, *tentry;
+ bContextStore *ctx, *lastctx;
+
+ /* ensure we have a context to put the entries in, if it was already used
+ * we have to copy the context to ensure */
+ ctx= contexts->last;
+
+ if (!ctx || ctx->used) {
+ if (ctx) {
+ lastctx= ctx;
+ ctx= MEM_dupallocN(lastctx);
+ BLI_duplicatelist(&ctx->entries, &lastctx->entries);
+ }
+ else
+ ctx= MEM_callocN(sizeof(bContextStore), "bContextStore");
+
+ BLI_addtail(contexts, ctx);
+ }
+
+ for (tentry= context->entries.first; tentry; tentry= tentry->next) {
+ entry= MEM_dupallocN(tentry);
+ BLI_addtail(&ctx->entries, entry);
+ }
+
+ return ctx;
+}
+
void CTX_store_set(bContext *C, bContextStore *store)
{
C->wm.store= store;