[Bf-blender-cvs] [f13bedd649e] sculpt-dev: Sculpt-dev: sculpt_init_tool_override_channels related fixes

Joseph Eagar noreply at git.blender.org
Thu Nov 25 20:44:37 CET 2021


Commit: f13bedd649e64a7f02cb559c007c0cbb9ce6aa0c
Author: Joseph Eagar
Date:   Thu Nov 25 11:34:24 2021 -0800
Branches: sculpt-dev
https://developer.blender.org/rBf13bedd649e64a7f02cb559c007c0cbb9ce6aa0c

Sculpt-dev: sculpt_init_tool_override_channels
            related fixes

Various fixes so sculpt_init_tool_override_channels
for shift-smooth can replicate the prior behavior:

* Brush spacing will now look up brush channel
  spacing directly for sculpt, instead of relying
  on copying the channel data into Brush.
* Brush spacing code will now use brush channel
  pressure for sculpt.  Fixes broken shift-smooth
  pen pressure.
* The falloff_curve channel is now automatically
  added (before it was only used internally by
  command lists, the code was defaulting to
  the Brush field otherwise).
* BrushCurve now has an option for custom curve
  presets to have negative slopes.
* The Falloff panel now puts the type dropbox
  inside the panel header.
* Falloff panel also now uses brush channel data in
  sculpt mode.
* falloff_shape is now a brush channel

In a somewhat unrelated change, I also unnested the
Brush Settings subpanels.  It's been driving me
insane for a very, very long time.  Much more
usable this way.

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

M	intern/cycles/kernel/CMakeLists.txt
M	release/scripts/startup/bl_ui/properties_paint_common.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/BKE_brush.h
M	source/blender/blenkernel/BKE_brush_engine.h
M	source/blender/blenkernel/BKE_paint.h
M	source/blender/blenkernel/intern/brush.c
M	source/blender/blenkernel/intern/brush_channel_define.h
M	source/blender/blenkernel/intern/brush_engine.c
M	source/blender/blenkernel/intern/brush_engine_presets.c
M	source/blender/blenkernel/intern/paint.c
M	source/blender/blenkernel/intern/pbvh.c
M	source/blender/blenloader/intern/versioning_300.c
M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/sculpt_paint/paint_intern.h
M	source/blender/editors/sculpt_paint/paint_stroke.c
M	source/blender/editors/sculpt_paint/paint_vertex.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_automasking.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h
M	source/blender/makesdna/DNA_sculpt_brush_types.h
M	source/blender/makesrna/intern/rna_brush_engine.c

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

diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 39cb886b16e..9c8cbb30db3 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -361,6 +361,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
   string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR "${NVCC_OUT}")
   set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
 
+
   # warn for other versions
   if((CUDA_VERSION MATCHES "101") OR
      (CUDA_VERSION MATCHES "102") OR
@@ -406,6 +407,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
       -D CCL_NAMESPACE_BEGIN=
       -D CCL_NAMESPACE_END=
       -D NVCC
+      -allow-unsupported-compiler
       -m ${CUDA_BITS}
       -I ${CMAKE_CURRENT_SOURCE_DIR}/..
       -I ${CMAKE_CURRENT_SOURCE_DIR}/device/cuda
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index a7a36973a44..355b24a6acc 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -273,8 +273,8 @@ channel_name_map = {
 expand_channels = {"direction", "radius_unit", "automasking"}
 
 
-def template_curve(layout, base, propname, full_path):
-    layout.template_curve_mapping(base, propname, brush=True)
+def template_curve(layout, base, propname, full_path, use_negative_slope=None):
+    layout.template_curve_mapping(base, propname, brush=True, use_negative_slope=use_negative_slope)
 
     path = full_path
 
@@ -286,6 +286,7 @@ def template_curve(layout, base, propname, full_path):
 
     for i, shape in enumerate(shapes):
         props = row.operator("brush.curve_preset_load", icon=icons[i], text="")
+        props.invert = use_negative_slope
         props.shape = shape
         props.path = path
 
@@ -414,13 +415,16 @@ class UnifiedPaintPanel:
     @staticmethod
     def channel_unified(layout, context, brush, prop_name, icon='NONE', pressure=None, text=None, baselayout=None,
                         slider=False, header=False, show_reorder=False, expand=None, toolsettings_only=False, ui_editing=None,
-                        show_mappings=None):
+                        show_mappings=None, brush_only=False, use_negative_slope=None):
         """ Generalized way of adding brush options to the UI,
             along with their pen pressure setting and global toggle
 
             note that ui_editing is no longer a bool, it can also be "mappings_only"
             to just show the input mappings controls.
-            """
+
+            for curve channels, if use_negative_slope is None then
+            `channel.curve_preset_negative_slope` will be used.
+        """
 
         if baselayout is None:
             baselayout = layout
@@ -488,7 +492,7 @@ class UnifiedPaintPanel:
 
         pressurech = ch
 
-        if ch.inherit or toolsettings_only:
+        if not brush_only and (ch.inherit or toolsettings_only):
             sd = context.tool_settings.sculpt
             # ensure channel exists in tool settings channel set
             sd.channels.ensure(ch)
@@ -527,9 +531,13 @@ class UnifiedPaintPanel:
 
         if ch.type == "CURVE":
             row.prop(finalch.curve, "curve_preset", text=text)
-            if finalch.curve.curve_preset == "CUSTOM":
+
+            if use_negative_slope is None:
+                use_negative_slope = finalch.curve.preset_slope_negative
+
+            if not header and finalch.curve.curve_preset == "CUSTOM":
                 path2 = path + ".curve.curve"
-                template_curve(layout, finalch.curve, "curve", path2)
+                template_curve(layout, finalch.curve, "curve", path2, use_negative_slope=use_negative_slope)
 
         elif ch.type == "BITMASK":
             if header or not expand:
@@ -985,7 +993,11 @@ class StrokePanel(BrushPanel):
                 row.prop(brush, "spacing", text="Spacing")
 
         if mode == 'SCULPT':
-            col.row().prop(brush, "use_scene_spacing", text="Spacing Distance", expand=True)
+            UnifiedPaintPanel.channel_unified(col,
+                    context,
+                    brush,
+                    "use_scene_spacing", text="Spacing Distance", expand=True)
+            #col.row().prop(brush, "use_scene_spacing", text="Spacing Distance", expand=True)
 
         if mode in {'PAINT_TEXTURE', 'PAINT_2D'}:
             if brush.image_paint_capabilities.has_space_attenuation or brush.sculpt_capabilities.has_space_attenuation:
@@ -1099,7 +1111,7 @@ class SmoothStrokePanel(BrushPanel):
 
 
 class FalloffPanel(BrushPanel):
-    bl_label = "Falloff"
+    bl_label = ""
     bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
@@ -1109,6 +1121,23 @@ class FalloffPanel(BrushPanel):
         settings = cls.paint_settings(context)
         return (settings and settings.brush and settings.brush.curve)
 
+    def draw_header(self, context):
+        layout = self.layout
+        settings = self.paint_settings(context)
+        mode = self.get_brush_mode(context)
+        brush = settings.brush
+
+        if 0 and mode == "SCULPT" and "falloff_curve" in brush.channels:
+            layout.label(text="Falloff")
+            ch = UnifiedPaintPanel.get_channel(context, brush, "falloff_curve")
+            layout.prop(ch.curve, "curve_preset", text="")
+
+            #UnifiedPaintPanel.channel_unified(layout, context, brush, "falloff_curve", use_negative_slope=True, header=True, text="")
+            return
+        else:
+            layout.label(text="Falloff")
+            layout.prop(brush, "curve_preset", text="")
+
     def draw(self, context):
         layout = self.layout
         settings = self.paint_settings(context)
@@ -1118,9 +1147,17 @@ class FalloffPanel(BrushPanel):
         if brush is None:
             return
 
+        if mode == "SCULPT" and "falloff_curve" in brush.channels:
+            ch, path = UnifiedPaintPanel.get_channel(context, brush, "falloff_curve", need_path=True)
+            path += ".curve.curve"
+            template_curve(layout, ch.curve, "curve", path, True)
+
+            #UnifiedPaintPanel.channel_unified(layout, context, brush, "falloff_shape", expand=True)
+            layout.prop(brush, "falloff_shape", expand=True)
+
+            return
+
         col = layout.column(align=True)
-        row = col.row(align=True)
-        row.prop(brush, "curve_preset", text="")
 
         if brush.curve_preset == 'CUSTOM':
             layout.template_curve_mapping(brush, "curve", brush=True, use_negative_slope=False)
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 0bbb48e8fa2..18c0f26032e 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5357,11 +5357,17 @@ class VIEW3D_MT_sculpt_automasking_pie(Menu):
         tool_settings = context.tool_settings
         sculpt = tool_settings.sculpt
 
-        pie.prop(sculpt, "use_automasking_topology", text="Topology")
-        pie.prop(sculpt, "use_automasking_face_sets", text="Face Sets")
-        pie.prop(sculpt, "use_automasking_boundary_edges", text="Mesh Boundary")
-        pie.prop(sculpt, "use_automasking_boundary_face_sets", text="Face Sets Boundary")
+        ch = UnifiedPaintPanel.get_channel(context, sculpt.brush, "automasking")
 
+        keys = ["TOPOLOGY", "FACE_SETS", "BOUNDARY_EDGE", "BOUNDARY_FACE_SETS"]
+
+        for item in ch.enum_items:
+            if item.identifier not in keys:
+                keys.append(item.identifier)
+
+        for key in keys:
+            print(key)
+            pie.prop_enum(ch, "value", key)
 
 class VIEW3D_MT_sculpt_face_sets_edit_pie(Menu):
 
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index b7abd7bafed..9ac5e903bae 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -425,7 +425,7 @@ class VIEW3D_PT_tools_brush_settings_channels(Panel, View3DPaintBrushPanel):
 
 class VIEW3D_PT_tools_brush_settings_channels_preview(Panel, View3DPaintBrushPanel):
     bl_context = ".paint_common"
-    bl_parent_id = "VIEW3D_PT_tools_brush_settings"
+    #bl_parent_id = "VIEW3D_PT_tools_brush_settings"
     bl_label = "Workspace Settings Preview"
 
     @classmethod
@@ -454,7 +454,7 @@ class VIEW3D_PT_tools_brush_settings_channels_preview(Panel, View3DPaintBrushPan
 
 class VIEW3D_PT_tools_brush_settings_advanced(Panel, View3DPaintBrushPanel):
     bl_context = ".paint_common"
-    bl_parent_id = "VIEW3D_PT_tools_brush_settings"
+    #bl_parent_id = "VIEW3D_PT_tools_brush_settings"
     bl_label = "Advanced"
     bl_options = {'DEFAULT_CLOSED'}
     bl_ui_units_x = 14
@@ -473,7 +473,7 @@ class VIEW3D_PT_tools_brush_settings_advanced(Panel, View3DPaintBrushPanel):
 
 class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel):
     bl_context = ".paint_common"  # dot on purpose (access from topbar)
-    bl_parent_id = "VIEW3D_PT_tools_brush_settings"
+    #bl_parent_id = "VIEW3D_PT_tools_brush_settings"
     bl_label = "Color Picker"
 
     @classmethod
@@ -500,7 +500,7 @@ class VIEW3D_PT_tools_brush_color(Panel, View3DPaintPanel):
 
 class VIEW3D_PT_tools_persistent_base_channels(Panel, View3DPaintPanel):
     bl_context = ".paint_common"
-    bl_parent_id = "VIEW3D_PT_tools_brush_settings_channels"
+    #bl_parent_id = "VIEW3D_PT_tools_brush_settings_channels"
     bl_label = "Persistent Base"
     bl_options = {'DEFAULT_CLOSED'}
 
@@ -710,7 +710,7 @@ class VIEW3D_PT_stencil_projectpaint(View3DPanel, Panel):
 # TODO, move to space_view3d.py
 class VIEW3D_PT_tools_brush_display(Panel, View3DPaintBrushPanel, DisplayPanel):
     bl_context = ".paint_common"
-    bl_parent_id = "VIEW3D_PT_tools_brush_settings"
+    #bl_parent_id = "VIEW3D_PT_tools_brush_settings"
     bl_label = "Cursor"
     bl_options = {'DEFAULT_CLOSED'}
     bl_ui_units_x = 12
@@ -719,7 +719,7 @@ class VIEW3D_PT_tools_brush_display(Panel, View3DPaintBrushPanel, DisplayPanel):
 # TODO, move to space_view3d.py
 class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
     bl_context = ".paint_common

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list