1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2008 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 /** \file
21  * \ingroup spgraph
22  */
23 
24 #pragma once
25 
26 struct ARegion;
27 struct ARegionType;
28 struct SpaceGraph;
29 struct bAnimContext;
30 struct bAnimListElem;
31 struct bContext;
32 
33 /* internal exports only */
34 
35 /* ***************************************** */
36 /* graph_draw.c */
37 void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *region);
38 
39 void graph_draw_curves(struct bAnimContext *ac,
40                        struct SpaceGraph *sipo,
41                        struct ARegion *region,
42                        short sel);
43 void graph_draw_ghost_curves(struct bAnimContext *ac,
44                              struct SpaceGraph *sipo,
45                              struct ARegion *region);
46 
47 /* ***************************************** */
48 /* graph_select.c */
49 
50 void deselect_graph_keys(struct bAnimContext *ac, bool test, short sel, bool do_channels);
51 
52 void GRAPH_OT_select_all(struct wmOperatorType *ot);
53 void GRAPH_OT_select_box(struct wmOperatorType *ot);
54 void GRAPH_OT_select_lasso(struct wmOperatorType *ot);
55 void GRAPH_OT_select_circle(struct wmOperatorType *ot);
56 void GRAPH_OT_select_column(struct wmOperatorType *ot);
57 void GRAPH_OT_select_linked(struct wmOperatorType *ot);
58 void GRAPH_OT_select_more(struct wmOperatorType *ot);
59 void GRAPH_OT_select_less(struct wmOperatorType *ot);
60 void GRAPH_OT_select_leftright(struct wmOperatorType *ot);
61 void GRAPH_OT_clickselect(struct wmOperatorType *ot);
62 
63 /* defines for left-right select tool */
64 enum eGraphKeys_LeftRightSelect_Mode {
65   GRAPHKEYS_LRSEL_TEST = 0,
66   GRAPHKEYS_LRSEL_LEFT,
67   GRAPHKEYS_LRSEL_RIGHT,
68 };
69 
70 /* defines for column-select mode */
71 enum eGraphKeys_ColumnSelect_Mode {
72   GRAPHKEYS_COLUMNSEL_KEYS = 0,
73   GRAPHKEYS_COLUMNSEL_CFRA,
74   GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN,
75   GRAPHKEYS_COLUMNSEL_MARKERS_BETWEEN,
76 };
77 
78 /* ***************************************** */
79 /* graph_edit.c */
80 
81 void get_graph_keyframe_extents(struct bAnimContext *ac,
82                                 float *xmin,
83                                 float *xmax,
84                                 float *ymin,
85                                 float *ymax,
86                                 const bool do_sel_only,
87                                 const bool include_handles);
88 
89 void GRAPH_OT_previewrange_set(struct wmOperatorType *ot);
90 void GRAPH_OT_view_all(struct wmOperatorType *ot);
91 void GRAPH_OT_view_selected(struct wmOperatorType *ot);
92 void GRAPH_OT_view_frame(struct wmOperatorType *ot);
93 
94 void GRAPH_OT_click_insert(struct wmOperatorType *ot);
95 void GRAPH_OT_keyframe_insert(struct wmOperatorType *ot);
96 
97 void GRAPH_OT_copy(struct wmOperatorType *ot);
98 void GRAPH_OT_paste(struct wmOperatorType *ot);
99 
100 void GRAPH_OT_duplicate(struct wmOperatorType *ot);
101 void GRAPH_OT_delete(struct wmOperatorType *ot);
102 void GRAPH_OT_clean(struct wmOperatorType *ot);
103 void GRAPH_OT_decimate(struct wmOperatorType *ot);
104 void GRAPH_OT_sample(struct wmOperatorType *ot);
105 void GRAPH_OT_bake(struct wmOperatorType *ot);
106 void GRAPH_OT_sound_bake(struct wmOperatorType *ot);
107 void GRAPH_OT_smooth(struct wmOperatorType *ot);
108 void GRAPH_OT_euler_filter(struct wmOperatorType *ot);
109 
110 void GRAPH_OT_handle_type(struct wmOperatorType *ot);
111 void GRAPH_OT_interpolation_type(struct wmOperatorType *ot);
112 void GRAPH_OT_extrapolation_type(struct wmOperatorType *ot);
113 void GRAPH_OT_easing_type(struct wmOperatorType *ot);
114 
115 void GRAPH_OT_frame_jump(struct wmOperatorType *ot);
116 void GRAPH_OT_snap_cursor_value(struct wmOperatorType *ot);
117 void GRAPH_OT_snap(struct wmOperatorType *ot);
118 void GRAPH_OT_mirror(struct wmOperatorType *ot);
119 
120 /* defines for snap keyframes
121  * NOTE: keep in sync with eEditKeyframes_Snap (in ED_keyframes_edit.h)
122  */
123 enum eGraphKeys_Snap_Mode {
124   GRAPHKEYS_SNAP_CFRA = 1,
125   GRAPHKEYS_SNAP_NEAREST_FRAME,
126   GRAPHKEYS_SNAP_NEAREST_SECOND,
127   GRAPHKEYS_SNAP_NEAREST_MARKER,
128   GRAPHKEYS_SNAP_HORIZONTAL,
129   GRAPHKEYS_SNAP_VALUE,
130 };
131 
132 /* defines for mirror keyframes
133  * NOTE: keep in sync with eEditKeyframes_Mirror (in ED_keyframes_edit.h)
134  */
135 enum eGraphKeys_Mirror_Mode {
136   GRAPHKEYS_MIRROR_CFRA = 1,
137   GRAPHKEYS_MIRROR_YAXIS,
138   GRAPHKEYS_MIRROR_XAXIS,
139   GRAPHKEYS_MIRROR_MARKER,
140   GRAPHKEYS_MIRROR_VALUE,
141 };
142 
143 /* ----------- */
144 
145 void GRAPH_OT_fmodifier_add(struct wmOperatorType *ot);
146 void GRAPH_OT_fmodifier_copy(struct wmOperatorType *ot);
147 void GRAPH_OT_fmodifier_paste(struct wmOperatorType *ot);
148 
149 /* ----------- */
150 
151 void GRAPH_OT_driver_variables_copy(struct wmOperatorType *ot);
152 void GRAPH_OT_driver_variables_paste(struct wmOperatorType *ot);
153 void GRAPH_OT_driver_delete_invalid(struct wmOperatorType *ot);
154 
155 /* ----------- */
156 
157 void GRAPH_OT_ghost_curves_create(struct wmOperatorType *ot);
158 void GRAPH_OT_ghost_curves_clear(struct wmOperatorType *ot);
159 
160 /* ***************************************** */
161 /* graph_buttons.c */
162 
163 void graph_buttons_register(struct ARegionType *art);
164 
165 /* ***************************************** */
166 /* graph_utils.c */
167 
168 struct bAnimListElem *get_active_fcurve_channel(struct bAnimContext *ac);
169 
170 bool graphop_visible_keyframes_poll(struct bContext *C);
171 bool graphop_editable_keyframes_poll(struct bContext *C);
172 bool graphop_active_fcurve_poll(struct bContext *C);
173 bool graphop_active_editable_fcurve_ctx_poll(struct bContext *C);
174 bool graphop_selected_fcurve_poll(struct bContext *C);
175 
176 /* ***************************************** */
177 /* graph_ops.c */
178 void graphedit_keymap(struct wmKeyConfig *keyconf);
179 void graphedit_operatortypes(void);
180