Blender V5.3
wm_gesture_ops.cc File Reference
#include "MEM_guardedalloc.h"
#include <fmt/format.h>
#include <algorithm>
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_math_rotation_c.hh"
#include "BLI_math_vector.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_rect.hh"
#include "BKE_context.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "wm.hh"
#include "wm_event_types.hh"
#include "ED_screen.hh"
#include "ED_select_utils.hh"
#include "UI_view2d.hh"
#include "RNA_access.hh"

Go to the source code of this file.

Classes

struct  blender::SnapAngle

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define GESTURE_EDGE_PAN_INSIDE_PAD   2
#define GESTURE_EDGE_PAN_OUTSIDE_PAD   0
#define GESTURE_EDGE_PAN_SPEED_RAMP   1.0f
#define GESTURE_EDGE_PAN_MAX_SPEED   26.0f
#define GESTURE_EDGE_PAN_DELAY   0.5f
#define GESTURE_EDGE_PAN_ZOOM_INFLUENCE   0.0f

Functions

Internal Gesture Utilities

Border gesture has two types:

  1. WM_GESTURE_CROSS_RECT: starts a cross, on mouse click it changes to border.
  2. WM_GESTURE_RECT: starts immediate as a border, on mouse click or release it ends.

It stores 4 values (xmin, xmax, ymin, ymax) and event it ended with (event_type).

static void blender::gesture_modal_end (bContext *C, wmOperator *op)
static void blender::gesture_modal_state_to_operator (wmOperator *op, int modal_state)
static void blender::gesture_init_mval_set (wmGesture *gesture, const int2 mval)
static int UNUSED_FUNCTION blender::gesture_modal_state_from_operator (wmOperator *op)
Border Gesture

Border gesture has two types:

  1. WM_GESTURE_CROSS_RECT: starts a cross, on mouse click it changes to border.
  2. WM_GESTURE_RECT: starts immediate as a border, on mouse click or release it ends.

It stores 4 values (xmin, xmax, ymin, ymax) and event it ended with (event_type).

static bool blender::gesture_box_apply_rect (wmOperator *op)
static bool blender::gesture_box_apply (bContext *C, wmOperator *op)
wmOperatorStatus blender::WM_gesture_box_invoke (bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus blender::WM_gesture_box_modal (bContext *C, wmOperator *op, const wmEvent *event)
void blender::WM_gesture_box_cancel (bContext *C, wmOperator *op)
Circle Gesture

Currently only used for selection or modal paint stuff, calls #wmOperatorType.exec while hold mouse, exits on release (with no difference between cancel and confirm).

static void blender::gesture_circle_apply (bContext *C, wmOperator *op)
wmOperatorStatus blender::WM_gesture_circle_invoke (bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus blender::WM_gesture_circle_modal (bContext *C, wmOperator *op, const wmEvent *event)
void blender::WM_gesture_circle_cancel (bContext *C, wmOperator *op)
Lasso Gesture

There are two types of lasso gesture:

  1. WM_GESTURE_LASSO: A lasso that follows the mouse cursor with the enclosed area shaded.
  2. WM_GESTURE_LINES: A lasso that follows the mouse cursor without the enclosed area shaded.

The operator stores data in the "path" property as a series of screen space positions.

wmOperatorStatus blender::WM_gesture_lasso_invoke (bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus blender::WM_gesture_lines_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus blender::gesture_lasso_apply (bContext *C, wmOperator *op)
wmOperatorStatus blender::WM_gesture_lasso_modal (bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus blender::WM_gesture_lines_modal (bContext *C, wmOperator *op, const wmEvent *event)
void blender::WM_gesture_lasso_cancel (bContext *C, wmOperator *op)
void blender::WM_gesture_lines_cancel (bContext *C, wmOperator *op)
Array< int2 > blender::WM_gesture_lasso_path_to_array (bContext *, wmOperator *op)
Polyline Gesture

Gesture defined by three or more points in a viewport enclosing a particular area.

Like the Lasso Gesture, the data passed onto other operators via the 'path' property is a sequential array of mouse positions.

wmOperatorStatus blender::WM_gesture_polyline_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static int blender::gesture_polyline_valid_points (const wmGesture &wmGesture, const bool is_click_submitted)
static bool blender::gesture_polyline_can_apply (const wmGesture &wmGesture, const bool is_click_submitted)
static wmOperatorStatus blender::gesture_polyline_apply (bContext *C, wmOperator *op, const bool is_click_submitted)
wmOperatorStatus blender::WM_gesture_polyline_modal (bContext *C, wmOperator *op, const wmEvent *event)
void blender::WM_gesture_polyline_cancel (bContext *C, wmOperator *op)
Straight Line Gesture

Gesture defined by the start and end points of a line that is created between the position of the initial event and the position of the current event.

Straight Line Gesture has two modal callbacks depending on the tool that is being implemented: a regular modal callback intended to update the data during the execution of the gesture and a one-shot callback that only updates the data once when the gesture finishes.

It stores 4 values: xstart, ystart, xend, yend.

static SnapAngle blender::get_snap_angle (const ScrArea &area, const ToolSettings &tool_settings)
static bool blender::gesture_straightline_apply (bContext *C, wmOperator *op)
wmOperatorStatus blender::WM_gesture_straightline_invoke (bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus blender::WM_gesture_straightline_active_side_invoke (bContext *C, wmOperator *op, const wmEvent *event)
static void blender::wm_gesture_straightline_do_angle_snap (rcti *rect, float snap_angle)
wmOperatorStatus blender::WM_gesture_straightline_modal (bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus blender::WM_gesture_straightline_oneshot_modal (bContext *C, wmOperator *op, const wmEvent *event)
void blender::WM_gesture_straightline_cancel (bContext *C, wmOperator *op)

Detailed Description

Default operator callbacks for use with gestures (border/circle/lasso/straightline). Operators themselves are defined elsewhere.

Definition in file wm_gesture_ops.cc.

Macro Definition Documentation

◆ GESTURE_EDGE_PAN_DELAY

#define GESTURE_EDGE_PAN_DELAY   0.5f

Definition at line 48 of file wm_gesture_ops.cc.

Referenced by blender::WM_gesture_box_invoke().

◆ GESTURE_EDGE_PAN_INSIDE_PAD

#define GESTURE_EDGE_PAN_INSIDE_PAD   2

Definition at line 44 of file wm_gesture_ops.cc.

Referenced by blender::WM_gesture_box_invoke().

◆ GESTURE_EDGE_PAN_MAX_SPEED

#define GESTURE_EDGE_PAN_MAX_SPEED   26.0f

Definition at line 47 of file wm_gesture_ops.cc.

Referenced by blender::WM_gesture_box_invoke().

◆ GESTURE_EDGE_PAN_OUTSIDE_PAD

#define GESTURE_EDGE_PAN_OUTSIDE_PAD   0

Definition at line 45 of file wm_gesture_ops.cc.

Referenced by blender::WM_gesture_box_invoke().

◆ GESTURE_EDGE_PAN_SPEED_RAMP

#define GESTURE_EDGE_PAN_SPEED_RAMP   1.0f

Definition at line 46 of file wm_gesture_ops.cc.

Referenced by blender::WM_gesture_box_invoke().

◆ GESTURE_EDGE_PAN_ZOOM_INFLUENCE

#define GESTURE_EDGE_PAN_ZOOM_INFLUENCE   0.0f

Definition at line 49 of file wm_gesture_ops.cc.

Referenced by blender::WM_gesture_box_invoke().