Example test code
bl_info = {
"name": "TOP",
"author": "IIIFGIII",
"version": (1, 0),
"blender": (2, 83, 0),
"location": "Viev3D > N panel > FG Tools > TOP",
"description": "Test Operator.",
"warning": "",
"wiki_url": "",
"category": "FG_Tools",
}
import bpy, math
class TOP_PT_Panel(bpy.types.Panel):
bl_label = 'TOP'
bl_idname = 'TOP_PT_Panel'
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = 'FG_Tools'
def draw(self,context):
layout = self.layout
row = layout.row(align=True)
row.operator('fgt.top', text='', icon='ADD')
class TOP_OT_Test(bpy.types.Operator):
bl_idname = 'fgt.top'
bl_label = 'TOP_OT_Test'
bl_option = {'REGISTER','UNDO'}
bl_description = 'Test operator.'
def execute(self,context):
bpy.ops.transform.rotate(value= math.radians(45.0), orient_axis= 'Z', orient_type= 'GLOBAL')
return{'FINISHED'}
CTR = [
TOP_PT_Panel,
TOP_OT_Test,
]
def register():
for cls in CTR:
bpy.utils.register_class(cls)
def unregister():
for cls in CTR:
bpy.utils.unregister_class(cls)
This example is absolutely similar to operator in addon I workking on. Nothing speciall - just custom operator to rotate something with button. {'REGISTER','UNDO'}
added but I not able to undo this operator action.
Simplest thing ever but I can’t make it work properly. Tested on 2.83.13/2.93.2/3.0 alpha. Am I just stupid, do I miss something? Googling not help so I ask here.