Q; Panel button command and the Redo window

Hi,

I’ve been browsing the forum and docs, but am hoping that someone can fill me in here.
I’m trying to move some of the dropdown menu commands into panel buttons for convenience sake.

But I’m running into the Redo panel not showing up when I run the menu command from a button.
I can see the python code is being triggered in the Command Window, but I don’t get the Redo panel.

I did add the bl_options tag and even the bpy.ops.ed.undo_push() option I found being mentioned here, but it’s not working. I haven’t been able to find any other working suggestions, so hopefully someone can point me in the right direction…

Here’s one example:

class Randomize_Obj (bpy.types.Operator):
#Randomize LRS of Selected Objects
bl_idname = "rwtools.randomize_obj";
bl_label = "Randomize";
bl_description = "Randomize LRS Objects";
bl_options = {"REGISTER", "UNDO"}

@classmethod
def poll (cls, context):
    return bpy.context.active_object is not None;

def execute(self, context):
    bpy.ops.ed.undo_push()
    bpy.ops.object.randomize_transform()
    print("Randomized SRT for Objects");
    return {'FINISHED'};

cheers for any tips, as I’m a bit stuck atm.

rob

Hi all,

Anybody on this?
I’ve looked into it a bit more today, but so far no luck. Hadn’t the time after the first post to look into it any further, but want to make this work :wink:
I have some other menu commands with undo panel I want to ‘convert’ in a button, so a solution would be great.

cheers!

The code you posted has no indents, has no import bpy statement and has a gap in the class definition, so will not work. Maybe you have not copied what you wrote properly, or maybe it is not good code.

Tip: Run Blender from a terminal so you can see all the errors with your code…

It might be a good idea to post a blend file with your code in so we can look at exactly what you have done, what you have posted is no use as if I paste it into a text editor I just get a shed load of errors!