Пример #1
0
static bool memfile_undosys_step_encode(struct bContext *C, UndoStep *us_p)
{
	MemFileUndoStep *us = (MemFileUndoStep *)us_p;

	/* Important we only use 'main' from the context (see: BKE_undosys_stack_init_from_main). */
	struct Main *bmain = CTX_data_main(C);
	UndoStack *ustack = ED_undo_stack_get();

	/* can be NULL, use when set. */
	MemFileUndoStep *us_prev = (MemFileUndoStep *)BKE_undosys_step_find_by_type(ustack, BKE_UNDOSYS_TYPE_MEMFILE);
	us->data = BKE_memfile_undo_encode(bmain, us_prev ? us_prev->data : NULL);
	us->step.data_size = us->data->undo_size;
	return true;
}
Пример #2
0
static bool memfile_undosys_poll(bContext *C)
{
  /* other poll functions must run first, this is a catch-all. */

  if ((U.uiflag & USER_GLOBALUNDO) == 0) {
    return false;
  }

  /* Allow a single memfile undo step (the first). */
  UndoStack *ustack = ED_undo_stack_get();
  if ((ustack->step_active != NULL) && (ED_undo_is_memfile_compatible(C) == false)) {
    return false;
  }
  return true;
}