diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-31 13:11:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-31 13:11:55 +0300 |
commit | f06884b18ab5b619975689a0670f8f0f14f9c318 (patch) | |
tree | e0c0f557659f6b900019acd5c1f11e127619e539 /source/blender/editors | |
parent | b2193e020bc0c1a9ef9969440ece453e49f8012c (diff) |
Cleanup: style, duplicate includes
Diffstat (limited to 'source/blender/editors')
23 files changed, 134 insertions, 127 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 2431bd50e1b..79b7c7988fd 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -84,8 +84,6 @@ #include "BIF_gl.h" -#include "DEG_depsgraph.h" - #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 1981814eb02..54590c5f66c 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -2615,7 +2615,7 @@ static size_t animdata_filter_dopesheet_ob(bAnimContext *ac, ListBase *anim_data /* grease pencil */ if ((ob->type == OB_GPENCIL) && - (ob->data) && !(ads->filterflag & ADS_FILTER_NOGPENCIL)) + (ob->data) && !(ads->filterflag & ADS_FILTER_NOGPENCIL)) { tmp_items += animdata_filter_ds_gpencil(ac, &tmp_data, ads, ob->data, filter_mode); } diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c index dad5af7379c..4f6e2004197 100644 --- a/source/blender/editors/gpencil/annotate_draw.c +++ b/source/blender/editors/gpencil/annotate_draw.c @@ -787,9 +787,10 @@ static void gp_draw_data_layers( * It should also be noted that sbuffer contains temporary point types * i.e. tGPspoints NOT bGPDspoints */ - gp_draw_stroke_buffer(gpd->runtime.sbuffer, - gpd->runtime.sbuffer_size, lthick, - dflag, gpd->runtime.sbuffer_sflag, ink); + gp_draw_stroke_buffer( + gpd->runtime.sbuffer, + gpd->runtime.sbuffer_size, lthick, + dflag, gpd->runtime.sbuffer_sflag, ink); } } } diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 5c56877cbe6..2c0b3e9900a 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -1047,7 +1047,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw) (gp_style->fill_rgba[3] > 0.0f) && ((gps->flag & GP_STROKE_NOFILL) == 0)) { - continue; + continue; } /* calculate thickness */ diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 52642fb2570..0fadef55b9d 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -755,10 +755,11 @@ static bool gp_brush_randomize_apply( const float inf = gp_brush_influence_calc(gso, radius, co) / 2.0f; const float fac = BLI_rng_get_float(gso->rng) * inf; /* need one flag enabled by default */ - if ((gso->settings->flag & (GP_BRUSHEDIT_FLAG_APPLY_POSITION | - GP_BRUSHEDIT_FLAG_APPLY_STRENGTH | - GP_BRUSHEDIT_FLAG_APPLY_THICKNESS | - GP_BRUSHEDIT_FLAG_APPLY_UV)) == 0) + if ((gso->settings->flag & + (GP_BRUSHEDIT_FLAG_APPLY_POSITION | + GP_BRUSHEDIT_FLAG_APPLY_STRENGTH | + GP_BRUSHEDIT_FLAG_APPLY_THICKNESS | + GP_BRUSHEDIT_FLAG_APPLY_UV)) == 0) { gso->settings->flag |= GP_BRUSHEDIT_FLAG_APPLY_POSITION; } diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index dd1852ca8ce..c58c45b3117 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -67,7 +67,6 @@ #include "BKE_gpencil.h" #include "BKE_gpencil_modifier.h" #include "BKE_library.h" -#include "BKE_main.h" #include "BKE_modifier.h" #include "BKE_object.h" #include "BKE_material.h" @@ -462,8 +461,7 @@ void GPENCIL_OT_frame_duplicate(wmOperatorType *ot) { GP_FRAME_DUP_ACTIVE, "ACTIVE", 0, "Active", "Duplicate frame in active layer only" }, { GP_FRAME_DUP_ALL, "ALL", 0, "All", "Duplicate active frames in all layers" }, { 0, NULL, 0, NULL, NULL } - }; - + }; /* identifiers */ ot->name = "Duplicate Frame"; @@ -1401,8 +1399,8 @@ static bool gpencil_vertex_group_poll(bContext *C) if ((ob) && (ob->type == OB_GPENCIL)) { if (!ID_IS_LINKED(ob) && !ID_IS_LINKED(ob->data) && ob->defbase.first) { if (ELEM(ob->mode, - OB_MODE_GPENCIL_EDIT, - OB_MODE_GPENCIL_SCULPT)) + OB_MODE_GPENCIL_EDIT, + OB_MODE_GPENCIL_SCULPT)) { return true; } @@ -1418,8 +1416,7 @@ static bool gpencil_vertex_group_weight_poll(bContext *C) if ((ob) && (ob->type == OB_GPENCIL)) { if (!ID_IS_LINKED(ob) && !ID_IS_LINKED(ob->data) && ob->defbase.first) { - if (ob->mode == OB_MODE_GPENCIL_WEIGHT) - { + if (ob->mode == OB_MODE_GPENCIL_WEIGHT) { return true; } } @@ -1807,8 +1804,8 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op) { if (base->object->type == OB_GPENCIL) { if ((base->object->rot[0] != 0) || - (base->object->rot[1] != 0) || - (base->object->rot[2] != 0)) + (base->object->rot[1] != 0) || + (base->object->rot[2] != 0)) { BKE_report(op->reports, RPT_ERROR, "Apply all rotations before join objects"); return OPERATOR_CANCELLED; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 93cf2f18233..fdeadcc648a 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -62,7 +62,6 @@ #include "BKE_gpencil.h" #include "BKE_paint.h" #include "BKE_library.h" -#include "BKE_main.h" #include "BKE_material.h" #include "BKE_object.h" #include "BKE_report.h" @@ -861,8 +860,7 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op) for (bGPDstroke *gps = gp_strokes_copypastebuf.first; gps; gps = gps->next) { if (ED_gpencil_stroke_can_use(C, gps)) { ma = give_current_material(ob, gps->mat_nr + 1); - if (BLI_ghash_haskey(gp_strokes_copypastebuf_colors, &gps->mat_nr) == false) - { + if (BLI_ghash_haskey(gp_strokes_copypastebuf_colors, &gps->mat_nr) == false) { BLI_ghash_insert(gp_strokes_copypastebuf_colors, &gps->mat_nr, ma); } } @@ -2153,7 +2151,7 @@ static int gp_snap_to_cursor(bContext *C, wmOperator *op) } DEG_id_tag_update(&gpd->id, OB_RECALC_OB | OB_RECALC_DATA); - DEG_id_tag_update(&obact->id, DEG_TAG_COPY_ON_WRITE); + DEG_id_tag_update(&obact->id, DEG_TAG_COPY_ON_WRITE); WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); return OPERATOR_FINISHED; } @@ -2757,7 +2755,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); - RegionView3D *rv3d = ar->regiondata; + RegionView3D *rv3d = ar->regiondata; View3D *v3d = sa->spacedata.first; GP_SpaceConversion gsc = {NULL}; diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index a0626dd69b1..20db5c1504f 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -125,8 +125,9 @@ typedef struct tGPDfill { /* draw a given stroke using same thickness and color for all points */ -static void gp_draw_basic_stroke(tGPDfill *tgpf, bGPDstroke *gps, const float diff_mat[4][4], - bool cyclic, float ink[4], int flag, float thershold) +static void gp_draw_basic_stroke( + tGPDfill *tgpf, bGPDstroke *gps, const float diff_mat[4][4], + bool cyclic, float ink[4], int flag, float thershold) { bGPDspoint *points = gps->points; @@ -228,8 +229,7 @@ static void gp_draw_datablock(tGPDfill *tgpf, float ink[4]) } /* check if the color is visible */ MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1); - if ((gp_style == NULL) || (gp_style->flag & GP_STYLE_COLOR_HIDE)) - { + if ((gp_style == NULL) || (gp_style->flag & GP_STYLE_COLOR_HIDE)) { continue; } @@ -247,7 +247,7 @@ static void gp_draw_datablock(tGPDfill *tgpf, float ink[4]) /* normal strokes */ if ((tgpf->fill_draw_mode == GP_FILL_DMODE_STROKE) || - (tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH)) + (tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH)) { ED_gp_draw_fill(&tgpw); @@ -255,7 +255,7 @@ static void gp_draw_datablock(tGPDfill *tgpf, float ink[4]) /* 3D Lines with basic shapes and invisible lines */ if ((tgpf->fill_draw_mode == GP_FILL_DMODE_CONTROL) || - (tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH)) + (tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH)) { gp_draw_basic_stroke(tgpf, gps, tgpw.diff_mat, gps->flag & GP_STROKE_CYCLIC, ink, tgpf->flag, tgpf->fill_threshold); @@ -313,8 +313,9 @@ static void gp_render_offscreen(tGPDfill *tgpf) glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - ED_view3d_update_viewmat(tgpf->depsgraph, tgpf->scene, tgpf->v3d, tgpf->ar, - NULL, winmat, NULL); + ED_view3d_update_viewmat( + tgpf->depsgraph, tgpf->scene, tgpf->v3d, tgpf->ar, + NULL, winmat, NULL); /* set for opengl */ GPU_matrix_projection_set(tgpf->rv3d->winmat); GPU_matrix_set(tgpf->rv3d->viewmat); @@ -531,8 +532,7 @@ static void gpencil_boundaryfill_area(tGPDfill *tgpf) if (true) { /* Was: 'rgba' */ /* check if no border(red) or already filled color(green) */ - if ((rgba[0] != 1.0f) && (rgba[1] != 1.0f)) - { + if ((rgba[0] != 1.0f) && (rgba[1] != 1.0f)) { /* fill current pixel */ set_pixel(ibuf, v, fill_col); @@ -627,7 +627,7 @@ static void gpencil_get_outline_points(tGPDfill *tgpf) int backtracked_co[2]; int current_check_co[2]; int prev_check_co[2]; - int backtracked_offset[1][2] = { { 0,0 } }; + int backtracked_offset[1][2] = {{0, 0}}; // bool boundary_found = false; bool start_found = false; const int NEIGHBOR_COUNT = 8; @@ -667,12 +667,11 @@ static void gpencil_get_outline_points(tGPDfill *tgpf) } } - while (true && start_found) - { + while (start_found) { int cur_back_offset = -1; for (int i = 0; i < NEIGHBOR_COUNT; i++) { if (backtracked_offset[0][0] == offset[i][0] && - backtracked_offset[0][1] == offset[i][1]) + backtracked_offset[0][1] == offset[i][1]) { /* Finding the bracktracked pixel offset index */ cur_back_offset = i; @@ -706,7 +705,7 @@ static void gpencil_get_outline_points(tGPDfill *tgpf) } /* current pixel is equal to starting pixel */ if (boundary_co[0] == start_co[0] && - boundary_co[1] == start_co[1]) + boundary_co[1] == start_co[1]) { BLI_stack_pop(tgpf->stack, &v); // boundary_found = true; @@ -753,8 +752,10 @@ static void gpencil_get_depth_array(tGPDfill *tgpf) for (i = 0, ptc = tgpf->sbuffer; i < totpoints; i++, ptc++) { copy_v2_v2_int(mval, &ptc->x); - if ((ED_view3d_autodist_depth(tgpf->ar, mval, depth_margin, tgpf->depth_arr + i) == 0) && - (i && (ED_view3d_autodist_depth_seg(tgpf->ar, mval, mval_prev, depth_margin + 1, tgpf->depth_arr + i) == 0))) + if ((ED_view3d_autodist_depth( + tgpf->ar, mval, depth_margin, tgpf->depth_arr + i) == 0) && + (i && (ED_view3d_autodist_depth_seg( + tgpf->ar, mval, mval_prev, depth_margin + 1, tgpf->depth_arr + i) == 0))) { interp_depth = true; } @@ -849,7 +850,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf) gps->flag |= GP_STROKE_RECALC_CACHES; /* add stroke to frame */ - if ((ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) || (tgpf->on_back == true)){ + if ((ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) || (tgpf->on_back == true)) { BLI_addhead(&tgpf->gpf->strokes, gps); } else { @@ -862,10 +863,11 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf) point2D = (tGPspoint *)tgpf->sbuffer; for (int i = 0; i < tgpf->sbuffer_size && point2D; i++, point2D++, pt++, dvert++) { /* convert screen-coordinates to 3D coordinates */ - gp_stroke_convertcoords_tpoint(tgpf->scene, tgpf->ar, tgpf->v3d, tgpf->ob, - tgpf->gpl, point2D, - tgpf->depth_arr ? tgpf->depth_arr + i : NULL, - &pt->x); + gp_stroke_convertcoords_tpoint( + tgpf->scene, tgpf->ar, tgpf->v3d, tgpf->ob, + tgpf->gpl, point2D, + tgpf->depth_arr ? tgpf->depth_arr + i : NULL, + &pt->x); pt->pressure = 1.0f; pt->strength = 1.0f;; diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index 0218530be4e..a51f9e7a065 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -216,10 +216,11 @@ void gp_apply_parent_point(struct Depsgraph *depsgraph, struct Object *obact, bG bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, struct Scene *scene, const float screen_co[2], float r_out[3]); /* helper to convert 2d to 3d */ -void gp_stroke_convertcoords_tpoint(struct Scene *scene, struct ARegion *ar, - struct View3D *v3d, struct Object *ob, - bGPDlayer *gpl, const struct tGPspoint *point2D, - float *depth, float out[3]); +void gp_stroke_convertcoords_tpoint( + struct Scene *scene, struct ARegion *ar, + struct View3D *v3d, struct Object *ob, + bGPDlayer *gpl, const struct tGPspoint *point2D, + float *depth, float out[3]); /* Poll Callbacks ------------------------------------ */ /* gpencil_utils.c */ @@ -239,8 +240,9 @@ struct GHash *gp_copybuf_validate_colormap(struct bContext *C); /* Stroke Editing ------------------------------------ */ -void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke, - int tag_flags, bool select); +void gp_stroke_delete_tagged_points( + bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *next_stroke, + int tag_flags, bool select); int gp_delete_selected_point_wrap(bContext *C); bool gp_smooth_stroke(bGPDstroke *gps, int i, float inf, bool affect_pressure); diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index 991bfb622b7..e5ebfcecdf8 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -128,8 +128,8 @@ static bool gp_stroke_paintmode_draw_poll(bContext *C) bGPdata *gpd = CTX_data_gpencil_data(C); ToolSettings *ts = CTX_data_tool_settings(C); Brush *brush = BKE_brush_getactive_gpencil(ts); - return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush) - && (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_DRAW)); + return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush) && + (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_DRAW)); } /* Poll callback for stroke painting (erase brush) */ @@ -139,8 +139,8 @@ static bool gp_stroke_paintmode_erase_poll(bContext *C) bGPdata *gpd = CTX_data_gpencil_data(C); ToolSettings *ts = CTX_data_tool_settings(C); Brush *brush = BKE_brush_getactive_gpencil(ts); - return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush) - && (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE)); + return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush) && + (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE)); } /* Poll callback for stroke painting (fill) */ @@ -150,8 +150,8 @@ static bool gp_stroke_paintmode_fill_poll(bContext *C) bGPdata *gpd = CTX_data_gpencil_data(C); ToolSettings *ts = CTX_data_tool_settings(C); Brush *brush = BKE_brush_getactive_gpencil(ts); - return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush) - && (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_FILL)); + return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE) && (brush) && + (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_FILL)); } /* Poll callback for stroke sculpting mode */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index fd5b2803650..0c411db57b4 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -61,8 +61,6 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_gpencil.h" -#include "BKE_main.h" -#include "BKE_paint.h" #include "BKE_report.h" #include "BKE_layer.h" #include "BKE_material.h" @@ -624,7 +622,7 @@ static short gp_stroke_addpoint( } /* apply randomness to pressure */ if ((brush->gpencil_settings->flag & GP_BRUSH_GROUP_RANDOM) && - (brush->gpencil_settings->draw_random_press > 0.0f)) + (brush->gpencil_settings->draw_random_press > 0.0f)) { float curvef = curvemapping_evaluateF(brush->gpencil_settings->curve_sensitivity, 0, pressure); float tmp_pressure = curvef * brush->gpencil_settings->draw_sensitivity; @@ -672,7 +670,7 @@ static short gp_stroke_addpoint( /* apply randomness to color strength */ if ((brush->gpencil_settings->flag & GP_BRUSH_GROUP_RANDOM) && - (brush->gpencil_settings->draw_random_strength > 0.0f)) + (brush->gpencil_settings->draw_random_strength > 0.0f)) { if (BLI_rng_get_float(p->rng) > 0.5f) { pt->strength -= pt->strength * brush->gpencil_settings->draw_random_strength * BLI_rng_get_float(p->rng); @@ -1381,13 +1379,13 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, /* 2) Tag any point with overly low influence for removal in the next pass */ if ((pt1->pressure < cull_thresh) || (p->flags & GP_PAINTFLAG_HARD_ERASER) || - (eraser->gpencil_settings->eraser_mode == GP_BRUSH_ERASER_HARD)) + (eraser->gpencil_settings->eraser_mode == GP_BRUSH_ERASER_HARD)) { pt1->flag |= GP_SPOINT_TAG; do_cull = true; } if ((pt2->pressure < cull_thresh) || (p->flags & GP_PAINTFLAG_HARD_ERASER) || - (eraser->gpencil_settings->eraser_mode == GP_BRUSH_ERASER_HARD)) + (eraser->gpencil_settings->eraser_mode == GP_BRUSH_ERASER_HARD)) { pt2->flag |= GP_SPOINT_TAG; do_cull = true; @@ -1500,14 +1498,14 @@ static Brush *gp_get_default_eraser(Main *bmain, ToolSettings *ts) Brush *brush_old = paint->brush; for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) { if ((brush->ob_mode == OB_MODE_GPENCIL_PAINT) && - (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE)) + (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE)) { /* save first eraser to use later if no default */ if (brush_dft == NULL) { brush_dft = brush; } /* found default */ - if(brush->gpencil_settings->flag & GP_BRUSH_DEFAULT_ERASER) { + if (brush->gpencil_settings->flag & GP_BRUSH_DEFAULT_ERASER) { return brush; } } @@ -2201,7 +2199,7 @@ static void gpencil_draw_cursor_set(tGPsdata *p) { Brush *brush = p->brush; if ((p->paintmode == GP_PAINTMODE_ERASER) || - (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE)) + (brush->gpencil_settings->brush_type == GP_BRUSH_TYPE_ERASE)) { WM_cursor_modal_set(p->win, BC_CROSSCURSOR); /* XXX need a better cursor */ } @@ -2218,17 +2216,20 @@ static void gpencil_draw_status_indicators(bContext *C, tGPsdata *p) #if 0 /* FIXME, this never runs! */ switch (p->paintmode) { - case GP_PAINTMODE_DRAW_POLY: - /* Provide usage tips, since this is modal, and unintuitive without hints */ - ED_workspace_status_text(C, IFACE_("Annotation Create Poly: LMB click to place next stroke vertex | " - "ESC/Enter to end (or click outside this area)")); - break; - default: - /* Do nothing - the others are self explanatory, exit quickly once the mouse is released - * Showing any text would just be annoying as it would flicker. - */ - break; - } + case GP_PAINTMODE_DRAW_POLY: + /* Provide usage tips, since this is modal, and unintuitive without hints */ + ED_workspace_status_text( + C, IFACE_( + "Annotation Create Poly: LMB click to place next stroke vertex | " + "ESC/Enter to end (or click outside this area)" + )); + break; + default: + /* Do nothing - the others are self explanatory, exit quickly once the mouse is released + * Showing any text would just be annoying as it would flicker. + */ + break; + } #endif case GP_STATUS_IDLING: diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index ef09c5c3f76..9dbec666cc4 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -230,23 +230,27 @@ static void gpencil_primitive_status_indicators(bContext *C, tGPDprimitive *tgpi } else { if (tgpi->flag == IN_PROGRESS) { - BLI_snprintf(status_str, sizeof(status_str), "%s: %d (%d, %d) (%d, %d)", msg_str, (int)tgpi->tot_edges, - tgpi->top[0], tgpi->top[1], tgpi->bottom[0], tgpi->bottom[1]); + BLI_snprintf( + status_str, sizeof(status_str), "%s: %d (%d, %d) (%d, %d)", msg_str, (int)tgpi->tot_edges, + tgpi->top[0], tgpi->top[1], tgpi->bottom[0], tgpi->bottom[1]); } else { - BLI_snprintf(status_str, sizeof(status_str), "%s: %d (%d, %d)", msg_str, (int)tgpi->tot_edges, - tgpi->bottom[0], tgpi->bottom[1]); + BLI_snprintf( + status_str, sizeof(status_str), "%s: %d (%d, %d)", msg_str, (int)tgpi->tot_edges, + tgpi->bottom[0], tgpi->bottom[1]); } } } else { if (tgpi->flag == IN_PROGRESS) { - BLI_snprintf(status_str, sizeof(status_str), "%s: (%d, %d) (%d, %d)", msg_str, - tgpi->top[0], tgpi->top[1], tgpi->bottom[0], tgpi->bottom[1]); + BLI_snprintf( + status_str, sizeof(status_str), "%s: (%d, %d) (%d, %d)", msg_str, + tgpi->top[0], tgpi->top[1], tgpi->bottom[0], tgpi->bottom[1]); } else { - BLI_snprintf(status_str, sizeof(status_str), "%s: (%d, %d)", msg_str, - tgpi->bottom[0], tgpi->bottom[1]); + BLI_snprintf( + status_str, sizeof(status_str), "%s: (%d, %d)", msg_str, + tgpi->bottom[0], tgpi->bottom[1]); } } ED_workspace_status_text(C, status_str); @@ -467,7 +471,7 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op) if (tgpi->type == GP_STROKE_CIRCLE) { RNA_int_set(op->ptr, "edges", 32); } - else if(tgpi->type == GP_STROKE_BOX) { + else if (tgpi->type == GP_STROKE_BOX) { RNA_int_set(op->ptr, "edges", 4); } else { /* LINE */ diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 7262c537321..cd352579b4a 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -1426,9 +1426,9 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata) * The decision was to use a fix size, instead of paintbrush->thickness value. */ if ((gp_style) && (GPENCIL_PAINT_MODE(gpd)) && - ((paintbrush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) && - ((paintbrush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) && - (paintbrush->gpencil_settings->brush_type == GP_BRUSH_TYPE_DRAW)) + ((paintbrush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) && + ((paintbrush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) && + (paintbrush->gpencil_settings->brush_type == GP_BRUSH_TYPE_DRAW)) { radius = 2.0f; copy_v3_v3(color, gp_style->stroke_rgba); @@ -1491,7 +1491,7 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata) /* Draw line for lazy mouse */ if ((last_mouse_position) && - (paintbrush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP)) + (paintbrush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP)) { glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); @@ -1501,8 +1501,10 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata) immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, x, y); - immVertex2f(pos, last_mouse_position[0] + ar->winrct.xmin, - last_mouse_position[1] + ar->winrct.ymin); + immVertex2f( + pos, + last_mouse_position[0] + ar->winrct.xmin, + last_mouse_position[1] + ar->winrct.ymin); immEnd(); glDisable(GL_BLEND); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index fc3dd3f9968..d174a78ee23 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1023,7 +1023,7 @@ void uiTemplateHeader(uiLayout *layout, struct bContext *C); void uiTemplateID( uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, - int filter, const bool live_icon); + int filter, const bool live_icon); void uiTemplateIDBrowse( uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 07d259dd047..e81ad1428d1 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -174,7 +174,7 @@ static uiBlock *template_common_search_menu( uiButSearchFunc search_func, void *search_arg, uiButHandleFunc handle_func, void *active_item, const int preview_rows, const int preview_cols, - float scale) + float scale) { static char search[256]; wmWindow *win = CTX_wm_window(C); @@ -644,7 +644,7 @@ static uiBut *template_id_def_new_but( static void template_ID( bContext *C, uiLayout *layout, TemplateID *template_ui, StructRNA *type, int flag, const char *newop, const char *openop, const char *unlinkop, - const bool live_icon) + const bool live_icon) { uiBut *but; uiBlock *block; @@ -875,7 +875,7 @@ static void ui_template_id( PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols, int filter, bool use_tabs, - float scale, bool live_icon) + float scale, bool live_icon) { TemplateID *template_ui; PropertyRNA *prop; @@ -933,7 +933,7 @@ static void ui_template_id( void uiTemplateID( uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, - int filter, const bool live_icon) + int filter, const bool live_icon) { ui_template_id( layout, C, ptr, propname, @@ -1569,8 +1569,9 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) /************************ Grease Pencil Modifier Template *************************/ -static uiLayout *gpencil_draw_modifier(uiLayout *layout, Object *ob, - GpencilModifierData *md) +static uiLayout *gpencil_draw_modifier( + uiLayout *layout, Object *ob, + GpencilModifierData *md) { const GpencilModifierTypeInfo *mti = BKE_gpencil_modifierType_getInfo(md->type); PointerRNA ptr; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index d3181441168..1ae441ee2f4 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1005,7 +1005,8 @@ static int object_gpencil_add_exec(bContext *C, wmOperator *op) * for them to end up aligned oddly, but only for Monkey */ if ((RNA_struct_property_is_set(op->ptr, "view_align") == false) && - (type == GP_MONKEY)) { + (type == GP_MONKEY)) + { RNA_boolean_set(op->ptr, "view_align", true); } diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c index 261f7f42bc0..b9bfb44f680 100644 --- a/source/blender/editors/object/object_modes.c +++ b/source/blender/editors/object/object_modes.c @@ -118,7 +118,7 @@ bool ED_object_mode_compat_test(const Object *ob, eObjectMode mode) break; case OB_GPENCIL: if (mode & (OB_MODE_EDIT | OB_MODE_GPENCIL_EDIT | OB_MODE_GPENCIL_PAINT | - OB_MODE_GPENCIL_SCULPT | OB_MODE_GPENCIL_WEIGHT)) + OB_MODE_GPENCIL_SCULPT | OB_MODE_GPENCIL_WEIGHT)) { return true; } diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index f83c6af08ee..43f651b0532 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -204,9 +204,10 @@ static bool object_has_modifier(const Object *ob, const ModifierData *exclude, * If the callback ever returns true, iteration will stop and the * function value will be true. Otherwise the function returns false. */ -bool ED_object_iter_other(Main *bmain, Object *orig_ob, const bool include_orig, - bool (*callback)(Object *ob, void *callback_data), - void *callback_data) +bool ED_object_iter_other( + Main *bmain, Object *orig_ob, const bool include_orig, + bool (*callback)(Object *ob, void *callback_data), + void *callback_data) { ID *ob_data_id = orig_ob->data; int users = ob_data_id->us; @@ -220,10 +221,10 @@ bool ED_object_iter_other(Main *bmain, Object *orig_ob, const bool include_orig, int totfound = include_orig ? 0 : 1; for (ob = bmain->object.first; ob && totfound < users; - ob = ob->id.next) + ob = ob->id.next) { if (((ob != orig_ob) || include_orig) && - (ob->data == orig_ob->data)) + (ob->data == orig_ob->data)) { if (callback(ob, callback_data)) return true; @@ -318,7 +319,7 @@ static bool object_modifier_remove(Main *bmain, Object *ob, ModifierData *md, } if (ELEM(md->type, eModifierType_Softbody, eModifierType_Cloth) && - BLI_listbase_is_empty(&ob->particlesystem)) + BLI_listbase_is_empty(&ob->particlesystem)) { ob->mode &= ~OB_MODE_PARTICLE_EDIT; } @@ -681,8 +682,8 @@ int ED_object_modifier_apply( return 0; } else if ((ob->mode & OB_MODE_SCULPT) && - (find_multires_modifier_before(scene, md)) && - (modifier_isSameTopology(md) == false)) + (find_multires_modifier_before(scene, md)) && + (modifier_isSameTopology(md) == false)) { BKE_report(reports, RPT_ERROR, "Constructive modifier cannot be applied to multi-res data in sculpt mode"); return 0; @@ -1525,7 +1526,7 @@ static int skin_root_mark_exec(bContext *C, wmOperator *UNUSED(op)) BM_ITER_MESH (bm_vert, &bm_iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(bm_vert, BM_ELEM_SELECT) && - BLI_gset_add(visited, bm_vert)) + BLI_gset_add(visited, bm_vert)) { MVertSkin *vs = BM_ELEM_CD_GET_VOID_P(bm_vert, cd_vert_skin_offset); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 62115aea11d..98ff2f67b58 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -527,7 +527,7 @@ static void buttons_area_listener( } break; case NC_GPENCIL: - switch(wmn->data) { + switch (wmn->data) { case ND_DATA: if (ELEM(wmn->action, NA_EDITED, NA_ADDED, NA_REMOVED)) ED_area_tag_redraw(sa); diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c index d5ef7cdf441..fb335d5f922 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c @@ -37,7 +37,6 @@ #include "BKE_object.h" #include "BKE_unit.h" #include "BKE_material.h" -#include "BKE_main.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index afff5eb7f66..2f65ad1fde4 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1683,22 +1683,23 @@ static bool ed_object_select_pick( The grease pencil modes are not real modes, but a hack to make the interface consistent, so need some tricks to keep UI synchronized */ // XXX: This stuff neeeds reviewing (Aligorith) -#if 0 - if (((oldbasact) && oldbasact->object->type == OB_GPENCIL) || (basact->object->type == OB_GPENCIL)) { + if (false && + (((oldbasact) && oldbasact->object->type == OB_GPENCIL) || + (basact->object->type == OB_GPENCIL))) + { /* set cursor */ - if (ELEM(basact->object->mode == OB_MODE_GPENCIL_PAINT, - OB_MODE_GPENCIL_SCULPT, - OB_MODE_GPENCIL_WEIGHT)) { + if (ELEM(basact->object->mode, + OB_MODE_GPENCIL_PAINT, + OB_MODE_GPENCIL_SCULPT, + OB_MODE_GPENCIL_WEIGHT)) + { ED_gpencil_toggle_brush_cursor(C, true, NULL); } else { /* TODO: maybe is better use restore */ ED_gpencil_toggle_brush_cursor(C, false, NULL); } - /* set workspace mode */ - BKE_workspace_object_mode_set(CTX_wm_workspace(C), scene, basact->object->mode); } -#endif } DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 9ad80f2ab12..b0de996ee0e 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -103,8 +103,6 @@ #include "transform.h" -#include "DEG_depsgraph.h" - /* Disabling, since when you type you know what you are doing, and being able to set it to zero is handy. */ // #define USE_NUM_NO_ZERO diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index bc35e6e6b89..6dfcfe11af2 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -2282,9 +2282,9 @@ static short snapObject( break; case OB_GPENCIL: retval = snapEmpty( - snapdata, ob, obmat, - dist_px, - r_loc, r_no, r_index); + snapdata, ob, obmat, + dist_px, + r_loc, r_no, r_index); break; case OB_CAMERA: retval = snapCamera( |