diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-02-15 03:53:20 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-02-15 03:53:20 +0300 |
commit | dab76a3ccfba7dd72543d671461b449e939ac1e2 (patch) | |
tree | e771414802cdceac1eb4ead182f3b7e4175dbcc6 | |
parent | d4ebace1496303cda26a52875ebbbe6a5bee6b18 (diff) |
Ctrl-0 can now be used to just reset a single component of an array to
its default value instead of resetting the entire array
-rw-r--r-- | source/blender/editors/interface/interface.c | 6 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 31dbf87e47c..5929eb54026 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1773,11 +1773,13 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) return 0; } -void ui_set_but_default(bContext *C, uiBut *but) +void ui_set_but_default(bContext *C, uiBut *but, short all) { /* if there is a valid property that is editable... */ if (but->rnapoin.data && but->rnaprop && RNA_property_editable(&but->rnapoin, but->rnaprop)) { - if(RNA_property_reset(&but->rnapoin, but->rnaprop, -1)) { + int index = (all)? -1 : but->rnaindex; + + if(RNA_property_reset(&but->rnapoin, but->rnaprop, index)) { /* perform updates required for this property */ RNA_property_update(C, &but->rnapoin, but->rnaprop); } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 92b4e622d7e..67e4548b0b7 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4357,8 +4357,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) /* reset to default */ /* XXX hardcoded keymap check.... */ else if(ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) { + /* ctrl-0 = for arrays, only the active one gets done (vs whole array for just 0) */ if (!(ELEM3(but->type, HSVCIRCLE, HSVCUBE, HISTOGRAM))) - ui_set_but_default(C, but); + ui_set_but_default(C, but, !event->ctrl); } /* handle menu */ else if(event->type == RIGHTMOUSE && event->val == KM_PRESS) { diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 154a263cd7b..52214bf3fa7 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -364,7 +364,7 @@ extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen); extern int ui_set_but_string(struct bContext *C, uiBut *but, const char *str); extern int ui_get_but_string_max_length(uiBut *but); -extern void ui_set_but_default(struct bContext *C, uiBut *but); +extern void ui_set_but_default(struct bContext *C, uiBut *but, short all); extern void ui_set_but_soft_range(uiBut *but, double value); |