diff options
author | Bastien Montagne <bastien@blender.org> | 2020-06-24 13:51:08 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-06-30 13:27:55 +0300 |
commit | 3de9efdc9e1c2a04468cc36d575b83f882bce1a4 (patch) | |
tree | ef462850b4cc1a80fce9d067e63363eb58a9f4ec | |
parent | 141eb92345eaf09ce052cfff8428a3fc8f98fb16 (diff) |
Fix T78172: Undo crash due to IDTemplate operations missing undo push.
This should be included in 2.83 as well.
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 6b588fa8239..7b4cdb00c2f 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -519,6 +519,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) PointerRNA idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); ID *id = idptr.data; int event = POINTER_AS_INT(arg_event); + const char *undo_push_label = NULL; switch (event) { case UI_ID_BROWSE: @@ -539,6 +540,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) id_us_clear_real(id); id_fake_user_clear(id); id->us = 0; + undo_push_label = "Delete Data-Block"; } break; @@ -550,6 +552,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) else { id_us_min(id); } + undo_push_label = "Fake User"; } else { return; @@ -580,6 +583,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) } RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, NULL); RNA_property_update(C, &template_ui->ptr, template_ui->prop); + undo_push_label = "Make Local"; } break; case UI_ID_OVERRIDE: @@ -589,6 +593,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, NULL); RNA_property_update(C, &template_ui->ptr, template_ui->prop); + undo_push_label = "Override Data-Block"; } break; case UI_ID_ALONE: @@ -609,6 +614,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) id_single_user(C, id, &template_ui->ptr, template_ui->prop); DEG_relations_tag_update(bmain); } + undo_push_label = "Make Single User"; } break; #if 0 @@ -616,6 +622,10 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) break; #endif } + + if (undo_push_label != NULL) { + ED_undo_push(C, undo_push_label); + } } static const char *template_id_browse_tip(const StructRNA *type) |