How to add a new tab in the Properties Editor?

I would like to add a new tab in the Properties Editor. I want to make a dedicated space for thematic functionalities in that tab.

What is the basic code to achieve this?

Ideally it would be nice to have a template for that in the Text Editor (ui_tab maybe?).!

2 Likes

This is not currently possible through Python.

Thanks for the answer Brecht.

Will this be possible in the future (through Python)?

Since the disapperance of the ancient toolbar in favor of tools, where is the best place in the UI to put functionalities for addons now?

It could be supported in the future, but no one has made concrete plans to work on it as far as I know.

Regarding where to put tools, there is some information here:
https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/UI_API#Toolbar

What should I write in the bl_context, if I want to put the panels inside the Tool Settings context?
I tried “tool” and “tool_settings”, and the Hello World Panel is still not appearing in it (I have no problem in the other contexts).

tool_settings_tab

I think it’s a good idea to be able to add custom tabs in this part of Blender.
Or maybe it will be possible to use area to make something with it, like a library or a view for rigging.
I mean, create a new editor.

They say they were going to allow new editors https://developer.blender.org/T55407 but who knows

Custom Editors are already possible in 2.8.

How?

Ani documentation about that?

I also want to know how it can be done. My assumption is, it is possible, but the support maybe not complete yet.

There is no support yet for custom editors in 2.8. There was some work towards it but it’s not finished.

Ok, good to know, thank you.

Hello , is it possible now in 2.9 ,thanks.

The ability of adding custom editors would/could be a workaround for floating windows.
We have some ideas for tools that are easier to work with in a ‘regular’ window due to the larger screen estate. The Properties panel or N-panel are often too narrow/ long for a proper UI.

We could take the Preferences window ‘hostage’, like the Scatter addon does, or we can make a new Editor window for it.
The second one would be preferable.

Having custom editors would be super useful to us too. For now I’ll see if I can hijack the preferences window like Scatter does.

def pref_header(boolean):
    """show/hide header on 'PREFERENCE' areas"""

    for window in bpy.context.window_manager.windows:
        for area in window.screen.areas:
            if(area.type == 'PREFERENCES'):
                for space in area.spaces:
                    if(space.type == 'PREFERENCES'):
                        space.show_region_header = boolean


def panel_replace():
    """register impostors"""

    #show header just in case user hided it
    pref_header(True)
    #replace class by impostor
    try: bpy.utils.register_class(USERPREF_PT_addons)
    except: pass
    #replace class by impostor
    try: bpy.utils.register_class(USERPREF_PT_navigation_bar)
    except: pass
    #replace class by impostor
    try: bpy.utils.register_class(USERPREF_HT_header)
    except: pass


def panel_restore():
    """restore and find original drawing classes"""
    
    import os, sys
    scr = bpy.utils.system_resource('SCRIPTS')
    pth = os.path.join(scr,'startup','bl_ui')
    if pth not in sys.path:
        sys.path.append(pth)
    #restore addons drawing
    from space_userpref import USERPREF_PT_addons
    bpy.utils.register_class(USERPREF_PT_addons)
    #restore navigation panel
    from space_userpref import USERPREF_PT_navigation_bar
    bpy.utils.register_class(USERPREF_PT_navigation_bar)
    #restore header
    from space_userpref import USERPREF_HT_header
    bpy.utils.register_class(USERPREF_HT_header)

It’s a bit dirty, but creating an operator that register a new class that will overwrite native GUI code, then a restore operator that will register old GUI again is working fine in Scatter4

The only thing extremely important is keep having a loud escape button to restore old interface.

2 Likes

It’s really cool, but as I told you on Twitter, I think it’s a bit “risky”.
I mean, what happens if a user wants to view the prefs while your window is open?
If 2 addons use the same process, you will probably have the same problem.
It would be so much easier to have floating windows natively… like 98% of other softwares in fact…

1 Like

Yeah he’ll need to click on the exit button

It would be so much easier to have floating windows natively

completely agree

1 Like