From 2f4153396cf8aa35d99899b0f28fb194b2fd34c0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 Sep 2019 01:46:24 +1000 Subject: Cleanup: no need to add Brush.flag2 Also use 'use_' prefix for RNA booleans. --- source/blender/blenloader/intern/versioning_270.c | 2 +- source/blender/editors/sculpt_paint/paint_cursor.c | 4 ++-- source/blender/editors/sculpt_paint/sculpt.c | 4 ++-- source/blender/makesdna/DNA_brush_types.h | 15 +++++---------- source/blender/makesrna/intern/rna_brush.c | 4 ++-- 5 files changed, 12 insertions(+), 17 deletions(-) (limited to 'source') diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 3d55891bb0a..ae355e182e5 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -1748,7 +1748,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) if (!DNA_struct_elem_find(fd->filesdna, "Brush", "float", "falloff_angle")) { for (Brush *br = bmain->brushes.first; br; br = br->id.next) { br->falloff_angle = DEG2RADF(80); - br->flag &= ~(BRUSH_FLAG_UNUSED_1 | BRUSH_FLAG_UNUSED_6 | BRUSH_FLAG_UNUSED_7 | + br->flag &= ~(BRUSH_FLAG_UNUSED_1 | BRUSH_FLAG_UNUSED_6 | BRUSH_GRAB_ACTIVE_VERTEX | BRUSH_SCENE_SPACING | BRUSH_FRONTFACE_FALLOFF); } diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 62e44bf04c5..9464bdb901e 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1365,7 +1365,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) /* Update and draw dynamic mesh preview lines */ GPU_matrix_push(); GPU_matrix_mul(vc.obact->obmat); - if (brush->sculpt_tool == SCULPT_TOOL_GRAB && brush->flag2 & BRUSH_GRAB_ACTIVE_VERTEX) { + if (brush->sculpt_tool == SCULPT_TOOL_GRAB && brush->flag & BRUSH_GRAB_ACTIVE_VERTEX) { if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES && ss->modifiers_active) { sculpt_geometry_preview_lines_update(C, ss, rds); sculpt_geometry_preview_lines_draw(pos, ss); @@ -1397,7 +1397,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) cursor_draw_point_with_symmetry(pos, ar, cursor_location, sd, vc.obact, ss->cache->radius); /* Draw cached dynamic mesh preview lines */ - if (brush->sculpt_tool == SCULPT_TOOL_GRAB && brush->flag2 & BRUSH_GRAB_ACTIVE_VERTEX) { + if (brush->sculpt_tool == SCULPT_TOOL_GRAB && brush->flag & BRUSH_GRAB_ACTIVE_VERTEX) { if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES && ss->modifiers_active) { GPU_matrix_push_projection(); ED_view3d_draw_setup_view(CTX_wm_window(C), diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index fc6ee90fa97..44927a3052b 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5903,7 +5903,7 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru float grab_location[3], imat[4][4], delta[3], loc[3]; if (cache->first_time) { - if (tool == SCULPT_TOOL_GRAB && brush->flag2 & BRUSH_GRAB_ACTIVE_VERTEX) { + if (tool == SCULPT_TOOL_GRAB && brush->flag & BRUSH_GRAB_ACTIVE_VERTEX) { copy_v3_v3(cache->orig_grab_location, sculpt_vertex_co_get(ss, sculpt_active_vertex_get(ss))); } @@ -5962,7 +5962,7 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru copy_v3_v3(cache->old_grab_location, grab_location); if (tool == SCULPT_TOOL_GRAB) { - if (brush->flag2 & BRUSH_GRAB_ACTIVE_VERTEX) { + if (brush->flag & BRUSH_GRAB_ACTIVE_VERTEX) { copy_v3_v3(cache->anchored_location, cache->orig_grab_location); } else { diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 5901163c3a9..3aafe5a1ddb 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -244,8 +244,6 @@ typedef struct Brush { int size; /** General purpose flag. */ int flag; - int flag2; - char _pad[4]; /** Pressure influence for mask. */ int mask_pressure; /** Jitter the position of the brush. */ @@ -282,7 +280,7 @@ typedef struct Brush { /** Source for fill tool color gradient application. */ char gradient_fill_mode; - char _pad0; + char _pad; /** Projection shape (sphere, circle). */ char falloff_shape; float falloff_angle; @@ -291,6 +289,7 @@ typedef struct Brush { char sculpt_tool; /** Active sculpt tool. */ char uv_sculpt_tool; + /** Active vertex paint. */ char vertexpaint_tool; /** Active weight paint. */ char weightpaint_tool; @@ -300,7 +299,7 @@ typedef struct Brush { char mask_tool; /** Active grease pencil tool. */ char gpencil_tool; - char _pad1[1]; + char _pad0[1]; float autosmooth_factor; @@ -319,7 +318,7 @@ typedef struct Brush { int curve_preset; int automasking_flags; - char _pad2[4]; + char _pad1[4]; int elastic_deform_type; float elastic_deform_compressibility; @@ -405,7 +404,7 @@ typedef enum eBrushFlags { BRUSH_JITTER_PRESSURE = (1 << 4), BRUSH_SPACING_PRESSURE = (1 << 5), BRUSH_FLAG_UNUSED_6 = (1 << 6), /* cleared */ - BRUSH_FLAG_UNUSED_7 = (1 << 7), /* cleared */ + BRUSH_GRAB_ACTIVE_VERTEX = (1 << 7), BRUSH_ANCHORED = (1 << 8), BRUSH_DIR_IN = (1 << 9), BRUSH_SPACE = (1 << 10), @@ -432,10 +431,6 @@ typedef enum eBrushFlags { BRUSH_CURVE = (1u << 31), } eBrushFlags; -typedef enum eBrushFlags2 { - BRUSH_GRAB_ACTIVE_VERTEX = (1 << 0), -} eBrushFlags2; - typedef enum { BRUSH_MASK_PRESSURE_RAMP = (1 << 1), BRUSH_MASK_PRESSURE_CUTOFF = (1 << 2), diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index a78a6fb264b..a7e68ec29c2 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1984,8 +1984,8 @@ static void rna_def_brush(BlenderRNA *brna) prop, "Spacing distance", "Calculate the brush spacing using view or scene distance"); RNA_def_property_update(prop, 0, "rna_Brush_update"); - prop = RNA_def_property(srna, "grab_active_vertex", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_GRAB_ACTIVE_VERTEX); + prop = RNA_def_property(srna, "use_grab_active_vertex", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_GRAB_ACTIVE_VERTEX); RNA_def_property_ui_text( prop, "Grab Active Vertex", -- cgit v1.2.3