Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ED_clip.h « include « editors « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 74735018814db0d179cfe6622ddd53a83b15d16c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright 2009 Blender Foundation. All rights reserved. */

/** \file
 * \ingroup editors
 */

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

struct ARegion;
struct ImBuf;
struct Main;
struct Mask;
struct MovieClip;
struct SpaceClip;
struct bContext;
struct bScreen;

/*  ** clip_editor.c ** */

/* Returns true when the following conditions are met:
 * - Current space is Space Clip.
 * - There is a movie clip opened in it. */
bool ED_space_clip_poll(struct bContext *C);

/* Returns true when the following conditions are met:
 * - Current space is Space Clip.
 * - It is set to Clip view.
 *
 * It is not required to have movie clip opened for editing. */
bool ED_space_clip_view_clip_poll(struct bContext *C);

/* Returns true when the following conditions are met:
 * - Current space is Space Clip.
 * - It is set to Tracking mode.
 *
 * It is not required to have movie clip opened for editing. */
bool ED_space_clip_tracking_poll(struct bContext *C);

/* Returns true when the following conditions are met:
 * - Current space is Space Clip.
 * - It is set to Mask mode.
 *
 * It is not required to have mask opened for editing. */
bool ED_space_clip_maskedit_poll(struct bContext *C);

/* Returns true when the following conditions are met:
 * - Current space is Space Clip.
 * - It is set to Mask mode.
 * - The space has mask opened. */
bool ED_space_clip_maskedit_mask_poll(struct bContext *C);

void ED_space_clip_get_size(struct SpaceClip *sc, int *width, int *height);
void ED_space_clip_get_size_fl(struct SpaceClip *sc, float size[2]);
void ED_space_clip_get_zoom(struct SpaceClip *sc,
                            struct ARegion *region,
                            float *zoomx,
                            float *zoomy);
void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
void ED_space_clip_get_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, float *aspy);

/**
 * Return current frame number in clip space.
 */
int ED_space_clip_get_clip_frame_number(struct SpaceClip *sc);

struct ImBuf *ED_space_clip_get_buffer(struct SpaceClip *sc);
struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc,
                                              float loc[2],
                                              float *scale,
                                              float *angle);

bool ED_space_clip_get_position(struct SpaceClip *sc,
                                struct ARegion *region,
                                int mval[2],
                                float fpos[2]);
/**
 * Returns color in linear space, matching #ED_space_image_color_sample().
 */
bool ED_space_clip_color_sample(struct SpaceClip *sc,
                                struct ARegion *region,
                                const int mval[2],
                                float r_col[3]);

void ED_clip_update_frame(const struct Main *mainp, int cfra);
bool ED_clip_view_selection(const struct bContext *C, struct ARegion *region, bool fit);

void ED_clip_select_all(struct SpaceClip *sc, int action, bool *r_has_selection);
bool ED_clip_can_select(struct bContext *C);

void ED_clip_point_undistorted_pos(struct SpaceClip *sc, const float co[2], float r_co[2]);
void ED_clip_point_stable_pos(
    struct SpaceClip *sc, struct ARegion *region, float x, float y, float *xr, float *yr);
/**
 * \brief the reverse of #ED_clip_point_stable_pos(), gets the marker region coords.
 * better name here? view_to_track / track_to_view or so?
 */
void ED_clip_point_stable_pos__reverse(struct SpaceClip *sc,
                                       struct ARegion *region,
                                       const float co[2],
                                       float r_co[2]);
/**
 * Takes `event->mval`.
 */
void ED_clip_mouse_pos(struct SpaceClip *sc,
                       struct ARegion *region,
                       const int mval[2],
                       float co[2]);

bool ED_space_clip_check_show_trackedit(struct SpaceClip *sc);
bool ED_space_clip_check_show_maskedit(struct SpaceClip *sc);

struct MovieClip *ED_space_clip_get_clip(struct SpaceClip *sc);
void ED_space_clip_set_clip(struct bContext *C,
                            struct bScreen *screen,
                            struct SpaceClip *sc,
                            struct MovieClip *clip);

struct Mask *ED_space_clip_get_mask(struct SpaceClip *sc);
void ED_space_clip_set_mask(struct bContext *C, struct SpaceClip *sc, struct Mask *mask);

/* Locked state is used to preserve current clip editor viewport upon changes. Example usage:
 *
 *   ...
 *
 *   ClipViewLockState lock_state;
 *   ED_clip_view_lock_state_store(C, &lock_state);
 *
 *   <change selection>
 *
 *   ED_clip_view_lock_state_restore_no_jump(C, &lock_state);
 *
 * These function are to be used from space clip editor context only. Otherwise debug builds will
 * assert, release builds will crash. */

typedef struct ClipViewLockState {
  float offset_x, offset_y;
  float lock_offset_x, lock_offset_y;
  float zoom;
} ClipViewLockState;

void ED_clip_view_lock_state_store(const struct bContext *C, ClipViewLockState *state);
void ED_clip_view_lock_state_restore_no_jump(const struct bContext *C,
                                             const ClipViewLockState *state);

/* ** clip_ops.c ** */
void ED_operatormacros_clip(void);

#ifdef __cplusplus
}
#endif