2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2012 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2012-06-04 15:49:58 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup editors
|
2012-06-04 15:49:58 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-01-05 10:12:22 +01:00
|
|
|
#include "DNA_mask_types.h"
|
|
|
|
|
|
2025-01-07 12:39:13 +01:00
|
|
|
struct ARegion;
|
2019-05-21 17:29:58 +02:00
|
|
|
struct Depsgraph;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct KeyframeEditData;
|
2012-06-06 14:38:47 +00:00
|
|
|
struct MaskLayer;
|
2012-06-08 14:31:38 +00:00
|
|
|
struct MaskLayerShape;
|
2025-01-07 12:39:13 +01:00
|
|
|
struct Scene;
|
|
|
|
|
struct ScrArea;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bContext;
|
|
|
|
|
struct wmKeyConfig;
|
2012-06-04 15:49:58 +00:00
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* `mask_edit.cc` */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2024-03-26 17:54:30 +11:00
|
|
|
/**
|
|
|
|
|
* Returns true when the following conditions are met:
|
2022-06-17 09:58:23 +02:00
|
|
|
* - Current space supports mask editing.
|
|
|
|
|
* - The space is configured to interact with mask.
|
|
|
|
|
*
|
2024-03-26 17:54:30 +11:00
|
|
|
* It is not required to have mask opened for editing.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_maskedit_poll(bContext *C);
|
2022-06-17 09:58:23 +02:00
|
|
|
|
2024-03-26 17:54:30 +11:00
|
|
|
/**
|
|
|
|
|
* Returns true when the following conditions are met:
|
2022-06-16 10:13:03 +02:00
|
|
|
* - Current space supports mask editing.
|
|
|
|
|
* - The space is configured to interact with mask.
|
|
|
|
|
* - Mask has visible and editable splines.
|
|
|
|
|
*
|
2024-03-26 17:54:30 +11:00
|
|
|
* It is not required to have mask opened for editing.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_maskedit_visible_splines_poll(bContext *C);
|
2022-06-16 10:13:03 +02:00
|
|
|
|
2024-03-26 17:54:30 +11:00
|
|
|
/**
|
|
|
|
|
* Returns true when the following conditions are met:
|
2022-06-17 09:58:23 +02:00
|
|
|
* - Current space supports mask editing.
|
|
|
|
|
* - The space is configured to interact with mask.
|
2024-03-26 17:54:30 +11:00
|
|
|
* - The space has mask open for editing.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_maskedit_mask_poll(bContext *C);
|
2022-06-17 09:58:23 +02:00
|
|
|
|
2024-03-26 17:54:30 +11:00
|
|
|
/**
|
|
|
|
|
* Returns true when the following conditions are met:
|
2022-06-16 10:13:03 +02:00
|
|
|
* - Current space supports mask editing.
|
|
|
|
|
* - The space is configured to interact with mask.
|
|
|
|
|
* - The space has mask opened.
|
2024-03-26 17:54:30 +11:00
|
|
|
* - Mask has visible and editable splines.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_maskedit_mask_visible_splines_poll(bContext *C);
|
2022-06-16 10:13:03 +02:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_mask_deselect_all(const bContext *C);
|
2020-03-25 19:06:17 +11:00
|
|
|
|
2023-08-05 12:32:59 +10:00
|
|
|
void ED_operatortypes_mask();
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_keymap_mask(wmKeyConfig *keyconf);
|
2023-08-05 12:32:59 +10:00
|
|
|
void ED_operatormacros_mask();
|
2020-03-25 19:06:17 +11:00
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* `mask_query.cc` */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-11-30 10:42:18 +11:00
|
|
|
void ED_mask_get_size(ScrArea *area, int *r_width, int *r_height);
|
|
|
|
|
void ED_mask_zoom(ScrArea *area, ARegion *region, float *r_zoomx, float *r_zoomy);
|
|
|
|
|
void ED_mask_get_aspect(ScrArea *area, ARegion *region, float *r_aspx, float *r_aspy);
|
2012-07-24 19:29:24 +00:00
|
|
|
|
2023-11-30 10:42:18 +11:00
|
|
|
void ED_mask_pixelspace_factor(ScrArea *area, ARegion *region, float *r_scalex, float *r_scaley);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Takes `event->mval`.
|
|
|
|
|
*/
|
2023-11-30 10:42:18 +11:00
|
|
|
void ED_mask_mouse_pos(ScrArea *area, ARegion *region, const int mval[2], float r_co[2]);
|
2012-07-26 21:22:42 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* \param x/y: input, mval space.
|
|
|
|
|
* \param xr/yr: output, mask point space.
|
|
|
|
|
*/
|
2023-11-30 10:42:18 +11:00
|
|
|
void ED_mask_point_pos(ScrArea *area, ARegion *region, float x, float y, float *r_x, float *r_y);
|
2012-07-26 22:41:40 +00:00
|
|
|
void ED_mask_point_pos__reverse(
|
2023-11-30 10:42:18 +11:00
|
|
|
ScrArea *area, ARegion *region, float x, float y, float *r_x, float *r_y);
|
2012-07-26 21:22:42 +00:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_mask_cursor_location_get(ScrArea *area, float cursor[2]);
|
|
|
|
|
bool ED_mask_selected_minmax(const bContext *C,
|
2021-01-19 14:28:44 +01:00
|
|
|
float min[2],
|
|
|
|
|
float max[2],
|
2021-02-08 11:11:33 +01:00
|
|
|
bool handles_as_control_point);
|
2013-08-26 20:23:26 +00:00
|
|
|
|
2025-08-06 09:44:24 +00:00
|
|
|
void ED_mask_center_from_pivot_ex(
|
|
|
|
|
const bContext *C, ScrArea *area, float r_center[2], char mode, bool *r_has_select);
|
|
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* `mask_draw.cc` */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets up the opengl context.
|
|
|
|
|
* width, height are to match the values from #ED_mask_get_size().
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_mask_draw_region(Depsgraph *depsgraph,
|
|
|
|
|
Mask *mask,
|
|
|
|
|
ARegion *region,
|
2022-01-07 11:38:08 +11:00
|
|
|
char draw_flag,
|
|
|
|
|
char draw_type,
|
|
|
|
|
eMaskOverlayMode overlay_mode,
|
2022-06-15 15:15:23 +02:00
|
|
|
float blend_factor,
|
2022-01-07 11:38:08 +11:00
|
|
|
int width_i,
|
|
|
|
|
int height_i,
|
|
|
|
|
float aspx,
|
|
|
|
|
float aspy,
|
|
|
|
|
bool do_scale_applied,
|
|
|
|
|
bool do_draw_cb,
|
2012-07-24 19:29:24 +00:00
|
|
|
float stabmat[4][4],
|
2023-08-04 22:15:25 -04:00
|
|
|
const bContext *C);
|
2012-06-04 15:49:58 +00:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_mask_draw_frames(Mask *mask, ARegion *region, int cfra, int sfra, int efra);
|
2012-08-01 10:50:39 +00:00
|
|
|
|
2023-07-31 11:50:54 +10:00
|
|
|
/* `mask_shapekey.cc` */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_mask_layer_shape_auto_key(MaskLayer *mask_layer, int frame);
|
|
|
|
|
bool ED_mask_layer_shape_auto_key_all(Mask *mask, int frame);
|
|
|
|
|
bool ED_mask_layer_shape_auto_key_select(Mask *mask, int frame);
|
2012-06-04 15:49:58 +00:00
|
|
|
|
2012-06-08 14:31:38 +00:00
|
|
|
/* ----------- Mask AnimEdit API ------------------ */
|
2021-12-09 00:55:11 +11:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Loops over the mask-frames for a mask-layer, and applies the given callback.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_masklayer_frames_looper(MaskLayer *mask_layer,
|
|
|
|
|
Scene *scene,
|
|
|
|
|
bool (*mask_layer_shape_cb)(MaskLayerShape *, Scene *));
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Make a listing all the mask-frames in a layer as cfraelems.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_masklayer_make_cfra_list(MaskLayer *mask_layer, ListBase *elems, bool onlysel);
|
2012-06-08 14:31:38 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Check if one of the frames in this layer is selected.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_masklayer_frame_select_check(const MaskLayer *mask_layer);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Set all/none/invert select.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_masklayer_frame_select_set(MaskLayer *mask_layer, short mode);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Select the frames in this layer that occur within the bounds specified.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_masklayer_frames_select_box(MaskLayer *mask_layer,
|
2018-10-05 10:27:04 +10:00
|
|
|
float min,
|
|
|
|
|
float max,
|
|
|
|
|
short select_mode);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Select the frames in this layer that occur within the lasso/circle region specified.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_masklayer_frames_select_region(KeyframeEditData *ked,
|
|
|
|
|
MaskLayer *mask_layer,
|
2016-06-24 02:57:03 +12:00
|
|
|
short tool,
|
|
|
|
|
short select_mode);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Set all/none/invert select (like above, but with SELECT_* modes).
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_mask_select_frames(MaskLayer *mask_layer, short select_mode);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Select the frame in this layer that occurs on this frame (there should only be one at most).
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_mask_select_frame(MaskLayer *mask_layer, int selx, short select_mode);
|
2012-06-08 14:31:38 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Delete selected frames.
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
bool ED_masklayer_frames_delete(MaskLayer *mask_layer);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Duplicate selected frames from given mask-layer.
|
|
|
|
|
*/
|
2024-08-02 12:58:28 +02:00
|
|
|
bool ED_masklayer_frames_duplicate(MaskLayer *mask_layer);
|
2012-06-08 14:31:38 +00:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Snap selected frames to ...
|
|
|
|
|
*/
|
2023-08-04 22:15:25 -04:00
|
|
|
void ED_masklayer_snap_frames(MaskLayer *mask_layer, Scene *scene, short mode);
|
2012-12-03 13:07:43 +00:00
|
|
|
|
2012-06-08 21:48:04 +00:00
|
|
|
#if 0
|
2023-08-05 12:32:59 +10:00
|
|
|
void free_gpcopybuf();
|
|
|
|
|
void copy_gpdata();
|
|
|
|
|
void paste_gpdata();
|
2012-06-08 14:31:38 +00:00
|
|
|
|
2023-08-09 10:47:43 +10:00
|
|
|
void mirror_masklayer_frames(MaskLayer *mask_layer, short mode);
|
2012-06-08 21:48:04 +00:00
|
|
|
#endif
|