[Bf-blender-cvs] [1e7cae84e67] sculpt-dev: Sculpt: brush UI and debug changes
Joseph Eagar
noreply at git.blender.org
Sun Oct 17 13:21:58 CEST 2021
Commit: 1e7cae84e677002d6605ded8f8ea7ae212b99f26
Author: Joseph Eagar
Date: Sun Oct 17 04:19:38 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB1e7cae84e677002d6605ded8f8ea7ae212b99f26
Sculpt: brush UI and debug changes
* You can now edit brush input mappings
inside the main workspace brush panels.
* PBVH_CHECK_NAN now limits how many reports
it prints from a given source file.
* Fixed various problems with shift-smooth strength
setting.
* Fixed a NaN in the smoothing code.
===================================================================
M release/scripts/startup/bl_ui/properties_paint_common.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/blenkernel/BKE_brush_engine.h
M source/blender/blenkernel/BKE_pbvh.h
M source/blender/blenkernel/intern/brush_engine.c
M source/blender/blenkernel/intern/brush_engine_presets.c
M source/blender/blenloader/CMakeLists.txt
M source/blender/blenloader/intern/versioning_300.c
M source/blender/editors/gpencil/CMakeLists.txt
M source/blender/editors/interface/CMakeLists.txt
M source/blender/editors/mesh/CMakeLists.txt
M source/blender/editors/object/CMakeLists.txt
M source/blender/editors/render/CMakeLists.txt
M source/blender/editors/sculpt_paint/sculpt.c
M source/blender/editors/sculpt_paint/sculpt_smooth.c
M source/blender/editors/space_buttons/CMakeLists.txt
M source/blender/editors/space_image/CMakeLists.txt
M source/blender/editors/space_info/CMakeLists.txt
M source/blender/editors/space_view3d/CMakeLists.txt
M source/blender/editors/transform/CMakeLists.txt
M source/blender/editors/undo/CMakeLists.txt
M source/blender/editors/util/CMakeLists.txt
M source/blender/gpu/CMakeLists.txt
M source/blender/makesrna/intern/rna_brush_engine.c
M source/blender/modifiers/CMakeLists.txt
M source/blender/nodes/CMakeLists.txt
M source/blender/windowmanager/CMakeLists.txt
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index b2eb671ffab..282143c4afe 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -80,7 +80,8 @@ class DynamicBrushCategoryPanel(Panel):
ch.idname,
slider=True,
ui_editing=opt["ui_editing"],
- show_reorder=opt["show_reorder"])
+ show_reorder=opt["show_reorder"],
+ show_mappings=opt["show_mappings"])
class DynamicPaintPanelGen:
@@ -96,7 +97,7 @@ class DynamicPaintPanelGen:
groups = {}
@staticmethod
- def ensureCategory(idname, name=None, prefix="VIEW3D_PT_brush_category_", parent=None, show_reorder=False, ui_editing=False):
+ def ensureCategory(idname, name=None, prefix="VIEW3D_PT_brush_category_", parent=None, show_reorder=False, ui_editing=False, show_mappings=None):
if name is None:
name = idname
@@ -110,7 +111,8 @@ class DynamicPaintPanelGen:
group.options = {
"ui_editing": ui_editing,
- "show_reorder": show_reorder
+ "show_reorder": show_reorder,
+ "show_mappings" : show_mappings
}
def callback():
@@ -194,7 +196,8 @@ classes.append(CLASSNAME)
#pre create category panels in correct order
for cat in builtin_channel_categories:
- DynamicPaintPanelGen.ensureCategory(cat, cat, parent="VIEW3D_PT_tools_brush_settings_channels", prefix="VIEW3D_PT_brush_category_")
+ DynamicPaintPanelGen.ensureCategory(cat, cat, parent="VIEW3D_PT_tools_brush_settings_channels", prefix="VIEW3D_PT_brush_category_",
+ ui_editing=False, show_mappings=True)
DynamicPaintPanelGen.ensureCategory(cat, cat, prefix="VIEW3D_PT_brush_category_edit_",
parent="VIEW3D_PT_tools_brush_settings_channels_preview")
@@ -353,9 +356,14 @@ 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):
+ slider=False, header=False, show_reorder=False, expand=None, toolsettings_only=False, ui_editing=None,
+ show_mappings=None):
""" Generalized way of adding brush options to the UI,
- along with their pen pressure setting and global toggle"""
+ 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.
+ """
if baselayout is None:
baselayout = layout
@@ -363,17 +371,22 @@ class UnifiedPaintPanel:
if slider is None:
slider = False
- if ui_editing is None:
+ if header:
+ ui_editing = False
+ show_mappings = False
+ elif ui_editing is None:
ui_editing = True
- ui_editing = ui_editing and not header
-
- if context.mode != "SCULPT":
- return UnifiedPaintPanel.prop_unified(layout, context, brush, prop_name, icon=icon, text=text, slider=slider, header=header, expand=expand)
if not context.tool_settings.unified_paint_settings.brush_editor_mode:
ui_editing = False
show_reorder = False
+ if ui_editing and show_mappings is None:
+ show_mappings = True
+
+ if context.mode != "SCULPT":
+ return UnifiedPaintPanel.prop_unified(layout, context, brush, prop_name, icon=icon, text=text, slider=slider, header=header, expand=expand)
+
if prop_name == "size":
prop_name = "radius"
elif prop_name == "use_locked_size":
@@ -402,6 +415,8 @@ class UnifiedPaintPanel:
layout = layout.column(align=True)
row = layout.row(align=True)
+ row.use_property_split = False
+ row.use_property_decorate = False
typeprop = "value"
@@ -442,9 +457,9 @@ class UnifiedPaintPanel:
props.direction = 1
if ui_editing and not header:
- row.prop(ch, "show_in_workspace", text="", icon="HIDE_OFF")
- row.prop(ch, "show_in_context_menu", text="", icon="MENU_PANEL")
- #row.prop(ch, "ui_order", text="")
+ row2 = row.row(align=True)
+ row2.prop(ch, "show_in_workspace", text="", icon="HIDE_OFF")
+ row2.prop(ch, "show_in_context_menu", text="", icon="MENU_PANEL")
if ch.type == "CURVE":
row.prop(finalch.curve, "curve_preset", text=text)
@@ -523,7 +538,7 @@ class UnifiedPaintPanel:
if ch.type in ["BITMASK", "BOOL", "CURVE", "ENUM"]:
return
- if not ui_editing and not show_reorder:
+ if not show_mappings and not show_reorder:
return
row.prop(ch, "ui_expanded", text="", icon="TRIA_DOWN" if ch.ui_expanded else "TRIA_RIGHT")
@@ -536,7 +551,10 @@ class UnifiedPaintPanel:
if mp.inherit:
mp = finalch.mappings[i]
- row2 = layout.row()
+ row2 = layout.row(align=True)
+ row2.use_property_split = False
+ row2.use_property_decorate = False
+
name = mp.type.lower()
if len(name) > 0:
@@ -552,10 +570,13 @@ class UnifiedPaintPanel:
row2.prop(mp0, "ui_expanded", text="", icon="TRIA_DOWN" if mp.ui_expanded else "TRIA_RIGHT")
if mp0.ui_expanded:
- #XXX why do I have to feed use_negative_slope as true here?
- layout.template_curve_mapping(mp, "curve", brush=True, use_negative_slope=True)
+ #XXX why do I have to feed use_negative_slope as true
+ #here?
+ box = layout.box()
+
+ box.template_curve_mapping(mp, "curve", brush=True, use_negative_slope=True)
- col = layout.column(align=True)
+ col = box.column(align=True)
row = col.row(align=True)
if mp0.inherit or toolsettings_only:
@@ -1854,14 +1875,14 @@ def brush_settings_channels(layout, context, brush, ui_editing=False, popover=Fa
if len(ch.category) > 0:
DynamicPaintPanelGen.ensureCategory(ch.category, ch.category, parent=parent,
prefix=prefix, ui_editing=ui_editing,
- show_reorder=show_reorder)
+ show_reorder=show_reorder, show_mappings=True)
continue
# VIEW3D_PT_brush_category_edit_
UnifiedPaintPanel.channel_unified(layout.column(),
context,
brush,
- ch.idname, show_reorder=show_reorder, expand=False, ui_editing=ui_editing)
+ ch.idname, show_reorder=show_reorder, expand=False, ui_editing=ui_editing, show_mappings=True)
def brush_settings_advanced(layout, context, brush, popover=False):
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 06427f7bfa1..39f2be5dba2 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1248,12 +1248,12 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
UnifiedPaintPanel.channel_unified(layout.column(),
context,
brush,
- "smooth_strength_factor", ui_editing=False, slider=True)
+ "smooth_strength_factor", ui_editing=False, slider=True, show_mappings=True)
UnifiedPaintPanel.channel_unified(layout.column(),
context,
brush,
- "smooth_strength_projection", ui_editing=False, slider=True)
+ "smooth_strength_projection", ui_editing=False, slider=True, show_mappings=True)
"""
smoothbrush = None
@@ -1285,7 +1285,7 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
context,
brush,
"concave_mask_factor",
- toolsettings_only=True, ui_editing=False, slider=True)
+ toolsettings_only=True, ui_editing=False, slider=True, show_mappings=True)
"""
col = layout.column(heading="Auto-Masking", align=True)
diff --git a/source/blender/blenkernel/BKE_brush_engine.h b/source/blender/blenkernel/BKE_brush_engine.h
index 387dc902b2e..2ccea1220f2 100644
--- a/source/blender/blenkernel/BKE_brush_engine.h
+++ b/source/blender/blenkernel/BKE_brush_engine.h
@@ -102,6 +102,7 @@ typedef struct BrushMappingDef {
int curve;
bool enabled;
bool inv;
+ bool inherit;
float min, max;
int blendmode;
float func_cutoff;
@@ -190,7 +191,10 @@ typedef struct BrushCommandList {
void BKE_brush_channel_free_data(BrushChannel *ch);
void BKE_brush_channel_free(BrushChannel *ch);
-void BKE_brush_channel_copy_data(BrushChannel *dst, BrushChannel *src, bool keep_mappings);
+void BKE_brush_channel_copy_data(BrushChannel *dst,
+ BrushChannel *src,
+ bool keep_mappings,
+ bool keep_idname_and_def);
void BKE_brush_channel_init(BrushChannel *ch, BrushChannelType *def);
BrushChannelSet *BKE_brush_channelset_create(const char *info);
@@ -230,6 +234,7 @@ bool BKE_brush_channelset_has(BrushChannelSet *chset, const char *idname);
BrushChannel *BKE_brush_channelset_add_builtin(BrushChannelSet *chset, const char *idname);
BrushChannel *BKE_brush_channelset_ensure_builtin(BrushChannelSet *chset, const char *idname);
void BKE_brush_mapping_reset(BrushChannel *ch, int tool, int mapping);
+void BKE_brush_mapping_inherit_all(BrushChannel *ch
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list