[Bf-extensions-cvs] [cf48f1c] master: Add Update Panel name

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


Commit: cf48f1c65781c696d75d147c7ea059abd43bc8f0
Author: meta-androcto
Date:   Thu May 19 20:24:13 2016 +1000
Branches: master
https://developer.blender.org/rBACcf48f1c65781c696d75d147c7ea059abd43bc8f0

Add Update Panel name

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

M	space_view3d_toolshelf_menu.py

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

diff --git a/space_view3d_toolshelf_menu.py b/space_view3d_toolshelf_menu.py
index 6b1bfa0..9260b46 100644
--- a/space_view3d_toolshelf_menu.py
+++ b/space_view3d_toolshelf_menu.py
@@ -38,7 +38,7 @@ class View3DPanel():
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'TOOLS'
 
-class VIEW3D_PT_add_menu(View3DPanel,bpy.types.Panel):
+class VIEW3D_PT_Toolshelf_menu(View3DPanel,bpy.types.Panel):
     bl_label = "Dynamic Toolshelf"
     bl_category = "Dynamic"
 
@@ -1390,6 +1390,34 @@ class VIEW3D_MT_undoS(bpy.types.Menu):
         layout.operator("ed.undo", icon='TRIA_LEFT')
         layout.operator("ed.redo", icon='TRIA_RIGHT')
 
+## Addons Preferences Update Panel
+def update_panel(self, context):
+    try:
+        bpy.utils.unregister_class(VIEW3D_PT_Toolshelf_menu)
+    except:
+        pass
+    VIEW3D_PT_Toolshelf_menu.bl_category = context.user_preferences.addons[__name__].preferences.category
+    bpy.utils.register_class(VIEW3D_PT_Toolshelf_menu)   
+
+class ToolshelfMenuAddonPreferences(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="Dynamic",
+            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="")
+
 def register():
     bpy.utils.register_module(__name__)



More information about the Bf-extensions-cvs mailing list