[Bf-blender-cvs] [6f5a9dd8dea] master: Fix T78172: Undo crash due to IDTemplate operations missing undo push.

Bastien Montagne noreply at git.blender.org
Wed Jun 24 12:52:41 CEST 2020


Commit: 6f5a9dd8dea8a20e9ca298bb713786a247b9c9d3
Author: Bastien Montagne
Date:   Wed Jun 24 12:51:08 2020 +0200
Branches: master
https://developer.blender.org/rB6f5a9dd8dea8a20e9ca298bb713786a247b9c9d3

Fix T78172: Undo crash due to IDTemplate operations missing undo push.

This should be included in 2.83 as well.

===================================================================

M	source/blender/editors/interface/interface_templates.c

===================================================================

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)



More information about the Bf-blender-cvs mailing list