diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-01-01 18:52:51 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-01-01 18:52:51 +0300 |
commit | fc7944f436657ce4a9a479aff3d5903b79bd6ede (patch) | |
tree | 3c24b2597feea93b7ca54ec7044406382771da4f /source/blender/editors | |
parent | a1961436f564ad885a014dc964d443378a4b9617 (diff) |
RNA
* Added support for sending notifiers and updates when setting
RNA properties. Per property, there is a notifier NC_/ND_ flag,
and a function that is called. Currently only used for
Object.loc/rot/size.
* RNA_property_update that does this is not automatically called
in every _set function, it has do be done separate, and is being
done by buttons with RNA data.
* Perhaps for python there could be a trick to accumulate these
flags rather than update each time, though for now the python
RNA code could just do them everytime. Did not add these calls
in the python code yet because it needs context, not sure where
to get that from?
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface.c | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 31629ca7621..51cc89505b9 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1584,8 +1584,8 @@ void ui_check_but(uiBut *but) value= ui_get_but_val(but); if(ui_is_but_float(but)) { - if(value == FLT_MAX) sprintf(but->drawstr, "%sFLT_MAX", but->str); - else if(value == -FLT_MAX) sprintf(but->drawstr, "%s-FLT_MAX", but->str); + if(value == FLT_MAX) sprintf(but->drawstr, "%sinf", but->str); + else if(value == -FLT_MAX) sprintf(but->drawstr, "%s-inf", but->str); else if(but->a2) { /* amount of digits defined */ if(but->a2==1) sprintf(but->drawstr, "%s%.1f", but->str, value); else if(but->a2==2) sprintf(but->drawstr, "%s%.2f", but->str, value); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 17c3d6e3e69..c1b795f48f1 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -148,6 +148,9 @@ typedef struct uiAfterFunc { const char *opname; int opcontext; IDProperty *opproperties; + + PointerRNA rnapoin; + PropertyRNA *rnaprop; } uiAfterFunc; static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state); @@ -168,7 +171,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but) * handling is done, i.e. menus are closed, in order to avoid conflicts * with these functions removing the buttons we are working with */ - if(but->func || block->handle_func || (but->type == BUTM && block->butm_func) || but->opname) { + if(but->func || block->handle_func || (but->type == BUTM && block->butm_func) || but->opname || but->rnaprop) { after= MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc"); after->func= but->func; @@ -189,6 +192,9 @@ static void ui_apply_but_func(bContext *C, uiBut *but) after->opcontext= but->opcontext; after->opproperties= but->opproperties; + after->rnapoin= but->rnapoin; + after->rnaprop= but->rnaprop; + but->opname= NULL; but->opcontext= 0; but->opproperties= NULL; @@ -221,6 +227,9 @@ static void ui_apply_but_funcs_after(bContext *C) IDP_FreeProperty(after->opproperties); MEM_freeN(after->opproperties); } + + if(after->rnapoin.data) + RNA_property_update(C, &after->rnapoin, after->rnaprop); } BLI_freelistN(&funcs); |