Fix T85975: Edit-mode undo/redo removes overlays

Setting the active object when decoding undo steps missed
a call to ED_object_base_active_refresh.
This commit is contained in:
2021-02-25 16:08:48 +11:00
parent e301f3422d
commit b073e59d4e
7 changed files with 10 additions and 10 deletions

View File

@@ -212,7 +212,7 @@ static void armature_undosys_step_decode(struct bContext *C,
/* The first element is always active */
ED_undo_object_set_active_or_warn(
CTX_data_view_layer(C), us->elems[0].obedit_ref.ptr, us_p->name, &LOG);
CTX_data_scene(C), CTX_data_view_layer(C), us->elems[0].obedit_ref.ptr, us_p->name, &LOG);
/* Check after setting active. */
BLI_assert(armature_undosys_poll(C));

View File

@@ -273,7 +273,7 @@ static void curve_undosys_step_decode(struct bContext *C,
/* The first element is always active */
ED_undo_object_set_active_or_warn(
CTX_data_view_layer(C), us->elems[0].obedit_ref.ptr, us_p->name, &LOG);
CTX_data_scene(C), CTX_data_view_layer(C), us->elems[0].obedit_ref.ptr, us_p->name, &LOG);
/* Check after setting active. */
BLI_assert(curve_undosys_poll(C));

View File

@@ -76,7 +76,8 @@ struct Base **ED_undo_editmode_bases_from_view_layer(struct ViewLayer *view_laye
struct UndoStack *ED_undo_stack_get(void);
/* helpers */
void ED_undo_object_set_active_or_warn(struct ViewLayer *view_layer,
void ED_undo_object_set_active_or_warn(struct Scene *scene,
struct ViewLayer *view_layer,
struct Object *ob,
const char *info,
struct CLG_LogRef *log);

View File

@@ -246,7 +246,7 @@ static void lattice_undosys_step_decode(struct bContext *C,
/* The first element is always active */
ED_undo_object_set_active_or_warn(
CTX_data_view_layer(C), us->elems[0].obedit_ref.ptr, us_p->name, &LOG);
CTX_data_scene(C), CTX_data_view_layer(C), us->elems[0].obedit_ref.ptr, us_p->name, &LOG);
/* Check after setting active. */
BLI_assert(lattice_undosys_poll(C));

View File

@@ -801,7 +801,7 @@ static void mesh_undosys_step_decode(struct bContext *C,
/* The first element is always active */
ED_undo_object_set_active_or_warn(
CTX_data_view_layer(C), us->elems[0].obedit_ref.ptr, us_p->name, &LOG);
CTX_data_scene(C), CTX_data_view_layer(C), us->elems[0].obedit_ref.ptr, us_p->name, &LOG);
/* Check after setting active. */
BLI_assert(mesh_undosys_poll(C));

View File

@@ -221,7 +221,7 @@ static void mball_undosys_step_decode(struct bContext *C,
/* The first element is always active */
ED_undo_object_set_active_or_warn(
CTX_data_view_layer(C), us->elems[0].obedit_ref.ptr, us_p->name, &LOG);
CTX_data_scene(C), CTX_data_view_layer(C), us->elems[0].obedit_ref.ptr, us_p->name, &LOG);
/* Check after setting active. */

View File

@@ -846,16 +846,15 @@ void ED_OT_undo_history(wmOperatorType *ot)
/** \name Undo Helper Functions
* \{ */
void ED_undo_object_set_active_or_warn(ViewLayer *view_layer,
Object *ob,
const char *info,
CLG_LogRef *log)
void ED_undo_object_set_active_or_warn(
Scene *scene, ViewLayer *view_layer, Object *ob, const char *info, CLG_LogRef *log)
{
Object *ob_prev = OBACT(view_layer);
if (ob_prev != ob) {
Base *base = BKE_view_layer_base_find(view_layer, ob);
if (base != NULL) {
view_layer->basact = base;
ED_object_base_active_refresh(G_MAIN, scene, view_layer);
}
else {
/* Should never fail, may not crash but can give odd behavior. */