diff options
author | Bastien Montagne <bastien@blender.org> | 2020-06-24 13:51:08 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-06-24 13:51:08 +0300 |
commit | 6f5a9dd8dea8a20e9ca298bb713786a247b9c9d3 (patch) | |
tree | 612d1d84e45b0dd85ef28442404fb7e68d80b98b | |
parent | 5c8e349c28582fa86e767cafcbd6e8474300d81f (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 c3a432d6bcc..16b6b313f69 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -511,6 +511,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: @@ -531,6 +532,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; @@ -542,6 +544,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; @@ -572,6 +575,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: @@ -581,6 +585,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: @@ -601,6 +606,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 @@ -608,6 +614,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) |