Blender V4.5
mask_ops.cc File Reference
#include <algorithm>
#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 wmOperatorStatus mask_new_exec (bContext *C, wmOperator *op)
void MASK_OT_new (wmOperatorType *ot)
static wmOperatorStatus mask_layer_new_exec (bContext *C, wmOperator *op)
void MASK_OT_layer_new (wmOperatorType *ot)
static wmOperatorStatus 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 wmOperatorStatus 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 wmOperatorStatus 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 wmOperatorStatus 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 wmOperatorStatus slide_spline_curvature_modal (bContext *C, wmOperator *op, const wmEvent *event)
void MASK_OT_slide_spline_curvature (wmOperatorType *ot)
static wmOperatorStatus cyclic_toggle_exec (bContext *C, wmOperator *)
void MASK_OT_cyclic_toggle (wmOperatorType *ot)
static void delete_feather_points (MaskSplinePoint *point)
static wmOperatorStatus delete_exec (bContext *C, wmOperator *)
static wmOperatorStatus delete_invoke (bContext *C, wmOperator *op, const wmEvent *)
void MASK_OT_delete (wmOperatorType *ot)
static wmOperatorStatus mask_switch_direction_exec (bContext *C, wmOperator *)
void MASK_OT_switch_direction (wmOperatorType *ot)
static wmOperatorStatus mask_normals_make_consistent_exec (bContext *C, wmOperator *)
void MASK_OT_normals_make_consistent (wmOperatorType *ot)
static wmOperatorStatus set_handle_type_exec (bContext *C, wmOperator *op)
void MASK_OT_handle_type_set (wmOperatorType *ot)
static wmOperatorStatus mask_hide_view_clear_exec (bContext *C, wmOperator *op)
void MASK_OT_hide_view_clear (wmOperatorType *ot)
static wmOperatorStatus mask_hide_view_set_exec (bContext *C, wmOperator *op)
void MASK_OT_hide_view_set (wmOperatorType *ot)
static wmOperatorStatus 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 wmOperatorStatus mask_layer_move_exec (bContext *C, wmOperator *op)
void MASK_OT_layer_move (wmOperatorType *ot)
static wmOperatorStatus mask_duplicate_exec (bContext *C, wmOperator *)
void MASK_OT_duplicate (wmOperatorType *ot)
static wmOperatorStatus copy_splines_exec (bContext *C, wmOperator *)
void MASK_OT_copy_splines (wmOperatorType *ot)
static bool paste_splines_poll (bContext *C)
static wmOperatorStatus 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 199 of file mask_ops.cc.

Function Documentation

◆ cancel_slide_point()

void cancel_slide_point ( SlidePointData * data)
static

◆ cancel_slide_spline_curvature()

◆ check_sliding_handle_type()

◆ copy_splines_exec()

◆ cyclic_toggle_exec()

◆ delete_exec()

◆ delete_feather_points()

void delete_feather_points ( MaskSplinePoint * point)
static

◆ delete_invoke()

wmOperatorStatus 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 78 of file mask_ops.cc.

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

Referenced by create_primitive_from_points(), and ED_mask_layer_ensure().

◆ ED_mask_new()

◆ free_slide_point_data()

void free_slide_point_data ( SlidePointData * data)
static

◆ free_slide_spline_curvature_data()

void free_slide_spline_curvature_data ( SlideSplineCurvatureData * slide_data)
static

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

bool mask_layer_move_poll ( bContext * C)
static

◆ mask_layer_new_exec()

◆ mask_layer_remove_exec()

◆ mask_new_exec()

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

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

bool paste_splines_poll ( bContext * C)
static

◆ select_sliding_point()

◆ set_handle_type_exec()

◆ slide_point_check_initial_feather()

bool slide_point_check_initial_feather ( MaskSpline * spline)
static

◆ slide_point_customdata()

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

Definition at line 425 of file mask_ops.cc.

References SlidePointData::action, MaskSplinePoint::bezt, 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, BezTriple::h1, BezTriple::h2, SlidePointData::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, SlidePointData::old_h1, SlidePointData::old_h2, SlidePointData::orig_handle_coord, 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(), slide_point_customdata(), 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_customdata(), and slide_point_invoke().

◆ slide_point_delta_all_feather()

void slide_point_delta_all_feather ( SlidePointData * data,
float delta )
static

◆ slide_point_invoke()

◆ slide_point_modal()

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

◆ slide_point_restore_spline()

void slide_point_restore_spline ( SlidePointData * data)
static

◆ slide_spline_curvature_check()

◆ slide_spline_curvature_customdata()

◆ slide_spline_curvature_invoke()

◆ slide_spline_curvature_modal()

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

Definition at line 1161 of file mask_ops.cc.

References SlideSplineCurvatureData::accurate, add_v2_v2v2(), SlideSplineCurvatureData::adjust_bezt, ATTR_FALLTHROUGH, B, SlideSplineCurvatureData::bezt_backup, C, cancel_slide_spline_curvature(), RenderData::cfra, copy_v2_v2(), CTX_data_scene(), CTX_wm_area(), CTX_wm_region(), wmOperator::customdata, DEG_id_tag_update(), ED_mask_layer_shape_auto_key(), ED_mask_mouse_pos(), ELEM, SlideSplineCurvatureData::event_invoke_type, EVT_ESCKEY, EVT_LEFTCTRLKEY, EVT_LEFTSHIFTKEY, EVT_RIGHTCTRLKEY, EVT_RIGHTSHIFTKEY, free_slide_spline_curvature_data(), BezTriple::h1, BezTriple::h2, HD_FREE, HD_VECT, Mask::id, interp_v2_v2v2(), blender::animrig::is_autokey_on(), KM_PRESS, KM_RELEASE, LEFTMOUSE, SlideSplineCurvatureData::mask, SlideSplineCurvatureData::mask_layer, MOUSEMOVE, mul_v2_fl(), wmEvent::mval, NA_EDITED, NC_MASK, OPERATOR_CANCELLED, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, SlideSplineCurvatureData::other_bezt, SlideSplineCurvatureData::other_bezt_backup, SlideSplineCurvatureData::P0, SlideSplineCurvatureData::P1, SlideSplineCurvatureData::P2, SlideSplineCurvatureData::P3, SlideSplineCurvatureData::prev_mouse_coord, SlideSplineCurvatureData::prev_spline_coord, Scene::r, RIGHTMOUSE, slide_spline_curvature_modal(), slide_spline_solve_P1(), slide_spline_solve_P2(), sub_v2_v2v2(), wmEvent::type, SlideSplineCurvatureData::u, wmEvent::val, BezTriple::vec, WM_event_add_notifier(), and x.

Referenced by MASK_OT_slide_spline_curvature(), and slide_spline_curvature_modal().

◆ slide_spline_solve_P1()

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 1129 of file mask_ops.cc.

References B, slide_spline_solve_P1(), v, and v2.

Referenced by slide_spline_curvature_modal(), and slide_spline_solve_P1().

◆ slide_spline_solve_P2()

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 1145 of file mask_ops.cc.

References B, slide_spline_solve_P2(), v, and v2.

Referenced by slide_spline_curvature_modal(), and slide_spline_solve_P2().

◆ spline_under_mouse_get()