Sculpt: Fixed a few sculpt color issues

* Fixed broken smear brush
* Tweaked ui defaults a bit
This commit is contained in:
Joseph Eagar 2021-10-05 21:55:53 -07:00
parent 6264a6327f
commit c209e0902d
9 changed files with 65 additions and 14 deletions

View File

@ -1113,7 +1113,7 @@ def brush_settings(layout, context, brush, popover=False):
brush,
"autosmooth_spacing",
slider=True,
text="Spacing")
text="Smooth Spacing")
UnifiedPaintPanel.prop_unified(box,
context,
@ -1161,7 +1161,7 @@ def brush_settings(layout, context, brush, popover=False):
brush,
"topology_rake_spacing",
slider=True,
text="Spacing")
text="Rake Spacing")
UnifiedPaintPanel.prop_unified(box,
context,

View File

@ -39,7 +39,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 33
#define BLENDER_FILE_SUBVERSION 34
/* 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

View File

@ -309,8 +309,14 @@ extern void BKE_brush_channelset_to_unified_settings(BrushChannelSet *chset,
void BKE_brush_init_toolsettings(struct Sculpt *sd);
void BKE_brush_builtin_create(struct Brush *brush, int tool);
BrushCommandList *BKE_brush_commandlist_create();
void BKE_brush_commandlist_start(BrushCommandList *list,
struct Brush *brush,
BrushChannelSet *chset_final);
void BKE_brush_commandlist_free(BrushCommandList *cl);
BrushCommand *BKE_brush_commandlist_add(BrushCommandList *cl,
BrushChannelSet *chset_template,
bool auto_inherit);

View File

@ -194,7 +194,7 @@ places in rna_engine_codebase are relevent:
{-1}
})
MAKE_FLOAT_EX(spacing, "Spacing", "", 10.0f, 0.25f, 1000.0f, 1.0f, 500.0f, false)
MAKE_FLOAT_EX(spacing, "Spacing", "", 10.0f, 0.25f, 1000.0f, 1.0f, 200.0f, false)
MAKE_FLOAT_EX(topology_rake, "Topology Rake", "Automatically align edges to the brush direction to "
"generate cleaner topology and define sharp features. "
"Best used on low-poly meshes as it has a performance impact", 0.0f, 0.0f, 5.0f, 0.0f, 2.0f, false)
@ -335,7 +335,7 @@ MAKE_FLOAT_EX(vcol_boundary_exponent, "Exponent", "Hardening exponent (smaller v
MAKE_FLOAT_EX(vcol_boundary_radius_scale, "Radius Scale",
"Scale brush radius for vcol boundary hardening",
1.0f, 0.0001f, 100.0f, 0.001f, 3.0f, false)
MAKE_FLOAT_EX(vcol_boundary_spacing, "Spacing", "Spacing for vcol boundary hardening", 15, 0.25, 5000, 0.5, 300, false)
MAKE_FLOAT_EX(vcol_boundary_spacing, "Color Hardening Spacing", "Spacing for vcol boundary hardening", 15, 0.25, 5000, 0.5, 300, false)
MAKE_BOOL(invert_to_scrape_fill,"Invert to Scrape or Fill",
"Use Scrape or Fill tool when inverting this brush instead of "
"inverting its displacement direction", true)
@ -568,6 +568,15 @@ MAKE_ENUM(array_deform_type, "Deformation", "Deformation type that is used in th
MAKE_INT_EX(array_count, "Count", "Number of copies", 2, 1, 10000, 1, 50)
MAKE_ENUM(smear_deform_type, "Deformation", "Deformation type that is used in the brush", BRUSH_SMEAR_DEFORM_DRAG, {
{BRUSH_SMEAR_DEFORM_DRAG, "DRAG", "NONE", "Drag", ""},
{BRUSH_SMEAR_DEFORM_PINCH, "PINCH", "NONE", "Pinch", ""},
{BRUSH_SMEAR_DEFORM_EXPAND, "EXPAND", "NONE", "Expand", ""},
{-1}
})
MAKE_FLOAT(smear_deform_blend, "Smear Blend", "Blend with existing paint", 1.0f, 0.0f, 1.0f)
//MAKE_FLOAT3_EX
/* clang-format on */
#if defined(BRUSH_CHANNEL_DEFINE_TYPES) || defined(BRUSH_CHANNEL_DEFINE_EXTERNAL)

View File

@ -268,6 +268,9 @@ static bool check_builtin_init()
// SETCAT(direction, "Basic");
SETCAT(accumulate, "Basic");
SETCAT(smear_deform_type, "Smear");
SETCAT(smear_deform_blend, "Smear");
SETCAT(tip_roundness, "Basic");
SETCAT(hardness, "Basic");
SETCAT(tip_scale_x, "Basic");
@ -331,6 +334,15 @@ static bool check_builtin_init()
SETCAT(color, "Color");
SETCAT(secondary_color, "Color");
SETCAT(blend, "Color");
SETCAT(wet_mix, "Color");
SETCAT(wet_persistence, "Color");
SETCAT(density, "Color");
SETCAT(flow, "Color");
SETCAT(vcol_boundary_spacing, "Color Boundary Hardening");
SETCAT(vcol_boundary_radius_scale, "Color Boundary Hardening");
SETCAT(vcol_boundary_exponent, "Color Boundary Hardening");
SETCAT(vcol_boundary_factor, "Color Boundary Hardening");
return true;
}
@ -456,6 +468,7 @@ static BrushSettingsMap brush_settings_map[] = {
DEF(smooth_deform_type, smooth_deform_type, INT, INT)
DEF(array_deform_type, array_deform_type, INT, INT)
DEF(array_count, array_count, INT, INT)
DEF(smear_deform_type, smear_deform_type, INT, INT)
};
static const int brush_settings_map_len = ARRAY_SIZE(brush_settings_map);
@ -1095,6 +1108,8 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
break;
case SCULPT_TOOL_SMEAR:
ADDCH(rate);
ADDCH(smear_deform_type);
ADDCH(smear_deform_blend);
break;
case SCULPT_TOOL_SLIDE_RELAX:
ADDCH(slide_deform_type);
@ -1286,6 +1301,14 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
SHOWCTX(use_grab_active_vertex);
SHOWALL(grab_silhouette);
break;
case SCULPT_TOOL_SMEAR:
SHOWWRK(smear_deform_type);
SHOWCTX(smear_deform_type);
SHOWWRK(spacing);
// hrm, not sure this is such a good idea - joeedh
// SHOWALL(smear_deform_blend);
break;
case SCULPT_TOOL_CLAY_STRIPS:
SHOWWRK(area_radius_factor);
SHOWWRK(plane_offset);
@ -1397,6 +1420,9 @@ void BKE_brush_channelset_ui_init(Brush *brush, int tool)
SHOWWRK(rate);
SHOWALL(blend);
SHOWWRK(use_smoothed_rake);
SHOWCTX(use_smoothed_rake);
SHOWCTX(color);
SHOWCTX(blend);
break;
@ -1519,6 +1545,7 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
BRUSHSET_LOOKUP(chset, strength)->mappings[BRUSH_MAPPING_PRESSURE].flag &=
~BRUSH_MAPPING_ENABLED;
BRUSHSET_SET_BOOL(chset, dyntopo_disabled, true);
BRUSHSET_SET_BOOL(chset, use_space_attenuation, false);
break;
case SCULPT_TOOL_LAYER:

View File

@ -1788,6 +1788,14 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 300, 34)) {
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
if (brush->channels && brush->sculpt_tool == SCULPT_TOOL_SMEAR) {
BRUSHSET_SET_BOOL(brush->channels, use_space_attenuation, false);
BKE_brush_channelset_ui_init(brush, brush->sculpt_tool);
}
}
}
if (!MAIN_VERSION_ATLEAST(bmain, 300, 27)) {
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
if (brush->channels) {

View File

@ -8795,6 +8795,7 @@ void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings
/* Update last stroke position. */
ups->last_stroke_valid = true;
copy_v3_v3(ss->cache->true_last_location, ss->cache->true_location);
return;
}
@ -9235,10 +9236,6 @@ void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings
ups->last_stroke_valid = true;
}
void BKE_brush_commandlist_start(BrushCommandList *list,
Brush *brush,
BrushChannelSet *chset_final);
static void SCULPT_run_command_list(
Sculpt *sd, Object *ob, Brush *brush, BrushCommandList *list, UnifiedPaintSettings *ups)
{

View File

@ -31,6 +31,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "BKE_brush.h"
#include "BKE_colortools.h"
@ -138,7 +139,7 @@ static void do_paint_brush_task_cb_ex(void *__restrict userdata,
IMB_colormanagement_srgb_to_scene_linear_v3(brush_color);
// get un-pressure-mapped alpha
/* get un-pressure-mapped alpha */
float alpha = BKE_brush_channelset_get_final_float(
BKE_paint_brush(&data->sd->paint)->channels, data->sd->channels, "strength", NULL);
@ -394,6 +395,8 @@ static void do_smear_brush_task_cb_exec(void *__restrict userdata,
const Brush *brush = data->brush;
const float bstrength = ss->cache->bstrength;
const float blend = SCULPT_get_float(ss, smear_deform_blend, NULL, brush);
PBVHVertexIter vd;
SculptBrushTest test;
@ -453,7 +456,8 @@ static void do_smear_brush_task_cb_exec(void *__restrict userdata,
}
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
blend_color_interpolate_float(vd.col, ss->cache->prev_colors[vd.index], interp_color, fade);
blend_color_interpolate_float(
vd.col, ss->cache->prev_colors[vd.index], interp_color, fade * blend);
if (vd.mvert) {
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;

View File

@ -120,7 +120,7 @@ struct StructRNA *rna_BrushChannel_refine(PointerRNA *ptr)
subtype = PROP_PERCENTAGE;
break;
case BRUSH_CHANNEL_COLOR:
subtype = PROP_COLOR;
subtype = PROP_COLOR_GAMMA;
break;
case BRUSH_CHANNEL_PIXEL:
subtype = PROP_PIXEL;
@ -883,14 +883,14 @@ void RNA_def_brush_channel(BlenderRNA *brna)
"rna_BrushChannel_mappings_assignint");
RNA_def_property_struct_type(prop, "BrushMapping");
prop = RNA_def_property(srna, "color3_value", PROP_FLOAT, PROP_COLOR);
prop = RNA_def_property(srna, "color3_value", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, "BrushChannel", "vector");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Color", "");
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
prop = RNA_def_property(srna, "color4_value", PROP_FLOAT, PROP_COLOR);
prop = RNA_def_property(srna, "color4_value", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, "BrushChannel", "vector");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Color", "");