[Bf-blender-cvs] [e01dd8140e6] sculpt-dev: Sculpt: experimental brush palette ui

Joseph Eagar noreply at git.blender.org
Sat Oct 2 12:22:31 CEST 2021


Commit: e01dd8140e64b0ac915151526ec954ec577c3038
Author: Joseph Eagar
Date:   Sat Oct 2 00:15:48 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBe01dd8140e64b0ac915151526ec954ec577c3038

Sculpt: experimental brush palette ui

Pure python, experimental.

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

M	release/scripts/startup/bl_ui/__init__.py
M	release/scripts/startup/bl_ui/properties_paint_common.py
A	release/scripts/startup/bl_ui/sculpt_ui.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/blenkernel/intern/brush_channel_define.h
M	source/blender/blenkernel/intern/brush_engine_presets.c
M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index 842750969b7..3f6685ee339 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -69,6 +69,8 @@ _modules = [
     "properties_world",
     "properties_collection",
 
+    "sculpt_ui",
+
     # Generic Space Modules
     #
     # Depends on DNA_WORKSPACE_TOOL (C define).
@@ -125,6 +127,9 @@ def register():
         WindowManager,
     )
 
+    from . import sculpt_ui
+    sculpt_ui.post_register()
+
     # space_userprefs.py
     def addon_filter_items(_self, _context):
         import addon_utils
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index c0b9aa8b274..d6bc474256d 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -337,6 +337,9 @@ class UnifiedPaintPanel:
         """ Generalized way of adding brush options to the UI,
             along with their pen pressure setting and global toggle"""
 
+        if slider is None:
+            slider = False
+
         if ui_editing is None:
             ui_editing = True
         ui_editing = ui_editing and not header
@@ -1243,7 +1246,6 @@ def brush_settings(layout, context, brush, popover=False):
                 brush,
                 "dyntopo_disabled",
                 #text="Weight By Face Area",
-                slider=True,
                 header=True
             )
             #layout.prop(brush.dyntopo, "disabled", text="Disable Dyntopo")
@@ -1257,7 +1259,16 @@ def brush_settings(layout, context, brush, popover=False):
             text = "Pinch"
             if sculpt_tool in {'BLOB', 'SNAKE_HOOK'}:
                 text = "Magnify"
-            layout.prop(brush, "crease_pinch_factor", slider=True, text=text)
+
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "crease_pinch_factor",
+                #text="Weight By Face Area",
+                slider=True,
+                text = text
+            )
 
         # rake_factor
         if capabilities.has_rake_factor:
@@ -1310,7 +1321,7 @@ def brush_settings(layout, context, brush, popover=False):
             layout.prop(brush, "height", slider=True, text="Height")
 
         # use_persistent, set_persistent_base
-        if capabilities.has_persistence:
+        if 0: #capabilities.has_persistence:
             layout.separator()
             layout.prop(brush, "use_persistent")
             layout.operator("sculpt.set_persistent_base")
@@ -1335,89 +1346,211 @@ def brush_settings(layout, context, brush, popover=False):
 
         # Per sculpt tool options.
 
+        def doprop(col, prop, slider=None):
+            UnifiedPaintPanel.channel_unified(
+                col,
+                context,
+                brush,
+                prop,
+                slider=slider
+            )
+
         if sculpt_tool == "VCOL_BOUNDARY":
             row = layout.row()
-            row.prop(brush, "vcol_boundary_exponent")
+            UnifiedPaintPanel.channel_unified(
+                row,
+                context,
+                brush,
+                "vcol_boundary_exponent",
+                slider=True
+            )
 
         if sculpt_tool == 'CLAY_STRIPS':
             row = layout.row()
-            row.prop(brush, "tip_roundness")
+            UnifiedPaintPanel.channel_unified(
+                row,
+                context,
+                brush,
+                "tip_roundness",
+                slider=True
+            )
 
         elif sculpt_tool == 'ELASTIC_DEFORM':
             layout.separator()
-            layout.prop(brush, "elastic_deform_type")
-            layout.prop(brush, "elastic_deform_volume_preservation", slider=True)
-            layout.prop(brush, "use_surface_falloff")
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "elastic_deform_type",
+            )
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "elastic_deform_volume_preservation",
+                slider=True
+            )
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "use_surface_falloff",
+            )
             layout.separator()
 
         elif sculpt_tool == 'SNAKE_HOOK':
             layout.separator()
-            layout.prop(brush, "snake_hook_deform_type")
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "snake_hook_deform_type",
+            )
             layout.separator()
 
         elif sculpt_tool == 'POSE':
             layout.separator()
-            layout.prop(brush, "deform_target")
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "deform_target",
+            )
             layout.separator()
-            layout.prop(brush, "pose_deform_type")
-            layout.prop(brush, "pose_origin_type")
-            layout.prop(brush, "pose_offset")
-            layout.prop(brush, "pose_smooth_iterations")
-            if brush.pose_deform_type == 'ROTATE_TWIST' and brush.pose_origin_type in {'TOPOLOGY', 'FACE_SETS'}:
-                layout.prop(brush, "pose_ik_segments")
-            if brush.pose_deform_type == 'SCALE_TRANSLATE':
-                layout.prop(brush, "use_pose_lock_rotation")
-            layout.prop(brush, "use_pose_ik_anchored")
-            layout.prop(brush, "use_connected_only")
-            layout.prop(brush, "disconnected_distance_max")
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "pose_deform_type",
+            )
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "pose_origin_type",
+            )
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "pose_offset",
+            )
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "pose_smooth_iterations",
+            )
+
+            if brush.channels["pose_deform_type"].value == 'ROTATE_TWIST' and \
+              brush.channels["pose_origin_type"].value in {'TOPOLOGY', 'FACE_SETS'}:
+                UnifiedPaintPanel.channel_unified(
+                    layout,
+                    context,
+                    brush,
+                    "pose_ik_segments",
+                )
+            if brush.channels["pose_deform_type"].value == 'SCALE_TRANSLATE':
+                UnifiedPaintPanel.channel_unified(
+                    layout,
+                    context,
+                    brush,
+                    "use_pose_lock_rotation",
+                )
+
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "use_pose_ik_anchored",
+            )
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "use_connected_only",
+            )
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "disconnected_distance_max",
+            )
 
             layout.separator()
 
         elif sculpt_tool == 'CLOTH':
             layout.separator()
-            layout.prop(brush, "cloth_simulation_area_type")
-            if brush.cloth_simulation_area_type != 'GLOBAL':
-                layout.prop(brush, "cloth_sim_limit")
-                layout.prop(brush, "cloth_sim_falloff")
+            UnifiedPaintPanel.channel_unified(
+                layout,
+                context,
+                brush,
+                "cloth_simulation_area_type",
+            )
 
-            if brush.cloth_simulation_area_type == 'LOCAL':
-                layout.prop(brush, "use_cloth_pin_simulation_boundary")
+            if brush.channels["cloth_simulation_area_type"].value != 'GLOBAL':
+                UnifiedPaintPanel.channel_unified(
+                    layout,
+                    context,
+                    brush,
+                    "cloth_sim_limit",
+                )
+                UnifiedPaintPanel.channel_unified(
+                    layout,
+                    context,
+                    brush,
+                    "cloth_sim_falloff",
+                )
+
+            if brush.channels["cloth_simulation_area_type"].value == 'LOCAL':
+                UnifiedPaintPanel.channel_unified(
+                    layout,
+                    context,
+                    brush,
+                    "cloth_sim_falloff",
+                )
+                UnifiedPaintPanel.channel_unified(
+                    layout,
+                    context,
+                    brush,
+                    "cloth_pin_simulation_boundary",
+                )
 
             layout.separator()
-            layout.prop(brush, "cloth_deform_type")
-            layout.prop(brush, "cloth_force_falloff_type")
+            doprop(layout, "cloth_deform_type")
+            doprop(layout, "cloth_force_falloff_type")
             layout.separator()
-            layout.prop(brush, "cloth_mass")
-            layout.prop(brush, "cloth_damping")
-            layout.prop(brush, "cloth_constraint_softbody_strength")
+            doprop(layout, "cloth_mass")
+            doprop(layout, "cloth_damping")
+            doprop(layout, "cloth_constraint_softbody_strength")
             layout.separator()
-            layout.prop(brush, "use_cloth_collision")
+            doprop(layout, "use_cloth_collision")
             layout.sepa

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list