Blender  V2.93
armature_ops.c
Go to the documentation of this file.
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) 2009 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include "RNA_access.h"
25 
26 #include "WM_api.h"
27 #include "WM_types.h"
28 
29 #include "ED_armature.h"
30 #include "ED_screen.h"
31 
32 #include "armature_intern.h"
33 
34 /* ************************** registration **********************************/
35 
36 /* Both operators ARMATURE_OT_xxx and POSE_OT_xxx here */
38 {
39  /* EDIT ARMATURE */
41 
47 
50 
60 
72 
75 
79 
80  /* POSE */
83 
86 
92 
95 
97 
105 
114 
119 
122 
124 
126 
128 
130 
131  /* POSELIB */
134 
139 
142 
144 
145  /* POSE SLIDING */
151 }
152 
154 {
156  wmOperatorTypeMacro *otmacro;
157 
159  "ARMATURE_OT_duplicate_move",
160  "Duplicate",
161  "Make copies of the selected bones within the same armature and move them",
163  WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
164  otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
165  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
166 
167  ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_move",
168  "Extrude",
169  "Create new bones from the selected joints and move them",
171  otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
172  RNA_boolean_set(otmacro->ptr, "forked", false);
173  otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
174  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
175 
176  /* XXX would it be nicer to just be able to have standard extrude_move,
177  * but set the forked property separate?
178  * that would require fixing a properties bug T19733. */
179  ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_forked",
180  "Extrude Forked",
181  "Create new bones from the selected joints and move them",
183  otmacro = WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
184  RNA_boolean_set(otmacro->ptr, "forked", true);
185  otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
186  RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
187 }
188 
190 {
191  wmKeyMap *keymap;
192 
193  /* Armature ------------------------ */
194  /* only set in editmode armature, by space_view3d listener */
195  keymap = WM_keymap_ensure(keyconf, "Armature", 0, 0);
196  keymap->poll = ED_operator_editarmature;
197 
198  /* Pose ------------------------ */
199  /* only set in posemode, by space_view3d listener */
200  keymap = WM_keymap_ensure(keyconf, "Pose", 0, 0);
201  keymap->poll = ED_operator_posemode;
202 }
bool ED_operator_posemode(struct bContext *C)
Definition: screen_ops.c:484
bool ED_operator_editarmature(struct bContext *C)
Definition: screen_ops.c:437
@ OPTYPE_UNDO
Definition: WM_types.h:155
@ OPTYPE_REGISTER
Definition: WM_types.h:153
void ARMATURE_OT_subdivide(wmOperatorType *ot)
void ARMATURE_OT_click_extrude(wmOperatorType *ot)
Definition: armature_add.c:260
void ARMATURE_OT_duplicate(wmOperatorType *ot)
void ARMATURE_OT_symmetrize(wmOperatorType *ot)
void ARMATURE_OT_extrude(wmOperatorType *ot)
void ARMATURE_OT_bone_primitive_add(wmOperatorType *ot)
void ARMATURE_OT_hide(wmOperatorType *ot)
void ARMATURE_OT_delete(wmOperatorType *ot)
void ARMATURE_OT_roll_clear(wmOperatorType *ot)
void ARMATURE_OT_fill(wmOperatorType *ot)
void ARMATURE_OT_align(wmOperatorType *ot)
void ARMATURE_OT_calculate_roll(wmOperatorType *ot)
void ARMATURE_OT_switch_direction(wmOperatorType *ot)
void ARMATURE_OT_dissolve(wmOperatorType *ot)
void ARMATURE_OT_reveal(wmOperatorType *ot)
void ARMATURE_OT_split(wmOperatorType *ot)
void POSELIB_OT_unlink(struct wmOperatorType *ot)
Definition: pose_lib.c:282
void POSE_OT_relax_rest(struct wmOperatorType *ot)
Definition: pose_slide.c:1513
void ARMATURE_OT_select_less(struct wmOperatorType *ot)
void ARMATURE_OT_select_all(struct wmOperatorType *ot)
void POSE_OT_select_hierarchy(struct wmOperatorType *ot)
Definition: pose_select.c:826
void ARMATURE_OT_shortest_path_pick(struct wmOperatorType *ot)
void ARMATURE_OT_select_mirror(struct wmOperatorType *ot)
void ARMATURE_OT_separate(struct wmOperatorType *ot)
void POSE_OT_group_unassign(struct wmOperatorType *ot)
Definition: pose_group.c:290
void POSE_OT_reveal(struct wmOperatorType *ot)
Definition: pose_edit.c:1145
void ARMATURE_OT_parent_set(struct wmOperatorType *ot)
void POSE_OT_scale_clear(struct wmOperatorType *ot)
void POSE_OT_group_deselect(struct wmOperatorType *ot)
Definition: pose_group.c:537
void POSE_OT_group_sort(struct wmOperatorType *ot)
Definition: pose_group.c:446
void POSE_OT_quaternions_flip(struct wmOperatorType *ot)
Definition: pose_edit.c:1201
void POSE_OT_autoside_names(struct wmOperatorType *ot)
Definition: pose_edit.c:631
void POSELIB_OT_apply_pose(struct wmOperatorType *ot)
Definition: pose_lib.c:1875
void POSE_OT_relax(struct wmOperatorType *ot)
Definition: pose_slide.c:1394
void POSELIB_OT_pose_rename(struct wmOperatorType *ot)
Definition: pose_lib.c:739
void POSELIB_OT_browse_interactive(struct wmOperatorType *ot)
Definition: pose_lib.c:1830
void ARMATURE_OT_select_more(struct wmOperatorType *ot)
void POSE_OT_group_move(struct wmOperatorType *ot)
Definition: pose_group.c:349
void POSE_OT_paths_calculate(struct wmOperatorType *ot)
Definition: pose_edit.c:335
void POSE_OT_group_remove(struct wmOperatorType *ot)
Definition: pose_group.c:125
void POSELIB_OT_pose_add(struct wmOperatorType *ot)
Definition: pose_lib.c:532
void POSE_OT_copy(struct wmOperatorType *ot)
void POSE_OT_rot_clear(struct wmOperatorType *ot)
void POSELIB_OT_new(struct wmOperatorType *ot)
Definition: pose_lib.c:246
void POSE_OT_select_linked(struct wmOperatorType *ot)
Definition: pose_select.c:568
void POSE_OT_hide(struct wmOperatorType *ot)
Definition: pose_edit.c:1082
void ARMATURE_OT_select_linked(struct wmOperatorType *ot)
void POSE_OT_select_mirror(struct wmOperatorType *ot)
Definition: pose_select.c:1284
void POSE_OT_group_assign(struct wmOperatorType *ot)
Definition: pose_group.c:241
void POSE_OT_flip_names(struct wmOperatorType *ot)
Definition: pose_edit.c:578
void ARMATURE_OT_flip_names(struct wmOperatorType *ot)
void POSE_OT_select_grouped(struct wmOperatorType *ot)
Definition: pose_select.c:1175
void POSE_OT_select_linked_pick(struct wmOperatorType *ot)
Definition: pose_select.c:504
void POSE_OT_push_rest(struct wmOperatorType *ot)
Definition: pose_slide.c:1453
void POSE_OT_visual_transform_apply(struct wmOperatorType *ot)
void POSE_OT_paths_range_update(struct wmOperatorType *ot)
Definition: pose_edit.c:530
void ARMATURE_OT_parent_clear(struct wmOperatorType *ot)
void ARMATURE_OT_select_linked_pick(struct wmOperatorType *ot)
void POSE_OT_select_all(struct wmOperatorType *ot)
Definition: pose_select.c:622
void POSE_OT_push(struct wmOperatorType *ot)
Definition: pose_slide.c:1334
void POSELIB_OT_pose_move(struct wmOperatorType *ot)
Definition: pose_lib.c:815
void ARMATURE_OT_select_hierarchy(struct wmOperatorType *ot)
void POSE_OT_bone_layers(struct wmOperatorType *ot)
Definition: pose_edit.c:932
void POSE_OT_propagate(struct wmOperatorType *ot)
Definition: pose_slide.c:1940
void POSE_OT_rotation_mode_set(struct wmOperatorType *ot)
Definition: pose_edit.c:688
void POSE_OT_user_transforms_clear(struct wmOperatorType *ot)
void POSELIB_OT_pose_remove(struct wmOperatorType *ot)
Definition: pose_lib.c:650
void POSELIB_OT_action_sanitize(struct wmOperatorType *ot)
Definition: pose_lib.c:369
void POSE_OT_paths_update(struct wmOperatorType *ot)
Definition: pose_edit.c:409
void ARMATURE_OT_armature_layers(struct wmOperatorType *ot)
Definition: pose_edit.c:843
void POSE_OT_breakdown(struct wmOperatorType *ot)
Definition: pose_slide.c:1573
void POSE_OT_select_constraint_target(struct wmOperatorType *ot)
Definition: pose_select.c:734
void ARMATURE_OT_bone_layers(struct wmOperatorType *ot)
Definition: pose_edit.c:1008
void POSE_OT_select_parent(struct wmOperatorType *ot)
Definition: pose_select.c:669
void ARMATURE_OT_select_similar(struct wmOperatorType *ot)
void POSE_OT_group_add(struct wmOperatorType *ot)
Definition: pose_group.c:91
void POSE_OT_transforms_clear(struct wmOperatorType *ot)
void POSE_OT_loc_clear(struct wmOperatorType *ot)
void ARMATURE_OT_autoside_names(struct wmOperatorType *ot)
void POSE_OT_group_select(struct wmOperatorType *ot)
Definition: pose_group.c:502
void POSE_OT_paths_clear(struct wmOperatorType *ot)
Definition: pose_edit.c:487
void POSE_OT_armature_apply(struct wmOperatorType *ot)
void ARMATURE_OT_layers_show_all(struct wmOperatorType *ot)
Definition: pose_edit.c:771
void POSE_OT_paste(struct wmOperatorType *ot)
void ED_operatortypes_armature(void)
Definition: armature_ops.c:37
void ED_operatormacros_armature(void)
Definition: armature_ops.c:153
void ED_keymap_armature(wmKeyConfig *keyconf)
Definition: armature_ops.c:189
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
Definition: rna_access.c:6272
bool(* poll)(struct bContext *)
wmOperatorType * ot
Definition: wm_files.c:3156
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition: wm_keymap.c:852
wmOperatorType * WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag)
wmOperatorTypeMacro * WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))