From b79cc04f772aefab48e0a9769b1d0dae73198ec8 Mon Sep 17 00:00:00 2001 From: meta-androcto Date: Mon, 15 Aug 2016 23:59:43 +1000 Subject: light field tools: unify change tab category --- light_field_tools/__init__.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/light_field_tools/__init__.py b/light_field_tools/__init__.py index f1899b2d..a5523187 100644 --- a/light_field_tools/__init__.py +++ b/light_field_tools/__init__.py @@ -100,7 +100,33 @@ class LightFieldPropertyGroup(bpy.types.PropertyGroup): min=0, description="The spacing in pixels between two cameras on the focal plane") +## Addons Preferences Update Panel +def update_panel(self, context): + try: + bpy.utils.unregister_class(light_field_tools.VIEW3D_OT_lightfield_tools) + except: + pass + light_field_tools.VIEW3D_OT_lightfield_tools.bl_category = context.user_preferences.addons[__name__].preferences.category + bpy.utils.register_class(light_field_tools.VIEW3D_OT_lightfield_tools) +class LFTPreferences(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="Tab 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="Tab Category:") + col.prop(self, "category", text="") def register(): # register properties -- cgit v1.2.3