Fix small crash in last commit and a few typos

This commit is contained in:
Joseph Eagar 2021-09-20 03:34:13 -07:00
parent 83bfa950b1
commit 645aee0835
3 changed files with 15 additions and 2 deletions

View File

@ -2492,6 +2492,10 @@ void BKE_brush_size_set(Scene *scene, Brush *brush, int size, bool use_brush_cha
int BKE_brush_size_get(const Scene *scene, const Brush *brush, bool use_brush_channel)
{
if (!scene->toolsettings->sculpt || !scene->toolsettings->sculpt->channels || !brush->channels) {
use_brush_channel = false;
}
if (use_brush_channel) {
if (scene->toolsettings->sculpt) {
return (int)BKE_brush_channelset_get_final_float(

View File

@ -1069,7 +1069,7 @@ ATTR_NO_OPT void BKE_builtin_commandlist_create(Brush *brush,
float autosmooth_scale = BKE_brush_channelset_get_float(
chset, "autosmooth_radius_scale", mapdata);
float autosmooth_projection = BKE_brush_channelset_get_float(
chset, "topology_rake_projection", NULL);
chset, "autosmooth_projection", NULL);
float autosmooth_spacing;
@ -1109,7 +1109,7 @@ ATTR_NO_OPT void BKE_builtin_commandlist_create(Brush *brush,
if (topology_rake > 0.0f) {
cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, brush->channels, true),
SCULPT_TOOL_SMOOTH);
SCULPT_TOOL_TOPOLOGY_RAKE);
float_set_uninherit(cmd->params, "strength", topology_rake);
float_set_uninherit(cmd->params, "radius", radius * topology_rake_scale);

View File

@ -11267,6 +11267,15 @@ void sculpt_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerR
BKE_brush_channelset_free(ss->cache->channels_final);
}
if (!brush->channels) {
// eek!
printf("had to create brush->channels for brush '%s'!", brush->id.name + 2);
brush->channels = BKE_brush_channelset_create();
BKE_brush_builtin_patch(brush, brush->sculpt_tool);
BKE_brush_channelset_compat_load(brush->channels, brush, true);
}
if (brush->channels && sd->channels) {
ss->cache->channels_final = BKE_brush_channelset_create();
BKE_brush_channelset_merge(ss->cache->channels_final, brush->channels, sd->channels);