[Bf-blender-cvs] [150ad9cf9ca] sculpt-dev: Sculpt: More clay brush fixes
Joseph Eagar
noreply at git.blender.org
Thu Sep 30 06:07:09 CEST 2021
Commit: 150ad9cf9ca46fbd233b9194b548f2f45ab97d57
Author: Joseph Eagar
Date: Wed Sep 29 21:06:39 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB150ad9cf9ca46fbd233b9194b548f2f45ab97d57
Sculpt: More clay brush fixes
===================================================================
M release/scripts/startup/bl_ui/properties_paint_common.py
M source/blender/blenkernel/BKE_blender_version.h
M source/blender/blenkernel/BKE_brush_engine.h
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/blenloader/intern/versioning_300.c
M source/blender/editors/sculpt_paint/sculpt.c
M source/blender/editors/sculpt_paint/sculpt_intern.h
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 29c08b9ea81..e519cd0c5bc 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -127,23 +127,25 @@ class DynamicPaintPanelGen:
global classes
name = group.prefix + group.idname.lower()
+ name1 = name
name2 = ""
for c in name:
n = ord(c)
- ok = n >= ord("a") and n <= ord("a")
- ok = ok or n >= ord("A") and n <= ord("Z")
- ok = ok or n >= ord("0") and n <= ord("9")
+ ok = n >= ord("a") and n <= ord("z")
+ ok = ok or (n >= ord("A") and n <= ord("Z"))
+ ok = ok or (n >= ord("0") and n <= ord("9"))
ok = ok or c == "_"
if not ok:
c = "_"
+
name2 += c
name = name2
for cls in classes[:]:
- print("_", cls.bl_rna.identifier, cls.bl_rna.identifier == name) # r, dir(cls.bl_rna)) #.name)
+ #print("_", cls.bl_rna.identifier, cls.bl_rna.identifier == name) # r, dir(cls.bl_rna)) #.name)
if cls.bl_rna.identifier == name:
try:
@@ -180,7 +182,6 @@ classes.append(CLASSNAME)
""".strip().replace("CLASSNAME", name).replace("PARENT", parent).replace("LABEL", group.name).replace("OPT", opt)
code = code.replace("IDNAME", group.idname)
- print("\n", code)
exec(code)
@@ -522,7 +523,7 @@ class UnifiedPaintPanel:
if not toolsettings_only:
row.prop(ch, "inherit", text="", icon='BRUSHES_ALL')
- if ch.type in ["BITMASK", "BOOL", "CURVE"]:
+ if ch.type in ["BITMASK", "BOOL", "CURVE", "ENUM"]:
return
if not ui_editing and not show_reorder:
@@ -1038,6 +1039,7 @@ def brush_settings(layout, context, brush, popover=False):
layout.prop(context.tool_settings.unified_paint_settings, "brush_editor_advanced")
advanced = context.tool_settings.unified_paint_settings.brush_editor_advanced
+ editor = context.tool_settings.unified_paint_settings.brush_editor_mode
### Draw simple settings unique to each paint mode. ###
brush_shared_settings(layout, context, brush, popover)
@@ -1267,11 +1269,33 @@ def brush_settings(layout, context, brush, popover=False):
slider=True,
)
- row = layout.row(heading="Plane Trim")
- row.prop(brush, "use_plane_trim", text="")
- sub = row.row()
- sub.active = brush.use_plane_trim
- sub.prop(brush, "plane_trim", slider=True, text="")
+ if editor:
+ col = layout.column()
+
+ #row.prop(brush, "use_plane_trim", text="")
+ #"""
+ UnifiedPaintPanel.channel_unified(
+ col,
+ context,
+ brush,
+ "use_plane_trim",
+ text="Plane Trim"
+ )
+ UnifiedPaintPanel.channel_unified(
+ col,
+ context,
+ brush,
+ "plane_trim",
+ slider=True
+ )
+ #"""
+ else:
+ row = layout.row(heading="Plane Trim")
+ row.prop(brush.channels["use_plane_trim"], "bool_value", text="")
+
+ sub = row.row()
+ sub.active = brush.channels["use_plane_trim"].bool_value
+ sub.prop(brush.channels["plane_trim"], "factor_value", slider=True, text="")
layout.separator()
@@ -1802,9 +1826,26 @@ def brush_settings_advanced(layout, context, brush, popover=False):
# sculpt plane settings
if capabilities.has_sculpt_plane:
layout.prop(brush, "sculpt_plane")
- col = layout.column(heading="Use Original", align=True)
- col.prop(brush, "use_original_normal", text="Normal")
- col.prop(brush, "use_original_plane", text="Plane")
+
+ col = layout.column(heading="Use Original", align=False)
+ col = col.column()
+
+ UnifiedPaintPanel.channel_unified(
+ col,
+ context,
+ brush,
+ "original_normal",
+ text="Normal",
+ expand=False
+ )
+ UnifiedPaintPanel.channel_unified(
+ col,
+ context,
+ brush,
+ "original_plane",
+ text="Plane",
+ expand=False
+ )
layout.separator()
# 3D and 2D Texture Paint.
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 4a34a7ec2fc..c25f149acdc 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -39,7 +39,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 26
+#define BLENDER_FILE_SUBVERSION 27
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file
diff --git a/source/blender/blenkernel/BKE_brush_engine.h b/source/blender/blenkernel/BKE_brush_engine.h
index 15036014193..0d57644ff06 100644
--- a/source/blender/blenkernel/BKE_brush_engine.h
+++ b/source/blender/blenkernel/BKE_brush_engine.h
@@ -62,6 +62,8 @@ struct LibraryForeachIDData;
/* these macros check channel names at compile time */
+#define BRUSHSET_LOOKUP_FINAL(childset, parentset, idname) \
+ BKE_brush_channelset_lookup_final(childset, parentset, MAKE_BUILTIN_CH_NAME(idname))
#define BRUSHSET_LOOKUP(chset, channel) \
BKE_brush_channelset_lookup(chset, MAKE_BUILTIN_CH_NAME(channel))
#define BRUSHSET_HAS(chset, channel, mapdata) \
@@ -214,6 +216,9 @@ bool BKE_brush_channelset_remove_named(BrushChannelSet *chset, const char *idnam
void BKE_brush_channelset_ensure_existing(BrushChannelSet *chset, BrushChannel *existing);
BrushChannel *BKE_brush_channelset_lookup(BrushChannelSet *chset, const char *idname);
+BrushChannel *BKE_brush_channelset_lookup_final(BrushChannelSet *child,
+ BrushChannelSet *parent,
+ const char *idname);
bool BKE_brush_channelset_has(BrushChannelSet *chset, const char *idname);
@@ -270,6 +275,11 @@ void BKE_brush_channel_set_vector(BrushChannel *ch, float vec[4]);
int BKE_brush_channel_get_vector_size(BrushChannel *ch);
float BKE_brush_channel_curve_evaluate(BrushChannel *ch, float val, const float maxval);
+double BKE_brush_channel_eval_mappings(BrushChannel *ch,
+ BrushMappingData *mapdata,
+ double f,
+ int idx);
+
CurveMapping *BKE_brush_channel_curvemapping_get(BrushCurve *curve, bool force_create);
bool BKE_brush_channel_curve_ensure_write(BrushCurve *curve);
void BKE_brush_channel_curve_assign(BrushChannel *ch, BrushCurve *curve);
diff --git a/source/blender/blenkernel/intern/brush_channel_define.h b/source/blender/blenkernel/intern/brush_channel_define.h
index 2227e2e7218..94e69c95b03 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -273,6 +273,7 @@ MAKE_FLOAT(tip_scale_x, "Tip Scale X", "Scale of the brush tip in the X axis", 1
MAKE_FLOAT(dash_ratio, "Dash Ratio", "Ratio of samples in a cycle that the brush is enabled", 1.0f, 0.0f, 1.0f)
MAKE_FLOAT_EX(plane_offset, "Plane Offset", "Adjust plane on which the brush acts towards or away from the object surface", 0.0f, -2.0f, 2.0f, -0.5f, 0.5f, false)
MAKE_FLOAT(plane_trim, "Plane Trim", "If a vertex is further away from offset plane than this, then it is not affected", 0.5f, 0.0f, 1.0f)
+MAKE_BOOL(use_plane_trim, "Use Plane Trim", "Enable Plane Trim", false)
MAKE_BOOL(original_normal, "Original Normal", "When locked keep using normal of surface where stroke was initiated", false)
MAKE_BOOL(original_plane, "Original Plane", "When locked keep using the plane origin of surface where stroke was initiated", false)
MAKE_BOOL(use_weighted_smooth, "Weight By Area", "Weight by face area to get a smoother result", true)
diff --git a/source/blender/blenkernel/intern/brush_engine.c b/source/blender/blenkernel/intern/brush_engine.c
index 2e066432795..638f7f32c8c 100644
--- a/source/blender/blenkernel/intern/brush_engine.c
+++ b/source/blender/blenkernel/intern/brush_engine.c
@@ -593,6 +593,28 @@ BrushChannel *BKE_brush_channelset_lookup(BrushChannelSet *chset, const char *id
return BLI_ghash_lookup(chset->namemap, idname);
}
+BrushChannel *BKE_brush_channelset_lookup_final(BrushChannelSet *child,
+ BrushChannelSet *parent,
+ const char *idname)
+{
+ BrushChannel *ch = child ? BKE_brush_channelset_lookup(child, idname) : NULL;
+ BrushChannel *pch = parent ? BKE_brush_channelset_lookup(parent, idname) : NULL;
+
+ if (ch && pch) {
+ if (ch->flag & BRUSH_CHANNEL_INHERIT) {
+ return pch;
+ }
+
+ return ch;
+ }
+ else if (pch) {
+ return pch;
+ }
+ else {
+ return ch;
+ }
+}
+
bool BKE_brush_channelset_has(BrushChannelSet *chset, const char *idname)
{
return BKE_brush_channelset_lookup(chset, idname) != NULL;
@@ -843,7 +865,10 @@ static bool channel_has_mappings(BrushChannel *ch)
}
// idx is used by vector channels
-static double eval_channel_mappings(BrushChannel *ch, BrushMappingData *mapdata, double f, int idx)
+double BKE_brush_channel_eval_mappings(BrushChannel *ch,
+ BrushMappingData *mapdata,
+ double f,
+ int idx)
{
if (idx == 3 && !(ch->flag & BRUSH_CHANNEL_APP
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list