Blender  V3.3
Classes | Typedefs | Enumerations | Functions
mask_ops.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_mask.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "DNA_mask_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_clip.h"
#include "ED_image.h"
#include "ED_keyframing.h"
#include "ED_mask.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "mask_intern.h"

Go to the source code of this file.

Classes

struct  SlidePointData
 
struct  SlideSplineCurvatureData
 

Typedefs

typedef struct SlidePointData SlidePointData
 
typedef struct SlideSplineCurvatureData 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 *UNUSED(op))
 
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 voidslide_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 *UNUSED(op))
 
void MASK_OT_cyclic_toggle (wmOperatorType *ot)
 
static void delete_feather_points (MaskSplinePoint *point)
 
static int delete_exec (bContext *C, wmOperator *UNUSED(op))
 
void MASK_OT_delete (wmOperatorType *ot)
 
static int mask_switch_direction_exec (bContext *C, wmOperator *UNUSED(op))
 
void MASK_OT_switch_direction (wmOperatorType *ot)
 
static int mask_normals_make_consistent_exec (bContext *C, wmOperator *UNUSED(op))
 
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 *UNUSED(op))
 
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 *UNUSED(op))
 
void MASK_OT_duplicate (wmOperatorType *ot)
 
static int copy_splines_exec (bContext *C, wmOperator *UNUSED(op))
 
void MASK_OT_copy_splines (wmOperatorType *ot)
 
static bool paste_splines_poll (bContext *C)
 
static int paste_splines_exec (bContext *C, wmOperator *UNUSED(op))
 
void MASK_OT_paste_splines (wmOperatorType *ot)
 

Typedef Documentation

◆ SlidePointData

◆ SlideSplineCurvatureData

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 192 of file mask_ops.c.

Function Documentation

◆ cancel_slide_point()

static void cancel_slide_point ( SlidePointData data)
static

◆ cancel_slide_spline_curvature()

static void cancel_slide_spline_curvature ( SlideSplineCurvatureData slide_data)
static

◆ 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 UNUSEDop 
)
static

◆ cyclic_toggle_exec()

static int cyclic_toggle_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ delete_exec()

static int delete_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ delete_feather_points()

static void delete_feather_points ( MaskSplinePoint point)
static

Definition at line 1347 of file mask_ops.c.

References count, MEM_callocN, MEM_freeN, NULL, point, and SELECT.

Referenced by delete_exec().

◆ ED_mask_layer_ensure()

MaskLayer* ED_mask_layer_ensure ( struct bContext C,
bool r_added_mask 
)

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

Definition at line 71 of file mask_ops.c.

References BKE_mask_layer_active(), BKE_mask_layer_new(), C, CTX_data_edit_mask(), ED_mask_new(), mask(), and NULL.

Referenced by create_primitive_from_points().

◆ ED_mask_new()

Mask* ED_mask_new ( bContext C,
const char *  name 
)

◆ free_slide_point_data()

static void free_slide_point_data ( SlidePointData data)
static

Definition at line 624 of file mask_ops.c.

References BKE_mask_spline_free(), data, 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 953 of file mask_ops.c.

References MEM_freeN.

Referenced by slide_spline_curvature_modal().

◆ mask_duplicate_exec()

static int mask_duplicate_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ mask_feather_weight_clear_exec()

static int mask_feather_weight_clear_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ mask_hide_view_clear_exec()

static int mask_hide_view_clear_exec ( bContext C,
wmOperator op 
)
static

◆ mask_hide_view_set_exec()

static int mask_hide_view_set_exec ( bContext C,
wmOperator op 
)
static

◆ mask_layer_move_exec()

static int mask_layer_move_exec ( bContext C,
wmOperator op 
)
static

◆ mask_layer_move_poll()

static bool mask_layer_move_poll ( bContext C)
static

Definition at line 1860 of file mask_ops.c.

References C, CTX_data_edit_mask(), ED_maskedit_mask_poll(), and mask().

Referenced by MASK_OT_layer_move().

◆ mask_layer_new_exec()

static int mask_layer_new_exec ( bContext C,
wmOperator op 
)
static

◆ mask_layer_remove_exec()

static int mask_layer_remove_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ mask_new_exec()

static int mask_new_exec ( bContext C,
wmOperator op 
)
static

◆ mask_normals_make_consistent_exec()

static int mask_normals_make_consistent_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ MASK_OT_copy_splines()

void MASK_OT_copy_splines ( wmOperatorType ot)

◆ MASK_OT_cyclic_toggle()

void MASK_OT_cyclic_toggle ( wmOperatorType ot)

◆ MASK_OT_delete()

void MASK_OT_delete ( wmOperatorType ot)

◆ MASK_OT_duplicate()

void MASK_OT_duplicate ( wmOperatorType ot)

◆ MASK_OT_feather_weight_clear()

void MASK_OT_feather_weight_clear ( wmOperatorType ot)

◆ MASK_OT_handle_type_set()

void MASK_OT_handle_type_set ( wmOperatorType ot)

◆ MASK_OT_hide_view_clear()

void MASK_OT_hide_view_clear ( wmOperatorType ot)

◆ MASK_OT_hide_view_set()

void MASK_OT_hide_view_set ( wmOperatorType ot)

◆ MASK_OT_layer_move()

void MASK_OT_layer_move ( wmOperatorType ot)

◆ MASK_OT_layer_new()

void MASK_OT_layer_new ( wmOperatorType ot)

◆ MASK_OT_layer_remove()

void MASK_OT_layer_remove ( wmOperatorType ot)

◆ MASK_OT_new()

void MASK_OT_new ( wmOperatorType ot)

◆ MASK_OT_normals_make_consistent()

void MASK_OT_normals_make_consistent ( wmOperatorType ot)

◆ MASK_OT_paste_splines()

void MASK_OT_paste_splines ( wmOperatorType ot)

◆ MASK_OT_slide_point()

void MASK_OT_slide_point ( wmOperatorType ot)

◆ MASK_OT_slide_spline_curvature()

void MASK_OT_slide_spline_curvature ( wmOperatorType ot)

◆ MASK_OT_switch_direction()

void MASK_OT_switch_direction ( wmOperatorType ot)

◆ 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()

static int mask_switch_direction_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ paste_splines_exec()

static int paste_splines_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ paste_splines_poll()

static bool paste_splines_poll ( bContext C)
static

◆ select_sliding_point()

static void select_sliding_point ( Mask mask,
MaskLayer mask_layer,
MaskSpline spline,
MaskSplinePoint point,
eMaskWhichHandle  which_handle 
)
static

◆ set_handle_type_exec()

static int set_handle_type_exec ( bContext C,
wmOperator op 
)
static

◆ slide_point_check_initial_feather()

static bool slide_point_check_initial_feather ( MaskSpline spline)
static

Definition at line 345 of file mask_ops.c.

References point, MaskSpline::points, and MaskSpline::tot_point.

Referenced by slide_point_customdata().

◆ slide_point_customdata()

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

Definition at line 413 of file mask_ops.c.

References SlidePointData::action, blender::compositor::area(), BKE_mask_point_handle(), BKE_mask_point_normal(), BKE_mask_point_segment_co(), BKE_mask_point_weight_scalar(), C, 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, height, SlidePointData::is_initial_feather, SlidePointData::is_sliding_new_point, madd_v2_v2v2fl(), mask(), SlidePointData::mask, SlidePointData::mask_layer, MASK_WHICH_HANDLE_NONE, MEM_callocN, wmEvent::mval, NA_EDITED, NC_MASK, SlidePointData::no, NULL, SlidePointData::old_h1, SlidePointData::old_h2, SlidePointData::orig_handle_coord, SlidePointData::point, 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(), threshold, MaskSplinePointUW::u, SlidePointData::uw, SlidePointData::vec, BezTriple::vec, MaskSplinePointUW::w, SlidePointData::weight, BezTriple::weight, SlidePointData::weight_scalar, SlidePointData::which_handle, SlidePointData::width, 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 573 of file mask_ops.c.

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

Referenced by slide_point_modal().

◆ slide_point_invoke()

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

◆ slide_point_modal()

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

◆ slide_point_restore_spline()

static void slide_point_restore_spline ( SlidePointData data)
static

Definition at line 586 of file mask_ops.c.

References MaskSplinePoint::bezt, data, point, 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()

static SlideSplineCurvatureData* slide_spline_curvature_customdata ( bContext C,
const wmEvent event 
)
static

◆ slide_spline_curvature_invoke()

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

◆ 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 1105 of file mask_ops.c.

References B, t, u2, 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 1121 of file mask_ops.c.

References B, t, u2, v, and v2.

Referenced by slide_spline_curvature_modal().

◆ spline_under_mouse_get()

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