1
$\begingroup$

I'm on a mac, and i can press CMD+Z to undo, SHIFT+CMD+Z to redo.

Is there a way to trigger these in the python console?

$\endgroup$

1 Answer 1

4
$\begingroup$

Yes, absolutely.

bpy.ops.ed.undo()
bpy.ops.ed.redo()

More operators of that kind here: https://docs.blender.org/api/2.79/bpy.ops.ed.html?highlight=undo#bpy.ops.ed.undo_redo

$\endgroup$
3
  • $\begingroup$ Thanks, when I clicked undo, the console at the top wouldn't output that as an operation. so i figured they didn't exist haha. $\endgroup$
    – csch0
    Commented Jun 20, 2018 at 20:29
  • $\begingroup$ That console does not log quite some operators, so it is always a good idea to check the API document. Fortunately, the naming is quite good there. $\endgroup$
    – D. Skarn
    Commented Jun 20, 2018 at 20:31
  • $\begingroup$ I'm wondering if you can add a function that is called back before and or after on which to do some further clean up? and how that's done. [maybe it's another question I suppose.] $\endgroup$ Commented Nov 28, 2018 at 9:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .