Sculpting:

Grab and Snake hook brushes now support strength. To keep compatibility
with older brushes, this commit also sets strength to 1.0 for those
brushes.
This commit is contained in:
Antony Riakiotakis 2014-10-03 13:14:10 +02:00
parent 0fa7e4c853
commit 72f557d34e
5 changed files with 20 additions and 11 deletions

@ -844,7 +844,6 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
self.prop_unified_size(row, context, brush, "use_pressure_size")
# strength, use_strength_pressure, and use_strength_attenuation
if capabilities.has_strength:
col.separator()
row = col.row(align=True)
@ -852,6 +851,8 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True)
self.prop_unified_strength(row, context, brush, "strength", text="Strength")
if capabilities.has_strength_pressure:
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
# auto_smooth_factor and use_inverse_smooth_pressure

@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 272
#define BLENDER_SUBVERSION 0
#define BLENDER_SUBVERSION 1
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 270
#define BLENDER_MINSUBVERSION 5

@ -391,6 +391,14 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
if (!MAIN_VERSION_ATLEAST(main, 272, 1)) {
Brush *br;
for (br = main->brush.first; br; br = br->id.next) {
if ((br->ob_mode & OB_MODE_SCULPT) && ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK))
br->alpha = 1.0f;
}
}
if (!DNA_struct_elem_find(fd->filesdna, "Image", "float", "gen_color")) {
Image *image;
for (image = main->image.first; image != NULL; image = image->id.next) {

@ -809,10 +809,10 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather, Unifi
return alpha * pressure * feather;
case SCULPT_TOOL_SNAKE_HOOK:
return feather;
return root_alpha * feather;
case SCULPT_TOOL_GRAB:
return feather;
return root_alpha * feather;
case SCULPT_TOOL_ROTATE:
return alpha * pressure * feather;

@ -264,7 +264,7 @@ static int rna_BrushCapabilities_has_spacing_get(PointerRNA *ptr)
return (!(br->flag & BRUSH_ANCHORED));
}
static int rna_SculptToolCapabilities_has_strength_get(PointerRNA *ptr)
static int rna_SculptToolCapabilities_has_strength_pressure_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK);
@ -689,7 +689,7 @@ static void rna_def_sculpt_capabilities(BlenderRNA *brna)
SCULPT_TOOL_CAPABILITY(has_secondary_color, "Has Secondary Color");
SCULPT_TOOL_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke");
SCULPT_TOOL_CAPABILITY(has_space_attenuation, "Has Space Attenuation");
SCULPT_TOOL_CAPABILITY(has_strength, "Has Strength");
SCULPT_TOOL_CAPABILITY(has_strength_pressure, "Has Strength Pressure");
SCULPT_TOOL_CAPABILITY(has_gravity, "Has Gravity");
#undef SCULPT_CAPABILITY