2
$\begingroup$

Is there a way to call your own undo and or redo method when your operator is being 'undone'? I already used this bpy built-in method:

bl_info = {'UNDO'}

but this didn't do the full undo.

$\endgroup$

1 Answer 1

6
$\begingroup$

Blender's undo system works by saving the blend file to memory, and loading it to perform the undo. If your operator doesn't fully undo, you're probably calling other operators from within its code. That's usually a bad idea; modify object properties and call functions instead.

There are no undo/redo functions that you can override.

$\endgroup$
2
  • $\begingroup$ So there is no real workaround if you call a 'add modifier' operator from within your own operator to undo this action? $\endgroup$
    – Bert VdB
    Dec 3, 2017 at 11:30
  • 2
    $\begingroup$ Look at the source code of the operator. If it calls into a Python function to do the real work, you can just call that function instead of the operator itself. $\endgroup$
    – dr. Sybren
    Dec 3, 2017 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.