diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 20 |
2 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 5ffcdbd9668..6d2f45813fe 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2945,6 +2945,9 @@ void ui_but_text_password_hide(char password_str[UI_MAX_PASSWORD_STR], void ui_but_set_string_interactive(bContext *C, uiBut *but, const char *value) { + /* Caller should check. */ + BLI_assert((but->flag & UI_BUT_DISABLED) == 0); + button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); ui_textedit_string_set(but, but->active, value); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 60a68e270bf..aafb56119ae 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1942,6 +1942,24 @@ static void UI_OT_drop_color(wmOperatorType *ot) /** \name Drop Name Operator * \{ */ +static bool drop_name_poll(bContext *C) +{ + if (!ED_operator_regionactive(C)) { + return false; + } + + const uiBut *but = UI_but_active_drop_name_button(C); + if (!but) { + return false; + } + + if (but->flag & UI_BUT_DISABLED) { + return false; + } + + return true; +} + static int drop_name_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { uiBut *but = UI_but_active_drop_name_button(C); @@ -1961,7 +1979,7 @@ static void UI_OT_drop_name(wmOperatorType *ot) ot->idname = "UI_OT_drop_name"; ot->description = "Drop name to button"; - ot->poll = ED_operator_regionactive; + ot->poll = drop_name_poll; ot->invoke = drop_name_invoke; ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL; |