[Bf-blender-cvs] [76282a986dc] blender2.8: UI: initial dynamically generated sculpt tools

Campbell Barton noreply at git.blender.org
Sun Apr 29 14:32:36 CEST 2018


Commit: 76282a986dc854b79c9e12412b6ccc8324b54d9e
Author: Campbell Barton
Date:   Sun Apr 29 14:31:00 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB76282a986dc854b79c9e12412b6ccc8324b54d9e

UI: initial dynamically generated sculpt tools

Lots more work needed, this just lists sculpt tools in the toolbar.

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

M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 1bcb9c1a592..83e5241c16f 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -402,6 +402,23 @@ class _defs_edit_curve:
         )
 
 
+class _defs_sculpt:
+
+    @staticmethod
+    def generate_from_brushes(context):
+        for brush in context.blend_data.brushes:
+            name = brush.name
+            yield type(
+                "DynToolDef",
+                (ToolDef,),
+                dict(
+                    text=name,
+                    icon="none",
+                    data_block=name,
+                )
+            )
+
+
 class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'TOOLS'
@@ -527,6 +544,9 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
             _defs_edit_curve.draw,
             _defs_edit_curve.extrude_cursor,
         ],
+        'SCULPT': [
+            _defs_sculpt.generate_from_brushes,
+        ],
     }



More information about the Bf-blender-cvs mailing list