0
$\begingroup$

How to delete the History from python?

When I click the History button in Tool Shelf > Object Tools > History, it shows list of the operations I did.
How to clear this with python code?

$\endgroup$
  • $\begingroup$ See this post: blender.stackexchange.com/q/3065/599 $\endgroup$ – gandalf3 Dec 24 '13 at 11:00
  • $\begingroup$ Could I ask why you want to do this? You could try saving the blend file and then reloading it. $\endgroup$ – gandalf3 Dec 24 '13 at 21:47
  • $\begingroup$ I need some operation History's only in My History button so that I have to delete My previous Large list of History in History Button. Now I could choose very easy from my history. $\endgroup$ – Rasa Mohamed Dec 26 '13 at 5:48
1
$\begingroup$

I believe the answer is no.

However, you can clear the list by saving and reopening the .blend:

From the UI:

  1. Save the file with CtrlS

  2. Reload it with CtrlShiftO1

With python:

  1. Save the file with save_mainfile()

  2. Open the file with open_mainfile()

For example:

import bpy

file="/tmp/test.blend"
bpy.ops.wm.save_mainfile(filepath=file)
bpy.ops.wm.open_mainfile(filepath=file)
$\endgroup$
  • $\begingroup$ Also, If I click 'Ctrl+Z'[Undo] then the History Cleared. Is there any way to apply this method. I had tried the Undo command, finally the History Button shows the 'Undo' in history but History Cleared... $\endgroup$ – Rasa Mohamed Dec 30 '13 at 3:40
  • $\begingroup$ @RasaMohamed You can run bpy.ops.ed.undo() and then bpy.ops.ed.redo() to undo and then redo the last action, which as you said clears the history. I believe the history is cleared because undo/redo works by saving copies of the file in memory and loading them when needed. $\endgroup$ – gandalf3 Dec 30 '13 at 7:26

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.