Vector displacement for the sculpting draw brush #104481

Merged
Jeroen Bakker merged 18 commits from robin.hohni/blender:sculpt-vector-displacement into main 2023-02-14 15:29:40 +01:00
2 changed files with 4 additions and 1 deletions
Showing only changes of commit 964afd48e1 - Show all commits

View File

@ -1147,7 +1147,6 @@ def brush_texture_settings(layout, brush, sculpt):
col.prop(brush, "use_color_as_displacement", text="Vector Displacement")
Jeroen-Bakker marked this conversation as resolved
Review

Python has some rules about the number of lines between statements. Here it is max 1.

Python has some rules about the number of lines between statements. Here it is max 1.
def brush_mask_texture_settings(layout, brush):
mask_tex_slot = brush.mask_texture_slot

View File

@ -2713,6 +2713,10 @@ void SCULPT_brush_strength_color(struct SculptSession *ss,
void SCULPT_calc_vertex_displacement(SculptSession *ss, const struct Brush *brush, float rgba[4], float out_offset[3])
{
mul_v3_fl(rgba, ss->cache->bstrength);
if(ss->cache->bstrength < 0) {
rgba[0] *= -1;
rgba[1] *= -1;
}
rgba[0] *= 1.0f / (brush->mtex.size[0] == 0.0f ? 1.0f : brush->mtex.size[0] * brush->mtex.size[0]);
rgba[1] *= 1.0f / (brush->mtex.size[1] == 0.0f ? 1.0f : brush->mtex.size[1] * brush->mtex.size[1]);