diff options
Diffstat (limited to 'source/blender/editors/interface/interface_ops.c')
-rw-r--r-- | source/blender/editors/interface/interface_ops.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 05a2a6ef29b..540e98f542e 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -1296,6 +1296,19 @@ void UI_editsource_active_but_test(uiBut *but) BLI_ghash_insert(ui_editsource_info->hash, but, but_store); } +/** + * Remove the editsource data for \a old_but and reinsert it for \a new_but. Use when the button + * was reallocated, e.g. to have a new type (#ui_but_change_type()). + */ +void UI_editsource_but_replace(const uiBut *old_but, uiBut *new_but) +{ + uiEditSourceButStore *but_store = BLI_ghash_lookup(ui_editsource_info->hash, old_but); + if (but_store) { + BLI_ghash_remove(ui_editsource_info->hash, old_but, NULL, NULL); + BLI_ghash_insert(ui_editsource_info->hash, new_but, but_store); + } +} + static int editsource_text_edit(bContext *C, wmOperator *op, const char filepath[FILE_MAX], |