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/editors/interface
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/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_layout.c6
-rw-r--r--source/blender/editors/interface/interface_regions.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 91e38e7d914..58b54fef0df 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -2722,6 +2722,12 @@ void uiLayoutSetContextPointer(uiLayout *layout, const char *name, PointerRNA *p
layout->context = CTX_store_add(&block->contexts, name, ptr);
}
+void uiLayoutContextCopy(uiLayout *layout, bContextStore *context)
+{
+ uiBlock *block= layout->root->block;
+ layout->context= CTX_store_add_all(&block->contexts, context);
+}
+
/* introspect funcs */
#include "BLI_dynstr.h"
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 1c37fcdd488..b5d56f278e5 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2404,16 +2404,18 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
/* some enums reversing is strange, currently we have no good way to
* reverse some enum's but not others, so reverse all so the first menu
* items are always close to the mouse cursor */
-#if 0
else {
+#if 0
/* if this is an rna button then we can assume its an enum
* flipping enums is generally not good since the order can be
* important [#28786] */
if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
pup->block->flag |= UI_BLOCK_NO_FLIP;
}
- }
#endif
+ if (but->context)
+ uiLayoutContextCopy(pup->layout, but->context);
+ }
if (str) {
/* menu is created from a string */