Blender V5.3
view2d_ops.cc File Reference
#include <cmath>
#include "MEM_guardedalloc.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_math_base_c.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_time.hh"
#include "BLI_utildefines.hh"
#include "BKE_context.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "WM_api.hh"
#include "WM_types.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  blender::ui::v2dViewPanData
struct  blender::ui::v2dViewZoomData
struct  blender::ui::SmoothView2DStore
struct  blender::ui::v2dScrollerMove

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::ui

Functions

Internal Utilities
static bool blender::ui::view2d_poll (bContext *C)
static float blender::ui::view2d_scroll_delta_y_snap_page_size (const View2D &v2d, const float delta_y)
View Pan Shared Utilities
static bool blender::ui::view_pan_poll (bContext *C)
static void blender::ui::view_pan_init (bContext *C, wmOperator *op)
static void blender::ui::view_pan_apply_ex (bContext *C, v2dViewPanData *vpd, float dx, float dy)
static void blender::ui::view_pan_apply (bContext *C, wmOperator *op)
static void blender::ui::view_pan_exit (wmOperator *op)
View Pan Operator (modal drag-pan)
static wmOperatorStatus blender::ui::view_pan_exec (bContext *C, wmOperator *op)
static wmOperatorStatus blender::ui::view_pan_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus blender::ui::view_pan_modal (bContext *C, wmOperator *op, const wmEvent *event)
static void blender::ui::view_pan_cancel (bContext *, wmOperator *op)
static void blender::ui::VIEW2D_OT_pan (wmOperatorType *ot)
View Edge Pan Operator (modal)

Scroll the region if the mouse is dragged to an edge. "Invisible" operator that always passes through.

static wmOperatorStatus blender::ui::view_edge_pan_invoke (bContext *C, wmOperator *op, const wmEvent *)
static wmOperatorStatus blender::ui::view_edge_pan_modal (bContext *C, wmOperator *op, const wmEvent *event)
static void blender::ui::view_edge_pan_cancel (bContext *, wmOperator *op)
static void blender::ui::VIEW2D_OT_edge_pan (wmOperatorType *ot)
View Pan Operator (single step)
static wmOperatorStatus blender::ui::view_scrollright_exec (bContext *C, wmOperator *op)
static void blender::ui::VIEW2D_OT_scroll_right (wmOperatorType *ot)
static wmOperatorStatus blender::ui::view_scrollleft_exec (bContext *C, wmOperator *op)
static void blender::ui::VIEW2D_OT_scroll_left (wmOperatorType *ot)
static wmOperatorStatus blender::ui::view_scrolldown_exec (bContext *C, wmOperator *op)
static void blender::ui::VIEW2D_OT_scroll_down (wmOperatorType *ot)
static wmOperatorStatus blender::ui::view_scrollup_exec (bContext *C, wmOperator *op)
static void blender::ui::VIEW2D_OT_scroll_up (wmOperatorType *ot)
View Zoom Shared Utilities
static void blender::ui::view_zoom_axis_lock_defaults (bContext *C, bool r_do_zoom_xy[2])
static bool blender::ui::view_zoom_poll (bContext *C)
static void blender::ui::view_zoomdrag_init (bContext *C, wmOperator *op)
static void blender::ui::view_zoomstep_apply_ex (bContext *C, v2dViewZoomData *vzd, const float facx, const float facy)
static void blender::ui::view_zoomstep_apply (bContext *C, wmOperator *op)
View Zoom Operator (modal drag-zoom)
static void blender::ui::view_zoomdrag_apply (bContext *C, wmOperator *op)
static void blender::ui::view_zoomdrag_exit (bContext *C, wmOperator *op)
static void blender::ui::view_zoomdrag_cancel (bContext *C, wmOperator *op)
static wmOperatorStatus blender::ui::view_zoomdrag_exec (bContext *C, wmOperator *op)
static wmOperatorStatus blender::ui::view_zoomdrag_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus blender::ui::view_zoomdrag_modal (bContext *C, wmOperator *op, const wmEvent *event)
static void blender::ui::VIEW2D_OT_zoom (wmOperatorType *ot)
Border Zoom Operator

The user defines a rect using standard box select tools, and we use this rect to define the new zoom-level of the view in the following ways:

  1. LEFTMOUSE - zoom in to view
  2. RIGHTMOUSE - zoom out of view

Currently, these key mappings are hardcoded, but it shouldn't be too important to have custom key-mappings for this.

static wmOperatorStatus blender::ui::view_borderzoom_exec (bContext *C, wmOperator *op)
static void blender::ui::VIEW2D_OT_zoom_border (wmOperatorType *ot)
Smooth View Operator
static float blender::ui::smooth_view_rect_to_fac (const rctf *rect_a, const rctf *rect_b)
static wmOperatorStatus blender::ui::view2d_smoothview_invoke (bContext *C, wmOperator *, const wmEvent *event)
static void blender::ui::VIEW2D_OT_smoothview (wmOperatorType *ot)
Operators
void blender::ui::view2d_smooth_view (const bContext *C, ARegion *region, const rctf *cur, int smooth_viewtx)
void blender::ui::ED_operatortypes_view2d ()
void blender::ui::ED_keymap_view2d (wmKeyConfig *keyconf)
View Reset Operator
static wmOperatorStatus blender::ui::reset_exec (bContext *C, wmOperator *)
static void blender::ui::VIEW2D_OT_reset (wmOperatorType *ot)

Scroll Bar Move Operator

enum  {
  blender::ui::SCROLLHANDLE_MIN = -1 , blender::ui::SCROLLHANDLE_BAR , blender::ui::SCROLLHANDLE_MAX , blender::ui::SCROLLHANDLE_MIN_OUTSIDE ,
  blender::ui::SCROLLHANDLE_MAX_OUTSIDE
}
static short blender::ui::scrollbar_zone_get (int mouse, int sh_min, int sh_max)
static bool blender::ui::scroller_activate_poll (bContext *C)
static void blender::ui::scroller_activate_init (bContext *C, wmOperator *op, const wmEvent *event, const char in_scroller)
static void blender::ui::scroller_activate_exit (bContext *C, wmOperator *op)
static void blender::ui::scroller_activate_cancel (bContext *C, wmOperator *op)
static void blender::ui::scroller_activate_apply (bContext *C, wmOperator *op)
static wmOperatorStatus blender::ui::scroller_activate_modal (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus blender::ui::scroller_activate_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static void blender::ui::VIEW2D_OT_scroller_activate (wmOperatorType *ot)

View Zoom Operator (single step)

static constexpr float blender::ui::view_zoomfac_default = 0.0375f
static void blender::ui::view_zoomstep_props_init (bContext *C, wmOperator *op, const float zoomfac_default)
static void blender::ui::view_zoomstep_props_def (StructRNA *srna, const float zoomfac_default)
static void blender::ui::view_zoomstep_exit (bContext *C, wmOperator *op)
static wmOperatorStatus blender::ui::view_zoomin_exec (bContext *C, wmOperator *op)
static wmOperatorStatus blender::ui::view_zoomin_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static void blender::ui::VIEW2D_OT_zoom_in (wmOperatorType *ot)
static wmOperatorStatus blender::ui::view_zoomout_exec (bContext *C, wmOperator *op)
static wmOperatorStatus blender::ui::view_zoomout_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static void blender::ui::VIEW2D_OT_zoom_out (wmOperatorType *ot)