[Bf-blender-cvs] [3de9efdc9e1] blender-v2.83-release: Fix T78172: Undo crash due to IDTemplate operations missing undo push.

Bastien Montagne noreply at git.blender.org
Tue Jun 30 12:54:00 CEST 2020


Commit: 3de9efdc9e1c2a04468cc36d575b83f882bce1a4
Author: Bastien Montagne
Date:   Wed Jun 24 12:51:08 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB3de9efdc9e1c2a04468cc36d575b83f882bce1a4

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 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)



More information about the Bf-blender-cvs mailing list