[Bf-extensions-cvs] [8519564] master: Add Update Panel Name: T48459

meta-androcto noreply at git.blender.org
Thu May 19 12:04:39 CEST 2016


Commit: 8519564c212910db4ccb0a93742f75fec36c3952
Author: meta-androcto
Date:   Thu May 19 20:04:13 2016 +1000
Branches: master
https://developer.blender.org/rBAC8519564c212910db4ccb0a93742f75fec36c3952

Add Update Panel Name: T48459

===================================================================

M	space_view3d_align_tools.py

===================================================================

diff --git a/space_view3d_align_tools.py b/space_view3d_align_tools.py
index 665265d..6f80b10 100644
--- a/space_view3d_align_tools.py
+++ b/space_view3d_align_tools.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "Align Tools",
     "author": "gabhead, Lell, Anfeo",
-    "version": (0, 3, 0),
+    "version": (0, 3, 1),
     "blender": (2, 77, 0),
     "location": "View3D > Tool Shelf > Tools",
     "description": "Align Selected Objects to Active Object",
@@ -943,6 +943,34 @@ class AlignUi(bpy.types.Panel):
                     layout = self.layout
                     self.layout.operator("object.align_tools", text="Advanced")
 
+## Addons Preferences Update Panel
+def update_panel(self, context):
+    try:
+        bpy.utils.unregister_class(AlignUi)
+    except:
+        pass
+    AlignUi.bl_category = context.user_preferences.addons[__name__].preferences.category
+    bpy.utils.register_class(AlignUi)   
+
+class AlignAddonPreferences(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="")
+
 # Class List
 classes = [
     AlignUi,
@@ -959,7 +987,8 @@ classes = [
     AlignScaleXOperator,
     AlignScaleYOperator,
     AlignScaleZOperator,
-    OBJECT_OT_align_tools
+    OBJECT_OT_align_tools,
+    AlignAddonPreferences
     ]
 
 # Register all operators and panels



More information about the Bf-extensions-cvs mailing list