From f0675b14d84392e65c9e746752defa707335626c Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Mon, 9 Dec 2013 22:36:33 +0200 Subject: Refactoring/cleanup, borrowed from soc-2013-paint branch. * Move symmetry options to the paint struct (where all paint systems can make use of it) * Rename draw_pressure to stroke_active. This is what is really checked on those occasions that this is used. Also move turning on/off of this option to the stroke level and avoid doing it on every stroke system. * Rename BRUSH_RESTORE_MESH to BRUSH_DRAG_DOT. In image painting this won't restore any mesh, so better have a name that is directly linked to what the flag actually does. --- source/blender/blenkernel/BKE_blender.h | 2 +- source/blender/blenkernel/intern/brush.c | 4 +- source/blender/blenloader/intern/versioning_260.c | 20 ++++++++++ source/blender/editors/sculpt_paint/paint_cursor.c | 20 +++++----- source/blender/editors/sculpt_paint/paint_image.c | 6 +-- source/blender/editors/sculpt_paint/paint_mask.c | 8 ++-- source/blender/editors/sculpt_paint/paint_stroke.c | 20 ++++++++-- source/blender/editors/sculpt_paint/paint_vertex.c | 20 ---------- source/blender/editors/sculpt_paint/sculpt.c | 25 +++++------- source/blender/makesdna/DNA_brush_types.h | 2 +- source/blender/makesdna/DNA_scene_types.h | 20 +++++++++- source/blender/makesrna/intern/rna_brush.c | 10 ++--- source/blender/makesrna/intern/rna_sculpt_paint.c | 46 ++++++++++++---------- 13 files changed, 116 insertions(+), 87 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index d1e95097009..a240e79e473 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 269 -#define BLENDER_SUBVERSION 6 +#define BLENDER_SUBVERSION 7 /* 262 was the last editmesh release but it has compatibility code for bmesh data */ #define BLENDER_MINVERSION 262 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index de81ef179d7..8a59aab4036 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -307,7 +307,7 @@ void BKE_brush_debug_print_state(Brush *br) BR_TEST_FLAG(BRUSH_ADAPTIVE_SPACE); BR_TEST_FLAG(BRUSH_LOCK_SIZE); BR_TEST_FLAG(BRUSH_EDGE_TO_EDGE); - BR_TEST_FLAG(BRUSH_RESTORE_MESH); + BR_TEST_FLAG(BRUSH_DRAG_DOT); BR_TEST_FLAG(BRUSH_INVERSE_SMOOTH_PRESSURE); BR_TEST_FLAG(BRUSH_RANDOM_ROTATION); BR_TEST_FLAG(BRUSH_PLANE_TRIM); @@ -910,7 +910,7 @@ void BKE_brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], /* jitter-ed brush gives weird and unpredictable result for this * kinds of stroke, so manually disable jitter usage (sergey) */ - use_jitter &= (brush->flag & (BRUSH_RESTORE_MESH | BRUSH_ANCHORED)) == 0; + use_jitter &= (brush->flag & (BRUSH_DRAG_DOT | BRUSH_ANCHORED)) == 0; if (use_jitter) { float rand_pos[2]; diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index e023e8eed1d..5acf6319d2f 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -2625,4 +2625,24 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) } } } + + if (!MAIN_VERSION_ATLEAST(main, 269, 7)) { + Scene *scene; + for (scene = main->scene.first; scene; scene = scene->id.next) { + Sculpt *sd = scene->toolsettings->sculpt; + + if (sd) { + int symmetry_flags = sd->flags & 7; + + if (symmetry_flags & SCULPT_SYMM_X) + sd->paint.symmetry_flags |= PAINT_SYMM_X; + if (symmetry_flags & SCULPT_SYMM_Y) + sd->paint.symmetry_flags |= PAINT_SYMM_Y; + if (symmetry_flags & SCULPT_SYMM_Z) + sd->paint.symmetry_flags |= PAINT_SYMM_Z; + if (symmetry_flags & SCULPT_SYMMETRY_FEATHER) + sd->paint.symmetry_flags |= PAINT_SYMMETRY_FEATHER; + } + } + } } diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 56143d00afe..2dc6babdfa6 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -569,7 +569,7 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush, glTranslatef(-0.5f, -0.5f, 0); /* scale based on tablet pressure */ - if (primary && ups->draw_pressure && BKE_brush_use_size_pressure(vc->scene, brush)) { + if (primary && ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush)) { glTranslatef(0.5f, 0.5f, 0); glScalef(1.0f / ups->pressure_value, 1.0f / ups->pressure_value, 1); glTranslatef(-0.5f, -0.5f, 0); @@ -694,7 +694,7 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush, } /* scale based on tablet pressure */ - if (ups->draw_pressure && BKE_brush_use_size_pressure(vc->scene, brush)) { + if (ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush)) { do_pop = true; glPushMatrix(); glLoadIdentity(); @@ -788,7 +788,7 @@ static void paint_cursor_on_hit(UnifiedPaintSettings *ups, Brush *brush, ViewCon projected_radius); /* scale 3D brush radius by pressure */ - if (ups->draw_pressure && BKE_brush_use_size_pressure(vc->scene, brush)) + if (ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush)) unprojected_radius *= ups->pressure_value; /* set cached value in either Brush or UnifiedPaintSettings */ @@ -828,11 +828,13 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) outline_col = brush->add_col; final_radius = BKE_brush_size_get(scene, brush) * zoomx; - if (brush->flag & BRUSH_RAKE) - /* here, translation contains the mouse coordinates. */ - paint_calculate_rake_rotation(ups, translation); - else if (!(brush->flag & BRUSH_ANCHORED)) - ups->brush_rotation = 0.0; + /* don't calculate rake angles while a stroke is active because the rake variables are global and + * we may get interference with the stroke itself. For line strokes, such interference is visible */ + if (!ups->stroke_active) { + if (brush->flag & BRUSH_RAKE) + /* here, translation contains the mouse coordinates. */ + paint_calculate_rake_rotation(ups, translation); + } /* draw overlay */ paint_draw_alpha_overlay(ups, brush, &vc, x, y, zoomx, mode); @@ -883,7 +885,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) glTranslatef(translation[0], translation[1], 0); /* draw an inner brush */ - if (ups->draw_pressure && BKE_brush_use_size_pressure(scene, brush)) { + if (ups->stroke_active && BKE_brush_use_size_pressure(scene, brush)) { /* inner at full alpha */ glutil_draw_lined_arc(0.0, M_PI * 2.0, final_radius * ups->pressure_value, 40); /* outer at half alpha */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 6ffa54c5569..47ca3e5ce0c 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -511,7 +511,7 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, float mou { UnifiedPaintSettings *ups = &settings->unified_paint_settings; - ups->draw_pressure = true; + ups->stroke_active = true; } return pop; @@ -595,7 +595,7 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; - ups->draw_pressure = false; + ups->stroke_active = false; } } @@ -766,7 +766,7 @@ void brush_drawcursor_texpaint_uvsculpt(bContext *C, int x, int y, void *UNUSED( { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; /* hrmf, duplicate paint_draw_cursor logic here */ - if (ups->draw_pressure && BKE_brush_use_size_pressure(scene, brush)) { + if (ups->stroke_active && BKE_brush_use_size_pressure(scene, brush)) { /* inner at full alpha */ glutil_draw_lined_arc(0, (float)(M_PI * 2.0), size * ups->pressure_value, 40); /* outer at half alpha */ diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index 9b906c460e3..c421080956b 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -165,15 +165,15 @@ static int is_effected(float planes[4][4], const float co[3]) static void flip_plane(float out[4], const float in[4], const char symm) { - if (symm & SCULPT_SYMM_X) + if (symm & PAINT_SYMM_X) out[0] = -in[0]; else out[0] = in[0]; - if (symm & SCULPT_SYMM_Y) + if (symm & PAINT_SYMM_Y) out[1] = -in[1]; else out[1] = in[1]; - if (symm & SCULPT_SYMM_Z) + if (symm & PAINT_SYMM_Z) out[2] = -in[2]; else out[2] = in[2]; @@ -198,7 +198,7 @@ int do_sculpt_mask_box_select(ViewContext *vc, rcti *rect, bool select, bool UNU PBVH *pbvh; PBVHNode **nodes; int totnode, i, symmpass; - int symm = sd->flags & 7; + int symm = sd->paint.symmetry_flags & 7; mode = PAINT_MASK_FLOOD_VALUE; value = select ? 1.0 : 0.0; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 397baeae4c9..0c28081723f 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -76,6 +76,7 @@ typedef struct PaintStroke { ViewContext vc; bglMats mats; Brush *brush; + UnifiedPaintSettings *ups; /* Paint stroke can use up to PAINT_MAX_INPUT_SAMPLES prior inputs * to smooth the stroke */ @@ -174,7 +175,7 @@ static void paint_brush_update(bContext *C, Brush *brush, PaintMode mode, /* Truly temporary data that isn't stored in properties */ - ups->draw_pressure = TRUE; + ups->stroke_active = true; ups->pressure_value = stroke->cached_pressure; ups->pixel_radius = BKE_brush_size_get(scene, brush); @@ -247,7 +248,7 @@ static void paint_brush_update(bContext *C, Brush *brush, PaintMode mode, else copy_v2_v2(ups->anchored_initial_mouse, stroke->initial_mouse); - ups->draw_anchored = 1; + ups->draw_anchored = true; } else if (brush->flag & BRUSH_RAKE) { if (!stroke->brush_init) @@ -467,8 +468,10 @@ PaintStroke *paint_stroke_new(bContext *C, StrokeDone done, int event_type) { PaintStroke *stroke = MEM_callocN(sizeof(PaintStroke), "PaintStroke"); - + ToolSettings *toolsettings = CTX_data_tool_settings(C); + UnifiedPaintSettings *ups = &toolsettings->unified_paint_settings; Brush *br = stroke->brush = BKE_paint_brush(BKE_paint_get_active_from_context(C)); + view3d_set_viewcontext(C, &stroke->vc); if (stroke->vc.v3d) view3d_get_transformation(stroke->vc.ar, stroke->vc.rv3d, stroke->vc.obact, &stroke->mats); @@ -479,6 +482,7 @@ PaintStroke *paint_stroke_new(bContext *C, stroke->redraw = redraw; stroke->done = done; stroke->event_type = event_type; /* for modal, return event */ + stroke->ups = ups; /* initialize here to avoid initialization conflict with threaded strokes */ curvemapping_initialize(br->curve); @@ -498,6 +502,14 @@ void paint_stroke_data_free(struct wmOperator *op) static void stroke_done(struct bContext *C, struct wmOperator *op) { struct PaintStroke *stroke = op->customdata; + UnifiedPaintSettings *ups = stroke->ups; + + ups->draw_anchored = false; + ups->stroke_active = false; + + /* reset rotation here to avoid doing so in cursor display */ + if (!(stroke->brush->flag & BRUSH_RAKE)) + ups->brush_rotation = 0.0f; if (stroke->stroke_started) { if (stroke->redraw) @@ -556,7 +568,7 @@ bool paint_supports_smooth_stroke(Brush *br, PaintMode mode) { if (!(br->flag & BRUSH_SMOOTH_STROKE) || (br->flag & BRUSH_ANCHORED) || - (br->flag & BRUSH_RESTORE_MESH)) + (br->flag & BRUSH_DRAG_DOT)) { return false; } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 7d62ca0535d..9d7bad2591e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2255,11 +2255,6 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, const float UNU if (me->editflag & ME_EDIT_MIRROR_X) { wpd->vgroup_mirror = wpaint_mirror_vgroup_ensure(ob, wpd->vgroup_active); } - - { - UnifiedPaintSettings *ups = &ts->unified_paint_settings; - ups->draw_pressure = true; - } return TRUE; } @@ -2553,11 +2548,6 @@ static void wpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) } } - { - UnifiedPaintSettings *ups = &ts->unified_paint_settings; - ups->draw_pressure = false; - } - DAG_id_tag_update(ob->data, 0); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); @@ -2875,11 +2865,6 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const fl invert_m4_m4(imat, mat); copy_m3_m4(vpd->vpimat, imat); - { - UnifiedPaintSettings *ups = &ts->unified_paint_settings; - ups->draw_pressure = true; - } - return 1; } @@ -3103,11 +3088,6 @@ static void vpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) if (vpd->mfacetag) MEM_freeN(vpd->mfacetag); - { - UnifiedPaintSettings *ups = &ts->unified_paint_settings; - ups->draw_pressure = false; - } - WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); MEM_freeN(vpd); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 33ba4f6fef0..b8a082398ef 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -418,7 +418,7 @@ static int sculpt_stroke_dynamic_topology(const SculptSession *ss, /* Requires mesh restore, which doesn't work with * dynamic-topology */ !(brush->flag & BRUSH_ANCHORED) && - !(brush->flag & BRUSH_RESTORE_MESH) && + !(brush->flag & BRUSH_DRAG_DOT) && (!ELEM6(brush->sculpt_tool, /* These brushes, as currently coded, cannot @@ -762,15 +762,15 @@ static float integrate_overlap(Brush *br) /* Uses symm to selectively flip any axis of a coordinate. */ static void flip_v3_v3(float out[3], const float in[3], const char symm) { - if (symm & SCULPT_SYMM_X) + if (symm & PAINT_SYMM_X) out[0] = -in[0]; else out[0] = in[0]; - if (symm & SCULPT_SYMM_Y) + if (symm & PAINT_SYMM_Y) out[1] = -in[1]; else out[1] = in[1]; - if (symm & SCULPT_SYMM_Z) + if (symm & PAINT_SYMM_Z) out[2] = -in[2]; else out[2] = in[2]; @@ -820,7 +820,7 @@ static float calc_radial_symmetry_feather(Sculpt *sd, StrokeCache *cache, const static float calc_symmetry_feather(Sculpt *sd, StrokeCache *cache) { - if (sd->flags & SCULPT_SYMMETRY_FEATHER) { + if (sd->paint.symmetry_flags & PAINT_SYMMETRY_FEATHER) { float overlap; int symm = cache->symmetry; int i; @@ -3467,7 +3467,7 @@ static void do_symmetrical_brush_actions(Sculpt *sd, Object *ob, Brush *brush = BKE_paint_brush(&sd->paint); SculptSession *ss = ob->sculpt; StrokeCache *cache = ss->cache; - const char symm = sd->flags & 7; + const char symm = sd->paint.symmetry_flags & 7; int i; float feather = calc_symmetry_feather(sd, ss->cache); @@ -4015,7 +4015,7 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru /* location stays the same for finding vertices in brush radius */ copy_v3_v3(cache->true_location, cache->orig_grab_location); - ups->draw_anchored = 1; + ups->draw_anchored = true; copy_v2_v2(ups->anchored_initial_mouse, cache->initial_mouse); ups->anchored_size = ups->pixel_radius; } @@ -4142,7 +4142,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, #undef PIXEL_INPUT_THRESHHOLD } - ups->draw_anchored = 1; + ups->draw_anchored = true; copy_v2_v2(ups->anchored_initial_mouse, cache->initial_mouse); copy_v3_v3(cache->anchored_location, cache->true_location); ups->anchored_size = ups->pixel_radius; @@ -4314,7 +4314,7 @@ static void sculpt_restore_mesh(Sculpt *sd, Object *ob) if ((brush->flag & BRUSH_ANCHORED) || (brush->sculpt_tool == SCULPT_TOOL_GRAB && BKE_brush_use_size_pressure(ss->cache->vc->scene, brush)) || - (brush->flag & BRUSH_RESTORE_MESH)) + (brush->flag & BRUSH_DRAG_DOT)) { paint_mesh_restore_co(sd, ob); } @@ -4456,7 +4456,6 @@ static void sculpt_brush_exit_tex(Sculpt *sd) static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(stroke)) { - UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings; Object *ob = CTX_data_active_object(C); Scene *scene = CTX_data_scene(C); SculptSession *ss = ob->sculpt; @@ -4464,10 +4463,6 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str sculpt_omp_done(ss); - /* reset values used to draw brush after completing the stroke */ - ups->draw_anchored = 0; - ups->draw_pressure = 0; - /* Finished */ if (ss->cache) { Brush *brush = BKE_paint_brush(&sd->paint); @@ -5068,7 +5063,7 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) ts->sculpt = MEM_callocN(sizeof(Sculpt), "sculpt mode data"); /* Turn on X plane mirror symmetry by default */ - ts->sculpt->flags |= SCULPT_SYMM_X; + ts->sculpt->paint.symmetry_flags |= PAINT_SYMM_X; /* Make sure at least dyntopo subdivision is enabled */ ts->sculpt->flags |= SCULPT_DYNTOPO_SUBDIVIDE; diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 824091dab32..86fa7058f97 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -140,7 +140,7 @@ typedef enum BrushFlags { BRUSH_LOCK_SIZE = (1 << 20), // BRUSH_TEXTURE_OVERLAY = (1 << 21), /* obsolete, use overlay_flags |= BRUSH_OVERLAY_PRIMARY instead */ BRUSH_EDGE_TO_EDGE = (1 << 22), - BRUSH_RESTORE_MESH = (1 << 23), + BRUSH_DRAG_DOT = (1 << 23), BRUSH_INVERSE_SMOOTH_PRESSURE = (1 << 24), BRUSH_RANDOM_ROTATION = (1 << 25), BRUSH_PLANE_TRIM = (1 << 26), diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 5291ad808b1..88f25bd57ae 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -770,7 +770,8 @@ typedef struct Paint { * smooth the stroke */ int num_input_samples; - int pad; + /* flags used for symmetry */ + int symmetry_flags; } Paint; /* ------------------------------------------- */ @@ -919,8 +920,10 @@ typedef struct UnifiedPaintSettings { int anchored_size; float anchored_initial_mouse[2]; + /* check is there an ongoing stroke right now */ + int stroke_active; + /* drawing pressure */ - int draw_pressure; float pressure_value; /* position of mouse, used to sample the texture */ @@ -1550,16 +1553,29 @@ typedef enum { PAINT_SHOW_BRUSH_ON_SURFACE = (1 << 2), } PaintFlags; +/* Paint.symmetry_flags + * (for now just a duplicate of sculpt symmetry flags) */ +typedef enum SymmetryFlags { + PAINT_SYMM_X = (1 << 0), + PAINT_SYMM_Y = (1 << 1), + PAINT_SYMM_Z = (1 << 2), + PAINT_SYMMETRY_FEATHER = (1 << 3) +} SymmetryFlags; + /* Sculpt.flags */ /* These can eventually be moved to paint flags? */ typedef enum SculptFlags { + /* deprecated, part of paint struct symmetry_flags now */ SCULPT_SYMM_X = (1 << 0), SCULPT_SYMM_Y = (1 << 1), SCULPT_SYMM_Z = (1 << 2), + SCULPT_LOCK_X = (1 << 3), SCULPT_LOCK_Y = (1 << 4), SCULPT_LOCK_Z = (1 << 5), + /* deprecated, part of paint struct symmetry_flags now */ SCULPT_SYMMETRY_FEATHER = (1 << 6), + SCULPT_USE_OPENMP = (1 << 7), SCULPT_ONLY_DEFORM = (1 << 8), SCULPT_SHOW_DIFFUSE = (1 << 9), diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 405d38e9683..01e8c5956ff 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -131,7 +131,7 @@ static int rna_SculptToolCapabilities_has_jitter_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return (!(br->flag & BRUSH_ANCHORED) && - !(br->flag & BRUSH_RESTORE_MESH) && + !(br->flag & BRUSH_DRAG_DOT) && !ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB)); @@ -211,7 +211,7 @@ static int rna_SculptToolCapabilities_has_smooth_stroke_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return (!(br->flag & BRUSH_ANCHORED) && - !(br->flag & BRUSH_RESTORE_MESH) && + !(br->flag & BRUSH_DRAG_DOT) && !ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB)); @@ -608,7 +608,7 @@ static void rna_def_brush(BlenderRNA *brna) static EnumPropertyItem sculpt_stroke_method_items[] = { {0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"}, - {BRUSH_RESTORE_MESH, "DRAG_DOT", 0, "Drag Dot", "Allows a single dot to be carefully positioned"}, + {BRUSH_DRAG_DOT, "DRAG_DOT", 0, "Drag Dot", "Allows a single dot to be carefully positioned"}, {BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"}, {BRUSH_ANCHORED, "ANCHORED", 0, "Anchored", "Keep the brush anchored to the initial location"}, {BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"}, @@ -996,8 +996,8 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Edge-to-edge", "Drag anchor brush from edge-to-edge"); RNA_def_property_update(prop, 0, "rna_Brush_update"); - prop = RNA_def_property(srna, "use_restore_mesh", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RESTORE_MESH); + prop = RNA_def_property(srna, "use_drag_dot", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_DRAG_DOT); RNA_def_property_ui_text(prop, "Restore Mesh", "Allow a single dot to be carefully positioned"); RNA_def_property_update(prop, 0, "rna_Brush_update"); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 53200d4b894..d72fbcc48f3 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -305,19 +305,44 @@ static void rna_def_paint(BlenderRNA *brna) prop = RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH); RNA_def_property_ui_text(prop, "Show Brush", ""); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); prop = RNA_def_property(srna, "show_brush_on_surface", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH_ON_SURFACE); RNA_def_property_ui_text(prop, "Show Brush On Surface", ""); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); prop = RNA_def_property(srna, "show_low_resolution", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_FAST_NAVIGATE); RNA_def_property_ui_text(prop, "Fast Navigate", "For multires, show low resolution while navigating the view"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); prop = RNA_def_property(srna, "input_samples", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "num_input_samples"); RNA_def_property_ui_range(prop, 1, PAINT_MAX_INPUT_SAMPLES, 0, -1); RNA_def_property_ui_text(prop, "Input Samples", "Average multiple input samples together to smooth the brush stroke"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_X); + RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "use_symmetry_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_Y); + RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "use_symmetry_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_Z); + RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + + prop = RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMMETRY_FEATHER); + RNA_def_property_ui_text(prop, "Symmetry Feathering", + "Reduce the strength of the brush where it overlaps symmetrical daubs"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); } static void rna_def_sculpt(BlenderRNA *brna) @@ -347,21 +372,6 @@ static void rna_def_sculpt(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Radial Symmetry Count X Axis", "Number of times to copy strokes across the surface"); - prop = RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X); - RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis"); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - - prop = RNA_def_property(srna, "use_symmetry_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Y); - RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis"); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - - prop = RNA_def_property(srna, "use_symmetry_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Z); - RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis"); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X); RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices"); @@ -377,12 +387,6 @@ static void rna_def_sculpt(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - prop = RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMMETRY_FEATHER); - RNA_def_property_ui_text(prop, "Symmetry Feathering", - "Reduce the strength of the brush where it overlaps symmetrical daubs"); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); - prop = RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP); RNA_def_property_ui_text(prop, "Use OpenMP", -- cgit v1.2.3