0
$\begingroup$

I have a suite of several addons that I grouped together in a custom tab in Blender 2.7x, assigning the bl_category to the name of my custom suit:

class Panel1(bpy.types.Panel):  # Blender 2.7x
    bl_label = "Panel 1"
    bl_space_type = "VIEW_3D"
    bl_region_type = "TOOLS"
    bl_category = "MyToolSuite"

In Blender 2.80, I would like to group the tools together in a new properties tab. How can I create a custom properties tab?

The following works to put my panel inside an already-existing tab, but does not work to create a new tab to hold all my panels:

class Panel1(bpy.types.Panel):
    bl_label = "Panel 1"
    bl_space_type = "PROPERTIES"
    bl_region_type = "WINDOW"
    # bl_context = "object"     # this puts my panel in the Object tab
    bl_context = "MyToolSuite"  # this does nothing?

What else needs to be done to create a new tab in Blender 2.80?

Thanks!

$\endgroup$
  • 1
    $\begingroup$ I haven't found anything that exposes the Properties Editor to allow us to make custom tabs yet - the existing ones are from an enumerated list that is pulled in from source I think. $\endgroup$ – Craig D Jones Aug 16 at 18:07
1
$\begingroup$

The code you've posted adds a tab to the Tool Shelf, not the Properties. As far as I know you cannot add new tabs to the properties, you can however add tabs in the 3D View.

enter image description here

In Blender 2.8 needs to have the following attributes to create your own tab:

bl_category = "Name of your tab"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"

A minimal add-on that adds a panel in a separate tab:

import bpy

class EXAMPLE_PT_panel(bpy.types.Panel):
    bl_label = "My own addon"
    bl_category = "Name of your tab"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"

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

        layout.label(text="This is a label")


classes = (EXAMPLE_PT_panel,)


def register():
    for cls in classes:
        bpy.utils.register_class(cls)


def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)

if __name__ == "__main__":
    register()

enter image description here

$\endgroup$
  • $\begingroup$ Aha. Since the Tool Shelf no longer exists as before in 2.80, I figured the next best place to put my tools was over with the Properties. But your solution is better. Thanks rjg! $\endgroup$ – Animik Aug 17 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.