Cleanup: no need to add Brush.flag2

Also use 'use_' prefix for RNA booleans.
This commit is contained in:
2019-09-11 01:46:24 +10:00
parent 5ba0726bc1
commit 2f4153396c
6 changed files with 13 additions and 18 deletions

View File

@@ -383,7 +383,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
if brush.sculpt_tool == 'GRAB':
col.separator()
row = col.row()
row.prop(brush, "grab_active_vertex")
row.prop(brush, "use_grab_active_vertex")
# topology_rake_factor
if (

View File

@@ -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);
}

View File

@@ -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),

View File

@@ -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 {

View File

@@ -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),

View File

@@ -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",