Cleanup: Fix missing-braces warning on macOS Clang
[blender.git] / source / blender / editors / space_action / action_ops.c
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 spaction
22  */
23
24 #include <math.h>
25 #include <stdlib.h>
26
27 #include "DNA_space_types.h"
28
29 #include "ED_anim_api.h"
30 #include "ED_transform.h"
31
32 #include "action_intern.h"
33
34 #include "RNA_access.h"
35
36 #include "WM_api.h"
37 #include "WM_types.h"
38
39 /* ************************** registration - operator types **********************************/
40
41 void action_operatortypes(void)
42 {
43   /* keyframes */
44   /* selection */
45   WM_operatortype_append(ACTION_OT_clickselect);
46   WM_operatortype_append(ACTION_OT_select_all);
47   WM_operatortype_append(ACTION_OT_select_box);
48   WM_operatortype_append(ACTION_OT_select_lasso);
49   WM_operatortype_append(ACTION_OT_select_circle);
50   WM_operatortype_append(ACTION_OT_select_column);
51   WM_operatortype_append(ACTION_OT_select_linked);
52   WM_operatortype_append(ACTION_OT_select_more);
53   WM_operatortype_append(ACTION_OT_select_less);
54   WM_operatortype_append(ACTION_OT_select_leftright);
55
56   /* editing */
57   WM_operatortype_append(ACTION_OT_snap);
58   WM_operatortype_append(ACTION_OT_mirror);
59   WM_operatortype_append(ACTION_OT_frame_jump);
60   WM_operatortype_append(ACTION_OT_handle_type);
61   WM_operatortype_append(ACTION_OT_interpolation_type);
62   WM_operatortype_append(ACTION_OT_extrapolation_type);
63   WM_operatortype_append(ACTION_OT_easing_type);
64   WM_operatortype_append(ACTION_OT_keyframe_type);
65   WM_operatortype_append(ACTION_OT_sample);
66   WM_operatortype_append(ACTION_OT_clean);
67   WM_operatortype_append(ACTION_OT_delete);
68   WM_operatortype_append(ACTION_OT_duplicate);
69   WM_operatortype_append(ACTION_OT_keyframe_insert);
70   WM_operatortype_append(ACTION_OT_copy);
71   WM_operatortype_append(ACTION_OT_paste);
72
73   WM_operatortype_append(ACTION_OT_new);
74   WM_operatortype_append(ACTION_OT_unlink);
75
76   WM_operatortype_append(ACTION_OT_push_down);
77   WM_operatortype_append(ACTION_OT_stash);
78   WM_operatortype_append(ACTION_OT_stash_and_create);
79
80   WM_operatortype_append(ACTION_OT_layer_next);
81   WM_operatortype_append(ACTION_OT_layer_prev);
82
83   WM_operatortype_append(ACTION_OT_previewrange_set);
84   WM_operatortype_append(ACTION_OT_view_all);
85   WM_operatortype_append(ACTION_OT_view_selected);
86   WM_operatortype_append(ACTION_OT_view_frame);
87
88   WM_operatortype_append(ACTION_OT_markers_make_local);
89 }
90
91 void ED_operatormacros_action(void)
92 {
93   wmOperatorType *ot;
94   wmOperatorTypeMacro *otmacro;
95
96   ot = WM_operatortype_append_macro("ACTION_OT_duplicate_move",
97                                     "Duplicate",
98                                     "Make a copy of all selected keyframes and move them",
99                                     OPTYPE_UNDO | OPTYPE_REGISTER);
100   WM_operatortype_macro_define(ot, "ACTION_OT_duplicate");
101   otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
102   RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE);
103   RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
104 }
105
106 /* ************************** registration - keymaps **********************************/
107
108 /* --------------- */
109
110 void action_keymap(wmKeyConfig *keyconf)
111 {
112   /* keymap for all regions */
113   WM_keymap_ensure(keyconf, "Dopesheet Generic", SPACE_ACTION, 0);
114
115   /* channels */
116   /* Channels are not directly handled by the Action Editor module,
117    * but are inherited from the Animation module.
118    * All the relevant operations, keymaps, drawing, etc.
119    * can therefore all be found in that module instead, as these
120    * are all used for the Graph-Editor too.
121    */
122
123   /* keyframes */
124   WM_keymap_ensure(keyconf, "Dopesheet", SPACE_ACTION, 0);
125 }