Thanks to Mano_Wii I discovered his Rename Tabs Function.
This allows users to open the addons preferences & type in the name of the Tab you want a Panel in.
Great for cleaning up tabs.
you need to add the code to your addon.
I’m already working on some addons in Blender to use this option.
If you look here: https://developer.blender.org/T48459
You’ll find example code & list of addons I’m adding this function to.
Enjoy.
Note: It’s up to addons writers here to use this method or not, I suggest Just Do It & help stop some of the complaints about the toolshelf Tabs being overcrowded.
saltorio
(saltorio)
May 19, 2016, 7:24pm
2
Yes please!
I posted in a number of add-on threads last week, asking for the devs to either move their panels into existing default tabs, or add something like this. It would be fantastic if more add-ons offer their users the ability to decide how to layout their tabs this way.
pitiwazou
(Pitiwazou)
May 20, 2016, 12:44am
3
I added the code to speedflow !
The doc forgot to tell that wwe need to register the update _panel
def register():
with update_panel(None, bpy.context)
And if we are in multi files we have to import the panel module.
from .ui import *
hi, good find, would you be able to post me a mock example or what your doing there?
Edit: i’m failing with Cacharanth in contrib due to multifiles
There is a complete code with an addon example.
bl_info = {
"name": "addon change category example",
"description": "",
"author": "Your Name",
"version": (0, 0, 1),
"blender": (2, 77, 1),
"location": "View3D",
"warning": "This addon is still in development.",
"wiki_url": "",
"category": "Object" }
import bpy
#if multi files add this with the name of your ui.py
#from .ui import*
## Addons Preferences Update Panel
def update_panel(self, context):
try:
bpy.utils.unregister_class(Change_Name_Panel)
except:
pass
Change_Name_Panel.bl_category = context.user_preferences.addons[__name__].preferences.category
bpy.utils.register_class(Change_Name_Panel)
#Preferences
class AddonPreferences(bpy.types.AddonPreferences):
# this must match the addon name, use '__package__'
# when defining this in a submodule of a python package.
bl_idname = __name__
category = bpy.props.StringProperty(
name="Category",
description="Choose a name for the category of the panel",
default="Tools",
update=update_panel)
def draw(self, context):
layout = self.layout
row = layout.row()
col = row.column()
col.label(text="Category:")
col.prop(self, "category", text="")
#Your class panel
class Change_Name_Panel(bpy.types.Panel):
bl_idname = "change_name_panel"
bl_label = "Change Name Panel"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_category = "category"
def draw(self, context):
layout = self.layout
layout.label(text="Primitives:")
layout.operator("mesh.primitive_plane_add", text="Plane", icon='MESH_PLANE')
layout.operator("mesh.primitive_cube_add", text="Cube", icon='MESH_CUBE')
layout.operator("mesh.primitive_circle_add", text="Circle", icon='MESH_CIRCLE')
layout.operator("mesh.primitive_uv_sphere_add", text="UV Sphere", icon='MESH_UVSPHERE')
layout.operator("mesh.primitive_ico_sphere_add", text="Ico Sphere", icon='MESH_ICOSPHERE')
layout.operator("mesh.primitive_cylinder_add", text="Cylinder", icon='MESH_CYLINDER')
layout.operator("mesh.primitive_cone_add", text="Cone", icon='MESH_CONE')
layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')
def register():
bpy.utils.register_module(__name__)
#Add this to register the update panel
update_panel(None, bpy.context)
def unregister():
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()
If you use multi files, just uncomment
from . ui import*
1 Like
hi, thanks very much This is really useful to help provide users a better experience.
Not really, the goal is to add the choice of name panel in the preferences of each addon.
The code is simple so everyone can add it.