Blender V4.3
view2d.cc File Reference
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
#include "BLI_link_utils.h"
#include "BLI_listbase.h"
#include "BLI_math_matrix.h"
#include "BLI_memarena.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "BKE_context.hh"
#include "BKE_global.hh"
#include "BKE_screen.hh"
#include "GPU_immediate.hh"
#include "GPU_matrix.hh"
#include "GPU_state.hh"
#include "WM_api.hh"
#include "BLF_api.hh"
#include "ED_screen.hh"
#include "UI_interface.hh"
#include "UI_view2d.hh"
#include "view2d_intern.hh"

Go to the source code of this file.

Classes

struct  View2DString
 

Functions

View2D Refresh and Validation (Spatial)
static void ui_view2d_curRect_validate_resize (View2D *v2d, bool resize)
 
void UI_view2d_region_reinit (View2D *v2d, short type, int winx, int winy)
 
void UI_view2d_curRect_validate (View2D *v2d)
 
void UI_view2d_curRect_changed (const bContext *C, View2D *v2d)
 
void UI_view2d_curRect_clamp_y (View2D *v2d)
 
bool UI_view2d_area_supports_sync (ScrArea *area)
 
void UI_view2d_sync (bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
 
void UI_view2d_curRect_reset (View2D *v2d)
 
void view2d_totRect_set_resize (View2D *v2d, int width, int height, bool resize)
 
void UI_view2d_totRect_set (View2D *v2d, int width, int height)
 
void UI_view2d_zoom_cache_reset ()
 
Internal Utilities
BLI_INLINE int clamp_float_to_int (const float f)
 
BLI_INLINE void clamp_rctf_to_rcti (rcti *dst, const rctf *src)
 
float view2d_page_size_y (const View2D &v2d)
 
Internal Scroll & Mask Utilities
static int view2d_scroll_mapped (int scroll)
 
void UI_view2d_mask_from_win (const View2D *v2d, rcti *r_mask)
 
static void view2d_masks (View2D *v2d, const rcti *mask_scroll)
 
View2D Matrix Setup
static void view2d_map_cur_using_mask (const View2D *v2d, rctf *r_curmasked)
 
void UI_view2d_view_ortho (const View2D *v2d)
 
void UI_view2d_view_orthoSpecial (ARegion *region, View2D *v2d, const bool xaxis)
 
void UI_view2d_view_restore (const bContext *C)
 
Grid-Line Drawing
void UI_view2d_multi_grid_draw (const View2D *v2d, int colorid, float step, int level_size, int totlevels)
 
static void grid_axis_start_and_count (const float step, const float min, const float max, float *r_start, int *r_count)
 
void UI_view2d_dot_grid_draw (const View2D *v2d, const int grid_color_id, const float min_step, const int grid_subdivisions)
 
Scrollers
void view2d_scrollers_calc (View2D *v2d, const rcti *mask_custom, View2DScrollers *r_scrollers)
 
void UI_view2d_scrollers_draw_ex (View2D *v2d, const rcti *mask_custom, bool use_full_hide)
 
void UI_view2d_scrollers_draw (View2D *v2d, const rcti *mask_custom)
 
List View Utilities
void UI_view2d_listview_view_to_cell (float columnwidth, float rowheight, float startx, float starty, float viewx, float viewy, int *r_column, int *r_row)
 
Coordinate Conversions
float UI_view2d_region_to_view_x (const View2D *v2d, float x)
 
float UI_view2d_region_to_view_y (const View2D *v2d, float y)
 
void UI_view2d_region_to_view (const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y)
 
void UI_view2d_region_to_view_rctf (const View2D *v2d, const rctf *rect_src, rctf *rect_dst)
 
float UI_view2d_view_to_region_x (const View2D *v2d, float x)
 
float UI_view2d_view_to_region_y (const View2D *v2d, float y)
 
bool UI_view2d_view_to_region_clip (const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y)
 
void UI_view2d_view_to_region (const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y)
 
void UI_view2d_view_to_region_fl (const View2D *v2d, float x, float y, float *r_region_x, float *r_region_y)
 
bool UI_view2d_view_to_region_segment_clip (const View2D *v2d, const float xy_a[2], const float xy_b[2], int r_region_a[2], int r_region_b[2])
 
void UI_view2d_view_to_region_rcti (const View2D *v2d, const rctf *rect_src, rcti *rect_dst)
 
void UI_view2d_view_to_region_m4 (const View2D *v2d, float matrix[4][4])
 
bool UI_view2d_view_to_region_rcti_clip (const View2D *v2d, const rctf *rect_src, rcti *rect_dst)
 
Utilities
View2DUI_view2d_fromcontext (const bContext *C)
 
View2DUI_view2d_fromcontext_rwin (const bContext *C)
 
void UI_view2d_scroller_size_get (const View2D *v2d, bool mapped, float *r_x, float *r_y)
 
void UI_view2d_scale_get (const View2D *v2d, float *r_x, float *r_y)
 
float UI_view2d_scale_get_x (const View2D *v2d)
 
float UI_view2d_scale_get_y (const View2D *v2d)
 
void UI_view2d_scale_get_inverse (const View2D *v2d, float *r_x, float *r_y)
 
void UI_view2d_center_get (const View2D *v2d, float *r_x, float *r_y)
 
void UI_view2d_center_set (View2D *v2d, float x, float y)
 
void UI_view2d_offset (View2D *v2d, float xfac, float yfac)
 
void UI_view2d_offset_y_snap_to_closest_page (View2D *v2d)
 
char UI_view2d_mouse_in_scrollers_ex (const ARegion *region, const View2D *v2d, const int xy[2], int *r_scroll)
 
char UI_view2d_rect_in_scrollers_ex (const ARegion *region, const View2D *v2d, const rcti *rect, int *r_scroll)
 
char UI_view2d_mouse_in_scrollers (const ARegion *region, const View2D *v2d, const int xy[2])
 
char UI_view2d_rect_in_scrollers (const ARegion *region, const View2D *v2d, const rcti *rect)
 

View2D Text Drawing Cache

static MemArenag_v2d_strings_arena = nullptr
 
static View2DStringg_v2d_strings = nullptr
 
void UI_view2d_text_cache_add (View2D *v2d, float x, float y, const char *str, size_t str_len, const uchar col[4])
 
void UI_view2d_text_cache_add_rectf (View2D *v2d, const rctf *rect_view, const char *str, size_t str_len, const uchar col[4])
 
void UI_view2d_text_cache_draw (ARegion *region)
 

Function Documentation

◆ clamp_float_to_int()

BLI_INLINE int clamp_float_to_int ( const float f)

Definition at line 51 of file view2d.cc.

References float, int, min, and UNLIKELY.

Referenced by clamp_rctf_to_rcti(), and UI_view2d_view_to_region().

◆ clamp_rctf_to_rcti()

BLI_INLINE void clamp_rctf_to_rcti ( rcti * dst,
const rctf * src )

use instead of BLI_rcti_rctf_copy so we have consistent behavior with users of clamp_float_to_int.

Definition at line 69 of file view2d.cc.

References clamp_float_to_int(), rctf::xmax, rcti::xmax, rctf::xmin, rcti::xmin, rctf::ymax, rcti::ymax, rctf::ymin, and rcti::ymin.

Referenced by UI_view2d_view_to_region_rcti(), and UI_view2d_view_to_region_rcti_clip().

◆ grid_axis_start_and_count()

static void grid_axis_start_and_count ( const float step,
const float min,
const float max,
float * r_start,
int * r_count )
static

Definition at line 1264 of file view2d.cc.

References fabs(), float, fmod(), and min.

Referenced by UI_view2d_dot_grid_draw().

◆ UI_view2d_area_supports_sync()

bool UI_view2d_area_supports_sync ( ScrArea * area)

Definition at line 856 of file view2d.cc.

References ELEM, SPACE_ACTION, SPACE_CLIP, SPACE_GRAPH, SPACE_NLA, and SPACE_SEQ.

Referenced by UI_view2d_sync().

◆ UI_view2d_center_get()

void UI_view2d_center_get ( const View2D * v2d,
float * r_x,
float * r_y )

Simple functions for consistent center offset access. Used by node editor to shift view center for each individual node tree.

Definition at line 1934 of file view2d.cc.

References BLI_rctf_cent_x(), BLI_rctf_cent_y(), and View2D::cur.

Referenced by actkeys_viewall(), nlaedit_viewall(), and blender::ed::space_node::node_draw_space().

◆ UI_view2d_center_set()

◆ UI_view2d_curRect_changed()

void UI_view2d_curRect_changed ( const bContext * C,
View2D * v2d )

Perform all required updates after v2d->cur as been modified. This includes like validation view validation (UI_view2d_curRect_validate).

Current intent is to use it from user code, such as view navigation and zoom operations.

Definition at line 829 of file view2d.cc.

References CTX_wm_region(), and UI_view2d_curRect_validate().

Referenced by edge_pan_apply_delta(), reset_exec(), scroller_activate_apply(), sequencer_view_all_preview_exec(), sequencer_view_zoom_ratio_exec(), UI_but_ensure_in_view(), UI_view2d_edge_pan_cancel(), UI_view2d_smooth_view(), view2d_smoothview_invoke(), view_pan_apply_ex(), view_zoomdrag_apply(), and view_zoomstep_apply_ex().

◆ UI_view2d_curRect_clamp_y()

void UI_view2d_curRect_clamp_y ( View2D * v2d)

Clamp view2d area to what's visible, preventing scrolling vertically to infinity.

Definition at line 840 of file view2d.cc.

References BLI_rctf_size_y(), View2D::cur, View2D::tot, rctf::ymax, and rctf::ymin.

Referenced by nla_track_region_draw(), set_v2d_height(), and set_v2d_height().

◆ UI_view2d_curRect_reset()

void UI_view2d_curRect_reset ( View2D * v2d)

Restore 'cur' rect to standard orientation (i.e. optimal maximum view of tot). This does not take into account if zooming the view on an axis will improve the view (if allowed).

Definition at line 924 of file view2d.cc.

References View2D::align, BLI_rcti_size_x(), BLI_rcti_size_y(), View2D::cur, float, View2D::mask, V2D_ALIGN_NO_NEG_X, V2D_ALIGN_NO_NEG_Y, V2D_ALIGN_NO_POS_X, V2D_ALIGN_NO_POS_Y, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.

◆ UI_view2d_curRect_validate()

◆ ui_view2d_curRect_validate_resize()

◆ UI_view2d_dot_grid_draw()

void UI_view2d_dot_grid_draw ( const View2D * v2d,
int grid_color_id,
float min_step,
int grid_subdivisions )

Draw a multi-level grid of dots, with a dynamic number of levels based on the fading.

Parameters
grid_color_idThe theme color used for the points. Faded dynamically based on zoom.
min_stepThe base size of the grid. At different zoom levels, the visible grid may have a larger step size.
grid_subdivisionsThe maximum number of sub-levels drawn at once.

Definition at line 1283 of file view2d.cc.

References BLI_assert, BLI_rctf_size_x(), BLI_rcti_size_x(), ceilf, clamp_f(), View2D::cur, float, fractf(), GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_POINTS, GPU_program_point_size(), GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, GPU_vertformat_attr_add(), grid_axis_start_and_count(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform4fv(), immVertex2f(), immVertexFormat(), int, logf, View2D::mask, pos, pow2f(), powf, UI_GetThemeColor3fv(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.

Referenced by blender::ed::space_node::node_draw_space().

◆ UI_view2d_fromcontext()

◆ UI_view2d_fromcontext_rwin()

View2D * UI_view2d_fromcontext_rwin ( const bContext * C)

Same as UI_view2d_fromcontext, but it returns region-window. Utility for pull-downs or buttons.

Definition at line 1864 of file view2d.cc.

References BKE_area_find_region_type(), CTX_wm_area(), CTX_wm_region(), RGN_TYPE_WINDOW, and ARegion::v2d.

◆ UI_view2d_listview_view_to_cell()

void UI_view2d_listview_view_to_cell ( float columnwidth,
float rowheight,
float startx,
float starty,
float viewx,
float viewy,
int * r_column,
int * r_row )

Get the 'cell' (row, column) that the given 2D-view coordinates (i.e. in 'tot' rect space) lie in.

Parameters
columnwidth,rowheightsize of each 'cell'
startx,startycoordinates (in 'tot' rect space) that the list starts from. This should be (0,0) for most views. However, for those where the starting row was offsetted (like for Animation Editor channel lists, to make the first entry more visible), these will be the min-coordinates of the first item.
viewx,viewy2D-coordinates (in 2D-view / 'tot' rect space) to get the cell for
r_column,r_rowThe 'coordinates' of the relevant 'cell'.

Definition at line 1616 of file view2d.cc.

References floorf.

Referenced by actkeys_find_list_element_at_position(), animchannels_channel_get(), animchannels_mouseclick_invoke(), nlaedit_strip_at_region_position(), and nlatracks_mouseclick_invoke().

◆ UI_view2d_mask_from_win()

void UI_view2d_mask_from_win ( const View2D * v2d,
rcti * r_mask )

Definition at line 109 of file view2d.cc.

References View2D::winx, View2D::winy, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.

Referenced by ED_region_panels_draw(), and view2d_masks().

◆ UI_view2d_mouse_in_scrollers()

char UI_view2d_mouse_in_scrollers ( const ARegion * region,
const View2D * v2d,
const int xy[2] )

Definition at line 2042 of file view2d.cc.

References UI_view2d_mouse_in_scrollers_ex(), and xy.

◆ UI_view2d_mouse_in_scrollers_ex()

char UI_view2d_mouse_in_scrollers_ex ( const ARegion * region,
const View2D * v2d,
const int xy[2],
int * r_scroll )

◆ UI_view2d_multi_grid_draw()

◆ UI_view2d_offset()

void UI_view2d_offset ( View2D * v2d,
float xfac,
float yfac )

Simple pan function (0.0, 0.0) bottom left (0.5, 0.5) center (1.0, 1.0) top right.

Definition at line 1952 of file view2d.cc.

References BLI_rctf_size_x(), BLI_rctf_size_y(), View2D::cur, View2D::tot, UI_view2d_curRect_validate(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.

Referenced by ui_handle_panel_header(), and ui_handler_panel_region().

◆ UI_view2d_offset_y_snap_to_closest_page()

void UI_view2d_offset_y_snap_to_closest_page ( View2D * v2d)

Scrolls the view so that the upper edge is at a multiple of the page size.

Definition at line 1975 of file view2d.cc.

References BLI_rctf_size_y(), View2D::cur, UI_view2d_curRect_validate(), view2d_page_size_y(), rctf::ymax, and rctf::ymin.

Referenced by blender::ed::asset::shelf::region_init().

◆ UI_view2d_rect_in_scrollers()

char UI_view2d_rect_in_scrollers ( const ARegion * region,
const View2D * v2d,
const rcti * rect )

Definition at line 2048 of file view2d.cc.

References UI_view2d_rect_in_scrollers_ex().

◆ UI_view2d_rect_in_scrollers_ex()

char UI_view2d_rect_in_scrollers_ex ( const ARegion * region,
const View2D * v2d,
const rcti * rect,
int * r_scroll )

◆ UI_view2d_region_reinit()

void UI_view2d_region_reinit ( View2D * v2d,
short type,
int winx,
int winy )

Refresh and validation (of view rects).

Initialize all relevant View2D data (including view rects if first time) and/or refresh mask sizes after view resize.

  • For some of these presets, it is expected that the region will have defined some additional settings necessary for the customization of the 2D viewport to its requirements
  • This function should only be called from region init() callbacks, where it is expected that this is called before #UI_view2d_size_update(), as this one checks that the rects are properly initialized.

Definition at line 212 of file view2d.cc.

References View2D::align, View2D::alpha_hor, View2D::alpha_vert, View2D::cur, View2D::flag, float, View2D::keepofs, View2D::keeptot, View2D::keepzoom, View2D::max, View2D::maxzoom, View2D::min, View2D::minzoom, uiStyle::panelzoom, View2D::scroll, View2D::tot, UI_style_get(), ui_view2d_curRect_validate_resize(), V2D_ALIGN_NO_NEG_X, V2D_ALIGN_NO_NEG_Y, V2D_ALIGN_NO_POS_Y, V2D_COMMONVIEW_HEADER, V2D_COMMONVIEW_LIST, V2D_COMMONVIEW_PANELS_UI, V2D_COMMONVIEW_STACK, V2D_COMMONVIEW_STANDARD, V2D_IS_INIT, V2D_KEEPASPECT, V2D_KEEPTOT_BOUNDS, V2D_KEEPTOT_STRICT, V2D_KEEPZOOM, V2D_LIMITZOOM, V2D_LOCKOFS_Y, V2D_LOCKZOOM_X, V2D_LOCKZOOM_Y, V2D_SCROLL_HORIZONTAL_HIDE, V2D_SCROLL_VERTICAL_HIDE, view2d_masks(), view2d_totRect_set_resize(), View2D::winx, View2D::winy, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.

Referenced by action_channel_region_init(), action_main_region_init(), clip_channels_region_init(), clip_preview_region_init(), console_main_region_init(), ED_region_header_init(), ED_region_panels_init(), file_main_region_draw(), file_main_region_init(), graph_channel_region_init(), graph_main_region_init(), hud_region_layout(), info_main_region_init(), nla_main_region_init(), nla_track_region_init(), blender::ed::space_node::node_main_region_init(), blender::ed::outliner::outliner_main_region_init(), blender::ed::asset::shelf::region_init(), script_main_region_init(), sequencer_channel_region_init(), sequencer_main_region_init(), sequencer_preview_region_init(), blender::ed::spreadsheet::spreadsheet_main_region_init(), text_main_region_init(), and topbar_main_region_init().

◆ UI_view2d_region_to_view()

void UI_view2d_region_to_view ( const View2D * v2d,
float x,
float y,
float * r_view_x,
float * r_view_y )

Convert from screen/region space to 2d-View space

Parameters
x,ycoordinates to convert
r_view_x,r_view_yresultant coordinates

Definition at line 1663 of file view2d.cc.

References UI_view2d_region_to_view_x(), and UI_view2d_region_to_view_y().

Referenced by actkeys_find_list_element_at_position(), blender::ed::space_node::add_reroute_exec(), animchannels_channel_get(), animchannels_mouseclick_invoke(), annotation_stroke_convertcoords(), applyTimeSlide(), applyTimeTranslate(), box_select_action(), box_select_anim_channels(), box_select_nla_strips(), blender::ed::space_node::cut_links_exec(), dopesheet_select_channel_invoke(), ED_mask_mouse_pos(), ED_outliner_give_base_under_cursor(), ED_outliner_give_rna_under_cursor(), ED_space_image_color_sample(), ED_space_image_get_position(), file_attribute_column_type_find_isect(), file_box_select_find_last_selected(), file_highlight_set(), find_nearest_seq(), frame_from_event(), frame_from_event(), grab_clone_modal(), graphkeys_click_insert_invoke(), graphview_cursor_setprops(), image_sample_apply(), image_sample_line_exec(), image_view_zoom_in_invoke(), image_view_zoom_init(), image_view_zoom_invoke(), image_view_zoom_out_invoke(), blender::ed::space_node::is_event_over_node_or_socket(), mouse_frame_side(), MouseCoords::MouseCoords(), blender::ed::space_node::mute_links_exec(), nlaedit_strip_at_region_position(), nlatracks_mouseclick_invoke(), blender::ed::space_node::node_add_collection_invoke(), blender::ed::space_node::node_add_file_invoke(), blender::ed::space_node::node_add_group_asset_invoke(), blender::ed::space_node::node_add_group_invoke(), blender::ed::space_node::node_add_material_invoke(), blender::ed::space_node::node_add_object_invoke(), blender::ed::space_node::node_circleselect_exec(), blender::ed::space_node::node_clipboard_paste_invoke(), blender::ed::space_node::node_cursor(), blender::ed::space_node::node_draw_space(), blender::ed::space_node::node_find_frame_to_attach(), blender::ed::space_node::node_link_invoke(), blender::ed::space_node::node_link_modal(), blender::ed::space_node::node_mouse_select(), blender::ed::space_node::node_resize_invoke(), blender::ed::space_node::node_resize_modal(), blender::ed::outliner::outliner_box_select_invoke(), blender::ed::outliner::outliner_drop_find(), blender::ed::outliner::outliner_drop_insert_find(), blender::ed::outliner::outliner_highlight_update_invoke(), blender::ed::outliner::outliner_id_delete_invoke(), blender::ed::outliner::outliner_id_remap_invoke(), blender::ed::outliner::outliner_item_do_activate_from_cursor(), blender::ed::outliner::outliner_item_drag_drop_invoke(), blender::ed::outliner::outliner_item_openclose_invoke(), blender::ed::outliner::outliner_item_openclose_modal(), blender::ed::outliner::outliner_item_rename_find_hovered(), blender::ed::outliner::outliner_lib_reload_invoke(), blender::ed::outliner::outliner_lib_relocate_invoke(), blender::ed::outliner::outliner_operation_invoke(), paint_2d_stroke(), paint_2d_transform_mouse(), paintcurve_cursor_invoke(), select_invoke(), seq_select_seq_from_preview(), sequencer_box_select_invoke(), sequencer_file_drop_channel_frame_set(), sequencer_main_cursor(), sequencer_sample_apply(), sequencer_set_2d_cursor_invoke(), sequencer_skip_for_handle_tweak(), sequencer_slip_invoke(), sequencer_slip_modal(), sequencer_split_invoke(), snapNode(), stitch_select(), transform_convert_frame_side_dir_get(), update_overlay_strip_position_data(), uv_circle_select_exec(), uv_rip_invoke(), uv_sculpt_stroke_apply(), uv_sculpt_stroke_init(), uv_select_edge_ring_invoke(), uv_select_invoke(), uv_select_linked_internal(), uv_select_loop_invoke(), uv_set_2d_cursor_invoke(), uv_shortest_path_pick_invoke(), view_zoomdrag_invoke(), view_zoomin_invoke(), and view_zoomout_invoke().

◆ UI_view2d_region_to_view_rctf()

◆ UI_view2d_region_to_view_x()

◆ UI_view2d_region_to_view_y()

◆ UI_view2d_scale_get()

void UI_view2d_scale_get ( const View2D * v2d,
float * r_x,
float * r_y )

Calculate the scale per-axis of the drawing-area

Is used to inverse correct drawing of icons, etc. that need to follow view but not be affected by scale

Parameters
r_x,r_yscale on each axis

Definition at line 1907 of file view2d.cc.

References UI_view2d_scale_get_x(), and UI_view2d_scale_get_y().

Referenced by createTransGraphEditData(), draw_fcurve_samples(), draw_tracks_motion_and_error_curves(), ED_markers_draw(), ED_mask_pixelspace_factor(), ED_uvedit_nearest_uv_multi(), blender::ed::space_node::node_draw_hidden(), blender::ed::space_node::node_draw_sockets(), and blender::ed::space_node::node_draw_zones_and_frames().

◆ UI_view2d_scale_get_inverse()

void UI_view2d_scale_get_inverse ( const View2D * v2d,
float * r_x,
float * r_y )

◆ UI_view2d_scale_get_x()

◆ UI_view2d_scale_get_y()

◆ UI_view2d_scroller_size_get()

void UI_view2d_scroller_size_get ( const View2D * v2d,
bool mapped,
float * r_x,
float * r_y )

Get scroll-bar sizes of the current 2D view. The size will be zero if the view has its scroll-bars disabled.

Parameters
mappedwhether to use view2d_scroll_mapped which changes flags

Definition at line 1882 of file view2d.cc.

References View2D::alpha_hor, View2D::alpha_vert, View2D::scroll, V2D_SCROLL_HANDLE_HEIGHT, V2D_SCROLL_HANDLE_WIDTH, V2D_SCROLL_HEIGHT, V2D_SCROLL_HORIZONTAL, V2D_SCROLL_HORIZONTAL_HANDLES, V2D_SCROLL_MIN_WIDTH, V2D_SCROLL_VERTICAL, V2D_SCROLL_VERTICAL_HANDLES, V2D_SCROLL_WIDTH, and view2d_scroll_mapped().

Referenced by ED_area_type_hud_ensure(), and view2d_masks().

◆ UI_view2d_scrollers_draw()

◆ UI_view2d_scrollers_draw_ex()

◆ UI_view2d_sync()

◆ UI_view2d_text_cache_add()

void UI_view2d_text_cache_add ( View2D * v2d,
float x,
float y,
const char * str,
size_t str_len,
const unsigned char col[4] )

◆ UI_view2d_text_cache_add_rectf()

void UI_view2d_text_cache_add_rectf ( View2D * v2d,
const rctf * rect_view,
const char * str,
size_t str_len,
const unsigned char col[4] )

◆ UI_view2d_text_cache_draw()

◆ UI_view2d_totRect_set()

◆ UI_view2d_view_ortho()

◆ UI_view2d_view_orthoSpecial()

void UI_view2d_view_orthoSpecial ( ARegion * region,
View2D * v2d,
bool xaxis )

Set view matrices to only use one axis of 'cur' only

Parameters
xaxisif non-zero, only use cur x-axis, otherwise use cur-yaxis (mostly this will be used for x).

Definition at line 1132 of file view2d.cc.

References view2d_map_cur_using_mask(), wmOrtho2(), rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.

Referenced by action_main_region_draw(), action_main_region_draw_overlay(), draw_timeline_markers(), graph_main_region_draw(), and nla_main_region_draw().

◆ UI_view2d_view_restore()

◆ UI_view2d_view_to_region()

void UI_view2d_view_to_region ( const View2D * v2d,
float x,
float y,
int * r_region_x,
int * r_region_y )

◆ UI_view2d_view_to_region_clip()

bool UI_view2d_view_to_region_clip ( const View2D * v2d,
float x,
float y,
int * r_region_x,
int * r_region_y )

Convert from 2d-View space to screen/region space

Note
Coordinates are clamped to lie within bounds of region
Parameters
x,yCoordinates to convert.
r_region_x,r_region_yResultant coordinates.

Definition at line 1697 of file view2d.cc.

References BLI_rctf_size_x(), BLI_rctf_size_y(), BLI_rcti_size_x(), BLI_rcti_size_y(), View2D::cur, int, View2D::mask, V2D_IS_CLIPPED, rctf::xmin, rcti::xmin, rctf::ymin, and rcti::ymin.

Referenced by do_lasso_select_mesh_uv_is_point_inside(), blender::ed::space_node::do_lasso_select_node(), gpencil_point_to_xy(), mouse_select_knot(), nearest_fcurve_vert_store(), and UI_view2d_text_cache_add().

◆ UI_view2d_view_to_region_fl()

◆ UI_view2d_view_to_region_m4()

void UI_view2d_view_to_region_m4 ( const View2D * v2d,
float matrix[4][4] )

◆ UI_view2d_view_to_region_rcti()

void UI_view2d_view_to_region_rcti ( const View2D * v2d,
const rctf * rect_src,
rcti * rect_dst )

◆ UI_view2d_view_to_region_rcti_clip()

bool UI_view2d_view_to_region_rcti_clip ( const View2D * v2d,
const rctf * rect_src,
rcti * rect_dst )

◆ UI_view2d_view_to_region_segment_clip()

bool UI_view2d_view_to_region_segment_clip ( const View2D * v2d,
const float xy_a[2],
const float xy_b[2],
int r_region_a[2],
int r_region_b[2] )

◆ UI_view2d_view_to_region_x()

◆ UI_view2d_view_to_region_y()

◆ UI_view2d_zoom_cache_reset()

void UI_view2d_zoom_cache_reset ( )

◆ view2d_map_cur_using_mask()

◆ view2d_masks()

◆ view2d_page_size_y()

float view2d_page_size_y ( const View2D & v2d)

For paginated scrolling, get the page height to scroll. This may be a custom height (View2D.page_size_y) but defaults to the View2D.mask height.

Definition at line 77 of file view2d.cc.

References BLI_rcti_size_y(), View2D::mask, and View2D::page_size_y.

Referenced by UI_view2d_offset_y_snap_to_closest_page(), view2d_scroll_delta_y_snap_page_size(), view_scrolldown_exec(), and view_scrollup_exec().

◆ view2d_scroll_mapped()

static int view2d_scroll_mapped ( int scroll)
static

Helper to allow scroll-bars to dynamically hide:

  • Returns a copy of the scroll-bar settings with the flags to display horizontal/vertical scroll-bars removed.
  • Input scroll value is the v2d->scroll var.
  • Hide flags are set per region at draw-time.

Definition at line 98 of file view2d.cc.

References V2D_SCROLL_HORIZONTAL_FULLR, and V2D_SCROLL_VERTICAL_FULLR.

Referenced by UI_view2d_mouse_in_scrollers_ex(), UI_view2d_rect_in_scrollers_ex(), UI_view2d_scroller_size_get(), UI_view2d_scrollers_draw_ex(), view2d_map_cur_using_mask(), and view2d_scrollers_calc().

◆ view2d_scrollers_calc()

◆ view2d_totRect_set_resize()

void view2d_totRect_set_resize ( View2D * v2d,
int width,
int height,
bool resize )

Variable Documentation

◆ g_v2d_strings

View2DString* g_v2d_strings = nullptr
static

◆ g_v2d_strings_arena

MemArena* g_v2d_strings_arena = nullptr
static