[Bf-blender-cvs] [c1b8049adf8] sculpt-dev: Fix a few defaults for sculpt paint brush
Joseph Eagar
noreply at git.blender.org
Sat Sep 25 10:50:10 CEST 2021
Commit: c1b8049adf869d632f033502fc2d89d9a4b9b03c
Author: Joseph Eagar
Date: Sat Sep 25 01:49:52 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBc1b8049adf869d632f033502fc2d89d9a4b9b03c
Fix a few defaults for sculpt paint brush
===================================================================
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
M source/blender/editors/sculpt_paint/sculpt_intern.h
M source/blender/editors/sculpt_paint/sculpt_paint_color.c
===================================================================
diff --git a/source/blender/blenkernel/intern/brush_channel_define.h b/source/blender/blenkernel/intern/brush_channel_define.h
index a654eebe8a2..eee51e5a9c3 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -172,7 +172,7 @@ places in rna_engine_codebase are relevent:
MAKE_FLOAT(normal_radius_factor, "Normal Radius", "Ratio between the brush radius and the radius that is going to be "
"used to sample the normal", 0.5f, 0.0f, 1.0f)
MAKE_FLOAT(hardness, "Hardness", "Brush falloff hardness", 0.0f, 0.0f, 1.0f)
- MAKE_FLOAT(tip_roundness, "Tip Roundness", "", 0.0f, 0.0f, 1.0f)
+ MAKE_FLOAT(tip_roundness, "Tip Roundness", "", 1.0f, 0.0f, 1.0f)
MAKE_BOOL(accumulate, "Accumulate", "", false)
MAKE_ENUM(direction, "Direction", "", 0, _({
{0, "ADD", "ADD", "Add", "Add effect of brush"},
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c b/source/blender/blenkernel/intern/brush_engine_presets.c
index 2b398ff053b..13812067140 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -317,6 +317,8 @@ static BrushSettingsMap brush_settings_map[] = {
DEF(pose_deform_type, pose_deform_type, INT, INT)
DEF(pose_origin_type, pose_origin_type, INT, INT)
DEF(snake_hook_deform_type, snake_hook_deform_type, INT, INT)
+ DEF(tip_roundness, tip_roundness, FLOAT, FLOAT)
+ DEF(tip_scale_x, tip_scale_x, FLOAT, FLOAT)
};
static const int brush_settings_map_len = ARRAY_SIZE(brush_settings_map);
@@ -1123,6 +1125,7 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
BRUSHSET_SET_FLOAT(chset, hardness, 0.4f);
BRUSHSET_SET_FLOAT(chset, spacing, 10.0f);
BRUSHSET_SET_FLOAT(chset, strength, 0.6f);
+ BRUSHSET_LOOKUP(chset, strength)->flag &= ~BRUSH_MAPPING_INHERIT;
break;
case SCULPT_TOOL_CLAY:
GETCH(radius)->mappings[BRUSH_MAPPING_PRESSURE].flag |= BRUSH_MAPPING_ENABLED;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 5f5bccc1545..a49f72fc273 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -145,19 +145,19 @@ float SCULPT_get_float_intern(const SculptSession *ss,
const Sculpt *sd,
const Brush *br)
{
+ BrushMappingData *mapdata = ss->cache ? &ss->cache->input_mapping : NULL;
+
if (ss->cache && ss->cache->channels_final) {
- return BKE_brush_channelset_get_float(
- ss->cache->channels_final, idname, &ss->cache->input_mapping);
+ return BKE_brush_channelset_get_float(ss->cache->channels_final, idname, mapdata);
}
else if (br && sd && br->channels && sd->channels) {
- return BKE_brush_channelset_get_final_float(
- br->channels, sd->channels, idname, &ss->cache->input_mapping);
+ return BKE_brush_channelset_get_final_float(br->channels, sd->channels, idname, mapdata);
}
else if (br && br->channels) {
- return BKE_brush_channelset_get_float(br->channels, idname, &ss->cache->input_mapping);
+ return BKE_brush_channelset_get_float(br->channels, idname, mapdata);
}
else if (sd && sd->channels) {
- return BKE_brush_channelset_get_float(sd->channels, idname, &ss->cache->input_mapping);
+ return BKE_brush_channelset_get_float(sd->channels, idname, mapdata);
}
else {
// eek!
@@ -170,19 +170,43 @@ int SCULPT_get_int_intern(const SculptSession *ss,
const Sculpt *sd,
const Brush *br)
{
+ BrushMappingData *mapdata = ss->cache ? &ss->cache->input_mapping : NULL;
+
if (ss->cache && ss->cache->channels_final) {
- return BKE_brush_channelset_get_int(
- ss->cache->channels_final, idname, &ss->cache->input_mapping);
+ return BKE_brush_channelset_get_int(ss->cache->channels_final, idname, mapdata);
+ }
+ else if (br && br->channels && sd && sd->channels) {
+ return BKE_brush_channelset_get_final_int(br->channels, sd->channels, idname, mapdata);
+ }
+ else if (br && br->channels) {
+ return BKE_brush_channelset_get_int(br->channels, idname, mapdata);
+ }
+ else if (sd && sd->channels) {
+ return BKE_brush_channelset_get_int(sd->channels, idname, mapdata);
+ }
+ else {
+ // eek!
+ return 0;
+ }
+}
+
+int SCULPT_get_vector_intern(
+ const SculptSession *ss, const char *idname, float out[4], const Sculpt *sd, const Brush *br)
+{
+ BrushMappingData *mapdata = ss->cache ? &ss->cache->input_mapping : NULL;
+
+ if (ss->cache && ss->cache->channels_final) {
+
+ BKE_brush_channelset_get_vector(ss->cache->channels_final, idname, out, mapdata);
}
else if (br && br->channels && sd && sd->channels) {
- return BKE_brush_channelset_get_final_int(
- br->channels, sd->channels, idname, &ss->cache->input_mapping);
+ return BKE_brush_channelset_get_final_vector(br->channels, sd->channels, idname, out, mapdata);
}
else if (br && br->channels) {
- return BKE_brush_channelset_get_int(br->channels, idname, &ss->cache->input_mapping);
+ return BKE_brush_channelset_get_vector(br->channels, idname, out, mapdata);
}
else if (sd && sd->channels) {
- return BKE_brush_channelset_get_int(sd->channels, idname, &ss->cache->input_mapping);
+ return BKE_brush_channelset_get_vector(sd->channels, idname, out, mapdata);
}
else {
// eek!
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 9e08241bd1a..bdd732d1d3e 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -274,6 +274,11 @@ int SCULPT_get_int_intern(const SculptSession *ss,
SCULPT_get_int_intern(ss, BRUSH_BUILTIN_##idname, sd, br)
#define SCULPT_get_bool(ss, idname, sd, br) SCULPT_get_int(ss, idname, sd, br)
+int SCULPT_get_vector_intern(
+ const SculptSession *ss, const char *idname, float out[4], const Sculpt *sd, const Brush *br);
+#define SCULPT_get_vector(ss, idname, out, sd, br) \
+ SCULPT_get_vector_intern(ss, BRUSH_BUILTIN_##idname, out, sd, br)
+
SculptCornerType SCULPT_vertex_is_corner(const SculptSession *ss,
const SculptVertRef index,
SculptCornerType cornertype);
@@ -647,7 +652,8 @@ struct SculptPoseIKChain *SCULPT_pose_ik_chain_init(struct Sculpt *sd,
void SCULPT_pose_ik_chain_free(struct SculptPoseIKChain *ik_chain);
/* Boundary Brush. */
-struct SculptBoundary *SCULPT_boundary_data_init(struct Sculpt *sd, Object *object,
+struct SculptBoundary *SCULPT_boundary_data_init(struct Sculpt *sd,
+ Object *object,
Brush *brush,
const SculptVertRef initial_vertex,
const float radius);
diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_color.c b/source/blender/editors/sculpt_paint/sculpt_paint_color.c
index d82e0c33923..f5411c1aaf2 100644
--- a/source/blender/editors/sculpt_paint/sculpt_paint_color.c
+++ b/source/blender/editors/sculpt_paint/sculpt_paint_color.c
@@ -291,7 +291,7 @@ void SCULPT_do_paint_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
scale_m4_fl(scale, ss->cache->radius);
mul_m4_m4m4(tmat, mat, scale);
- mul_v3_fl(tmat[1], brush->tip_scale_x);
+ mul_v3_fl(tmat[1], SCULPT_get_float(ss, tip_scale_x, sd, brush));
invert_m4_m4(mat, tmat);
if (is_zero_m4(mat)) {
return;
@@ -300,10 +300,12 @@ void SCULPT_do_paint_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
float brush_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
- BKE_brush_channelset_get_vector(ss->cache->channels_final,
- ss->cache->invert ? "secondary_color" : "color",
- brush_color,
- &ss->cache->input_mapping);
+ if (ss->cache->invert) {
+ SCULPT_get_vector(ss, secondary_color, brush_color, sd, brush);
+ }
+ else {
+ SCULPT_get_vector(ss, color, brush_color, sd, brush);
+ }
/* Smooth colors mode. */
if (ss->cache->alt_smooth) {
More information about the Bf-blender-cvs
mailing list