Blender  V3.3
ED_armature.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
8 #pragma once
9 
10 #include <stdbool.h>
11 
12 #include "BLI_listbase.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 struct Base;
19 struct Bone;
20 struct Depsgraph;
21 struct EditBone;
22 struct GPUSelectResult;
23 struct ListBase;
24 struct Main;
25 struct Mesh;
27 struct Object;
28 struct ReportList;
29 struct Scene;
30 struct SelectPick_Params;
31 struct UndoType;
32 struct View3D;
33 struct ViewLayer;
34 struct bAction;
35 struct bArmature;
36 struct bContext;
37 struct bPoseChannel;
38 struct wmKeyConfig;
39 struct wmOperator;
40 
41 #define BONESEL_ROOT (1u << 29)
42 #define BONESEL_TIP (1u << 30)
43 #define BONESEL_BONE (1u << 31)
44 #define BONESEL_ANY (BONESEL_TIP | BONESEL_ROOT | BONESEL_BONE)
45 
46 /* useful macros */
47 #define EBONE_VISIBLE(arm, ebone) \
48  (CHECK_TYPE_INLINE(arm, bArmature *), \
49  CHECK_TYPE_INLINE(ebone, EditBone *), \
50  (((arm)->layer & (ebone)->layer) && !((ebone)->flag & BONE_HIDDEN_A)))
51 
52 #define EBONE_SELECTABLE(arm, ebone) \
53  (EBONE_VISIBLE(arm, ebone) && !((ebone)->flag & BONE_UNSELECTABLE))
54 
55 #define EBONE_EDITABLE(ebone) \
56  (CHECK_TYPE_INLINE(ebone, EditBone *), \
57  (((ebone)->flag & BONE_SELECTED) && !((ebone)->flag & BONE_EDITMODE_LOCKED)))
58 
59 /* Used in `armature_select.c` and `pose_select.c`. */
60 
61 #define BONE_SELECT_PARENT 0
62 #define BONE_SELECT_CHILD 1
63 
64 /* armature_add.c */
65 
71 struct EditBone *ED_armature_ebone_add(struct bArmature *arm, const char *name);
72 struct EditBone *ED_armature_ebone_add_primitive(struct Object *obedit_arm,
73  float length,
74  bool view_aligned);
75 
76 /* armature_edit.c */
77 
82  const float align_axis[3],
83  bool axis_only);
90  struct Main *bmain, struct Object *ob, const float cursor[3], int centermode, int around);
94 void ED_armature_edit_transform(struct bArmature *arm, const float mat[4][4], bool do_props);
95 void ED_armature_transform(struct bArmature *arm, const float mat[4][4], bool do_props);
96 
97 /* armature_naming.c */
98 
103 void ED_armature_ebone_unique_name(struct ListBase *ebones, char *name, struct EditBone *bone);
104 
110 void ED_armature_bone_rename(struct Main *bmain,
111  struct bArmature *arm,
112  const char *oldnamep,
113  const char *newnamep);
124 void ED_armature_bones_flip_names(struct Main *bmain,
125  struct bArmature *arm,
126  struct ListBase *bones_names,
127  bool do_strip_numbers);
128 
129 /* armature_ops.c */
130 
131 void ED_operatortypes_armature(void);
132 void ED_operatormacros_armature(void);
133 void ED_keymap_armature(struct wmKeyConfig *keyconf);
134 
135 /* armature_relations.c */
136 
140 int ED_armature_join_objects_exec(struct bContext *C, struct wmOperator *op);
141 
142 /* armature_select.c */
143 
145  uint bases_len,
146  unsigned int select_id,
147  struct EditBone **r_ebone);
149  uint objects_len,
150  unsigned int select_id,
151  struct EditBone **r_ebone);
153  uint bases_len,
154  unsigned int select_id,
155  struct bPoseChannel **r_pchan);
160  uint bases_len,
161  unsigned int select_id,
162  struct Bone **r_bone);
163 bool ED_armature_edit_deselect_all(struct Object *obedit);
164 bool ED_armature_edit_deselect_all_visible(struct Object *obedit);
165 bool ED_armature_edit_deselect_all_multi_ex(struct Base **bases, uint bases_len);
166 bool ED_armature_edit_deselect_all_visible_multi_ex(struct Base **bases, uint bases_len);
172  struct Base *basact,
173  struct EditBone *ebone,
174  int selmask,
175  const struct SelectPick_Params *params);
180  const int mval[2],
181  const struct SelectPick_Params *params);
194 bool ED_armature_edit_select_op_from_tagged(struct bArmature *arm, int sel_op);
195 
196 /* armature_skinning.c */
197 
198 #define ARM_GROUPS_NAME 1
199 #define ARM_GROUPS_ENVELOPE 2
200 #define ARM_GROUPS_AUTO 3
202  struct Depsgraph *depsgraph,
203  struct Scene *scene,
204  struct Object *ob,
205  struct Object *par,
206  int mode,
207  bool mirror);
208 
209 /* editarmature_undo.c */
210 
212 void ED_armature_undosys_type(struct UndoType *ut);
213 
214 /* armature_utils.c */
215 
217 void ED_armature_edit_sync_selection(struct ListBase *edbo);
228 void ED_armature_ebone_remove_ex(struct bArmature *arm,
229  struct EditBone *exBone,
230  bool clear_connected);
231 void ED_armature_ebone_remove(struct bArmature *arm, struct EditBone *exBone);
232 bool ED_armature_ebone_is_child_recursive(struct EditBone *ebone_parent,
233  struct EditBone *ebone_child);
241 struct EditBone *ED_armature_ebone_find_shared_parent(struct EditBone *ebone_child[],
242  unsigned int ebone_child_tot);
243 void ED_armature_ebone_to_mat3(struct EditBone *ebone, float r_mat[3][3]);
244 void ED_armature_ebone_to_mat4(struct EditBone *ebone, float r_mat[4][4]);
245 void ED_armature_ebone_from_mat3(struct EditBone *ebone, const float mat[3][3]);
246 void ED_armature_ebone_from_mat4(struct EditBone *ebone, const float mat[4][4]);
250 struct EditBone *ED_armature_ebone_find_name(const struct ListBase *edbo, const char *name);
254 struct EditBone *ED_armature_ebone_get_mirrored(const struct ListBase *edbo, struct EditBone *ebo);
256  struct EditBone *ebo,
257  bool check_select);
264 void ED_armature_from_edit(struct Main *bmain, struct bArmature *arm);
266 void ED_armature_to_edit(struct bArmature *arm);
267 void ED_armature_edit_free(struct bArmature *arm);
269 
273 void ED_armature_ebone_listbase_free(struct ListBase *lb, bool do_id_user);
274 void ED_armature_ebone_listbase_copy(struct ListBase *lb_dst,
275  struct ListBase *lb_src,
276  bool do_id_user);
277 
283 
284 /* pose_edit.c */
285 
287 bool ED_object_posemode_exit_ex(struct Main *bmain, struct Object *ob);
288 bool ED_object_posemode_exit(struct bContext *C, struct Object *ob);
290 bool ED_object_posemode_enter_ex(struct Main *bmain, struct Object *ob);
291 bool ED_object_posemode_enter(struct bContext *C, struct Object *ob);
292 
294 typedef enum ePosePathCalcRange {
306  struct Scene *scene,
307  struct Object *ob,
308  ePosePathCalcRange range);
309 
310 /* pose_select.c */
311 
315 bool ED_armature_pose_select_pick_bone(struct ViewLayer *view_layer,
316  struct View3D *v3d,
317  struct Object *ob,
318  struct Bone *bone,
319  const struct SelectPick_Params *params);
327  struct View3D *v3d,
328  struct Base *base,
329  const struct GPUSelectResult *buffer,
330  short hits,
331  const struct SelectPick_Params *params,
332  bool do_nearest);
341 void ED_armature_pose_select_in_wpaint_mode(struct ViewLayer *view_layer,
342  struct Base *base_select);
343 bool ED_pose_deselect_all_multi_ex(struct Base **bases,
344  uint bases_len,
345  int select_mode,
346  bool ignore_visibility);
347 bool ED_pose_deselect_all_multi(struct bContext *C, int select_mode, bool ignore_visibility);
353 bool ED_pose_deselect_all(struct Object *ob, int select_mode, bool ignore_visibility);
354 void ED_pose_bone_select_tag_update(struct Object *ob);
358 void ED_pose_bone_select(struct Object *ob, struct bPoseChannel *pchan, bool select);
359 
360 /* meshlaplacian.c */
361 
362 void ED_mesh_deform_bind_callback(struct Object *object,
363  struct MeshDeformModifierData *mmd,
364  struct Mesh *cagemesh,
365  float *vertexcos,
366  int verts_num,
367  float cagemat[4][4]);
368 
369 /* Pose backups, pose_backup.c */
370 struct PoseBackup;
375  const struct Object *ob, const struct bAction *action) ATTR_WARN_UNUSED_RESULT;
377  const struct Object *ob, const struct bAction *action) ATTR_WARN_UNUSED_RESULT;
378 bool ED_pose_backup_is_selection_relevant(const struct PoseBackup *pose_backup);
379 void ED_pose_backup_restore(const struct PoseBackup *pbd);
380 void ED_pose_backup_free(struct PoseBackup *pbd);
381 
382 #ifdef __cplusplus
383 }
384 #endif
#define ATTR_WARN_UNUSED_RESULT
unsigned int uint
Definition: BLI_sys_types.h:67
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
bool ED_armature_pose_select_pick_with_buffer(struct ViewLayer *view_layer, struct View3D *v3d, struct Base *base, const struct GPUSelectResult *buffer, short hits, const struct SelectPick_Params *params, bool do_nearest)
Definition: pose_select.c:246
int ED_armature_join_objects_exec(struct bContext *C, struct wmOperator *op)
void ED_operatortypes_armature(void)
Definition: armature_ops.c:20
struct Base * ED_armature_base_and_bone_from_select_buffer(struct Base **bases, uint bases_len, unsigned int select_id, struct Bone **r_bone)
bool ED_armature_pose_select_pick_bone(struct ViewLayer *view_layer, struct View3D *v3d, struct Object *ob, struct Bone *bone, const struct SelectPick_Params *params)
Definition: pose_select.c:124
void ED_operatormacros_armature(void)
Definition: armature_ops.c:141
struct EditBone * ED_armature_ebone_get_mirrored(const struct ListBase *edbo, struct EditBone *ebo)
bool ED_object_posemode_exit_ex(struct Main *bmain, struct Object *ob)
Definition: pose_edit.c:115
bool ED_object_posemode_enter(struct bContext *C, struct Object *ob)
Definition: pose_edit.c:100
ePosePathCalcRange
Definition: ED_armature.h:294
@ POSE_PATH_CALC_RANGE_CURRENT_FRAME
Definition: ED_armature.h:295
@ POSE_PATH_CALC_RANGE_CHANGED
Definition: ED_armature.h:296
@ POSE_PATH_CALC_RANGE_FULL
Definition: ED_armature.h:297
bool ED_armature_edit_deselect_all_visible_multi(struct bContext *C)
void ED_armature_pose_select_in_wpaint_mode(struct ViewLayer *view_layer, struct Base *base_select)
Definition: pose_select.c:269
void ED_mesh_deform_bind_callback(struct Object *object, struct MeshDeformModifierData *mmd, struct Mesh *cagemesh, float *vertexcos, int verts_num, float cagemat[4][4])
bool ED_object_posemode_exit(struct bContext *C, struct Object *ob)
Definition: pose_edit.c:128
void ED_keymap_armature(struct wmKeyConfig *keyconf)
Definition: armature_ops.c:177
struct EditBone * ED_armature_ebone_add_primitive(struct Object *obedit_arm, float length, bool view_aligned)
Definition: armature_add.c:86
bool ED_armature_edit_deselect_all(struct Object *obedit)
void ED_armature_bone_rename(struct Main *bmain, struct bArmature *arm, const char *oldnamep, const char *newnamep)
void ED_armature_ebone_from_mat4(struct EditBone *ebone, const float mat[4][4])
void ED_armature_edit_transform(struct bArmature *arm, const float mat[4][4], bool do_props)
Definition: armature_edit.c:53
void ED_armature_ebone_to_mat4(struct EditBone *ebone, float r_mat[4][4])
void ED_pose_bone_select_tag_update(struct Object *ob)
Definition: pose_select.c:80
void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob, ePosePathCalcRange range)
Definition: pose_edit.c:154
void ED_armature_ebone_select_set(struct EditBone *ebone, bool select)
void ED_armature_ebone_remove_ex(struct bArmature *arm, struct EditBone *exBone, bool clear_connected)
void ED_armature_ebone_from_mat3(struct EditBone *ebone, const float mat[3][3])
void ED_armature_ebone_selectflag_set(struct EditBone *ebone, int flag)
struct PoseBackup * ED_pose_backup_create_all_bones(const struct Object *ob, const struct bAction *action) ATTR_WARN_UNUSED_RESULT
struct Base * ED_armature_base_and_pchan_from_select_buffer(struct Base **bases, uint bases_len, unsigned int select_id, struct bPoseChannel **r_pchan)
struct Object * ED_armature_object_and_ebone_from_select_buffer(struct Object **objects, uint objects_len, unsigned int select_id, struct EditBone **r_ebone)
bool ED_pose_backup_is_selection_relevant(const struct PoseBackup *pose_backup)
Definition: pose_backup.cc:101
void ED_armature_ebone_transform_mirror_update(struct bArmature *arm, struct EditBone *ebo, bool check_select)
bool ED_armature_edit_select_pick_bone(struct bContext *C, struct Base *basact, struct EditBone *ebone, int selmask, const struct SelectPick_Params *params)
void ED_pose_backup_free(struct PoseBackup *pbd)
Definition: pose_backup.cc:120
int ED_armature_ebone_selectflag_get(const struct EditBone *ebone)
bool ED_armature_edit_deselect_all_multi_ex(struct Base **bases, uint bases_len)
struct EditBone * ED_armature_ebone_add(struct bArmature *arm, const char *name)
Definition: armature_add.c:51
void ED_armature_ebone_listbase_copy(struct ListBase *lb_dst, struct ListBase *lb_src, bool do_id_user)
bool ED_pose_deselect_all(struct Object *ob, int select_mode, bool ignore_visibility)
Definition: pose_select.c:315
void ED_armature_ebone_selectflag_enable(struct EditBone *ebone, int flag)
void ED_armature_from_edit(struct Main *bmain, struct bArmature *arm)
void ED_armature_edit_validate_active(struct bArmature *arm)
bool ED_pose_deselect_all_multi(struct bContext *C, int select_mode, bool ignore_visibility)
Definition: pose_select.c:397
bool ED_armature_ebone_is_child_recursive(struct EditBone *ebone_parent, struct EditBone *ebone_child)
struct EditBone * ED_armature_ebone_find_shared_parent(struct EditBone *ebone_child[], unsigned int ebone_child_tot)
bool ED_armature_edit_deselect_all_visible(struct Object *obedit)
bool ED_object_posemode_enter_ex(struct Main *bmain, struct Object *ob)
Definition: pose_edit.c:80
void ED_armature_edit_transform_mirror_update(struct Object *obedit)
struct Base * ED_armature_base_and_ebone_from_select_buffer(struct Base **bases, uint bases_len, unsigned int select_id, struct EditBone **r_ebone)
struct EditBone * ED_armature_ebone_find_name(const struct ListBase *edbo, const char *name)
float ED_armature_ebone_roll_to_vector(const struct EditBone *bone, const float align_axis[3], bool axis_only)
void ED_armature_edit_refresh_layer_used(struct bArmature *arm)
void ED_armature_transform(struct bArmature *arm, const float mat[4][4], bool do_props)
Definition: armature_edit.c:90
void ED_object_vgroup_calc_from_armature(struct ReportList *reports, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct Object *par, int mode, bool mirror)
bool ED_armature_edit_select_op_from_tagged(struct bArmature *arm, int sel_op)
void ED_armature_ebone_selectflag_disable(struct EditBone *ebone, int flag)
void ED_armature_ebone_to_mat3(struct EditBone *ebone, float r_mat[3][3])
void ED_armature_edit_free(struct bArmature *arm)
void ED_armature_ebone_listbase_temp_clear(struct ListBase *lb)
void ED_armature_ebone_listbase_free(struct ListBase *lb, bool do_id_user)
void ED_pose_backup_restore(const struct PoseBackup *pbd)
void ED_armature_bones_flip_names(struct Main *bmain, struct bArmature *arm, struct ListBase *bones_names, bool do_strip_numbers)
void ED_armature_undosys_type(struct UndoType *ut)
bool ED_pose_deselect_all_multi_ex(struct Base **bases, uint bases_len, int select_mode, bool ignore_visibility)
Definition: pose_select.c:375
void ED_pose_bone_select(struct Object *ob, struct bPoseChannel *pchan, bool select)
Definition: pose_select.c:95
void ED_armature_ebone_unique_name(struct ListBase *ebones, char *name, struct EditBone *bone)
void ED_armature_to_edit(struct bArmature *arm)
void ED_armature_edit_sync_selection(struct ListBase *edbo)
void ED_armature_ebone_remove(struct bArmature *arm, struct EditBone *exBone)
void ED_armature_origin_set(struct Main *bmain, struct Object *ob, const float cursor[3], int centermode, int around)
bool ED_armature_edit_select_pick(struct bContext *C, const int mval[2], const struct SelectPick_Params *params)
bool ED_armature_edit_deselect_all_visible_multi_ex(struct Base **bases, uint bases_len)
struct PoseBackup * ED_pose_backup_create_selected_bones(const struct Object *ob, const struct bAction *action) ATTR_WARN_UNUSED_RESULT
struct Object * ED_pose_object_from_context(struct bContext *C)
Definition: pose_edit.c:61
#define C
Definition: RandGen.cpp:25
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: avxb.h:154
Scene scene
const Depsgraph * depsgraph
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
ccl_global float * buffer
T length(const vec_base< T, Size > &a)
char name[64]
Definition: BKE_armature.h:43
struct EditBone * ebone
Definition: BKE_armature.h:105
struct Bone * bone
Definition: BKE_armature.h:106
Definition: BKE_main.h:121