From 72f557d34e21a5fe341de0a88797334810a3c66c Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Fri, 3 Oct 2014 13:14:10 +0200 Subject: 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. --- release/scripts/startup/bl_ui/space_view3d_toolbar.py | 13 +++++++------ source/blender/blenkernel/BKE_blender.h | 2 +- source/blender/blenloader/intern/versioning_270.c | 8 ++++++++ source/blender/editors/sculpt_paint/sculpt.c | 4 ++-- source/blender/makesrna/intern/rna_brush.c | 4 ++-- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 1969572530d..ffd4299bc39 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -844,14 +844,15 @@ 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) + col.separator() + row = col.row(align=True) + + if capabilities.has_space_attenuation: + row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True) - if capabilities.has_space_attenuation: - row.prop(brush, "use_space_attenuation", toggle=True, icon_only=True) + self.prop_unified_strength(row, context, brush, "strength", text="Strength") - 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 diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 661fe03912f..105c83f9864 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -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 diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 22868035a13..d8da0a12b50 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -390,6 +390,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; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 7e518242b00..891130af7d8 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -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; diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 1ff99271146..bbc2e0572fa 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -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 -- cgit v1.2.3