[Bf-blender-cvs] [0e4f8ed90ee] master: UndoType: Fix some incinsistencies re context usage flag.

Bastien Montagne noreply at git.blender.org
Wed Jan 6 14:11:30 CET 2021


Commit: 0e4f8ed90ee0823307a2070812e2b9cfbced7bdd
Author: Bastien Montagne
Date:   Wed Jan 6 14:09:58 2021 +0100
Branches: master
https://developer.blender.org/rB0e4f8ed90ee0823307a2070812e2b9cfbced7bdd

UndoType: Fix some incinsistencies re context usage flag.

`use_context_for_encode` was not properly set regarding actual `encode` code for a few types.

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

M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/editors/space_image/image_undo.c
M	source/blender/editors/undo/memfile_undo.c

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

diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 11a279b5a5a..9f2a6e305d0 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1576,7 +1576,7 @@ void ED_sculpt_undosys_type(UndoType *ut)
   ut->step_decode = sculpt_undosys_step_decode;
   ut->step_free = sculpt_undosys_step_free;
 
-  ut->use_context_for_encode = true;
+  ut->use_context_for_encode = false;
 
   ut->step_size = sizeof(SculptUndoStep);
 }
diff --git a/source/blender/editors/space_image/image_undo.c b/source/blender/editors/space_image/image_undo.c
index 2c8b0f2e0cf..8c5e2ee2f8a 100644
--- a/source/blender/editors/space_image/image_undo.c
+++ b/source/blender/editors/space_image/image_undo.c
@@ -883,6 +883,9 @@ static bool image_undosys_step_encode(struct bContext *C,
     }
   }
   else {
+    if (C == NULL) {
+      return false;
+    }
     /* Happens when switching modes. */
     ePaintMode paint_mode = BKE_paintmode_get_active_from_context(C);
     BLI_assert(ELEM(paint_mode, PAINT_MODE_TEXTURE_2D, PAINT_MODE_TEXTURE_3D));
@@ -995,7 +998,7 @@ void ED_image_undosys_type(UndoType *ut)
 
   ut->step_foreach_ID_ref = image_undosys_foreach_ID_ref;
 
-  ut->use_context_for_encode = true;
+  ut->use_context_for_encode = false;
 
   ut->step_size = sizeof(ImageUndoStep);
 }
diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c
index 456458173ce..5f3381e3c9e 100644
--- a/source/blender/editors/undo/memfile_undo.c
+++ b/source/blender/editors/undo/memfile_undo.c
@@ -282,7 +282,7 @@ void ED_memfile_undosys_type(UndoType *ut)
   ut->step_decode = memfile_undosys_step_decode;
   ut->step_free = memfile_undosys_step_free;
 
-  ut->use_context_for_encode = true;
+  ut->use_context_for_encode = false;
 
   ut->step_size = sizeof(MemFileUndoStep);
 }



More information about the Bf-blender-cvs mailing list