HIDE elements of the interface

Hi, i have seen that the last versions of blender have the “edit code” functionality on their UI objects, i have seen tutorials about how to ADD new menus or other parts of the interface, but i’m interested on the other side…it’s possible to HIDE parts of the blender UI from the view. for example is possible to hide the layer icons on the bottom of the screen?

Why bother? The header will still be there, but you’ll just have a blank spot on it where once a useful tool sat.

i’m trying to do a interface for children about 8-10 years old, they dont have to use all the funtionalities of blender , is more important that the focus their atention on very simply task , as “model it”…“paint it”…this way

Moved from “Support > Basics & Interface” to “Coding > Python Support”

Yes, it is possible to hide elements, though perhaps not with the same fine grain as “just remove the layer buttons”. For instance, you can remove the whole header for the 3D View with the following code:


But to remove just parts… you’d basically have make a new header class that has everything but those parts omitted… then register that after unregistering the main one. It’s a bit of work, but it’s totally possible.

As well as overriding classes, it may be simpler to override the draw method of UI elements like headers and panels.

When you right click and choose view source from any UI element it loads the appropriate UI script into the text editor. In the case of the view3d header, it will be space_view3d.py.

Here is a simple example that takes out the usual draw method, and sample code that shows you how to restore it.

import bpy
from bl_ui.space_view3d import VIEW3D_HT_header as V3DH
old_draw = V3DH.draw

from bpy.props import BoolProperty

def toggle_header(self, context):
    if not self.toggle_header:
        bpy.types.VIEW3D_HT_header.draw = my_draw
        bpy.types.VIEW3D_HT_header.draw = old_draw
bpy.types.WindowManager.toggle_header = BoolProperty(update=toggle_header)

def my_draw(self, context):
    layout = self.layout
    layout.prop(context.window_manager, "toggle_header", text="Restore Header", toggle=True)
bpy.types.VIEW3D_HT_header.draw = my_draw

The original draw method is in the space_view3d.py script here

class VIEW3D_HT_header(Header):
    bl_space_type = 'VIEW_3D'

    def draw(self, context):
        layout = self.layout

        view = context.space_data

1 Like

why not modify the original layout scripts? Works on a per-element basis (except for templates).