Here is my addon script and it’s not working …I’m trying to make this interface button that the script creates called the undo function but when I do an operation to a mesh and then press the undo button I created via the script after running it in the scripting tab at the top nothing happens… What am I doing wrong here… here’s my code…
import bpy
class UndoScript(bpy.types.Operator):
“”“Tooltip”""
bl_idname = “object.undo_script”
bl_label = “Undo Script”
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
bpy.ops.ed.undo()
return {'FINISHED'}
class Undo(bpy.types.Menu):
bl_label = “Undo”
bl_idname = “OBJECT_MT_simple_custom_menu”
def draw(self, context):
self.layout.operator("object.undo_script",
text = "CUP",
icon = "IPO_EXPO")
def draw_btn(self, context):
draw_btn.f(self, context)
self.layout.menu(Undo.bl_idname, text = Undo.bl_label)
draw_btn.f = bpy.types.TOPBAR_HT_upper_bar.draw_right
def register():
bpy.utils.register_class(Undo)
bpy.types.TOPBAR_HT_upper_bar.draw_right = draw_btn
def unregister():
bpy.utils.unregister_class(Undo)
bpy.types.TOPBAR_HT_upper_bar.draw_right = draw_btn.f
if name == “main”:
register()
I would appreciate any help on this