Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2021-09-21 00:10:35 +0300
committerJoseph Eagar <joeedh@gmail.com>2021-09-21 00:10:35 +0300
commit76beed9068e53e3d393e1c16f61efe8fd6edceda (patch)
treea6e38d77ee264991064b0ee5d7d991b294352604 /release/scripts
parent645aee083543670cf3bab1766b689a6113b81fc8 (diff)
Sculpt: More brush engine stuff, got automasking to work with it
* Sculpt now has an API to get brush channel settings. If a sculpt cache exists it will use the channels there (ss->cache->channels_final), otherwise it pulls them from a brush and Sculpt toolsettings. Exampes: float f = SCULPT_get_float(ss, "setting", sd, brush); itn i = SCULPT_get_int(ss, "setting", sd, brush); * Improved the UI a bit
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/startup/bl_ui/properties_paint_common.py50
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py15
2 files changed, 61 insertions, 4 deletions
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index dacde89a72c..c656df2fa81 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -108,7 +108,8 @@ class UnifiedPaintPanel:
return None
@staticmethod
- def channel_unified(layout, context, brush, prop_name, icon='NONE', pressure=True, text=None, slider=False, header=False, expand=None):
+ def channel_unified(layout, context, brush, prop_name, icon='NONE', pressure=True, text=None,
+ slider=False, header=False, expand=None, toolsettings_only=False):
""" Generalized way of adding brush options to the UI,
along with their pen pressure setting and global toggle, if they exist. """
ch = brush.channels.channels[prop_name]
@@ -119,6 +120,9 @@ class UnifiedPaintPanel:
#if ch.ui_expanded:
# layout = layout.box().column() #.column() is a bit more compact
+ if ch.type == "BITMASK":
+ layout = layout.box()
+
row = layout.row(align=True)
typeprop = "float_value"
@@ -139,18 +143,35 @@ class UnifiedPaintPanel:
text = text.strip()
path = ""
+ is_toolset = False
- if ch.inherit:
+ if ch.inherit or toolsettings_only:
sd = context.tool_settings.sculpt
#ensure channel exists in tool settings channel set
sd.channels.ensure(ch)
finalch = sd.channels.channels[prop_name]
+ is_toolset = True
path = "tool_settings.sculpt.channels.channels[\"%s\"]" % ch.idname
else:
path = "tool_settings.sculpt.brush.channels.channels[\"%s\"]" % ch.idname
- if expand is not None:
+ if ch.type == "BITMASK":
+ row.label(text=text)
+
+ if header:
+ row.prop_menu_enum(finalch, typeprop)
+ else:
+ col = layout.column()
+ col.emboss = "NONE"
+ for item in finalch.enum_items:
+ if item.identifier in finalch.flags_value:
+ itemicon = "CHECKBOX_HLT"
+ else:
+ itemicon = "CHECKBOX_DEHLT"
+ col.prop_enum(finalch, typeprop, item.identifier, icon=itemicon)
+
+ elif expand is not None:
row.prop(finalch, typeprop, icon=icon, text=text, slider=slider, expand=expand)
else:
row.prop(finalch, typeprop, icon=icon, text=text, slider=slider)
@@ -166,7 +187,15 @@ class UnifiedPaintPanel:
# # NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
# row.prop(ups, unified_name, text="", icon='BRUSHES_ALL')
if not header and ch.type != "BOOL":
- row.prop(ch, "inherit", text="", icon='BRUSHES_ALL')
+ if ch.type == "BITMASK" and not toolsettings_only and ch == finalch:
+ row.prop(ch, "inherit_if_unset", text="Combine With Defaults")
+
+ if not toolsettings_only:
+ row.prop(ch, "inherit", text="", icon='BRUSHES_ALL')
+
+ if ch.type == "BITMASK":
+ return
+
row.prop(ch, "ui_expanded", text="", icon="TRIA_DOWN" if ch.ui_expanded else "TRIA_RIGHT")
if ch.ui_expanded:
@@ -1163,6 +1192,18 @@ def brush_settings_advanced(layout, context, brush, popover=False):
use_accumulate = capabilities.has_accumulate
use_frontface = True
+ UnifiedPaintPanel.channel_unified(
+ layout.column(),
+ context,
+ brush,
+ "automasking", expand=False)
+ UnifiedPaintPanel.channel_unified(
+ layout.column(),
+ context,
+ brush,
+ "automasking_boundary_edges_propagation_steps")
+
+ """
col = layout.column(heading="Auto-Masking", align=True)
# topology automasking
@@ -1183,6 +1224,7 @@ def brush_settings_advanced(layout, context, brush, popover=False):
col.prop(brush, "use_automasking_boundary_edges", text="Mesh Boundary")
col.prop(brush, "use_automasking_boundary_face_sets", text="Face Sets Boundary")
col.prop(brush, "automasking_boundary_edges_propagation_steps")
+ """
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 7990878f48d..64170b8faa8 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -951,11 +951,26 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
col.separator()
+ brush = sculpt.brush
+ UnifiedPaintPanel.channel_unified(
+ layout.column(),
+ context,
+ brush,
+ "automasking", toolsettings_only=True)
+ UnifiedPaintPanel.channel_unified(
+ layout.column(),
+ context,
+ brush,
+ "automasking_boundary_edges_propagation_steps",
+ toolsettings_only=True)
+
+ """
col = layout.column(heading="Auto-Masking", align=True)
col.prop(sculpt, "use_automasking_topology", text="Topology")
col.prop(sculpt, "use_automasking_face_sets", text="Face Sets")
col.prop(sculpt, "use_automasking_boundary_edges", text="Mesh Boundary")
col.prop(sculpt, "use_automasking_boundary_face_sets", text="Face Sets Boundary")
+ """
col.separator()
col.operator("sculpt.set_limit_surface")