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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-12-16 23:03:28 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-12-16 23:03:28 +0300
commitc1379f6613d327a7604700007afd52e36f48080a (patch)
treedff5af25582f4e343b7c0a7399d760c9dff4d54a /source/blender/editors/interface/interface.c
parent962870b2358775ebef96198da4efe61a4224b526 (diff)
UI:
* Added support for defining properties for operator buttons, with uiButGetOperatorPtrRNA. Needed to cleanup a hack that was there for operator properties in RNA, now a separate OperatorProperties type is used for storing operator properties, instead of being part of the Operator type itself. * Allow selecting menu items with mouse release instead of press again. * Fix some cases with hanging tooltips in the UI.
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index afb10a1bb26..398a526fbd8 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -42,6 +42,7 @@
#include "BLI_dynstr.h"
#include "BKE_global.h"
+#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_screen.h"
#include "BKE_texture.h"
@@ -1343,6 +1344,11 @@ static void ui_free_link(uiLink *link)
static void ui_free_but(const bContext *C, uiBut *but)
{
+ if(but->opproperties) {
+ IDP_FreeProperty(but->opproperties);
+ MEM_freeN(but->opproperties);
+ }
+ if(but->opptr) MEM_freeN(but->opptr);
if(but->active) ui_button_active_cancel(C, but);
if(but->str && but->str != but->strdata) MEM_freeN(but->str);
ui_free_link(but->link);
@@ -2553,6 +2559,22 @@ int uiButGetRetVal(uiBut *but)
return but->retval;
}
+PointerRNA *uiButGetOperatorPtrRNA(uiBut *but)
+{
+ wmOperatorType *ot;
+
+ if(but->opname && !but->opptr) {
+ ot= WM_operatortype_find(but->opname);
+
+ if(ot) {
+ but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
+ RNA_pointer_create(NULL, NULL, ot->srna, &but->opproperties, but->opptr);
+ }
+ }
+
+ return but->opptr;
+}
+
void uiBlockSetHandleFunc(uiBlock *block, void (*func)(struct bContext *C, void *arg, int event), void *arg)
{
block->handle_func= func;