Kill the HUD from script

Hi,

Is there any way to close/dismiss the HUD aka ‘UNDO/REDO’ operator panel from a script?

Thanks in advance for any suggestions

No??? oh well, never mind. Life is good.
Have a nice day

This is how you can do it

    #bl_options = {'UNDO', 'REGISTER'} # this will show the panel
    bl_options = {'UNDO'} # this won't show it
1 Like

What, you mean not open it at all? Now, that’s an idea… :grin:
I think you misread the question, my friend. You cannot close something if it is not open.
Thank you for trying to help.

To correct my answer, you must have ‘REGISTER’ and one property to show the operator panel while the operator is executed.

If you take a way the property the panel isn’t shown. Also having a property but not the ‘REGISTER’ is the same thing. :slight_smile:

import bpy


def main(context):
    for ob in context.scene.objects:
        print(ob)

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"
    bl_options = {'UNDO', 'REGISTER'}
    property : bpy.props.StringProperty()
    
    def execute(self, context):
        main(context)
        return {'FINISHED'}

def register():
    bpy.utils.register_class(SimpleOperator)

def unregister():
    bpy.utils.unregister_class(SimpleOperator)

if __name__ == "__main__":
    try:unregister()
    except:pass
    register()



This is all nice and dandy, elementary stuff, dude. You don’t seem to get the point though. The question is how to get rid of the thing after it has completed or not its assigned task and returned something like {‘FINISHED’} or {‘CANCELLED’}. Unfortunately, the HUD panel will not go away until you click on an object in the 3D View or in another window. But if you change property values in the N panel it keeps hanging around like some party pest. I have managed to close it from code using a boolean flag and modal operator which is called from the Invoke method of the first one and checks for mouse and key events outside the former’s region, which by the way is HUD, and correspondingly flags the bool property . That works but it feels hacky because the original operator is polled against the bool and you need to have a check box in your panel to re-enable it. Not to mention that it becomes a major hassle if you are dealing with several of those. So I was hoping someone might have a better solution, but I’m afraid they ordered a chinese takeaway… :smile:
Here is a video to show you what I mean.

Just minimize the box and and you’re basically done that. No need for “bikeshedding”.

So, what happens if you want to utilize both the HUD and N panels, then? You can’t, because clearly the integration of C code is broken. But I guess you just call that trivial and forget about it.