Blender V4.3
mask_ops.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"
#include "BKE_context.hh"
#include "BKE_mask.h"
#include "BLT_translation.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_query.hh"
#include "DNA_mask_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "WM_api.hh"
#include "WM_types.hh"
#include "ED_clip.hh"
#include "ED_image.hh"
#include "ED_mask.hh"
#include "ED_select_utils.hh"
#include "ANIM_keyframing.hh"
#include "UI_interface_icons.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "mask_intern.hh"

Go to the source code of this file.

Classes

struct  SlidePointData
 
struct  SlideSplineCurvatureData
 

Enumerations

enum  {
  SLIDE_ACTION_NONE = 0 , SLIDE_ACTION_POINT = 1 , SLIDE_ACTION_HANDLE = 2 , SLIDE_ACTION_FEATHER = 3 ,
  SLIDE_ACTION_SPLINE = 4
}
 

Functions

MaskED_mask_new (bContext *C, const char *name)
 
MaskLayerED_mask_layer_ensure (bContext *C, bool *r_added_mask)
 
static int mask_new_exec (bContext *C, wmOperator *op)
 
void MASK_OT_new (wmOperatorType *ot)
 
static int mask_layer_new_exec (bContext *C, wmOperator *op)
 
void MASK_OT_layer_new (wmOperatorType *ot)
 
static int mask_layer_remove_exec (bContext *C, wmOperator *)
 
void MASK_OT_layer_remove (wmOperatorType *ot)
 
static void mask_point_undistort_pos (SpaceClip *sc, float r_co[2], const float co[2])
 
static bool spline_under_mouse_get (const bContext *C, Mask *mask_orig, const float co[2], MaskLayer **r_mask_layer, MaskSpline **r_mask_spline)
 
static bool slide_point_check_initial_feather (MaskSpline *spline)
 
static void select_sliding_point (Mask *mask, MaskLayer *mask_layer, MaskSpline *spline, MaskSplinePoint *point, eMaskWhichHandle which_handle)
 
static void check_sliding_handle_type (MaskSplinePoint *point, eMaskWhichHandle which_handle)
 
static SlidePointDataslide_point_customdata (bContext *C, wmOperator *op, const wmEvent *event)
 
static int slide_point_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static void slide_point_delta_all_feather (SlidePointData *data, float delta)
 
static void slide_point_restore_spline (SlidePointData *data)
 
static void cancel_slide_point (SlidePointData *data)
 
static void free_slide_point_data (SlidePointData *data)
 
static int slide_point_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
void MASK_OT_slide_point (wmOperatorType *ot)
 
static void cancel_slide_spline_curvature (SlideSplineCurvatureData *slide_data)
 
static void free_slide_spline_curvature_data (SlideSplineCurvatureData *slide_data)
 
static bool slide_spline_curvature_check (bContext *C, const wmEvent *event)
 
static SlideSplineCurvatureDataslide_spline_curvature_customdata (bContext *C, const wmEvent *event)
 
static int slide_spline_curvature_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static void slide_spline_solve_P1 (const float u, const float B[2], const float P0[2], const float P2[2], const float P3[2], float solution[2])
 
static void slide_spline_solve_P2 (const float u, const float B[2], const float P0[2], const float P1[2], const float P3[2], float solution[2])
 
static int slide_spline_curvature_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
void MASK_OT_slide_spline_curvature (wmOperatorType *ot)
 
static int cyclic_toggle_exec (bContext *C, wmOperator *)
 
void MASK_OT_cyclic_toggle (wmOperatorType *ot)
 
static void delete_feather_points (MaskSplinePoint *point)
 
static int delete_exec (bContext *C, wmOperator *)
 
static int delete_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
void MASK_OT_delete (wmOperatorType *ot)
 
static int mask_switch_direction_exec (bContext *C, wmOperator *)
 
void MASK_OT_switch_direction (wmOperatorType *ot)
 
static int mask_normals_make_consistent_exec (bContext *C, wmOperator *)
 
void MASK_OT_normals_make_consistent (wmOperatorType *ot)
 
static int set_handle_type_exec (bContext *C, wmOperator *op)
 
void MASK_OT_handle_type_set (wmOperatorType *ot)
 
static int mask_hide_view_clear_exec (bContext *C, wmOperator *op)
 
void MASK_OT_hide_view_clear (wmOperatorType *ot)
 
static int mask_hide_view_set_exec (bContext *C, wmOperator *op)
 
void MASK_OT_hide_view_set (wmOperatorType *ot)
 
static int mask_feather_weight_clear_exec (bContext *C, wmOperator *)
 
void MASK_OT_feather_weight_clear (wmOperatorType *ot)
 
static bool mask_layer_move_poll (bContext *C)
 
static int mask_layer_move_exec (bContext *C, wmOperator *op)
 
void MASK_OT_layer_move (wmOperatorType *ot)
 
static int mask_duplicate_exec (bContext *C, wmOperator *)
 
void MASK_OT_duplicate (wmOperatorType *ot)
 
static int copy_splines_exec (bContext *C, wmOperator *)
 
void MASK_OT_copy_splines (wmOperatorType *ot)
 
static bool paste_splines_poll (bContext *C)
 
static int paste_splines_exec (bContext *C, wmOperator *)
 
void MASK_OT_paste_splines (wmOperatorType *ot)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SLIDE_ACTION_NONE 
SLIDE_ACTION_POINT 
SLIDE_ACTION_HANDLE 
SLIDE_ACTION_FEATHER 
SLIDE_ACTION_SPLINE 

Definition at line 197 of file mask_ops.cc.

Function Documentation

◆ cancel_slide_point()

static void cancel_slide_point ( SlidePointData * data)
static

◆ cancel_slide_spline_curvature()

◆ check_sliding_handle_type()

static void check_sliding_handle_type ( MaskSplinePoint * point,
eMaskWhichHandle which_handle )
static

◆ copy_splines_exec()

static int copy_splines_exec ( bContext * C,
wmOperator *  )
static

◆ cyclic_toggle_exec()

◆ delete_exec()

◆ delete_feather_points()

static void delete_feather_points ( MaskSplinePoint * point)
static

Definition at line 1366 of file mask_ops.cc.

References count, MEM_freeN(), and SELECT.

Referenced by delete_exec().

◆ delete_invoke()

static int delete_invoke ( bContext * C,
wmOperator * op,
const wmEvent *  )
static

◆ ED_mask_layer_ensure()

MaskLayer * ED_mask_layer_ensure ( bContext * C,
bool * r_added_mask )

Get active layer. Will create mask/layer to be sure there's an active layer.

Definition at line 76 of file mask_ops.cc.

References BKE_mask_layer_active(), BKE_mask_layer_new(), CTX_data_edit_mask(), and ED_mask_new().

Referenced by create_primitive_from_points().

◆ ED_mask_new()

◆ free_slide_point_data()

static void free_slide_point_data ( SlidePointData * data)
static

Definition at line 637 of file mask_ops.cc.

References BKE_mask_spline_free(), and MEM_freeN().

Referenced by slide_point_modal().

◆ free_slide_spline_curvature_data()

static void free_slide_spline_curvature_data ( SlideSplineCurvatureData * slide_data)
static

Definition at line 969 of file mask_ops.cc.

References MEM_freeN().

Referenced by slide_spline_curvature_modal().

◆ mask_duplicate_exec()

◆ mask_feather_weight_clear_exec()

◆ mask_hide_view_clear_exec()

◆ mask_hide_view_set_exec()

◆ mask_layer_move_exec()

◆ mask_layer_move_poll()

static bool mask_layer_move_poll ( bContext * C)
static

Definition at line 1900 of file mask_ops.cc.

References CTX_data_edit_mask(), and ED_maskedit_mask_poll().

Referenced by MASK_OT_layer_move().

◆ mask_layer_new_exec()

◆ mask_layer_remove_exec()

◆ mask_new_exec()

static int mask_new_exec ( bContext * C,
wmOperator * op )
static

◆ mask_normals_make_consistent_exec()

◆ MASK_OT_copy_splines()

◆ MASK_OT_cyclic_toggle()

◆ MASK_OT_delete()

◆ MASK_OT_duplicate()

◆ MASK_OT_feather_weight_clear()

◆ MASK_OT_handle_type_set()

◆ MASK_OT_hide_view_clear()

◆ MASK_OT_hide_view_set()

◆ MASK_OT_layer_move()

◆ MASK_OT_layer_new()

◆ MASK_OT_layer_remove()

◆ MASK_OT_new()

◆ MASK_OT_normals_make_consistent()

◆ MASK_OT_paste_splines()

◆ MASK_OT_slide_point()

◆ MASK_OT_slide_spline_curvature()

◆ MASK_OT_switch_direction()

◆ mask_point_undistort_pos()

static void mask_point_undistort_pos ( SpaceClip * sc,
float r_co[2],
const float co[2] )
static

◆ mask_switch_direction_exec()

◆ paste_splines_exec()

◆ paste_splines_poll()

static bool paste_splines_poll ( bContext * C)
static

◆ select_sliding_point()

◆ set_handle_type_exec()

◆ slide_point_check_initial_feather()

static bool slide_point_check_initial_feather ( MaskSpline * spline)
static

Definition at line 355 of file mask_ops.cc.

Referenced by slide_point_customdata().

◆ slide_point_customdata()

static SlidePointData * slide_point_customdata ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

Definition at line 423 of file mask_ops.cc.

References SlidePointData::action, BKE_mask_point_handle(), BKE_mask_point_normal(), BKE_mask_point_segment_co(), BKE_mask_point_weight_scalar(), check_sliding_handle_type(), copy_m3_m3(), copy_v2_v2(), CTX_data_edit_mask(), CTX_wm_area(), CTX_wm_region(), DEG_id_tag_update(), ED_mask_feather_find_nearest(), ED_mask_get_size(), ED_mask_mouse_pos(), ED_mask_point_find_nearest(), ED_mask_view_lock_state_restore_no_jump(), ED_mask_view_lock_state_store(), SlidePointData::event_invoke_type, SlidePointData::height, SlidePointData::is_initial_feather, SlidePointData::is_sliding_new_point, madd_v2_v2v2fl(), mask(), SlidePointData::mask, SlidePointData::mask_layer, MASK_WHICH_HANDLE_NONE, wmEvent::mval, NA_EDITED, NC_MASK, SlidePointData::no, SlidePointData::old_h1, SlidePointData::old_h2, SlidePointData::orig_handle_coord, point, SlidePointData::point, SlidePointData::prev_feather_coord, SlidePointData::prev_handle_coord, SlidePointData::prev_mouse_coord, SlidePointData::prev_zero_coord, wmOperator::ptr, RNA_boolean_get(), select_sliding_point(), SLIDE_ACTION_FEATHER, SLIDE_ACTION_HANDLE, SLIDE_ACTION_NONE, SLIDE_ACTION_POINT, SLIDE_ACTION_SPLINE, slide_point_check_initial_feather(), SlidePointData::spline, spline_under_mouse_get(), MaskSplinePointUW::u, SlidePointData::uw, BezTriple::vec, SlidePointData::vec, MaskSplinePointUW::w, BezTriple::weight, SlidePointData::weight, SlidePointData::weight_scalar, SlidePointData::which_handle, SlidePointData::width, and WM_event_add_notifier().

Referenced by slide_point_invoke().

◆ slide_point_delta_all_feather()

static void slide_point_delta_all_feather ( SlidePointData * data,
float delta )
static

Definition at line 586 of file mask_ops.cc.

References MaskSplinePoint::bezt, and BezTriple::weight.

Referenced by slide_point_modal().

◆ slide_point_invoke()

◆ slide_point_modal()

◆ slide_point_restore_spline()

static void slide_point_restore_spline ( SlidePointData * data)
static

Definition at line 599 of file mask_ops.cc.

References MaskSplinePoint::bezt, and MaskSplinePoint::uw.

Referenced by cancel_slide_point(), and slide_point_modal().

◆ slide_spline_curvature_check()

static bool slide_spline_curvature_check ( bContext * C,
const wmEvent * event )
static

◆ slide_spline_curvature_customdata()

◆ slide_spline_curvature_invoke()

◆ slide_spline_curvature_modal()

static int slide_spline_curvature_modal ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

◆ slide_spline_solve_P1()

static void slide_spline_solve_P1 ( const float u,
const float B[2],
const float P0[2],
const float P2[2],
const float P3[2],
float solution[2] )
static

Definition at line 1124 of file mask_ops.cc.

References B, v, and v2.

Referenced by slide_spline_curvature_modal().

◆ slide_spline_solve_P2()

static void slide_spline_solve_P2 ( const float u,
const float B[2],
const float P0[2],
const float P1[2],
const float P3[2],
float solution[2] )
static

Definition at line 1140 of file mask_ops.cc.

References B, v, and v2.

Referenced by slide_spline_curvature_modal().

◆ spline_under_mouse_get()