diff options
Diffstat (limited to 'source/blender/editors')
20 files changed, 77 insertions, 104 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 79dda480a0a..73a94f066e3 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -54,7 +54,6 @@ #include "BKE_deform.h" #include "BKE_global.h" #include "BKE_gpencil.h" -#include "BKE_gpencil_curve.h" #include "BKE_gpencil_geom.h" #include "BKE_layer.h" #include "BKE_main.h" @@ -835,7 +834,7 @@ static short gpencil_stroke_addpoint(tGPsdata *p, /* color strength */ if (brush_settings->flag & GP_BRUSH_USE_STRENGTH_PRESSURE) { pt->strength *= BKE_curvemapping_evaluateF(brush_settings->curve_strength, 0, pressure); - CLAMP(pt->strength, MIN2(GPENCIL_STRENGTH_MIN, brush_settings->draw_strength), 1.0f); + CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f); } /* Set vertex colors for buffer. */ @@ -919,19 +918,6 @@ static short gpencil_stroke_addpoint(tGPsdata *p, return GP_STROKEADD_INVALID; } -static void gpencil_stroke_unselect(bGPdata *gpd, bGPDstroke *gps) -{ - gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_reset(gps); - for (int i = 0; i < gps->totpoints; i++) { - gps->points[i].flag &= ~GP_SPOINT_SELECT; - } - /* Update the selection from the stroke to the curve. */ - if (gps->editcurve) { - BKE_gpencil_editcurve_stroke_sync_selection(gpd, gps, gps->editcurve); - } -} - /* make a new stroke from the buffer data */ static void gpencil_stroke_newfrombuffer(tGPsdata *p) { @@ -942,7 +928,6 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p) tGPspoint *ptc; MDeformVert *dvert = NULL; Brush *brush = p->brush; - BrushGpencilSettings *brush_settings = brush->gpencil_settings; ToolSettings *ts = p->scene->toolsettings; Depsgraph *depsgraph = p->depsgraph; Object *obact = (Object *)p->ownerPtr.data; @@ -1031,7 +1016,7 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p) /* copy pressure and time */ pt->pressure = ptc->pressure; pt->strength = ptc->strength; - CLAMP(pt->strength, MIN2(GPENCIL_STRENGTH_MIN, brush_settings->draw_strength), 1.0f); + CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f); copy_v4_v4(pt->vert_color, ptc->vert_color); pt->time = ptc->time; /* Apply the vertex color to point. */ @@ -1065,7 +1050,7 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p) /* copy pressure and time */ pt->pressure = ptc->pressure; pt->strength = ptc->strength; - CLAMP(pt->strength, MIN2(GPENCIL_STRENGTH_MIN, brush_settings->draw_strength), 1.0f); + CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f); pt->time = ptc->time; /* Apply the vertex color to point. */ ED_gpencil_point_vertex_color_set(ts, brush, pt, ptc); @@ -1190,7 +1175,7 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p) /* copy pressure and time */ pt->pressure = ptc->pressure; pt->strength = ptc->strength; - CLAMP(pt->strength, MIN2(GPENCIL_STRENGTH_MIN, brush_settings->draw_strength), 1.0f); + CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f); copy_v4_v4(pt->vert_color, ptc->vert_color); pt->time = ptc->time; pt->uv_fac = ptc->uv_fac; @@ -1315,12 +1300,7 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p) ctrl2, GPENCIL_MINIMUM_JOIN_DIST, &pt_index); - if (gps_target != NULL) { - /* Unselect all points of source and destination strokes. This is required to avoid - * a change in the resolution of the original strokes during the join. */ - gpencil_stroke_unselect(gpd, gps); - gpencil_stroke_unselect(gpd, gps_target); gps = ED_gpencil_stroke_join_and_trim(p->gpd, p->gpf, gps, gps_target, pt_index); } else { diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index 6bcddfa631a..8a669a2afc2 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -102,7 +102,7 @@ void ED_slider_destroy(struct bContext *C, struct tSlider *slider); */ void ED_slider_status_string_get(const struct tSlider *slider, char *status_string, - size_t size_of_status_string); + const size_t size_of_status_string); float ED_slider_factor_get(struct tSlider *slider); void ED_slider_factor_set(struct tSlider *slider, float factor); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 9ce07cd2e07..f01b8318e98 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -495,7 +495,7 @@ float UI_text_clip_middle_ex(const struct uiFontStyle *fstyle, char *str, float okwidth, float minwidth, - size_t max_len, + const size_t max_len, char rpart_sep); /** @@ -2957,17 +2957,15 @@ void UI_fontstyle_set(const struct uiFontStyle *fs); void UI_fontstyle_draw_ex(const struct uiFontStyle *fs, const struct rcti *rect, const char *str, - size_t str_len, const uchar col[4], const struct uiFontStyleDraw_Params *fs_params, + size_t len, int *r_xofs, int *r_yofs, struct ResultBLF *r_info); - void UI_fontstyle_draw(const struct uiFontStyle *fs, const struct rcti *rect, const char *str, - size_t str_len, const uchar col[4], const struct uiFontStyleDraw_Params *fs_params); /** diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 923f741e3ae..027f03d05c7 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -688,11 +688,11 @@ extern void ui_hsvcube_pos_from_vals( */ extern void ui_but_string_get_ex(uiBut *but, char *str, - size_t maxlen, + const size_t maxlen, int float_precision, bool use_exp_float, bool *r_use_exp_float) ATTR_NONNULL(1, 2); -extern void ui_but_string_get(uiBut *but, char *str, size_t maxlen) ATTR_NONNULL(); +extern void ui_but_string_get(uiBut *but, char *str, const size_t maxlen) ATTR_NONNULL(); /** * A version of #ui_but_string_get_ex for dynamic buffer sizes * (where #ui_but_string_get_max_length returns 0). diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 135cef5fe53..bc1d3387ad7 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1146,7 +1146,6 @@ static void panel_draw_aligned_widgets(const uiStyle *style, UI_fontstyle_draw(fontstyle, &title_rect, panel->drawname, - sizeof(panel->drawname), title_color, &(struct uiFontStyleDraw_Params){ .align = UI_STYLE_TEXT_LEFT, diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index fe58a6a05ae..e146443faaa 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -74,8 +74,6 @@ #define UI_TIP_PADDING (int)(UI_TIP_PAD_FAC * UI_UNIT_Y) #define UI_TIP_MAXWIDTH 600 -#define UI_TIP_STR_MAX 1024 - typedef struct uiTooltipFormat { enum { UI_TIP_STYLE_NORMAL = 0, @@ -216,7 +214,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region /* draw header and active data (is done here to be able to change color) */ rgb_float_to_uchar(drawcol, tip_colors[UI_TIP_LC_MAIN]); UI_fontstyle_set(&data->fstyle); - UI_fontstyle_draw(&data->fstyle, &bbox, field->text, UI_TIP_STR_MAX, drawcol, &fs_params); + UI_fontstyle_draw(&data->fstyle, &bbox, field->text, drawcol, &fs_params); /* offset to the end of the last line */ if (field->text_suffix) { @@ -226,8 +224,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region bbox.ymax -= yofs; rgb_float_to_uchar(drawcol, tip_colors[UI_TIP_LC_ACTIVE]); - UI_fontstyle_draw( - &data->fstyle, &bbox, field->text_suffix, UI_TIP_STR_MAX, drawcol, &fs_params); + UI_fontstyle_draw(&data->fstyle, &bbox, field->text_suffix, drawcol, &fs_params); /* undo offset */ bbox.xmin -= xofs; @@ -246,7 +243,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region /* XXX, needed because we don't have mono in 'U.uifonts' */ BLF_size(fstyle_mono.uifont_id, fstyle_mono.points * U.pixelsize, U.dpi); rgb_float_to_uchar(drawcol, tip_colors[field->format.color_id]); - UI_fontstyle_draw(&fstyle_mono, &bbox, field->text, UI_TIP_STR_MAX, drawcol, &fs_params); + UI_fontstyle_draw(&fstyle_mono, &bbox, field->text, drawcol, &fs_params); } else { BLI_assert(field->format.style == UI_TIP_STYLE_NORMAL); @@ -258,7 +255,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region /* draw remaining data */ rgb_float_to_uchar(drawcol, tip_colors[field->format.color_id]); UI_fontstyle_set(&data->fstyle); - UI_fontstyle_draw(&data->fstyle, &bbox, field->text, UI_TIP_STR_MAX, drawcol, &fs_params); + UI_fontstyle_draw(&data->fstyle, &bbox, field->text, drawcol, &fs_params); } bbox.ymax -= data->lineh * field->geom.lines; @@ -1218,12 +1215,12 @@ static ARegion *ui_tooltip_create_with_data(bContext *C, BLI_assert(ELEM(field->format.style, UI_TIP_STYLE_NORMAL, UI_TIP_STYLE_HEADER)); font_id = data->fstyle.uifont_id; } - w = BLF_width_ex(font_id, field->text, UI_TIP_STR_MAX, &info); + w = BLF_width_ex(font_id, field->text, BLF_DRAW_STR_DUMMY_MAX, &info); /* check for suffix (enum label) */ if (field->text_suffix && field->text_suffix[0]) { x_pos = info.width; - w = max_ii(w, x_pos + BLF_width(font_id, field->text_suffix, UI_TIP_STR_MAX)); + w = max_ii(w, x_pos + BLF_width(font_id, field->text_suffix, BLF_DRAW_STR_DUMMY_MAX)); } fontw = max_ii(fontw, w); diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 44942d508ca..c28769a4951 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -140,9 +140,9 @@ static uiFont *uifont_to_blfont(int id) void UI_fontstyle_draw_ex(const uiFontStyle *fs, const rcti *rect, const char *str, - const size_t str_len, const uchar col[4], const struct uiFontStyleDraw_Params *fs_params, + size_t len, int *r_xofs, int *r_yofs, struct ResultBLF *r_info) @@ -183,10 +183,10 @@ void UI_fontstyle_draw_ex(const uiFontStyle *fs, } if (fs_params->align == UI_STYLE_TEXT_CENTER) { - xofs = floor(0.5f * (BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, str_len))); + xofs = floor(0.5f * (BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, len))); } else if (fs_params->align == UI_STYLE_TEXT_RIGHT) { - xofs = BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, str_len); + xofs = BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, len); } yofs = MAX2(0, yofs); @@ -196,7 +196,7 @@ void UI_fontstyle_draw_ex(const uiFontStyle *fs, BLF_position(fs->uifont_id, rect->xmin + xofs, rect->ymin + yofs, 0.0f); BLF_color4ubv(fs->uifont_id, col); - BLF_draw_ex(fs->uifont_id, str, str_len, r_info); + BLF_draw_ex(fs->uifont_id, str, len, r_info); BLF_disable(fs->uifont_id, font_flag); @@ -211,11 +211,12 @@ void UI_fontstyle_draw_ex(const uiFontStyle *fs, void UI_fontstyle_draw(const uiFontStyle *fs, const rcti *rect, const char *str, - const size_t str_len, const uchar col[4], const struct uiFontStyleDraw_Params *fs_params) { - UI_fontstyle_draw_ex(fs, rect, str, str_len, col, fs_params, NULL, NULL, NULL); + int xofs, yofs; + + UI_fontstyle_draw_ex(fs, rect, str, col, fs_params, BLF_DRAW_STR_DUMMY_MAX, &xofs, &yofs, NULL); } void UI_fontstyle_draw_rotated(const uiFontStyle *fs, diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index b44496731f7..ad8c0842657 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2130,11 +2130,11 @@ static void widget_draw_text(const uiFontStyle *fstyle, UI_fontstyle_draw_ex(fstyle, rect, drawstr + but->ofs, - drawlen, wcol->text, &(struct uiFontStyleDraw_Params){ .align = align, }, + drawlen, &font_xofs, &font_yofs, NULL); @@ -2194,7 +2194,6 @@ static void widget_draw_text(const uiFontStyle *fstyle, UI_fontstyle_draw(fstyle, rect, drawstr_right, - UI_MAX_DRAW_STR, col, &(struct uiFontStyleDraw_Params){ .align = UI_STYLE_TEXT_RIGHT, @@ -5418,11 +5417,11 @@ void ui_draw_menu_item(const uiFontStyle *fstyle, UI_fontstyle_draw_ex(fstyle, rect, drawstr, - sizeof(drawstr), wt->wcol.text, &(struct uiFontStyleDraw_Params){ .align = UI_STYLE_TEXT_LEFT, }, + BLF_DRAW_STR_DUMMY_MAX, &xofs, &yofs, &info); @@ -5469,7 +5468,6 @@ void ui_draw_menu_item(const uiFontStyle *fstyle, UI_fontstyle_draw(fstyle, rect, hint_drawstr, - sizeof(hint_drawstr), wt->wcol.text, &(struct uiFontStyleDraw_Params){ .align = UI_STYLE_TEXT_RIGHT, @@ -5525,7 +5523,6 @@ void ui_draw_preview_item_stateless(const uiFontStyle *fstyle, UI_fontstyle_draw(fstyle, &trect, drawstr, - sizeof(drawstr), text_col, &(struct uiFontStyleDraw_Params){ .align = text_align, diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 06e21f91d04..b9943d13b19 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -3527,8 +3527,6 @@ static int object_add_named_exec(bContext *C, wmOperator *op) } basen->object->visibility_flag &= ~OB_HIDE_VIEWPORT; - /* Do immediately, as #copy_object_set_idnew() below operates on visible objects. */ - BKE_base_eval_flags(basen); /* object_add_duplicate_internal() doesn't deselect other objects, unlike object_add_common() or * BKE_view_layer_base_deselect_all(). */ diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc index 4f94927533b..16e83395401 100644 --- a/source/blender/editors/render/render_preview.cc +++ b/source/blender/editors/render/render_preview.cc @@ -722,7 +722,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r SpaceProperties *sbuts = CTX_wm_space_properties(C); ShaderPreview *sp = static_cast<ShaderPreview *>(WM_jobs_customdata(wm, area)); rcti newrect; - bool ok; + int ok; int newx = BLI_rcti_size_x(rect); int newy = BLI_rcti_size_y(rect); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index dd1b4e10e60..44e9735866d 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -240,7 +240,6 @@ static void file_draw_string(int sx, UI_fontstyle_draw(&fs, &rect, fname, - sizeof(fname), col, &(struct uiFontStyleDraw_Params){ .align = align, @@ -290,12 +289,12 @@ static void file_draw_string_multiline(int sx, UI_fontstyle_draw_ex(&style->widget, &rect, string, - len, text_col, &(struct uiFontStyleDraw_Params){ .align = UI_STYLE_TEXT_LEFT, .word_wrap = true, }, + len, NULL, NULL, &result); diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index e9a385c525b..2d3c42b16d1 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -2452,7 +2452,7 @@ static void frame_node_draw_label(const bNodeTree &ntree, const bool has_label = node.label[0] != '\0'; if (has_label) { BLF_position(fontid, x, y, 0); - BLF_draw(fontid, label, sizeof(label)); + BLF_draw(fontid, label, BLF_DRAW_STR_DUMMY_MAX); } /* draw text body */ diff --git a/source/blender/editors/space_node/node_group.cc b/source/blender/editors/space_node/node_group.cc index 4834ca3174a..02d68189997 100644 --- a/source/blender/editors/space_node/node_group.cc +++ b/source/blender/editors/space_node/node_group.cc @@ -28,9 +28,9 @@ #include "DNA_anim_types.h" #include "DNA_node_types.h" -#include "BLI_float2.hh" #include "BLI_linklist.h" #include "BLI_listbase.h" +#include "BLI_math_vec_types.hh" #include "BLI_string.h" #include "BLI_vector.hh" diff --git a/source/blender/editors/space_node/node_intern.hh b/source/blender/editors/space_node/node_intern.hh index 0f542734f66..740d1fbb6f9 100644 --- a/source/blender/editors/space_node/node_intern.hh +++ b/source/blender/editors/space_node/node_intern.hh @@ -23,7 +23,7 @@ #pragma once -#include "BLI_float2.hh" +#include "BLI_math_vec_types.hh" #include "BLI_vector.hh" #include "BKE_node.h" @@ -43,9 +43,6 @@ struct bNodeLink; struct bNodeSocket; struct wmGizmoGroupType; struct wmKeyConfig; -namespace blender { -struct float2; -} struct wmWindow; /** Temporary data used in node link drag modal operator. */ diff --git a/source/blender/editors/space_node/node_select.cc b/source/blender/editors/space_node/node_select.cc index 334ca1f76ee..803cf38c53a 100644 --- a/source/blender/editors/space_node/node_select.cc +++ b/source/blender/editors/space_node/node_select.cc @@ -111,11 +111,13 @@ static bNode *node_under_mouse_select(bNodeTree &ntree, int mx, int my) static bNode *node_under_mouse_tweak(bNodeTree &ntree, const float2 &mouse) { + using namespace blender::math; + LISTBASE_FOREACH_BACKWARD (bNode *, node, &ntree.nodes) { if (node->type == NODE_REROUTE) { bNodeSocket *socket = (bNodeSocket *)node->inputs.first; const float2 location{socket->locx, socket->locy}; - if (float2::distance(mouse, location) < 24.0f) { + if (distance(mouse, location) < 24.0f) { return node; } } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 6dffc0bc2a4..e814530d1e2 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -2262,15 +2262,28 @@ void sequencer_draw_preview(const bContext *C, seq_prefetch_wm_notify(C, scene); } -static void draw_seq_timeline_channels(View2D *v2d) +/* Draw backdrop in sequencer timeline. */ +static void draw_seq_backdrop(View2D *v2d) { + int i; + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + + /* View backdrop. */ + immUniformThemeColor(TH_BACK); + immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); + + /* Darker overlay over the view backdrop. */ + immUniformThemeColorShade(TH_BACK, -10); + immRectf(pos, v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0); + + /* Alternating horizontal stripes. */ + i = max_ii(1, ((int)v2d->cur.ymin) - 1); + GPU_blend(GPU_BLEND_ALPHA); immUniformThemeColor(TH_ROW_ALTERNATE); - /* Alternating horizontal stripes. */ - int i = max_ii(1, ((int)v2d->cur.ymin) - 1); while (i < v2d->cur.ymax) { if (i & 1) { immRectf(pos, v2d->cur.xmin, i, v2d->cur.xmax, i + 1); @@ -2282,14 +2295,6 @@ static void draw_seq_timeline_channels(View2D *v2d) immUnbindProgram(); } -static void draw_seq_timeline_channel_numbers(ARegion *region) -{ - View2D *v2d = ®ion->v2d; - rcti rect; - BLI_rcti_init(&rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y); - UI_view2d_draw_scale_y__block(region, v2d, &rect, TH_SCROLL_TEXT); -} - static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region) { Scene *scene = CTX_data_scene(C); @@ -2713,7 +2718,7 @@ void draw_timeline_seq(const bContext *C, ARegion *region) } UI_view2d_view_ortho(v2d); - draw_seq_timeline_channels(v2d); + draw_seq_backdrop(v2d); if ((sseq->flag & SEQ_SHOW_OVERLAY) && (sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_GRID)) { U.v2d_min_gridsize *= 3; UI_view2d_draw_lines_x__discrete_frames_or_seconds( @@ -2771,7 +2776,13 @@ void draw_timeline_seq(const bContext *C, ARegion *region) UI_view2d_view_restore(C); ED_time_scrub_draw(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true); - draw_seq_timeline_channel_numbers(region); + /* Draw channel numbers. */ + { + rcti rect; + BLI_rcti_init( + &rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y); + UI_view2d_draw_scale_y__block(region, v2d, &rect, TH_SCROLL_TEXT); + } } void draw_timeline_seq_display(const bContext *C, ARegion *region) diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_column.cc b/source/blender/editors/space_spreadsheet/spreadsheet_column.cc index ee623083db7..ede8756a9da 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_column.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_column.cc @@ -19,9 +19,8 @@ #include "MEM_guardedalloc.h" #include "BLI_color.hh" -#include "BLI_float2.hh" -#include "BLI_float3.hh" #include "BLI_hash.hh" +#include "BLI_math_vec_types.hh" #include "BLI_string.h" #include "BLI_string_ref.hh" diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc b/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc index 7cc2d8d0b48..f4b5ff819ed 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc @@ -17,8 +17,7 @@ #include <iomanip> #include <sstream> -#include "BLI_float2.hh" -#include "BLI_float3.hh" +#include "BLI_math_vec_types.hh" #include "BKE_geometry_set.hh" diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc index 36c7f1057df..556c0b0d5ca 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc @@ -123,9 +123,7 @@ static void apply_row_filter(const SpreadsheetRowFilter &row_filter, const float threshold_sq = row_filter.threshold; apply_filter_operation( column_data.typed<float2>(), - [&](const float2 cell) { - return float2::distance_squared(cell, value) > threshold_sq; - }, + [&](const float2 cell) { return math::distance_squared(cell, value) > threshold_sq; }, prev_mask, new_indices); break; @@ -155,9 +153,7 @@ static void apply_row_filter(const SpreadsheetRowFilter &row_filter, const float threshold_sq = row_filter.threshold; apply_filter_operation( column_data.typed<float3>(), - [&](const float3 cell) { - return float3::distance_squared(cell, value) > threshold_sq; - }, + [&](const float3 cell) { return math::distance_squared(cell, value) > threshold_sq; }, prev_mask, new_indices); break; diff --git a/source/blender/editors/util/ed_draw.c b/source/blender/editors/util/ed_draw.c index 3e85862a847..ccbde07f5b1 100644 --- a/source/blender/editors/util/ed_draw.c +++ b/source/blender/editors/util/ed_draw.c @@ -599,9 +599,9 @@ static void metadata_custom_draw_fields(const char *field, const char *value, vo } MetadataCustomDrawContext *ctx = (MetadataCustomDrawContext *)ctx_v; char temp_str[MAX_METADATA_STR]; - SNPRINTF(temp_str, "%s: %s", field, value); + BLI_snprintf(temp_str, MAX_METADATA_STR, "%s: %s", field, value); BLF_position(ctx->fontid, ctx->xmin, ctx->ymin + ctx->current_y, 0.0f); - BLF_draw(ctx->fontid, temp_str, sizeof(temp_str)); + BLF_draw(ctx->fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); ctx->current_y += ctx->vertical_offset; } @@ -625,18 +625,18 @@ static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const /* first line */ if (i == 0) { bool do_newline = false; - int len = SNPRINTF_RLEN(temp_str, "%s: ", meta_data_list[0]); + int len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[0]); if (metadata_is_valid(ibuf, temp_str, 0, len)) { BLF_position(fontid, xmin, ymax - vertical_offset, 0.0f); - BLF_draw(fontid, temp_str, sizeof(temp_str)); + BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); do_newline = true; } - len = SNPRINTF_RLEN(temp_str, "%s: ", meta_data_list[1]); + len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[1]); if (metadata_is_valid(ibuf, temp_str, 1, len)) { - int line_width = BLF_width(fontid, temp_str, sizeof(temp_str)); + int line_width = BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); BLF_position(fontid, xmax - line_width, ymax - vertical_offset, 0.0f); - BLF_draw(fontid, temp_str, sizeof(temp_str)); + BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); do_newline = true; } @@ -645,32 +645,32 @@ static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const } } /* Strip */ else if (ELEM(i, 1, 2)) { - int len = SNPRINTF_RLEN(temp_str, "%s: ", meta_data_list[i + 1]); + int len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i + 1]); if (metadata_is_valid(ibuf, temp_str, i + 1, len)) { BLF_position(fontid, xmin, ymax - vertical_offset - ofs_y, 0.0f); - BLF_draw(fontid, temp_str, sizeof(temp_str)); + BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); ofs_y += vertical_offset; } } /* Note (wrapped) */ else if (i == 3) { - int len = SNPRINTF_RLEN(temp_str, "%s: ", meta_data_list[i + 1]); + int len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i + 1]); if (metadata_is_valid(ibuf, temp_str, i + 1, len)) { struct ResultBLF info; BLF_enable(fontid, BLF_WORD_WRAP); BLF_wordwrap(fontid, ibuf->x - (margin * 2)); BLF_position(fontid, xmin, ymax - vertical_offset - ofs_y, 0.0f); - BLF_draw_ex(fontid, temp_str, sizeof(temp_str), &info); + BLF_draw_ex(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX, &info); BLF_wordwrap(fontid, 0); BLF_disable(fontid, BLF_WORD_WRAP); ofs_y += vertical_offset * info.lines; } } else { - int len = SNPRINTF_RLEN(temp_str, "%s: ", meta_data_list[i + 1]); + int len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i + 1]); if (metadata_is_valid(ibuf, temp_str, i + 1, len)) { - int line_width = BLF_width(fontid, temp_str, sizeof(temp_str)); + int line_width = BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); BLF_position(fontid, xmax - line_width, ymax - vertical_offset - ofs_y, 0.0f); - BLF_draw(fontid, temp_str, sizeof(temp_str)); + BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); ofs_y += vertical_offset; } } @@ -687,12 +687,12 @@ static void metadata_draw_imbuf(ImBuf *ibuf, const rctf *rect, int fontid, const int ofs_x = 0; ofs_y = ctx.current_y; for (int i = 5; i < 10; i++) { - int len = SNPRINTF_RLEN(temp_str, "%s: ", meta_data_list[i]); + int len = BLI_snprintf_rlen(temp_str, MAX_METADATA_STR, "%s: ", meta_data_list[i]); if (metadata_is_valid(ibuf, temp_str, i, len)) { BLF_position(fontid, xmin + ofs_x, ymin + ofs_y, 0.0f); - BLF_draw(fontid, temp_str, sizeof(temp_str)); + BLF_draw(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX); - ofs_x += BLF_width(fontid, temp_str, sizeof(temp_str)) + UI_UNIT_X; + ofs_x += BLF_width(fontid, temp_str, BLF_DRAW_STR_DUMMY_MAX) + UI_UNIT_X; } } } |