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

armature_ops.c « armature « editors « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 364e778fc2ee15c0d1c0b740c38d689358443af6 (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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * The Original Code is Copyright (C) 2009 Blender Foundation.
 * All rights reserved.
 */

/** \file
 * \ingroup edarmature
 */

#include "RNA_access.h"

#include "WM_api.h"
#include "WM_types.h"

#include "ED_armature.h"
#include "ED_screen.h"

#include "armature_intern.h"

/* ************************** registration **********************************/

void ED_operatortypes_armature(void)
{
  /* Both operators `ARMATURE_OT_*` and `POSE_OT_*` are registered here. */

  /* EDIT ARMATURE */
  WM_operatortype_append(ARMATURE_OT_bone_primitive_add);

  WM_operatortype_append(ARMATURE_OT_align);
  WM_operatortype_append(ARMATURE_OT_calculate_roll);
  WM_operatortype_append(ARMATURE_OT_roll_clear);
  WM_operatortype_append(ARMATURE_OT_switch_direction);
  WM_operatortype_append(ARMATURE_OT_subdivide);

  WM_operatortype_append(ARMATURE_OT_parent_set);
  WM_operatortype_append(ARMATURE_OT_parent_clear);

  WM_operatortype_append(ARMATURE_OT_select_all);
  WM_operatortype_append(ARMATURE_OT_select_mirror);
  WM_operatortype_append(ARMATURE_OT_select_more);
  WM_operatortype_append(ARMATURE_OT_select_less);
  WM_operatortype_append(ARMATURE_OT_select_hierarchy);
  WM_operatortype_append(ARMATURE_OT_select_linked);
  WM_operatortype_append(ARMATURE_OT_select_linked_pick);
  WM_operatortype_append(ARMATURE_OT_select_similar);
  WM_operatortype_append(ARMATURE_OT_shortest_path_pick);

  WM_operatortype_append(ARMATURE_OT_delete);
  WM_operatortype_append(ARMATURE_OT_dissolve);
  WM_operatortype_append(ARMATURE_OT_duplicate);
  WM_operatortype_append(ARMATURE_OT_symmetrize);
  WM_operatortype_append(ARMATURE_OT_extrude);
  WM_operatortype_append(ARMATURE_OT_hide);
  WM_operatortype_append(ARMATURE_OT_reveal);
  WM_operatortype_append(ARMATURE_OT_click_extrude);
  WM_operatortype_append(ARMATURE_OT_fill);
  WM_operatortype_append(ARMATURE_OT_separate);
  WM_operatortype_append(ARMATURE_OT_split);

  WM_operatortype_append(ARMATURE_OT_autoside_names);
  WM_operatortype_append(ARMATURE_OT_flip_names);

  WM_operatortype_append(ARMATURE_OT_layers_show_all);
  WM_operatortype_append(ARMATURE_OT_armature_layers);
  WM_operatortype_append(ARMATURE_OT_bone_layers);

  /* POSE */
  WM_operatortype_append(POSE_OT_hide);
  WM_operatortype_append(POSE_OT_reveal);

  WM_operatortype_append(POSE_OT_armature_apply);
  WM_operatortype_append(POSE_OT_visual_transform_apply);

  WM_operatortype_append(POSE_OT_rot_clear);
  WM_operatortype_append(POSE_OT_loc_clear);
  WM_operatortype_append(POSE_OT_scale_clear);
  WM_operatortype_append(POSE_OT_transforms_clear);
  WM_operatortype_append(POSE_OT_user_transforms_clear);

  WM_operatortype_append(POSE_OT_copy);
  WM_operatortype_append(POSE_OT_paste);

  WM_operatortype_append(POSE_OT_select_all);

  WM_operatortype_append(POSE_OT_select_parent);
  WM_operatortype_append(POSE_OT_select_hierarchy);
  WM_operatortype_append(POSE_OT_select_linked);
  WM_operatortype_append(POSE_OT_select_linked_pick);
  WM_operatortype_append(POSE_OT_select_constraint_target);
  WM_operatortype_append(POSE_OT_select_grouped);
  WM_operatortype_append(POSE_OT_select_mirror);

  WM_operatortype_append(POSE_OT_group_add);
  WM_operatortype_append(POSE_OT_group_remove);
  WM_operatortype_append(POSE_OT_group_move);
  WM_operatortype_append(POSE_OT_group_sort);
  WM_operatortype_append(POSE_OT_group_assign);
  WM_operatortype_append(POSE_OT_group_unassign);
  WM_operatortype_append(POSE_OT_group_select);
  WM_operatortype_append(POSE_OT_group_deselect);

  WM_operatortype_append(POSE_OT_paths_calculate);
  WM_operatortype_append(POSE_OT_paths_update);
  WM_operatortype_append(POSE_OT_paths_clear);
  WM_operatortype_append(POSE_OT_paths_range_update);

  WM_operatortype_append(POSE_OT_autoside_names);
  WM_operatortype_append(POSE_OT_flip_names);

  WM_operatortype_append(POSE_OT_rotation_mode_set);

  WM_operatortype_append(POSE_OT_quaternions_flip);

  WM_operatortype_append(POSE_OT_bone_layers);

  WM_operatortype_append(POSE_OT_propagate);

  /* POSELIB */
  WM_operatortype_append(POSELIB_OT_browse_interactive);
  WM_operatortype_append(POSELIB_OT_apply_pose);
  WM_operatortype_append(POSELIB_OT_apply_pose_asset);
  WM_operatortype_append(POSELIB_OT_blend_pose_asset);

  WM_operatortype_append(POSELIB_OT_pose_add);
  WM_operatortype_append(POSELIB_OT_pose_remove);
  WM_operatortype_append(POSELIB_OT_pose_rename);
  WM_operatortype_append(POSELIB_OT_pose_move);

  WM_operatortype_append(POSELIB_OT_new);
  WM_operatortype_append(POSELIB_OT_unlink);

  WM_operatortype_append(POSELIB_OT_action_sanitize);

  /* POSE SLIDING */
  WM_operatortype_append(POSE_OT_push);
  WM_operatortype_append(POSE_OT_relax);
  WM_operatortype_append(POSE_OT_push_rest);
  WM_operatortype_append(POSE_OT_relax_rest);
  WM_operatortype_append(POSE_OT_breakdown);
  WM_operatortype_append(POSE_OT_blend_to_neighbors);
}

void ED_operatormacros_armature(void)
{
  wmOperatorType *ot;
  wmOperatorTypeMacro *otmacro;

  ot = WM_operatortype_append_macro(
      "ARMATURE_OT_duplicate_move",
      "Duplicate",
      "Make copies of the selected bones within the same armature and move them",
      OPTYPE_UNDO | OPTYPE_REGISTER);
  WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
  otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);

  ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_move",
                                    "Extrude",
                                    "Create new bones from the selected joints and move them",
                                    OPTYPE_UNDO | OPTYPE_REGISTER);
  otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
  RNA_boolean_set(otmacro->ptr, "forked", false);
  otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);

  /* XXX would it be nicer to just be able to have standard extrude_move,
   * but set the forked property separate?
   * that would require fixing a properties bug T19733. */
  ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_forked",
                                    "Extrude Forked",
                                    "Create new bones from the selected joints and move them",
                                    OPTYPE_UNDO | OPTYPE_REGISTER);
  otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
  RNA_boolean_set(otmacro->ptr, "forked", true);
  otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
}

void ED_keymap_armature(wmKeyConfig *keyconf)
{
  wmKeyMap *keymap;

  /* Armature ------------------------ */
  /* only set in editmode armature, by space_view3d listener */
  keymap = WM_keymap_ensure(keyconf, "Armature", 0, 0);
  keymap->poll = ED_operator_editarmature;

  /* Pose ------------------------ */
  /* only set in posemode, by space_view3d listener */
  keymap = WM_keymap_ensure(keyconf, "Pose", 0, 0);
  keymap->poll = ED_operator_posemode;
}