Blender  V2.93
ED_armature.h
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) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 struct Base;
31 struct Bone;
32 struct Depsgraph;
33 struct EditBone;
34 struct ListBase;
35 struct Main;
36 struct Mesh;
38 struct Object;
39 struct ReportList;
40 struct Scene;
41 struct UndoType;
42 struct View3D;
43 struct ViewLayer;
44 struct bArmature;
45 struct bContext;
46 struct bPoseChannel;
47 struct wmKeyConfig;
48 struct wmOperator;
49 
50 #define BONESEL_ROOT (1u << 29)
51 #define BONESEL_TIP (1u << 30)
52 #define BONESEL_BONE (1u << 31)
53 #define BONESEL_ANY (BONESEL_TIP | BONESEL_ROOT | BONESEL_BONE)
54 
55 /* useful macros */
56 #define EBONE_VISIBLE(arm, ebone) \
57  (CHECK_TYPE_INLINE(arm, bArmature *), \
58  CHECK_TYPE_INLINE(ebone, EditBone *), \
59  (((arm)->layer & (ebone)->layer) && !((ebone)->flag & BONE_HIDDEN_A)))
60 
61 #define EBONE_SELECTABLE(arm, ebone) \
62  (EBONE_VISIBLE(arm, ebone) && !((ebone)->flag & BONE_UNSELECTABLE))
63 
64 #define EBONE_EDITABLE(ebone) \
65  (CHECK_TYPE_INLINE(ebone, EditBone *), \
66  (((ebone)->flag & BONE_SELECTED) && !((ebone)->flag & BONE_EDITMODE_LOCKED)))
67 
68 /* used in armature_select.c and pose_select.c */
69 #define BONE_SELECT_PARENT 0
70 #define BONE_SELECT_CHILD 1
71 
72 /* armature_add.c */
73 struct EditBone *ED_armature_ebone_add(struct bArmature *arm, const char *name);
74 struct EditBone *ED_armature_ebone_add_primitive(struct Object *obedit_arm,
75  float length,
76  bool view_aligned);
77 
78 /* armature_edit.c */
80  const float align_axis[3],
81  const bool axis_only);
83  struct Main *bmain, struct Object *ob, const float cursor[3], int centermode, int around);
84 void ED_armature_edit_transform(struct bArmature *arm, const float mat[4][4], const bool do_props);
85 void ED_armature_transform(struct bArmature *arm, const float mat[4][4], const bool do_props);
86 
87 /* armature_naming.c */
88 void ED_armature_ebone_unique_name(struct ListBase *ebones, char *name, struct EditBone *bone);
89 void ED_armature_bone_rename(struct Main *bmain,
90  struct bArmature *arm,
91  const char *oldnamep,
92  const char *newnamep);
93 void ED_armature_bones_flip_names(struct Main *bmain,
94  struct bArmature *arm,
95  struct ListBase *bones_names,
96  const bool do_strip_numbers);
97 
98 /* armature_ops.c */
99 void ED_operatortypes_armature(void);
100 void ED_operatormacros_armature(void);
101 void ED_keymap_armature(struct wmKeyConfig *keyconf);
102 
103 /* armature_relations.c */
104 int ED_armature_join_objects_exec(struct bContext *C, struct wmOperator *op);
105 
106 /* armature_select.c */
108  uint bases_len,
109  int hit,
110  struct EditBone **r_ebone);
112  uint objects_len,
113  int hit,
114  struct EditBone **r_ebone);
116  uint bases_len,
117  int hit,
118  struct bPoseChannel **r_pchan);
120  uint bases_len,
121  int hit,
122  struct Bone **r_bone);
123 bool ED_armature_edit_deselect_all(struct Object *obedit);
124 bool ED_armature_edit_deselect_all_visible(struct Object *obedit);
125 bool ED_armature_edit_deselect_all_multi_ex(struct Base **bases, uint bases_len);
126 bool ED_armature_edit_deselect_all_visible_multi_ex(struct Base **bases, uint bases_len);
129  struct Base *basact,
130  struct EditBone *ebone,
131  int selmask,
132  bool extend,
133  bool deselect,
134  bool toggle);
136  struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
137 bool ED_armature_edit_select_op_from_tagged(struct bArmature *arm, const int sel_op);
138 
139 /* armature_skinning.c */
140 #define ARM_GROUPS_NAME 1
141 #define ARM_GROUPS_ENVELOPE 2
142 #define ARM_GROUPS_AUTO 3
144  struct Depsgraph *depsgraph,
145  struct Scene *scene,
146  struct Object *ob,
147  struct Object *par,
148  const int mode,
149  const bool mirror);
150 
151 /* editarmature_undo.c */
152 void ED_armature_undosys_type(struct UndoType *ut);
153 
154 /* armature_utils.c */
155 void ED_armature_edit_sync_selection(struct ListBase *edbo);
158 void ED_armature_ebone_remove_ex(struct bArmature *arm,
159  struct EditBone *exBone,
160  bool clear_connected);
161 void ED_armature_ebone_remove(struct bArmature *arm, struct EditBone *exBone);
162 bool ED_armature_ebone_is_child_recursive(struct EditBone *ebone_parent,
163  struct EditBone *ebone_child);
164 struct EditBone *ED_armature_ebone_find_shared_parent(struct EditBone *ebone_child[],
165  const unsigned int ebone_child_tot);
166 void ED_armature_ebone_to_mat3(struct EditBone *ebone, float r_mat[3][3]);
167 void ED_armature_ebone_to_mat4(struct EditBone *ebone, float r_mat[4][4]);
168 void ED_armature_ebone_from_mat3(struct EditBone *ebone, const float mat[3][3]);
169 void ED_armature_ebone_from_mat4(struct EditBone *ebone, const float mat[4][4]);
170 struct EditBone *ED_armature_ebone_find_name(const struct ListBase *edbo, const char *name);
171 struct EditBone *ED_armature_ebone_get_mirrored(const struct ListBase *edbo, struct EditBone *ebo);
173  struct EditBone *ebo,
174  bool check_select);
176 void ED_armature_from_edit(struct Main *bmain, struct bArmature *arm);
177 void ED_armature_to_edit(struct bArmature *arm);
178 void ED_armature_edit_free(struct bArmature *arm);
180 void ED_armature_ebone_listbase_free(struct ListBase *lb, const bool do_id_user);
181 void ED_armature_ebone_listbase_copy(struct ListBase *lb_dst,
182  struct ListBase *lb_src,
183  const bool do_id_user);
184 
185 /* low level selection functions which handle */
191 
192 /* pose_edit.c */
194 bool ED_object_posemode_exit_ex(struct Main *bmain, struct Object *ob);
195 bool ED_object_posemode_exit(struct bContext *C, struct Object *ob);
196 bool ED_object_posemode_enter_ex(struct Main *bmain, struct Object *ob);
197 bool ED_object_posemode_enter(struct bContext *C, struct Object *ob);
198 
199 /* Corresponds to eAnimvizCalcRange. */
200 typedef enum ePosePathCalcRange {
206  struct Scene *scene,
207  struct Object *ob,
208  ePosePathCalcRange range);
209 
210 /* pose_select.c */
211 void ED_armature_pose_select_pick_bone(struct ViewLayer *view_layer,
212  struct View3D *v3d,
213  struct Object *ob,
214  struct Bone *bone,
215  bool extend,
216  bool deselect,
217  bool toggle);
219  struct View3D *v3d,
220  struct Base *base,
221  const unsigned int *buffer,
222  short hits,
223  bool extend,
224  bool deselect,
225  bool toggle,
226  bool do_nearest);
227 void ED_armature_pose_select_in_wpaint_mode(struct ViewLayer *view_layer,
228  struct Base *base_select);
229 bool ED_pose_deselect_all_multi_ex(struct Base **bases,
230  uint bases_len,
231  int select_mode,
232  const bool ignore_visibility);
233 bool ED_pose_deselect_all_multi(struct bContext *C, int select_mode, const bool ignore_visibility);
234 bool ED_pose_deselect_all(struct Object *ob, int select_mode, const bool ignore_visibility);
235 void ED_pose_bone_select_tag_update(struct Object *ob);
236 void ED_pose_bone_select(struct Object *ob, struct bPoseChannel *pchan, bool select);
237 
238 /* meshlaplacian.c */
240  struct Mesh *cagemesh,
241  float *vertexcos,
242  int totvert,
243  float cagemat[4][4]);
244 
245 #ifdef __cplusplus
246 }
247 #endif
unsigned int uint
Definition: BLI_sys_types.h:83
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
int ED_armature_join_objects_exec(struct bContext *C, struct wmOperator *op)
void ED_operatortypes_armature(void)
Definition: armature_ops.c:37
bool ED_armature_edit_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle)
void ED_armature_bones_flip_names(struct Main *bmain, struct bArmature *arm, struct ListBase *bones_names, const bool do_strip_numbers)
void ED_operatormacros_armature(void)
Definition: armature_ops.c:153
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:129
void ED_object_vgroup_calc_from_armature(struct ReportList *reports, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct Object *par, const int mode, const bool mirror)
bool ED_armature_pose_select_pick_with_buffer(struct ViewLayer *view_layer, struct View3D *v3d, struct Base *base, const unsigned int *buffer, short hits, bool extend, bool deselect, bool toggle, bool do_nearest)
Definition: pose_select.c:245
bool ED_object_posemode_enter(struct bContext *C, struct Object *ob)
Definition: pose_edit.c:114
ePosePathCalcRange
Definition: ED_armature.h:200
@ POSE_PATH_CALC_RANGE_CURRENT_FRAME
Definition: ED_armature.h:201
@ POSE_PATH_CALC_RANGE_CHANGED
Definition: ED_armature.h:202
@ POSE_PATH_CALC_RANGE_FULL
Definition: ED_armature.h:203
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:280
bool ED_pose_deselect_all(struct Object *ob, int select_mode, const bool ignore_visibility)
Definition: pose_select.c:329
bool ED_object_posemode_exit(struct bContext *C, struct Object *ob)
Definition: pose_edit.c:142
void ED_keymap_armature(struct wmKeyConfig *keyconf)
Definition: armature_ops.c:189
struct Object * ED_armature_object_and_ebone_from_select_buffer(struct Object **objects, uint objects_len, int hit, struct EditBone **r_ebone)
struct EditBone * ED_armature_ebone_add_primitive(struct Object *obedit_arm, float length, bool view_aligned)
Definition: armature_add.c:105
bool ED_armature_edit_select_op_from_tagged(struct bArmature *arm, const int sel_op)
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])
bool ED_pose_deselect_all_multi_ex(struct Base **bases, uint bases_len, int select_mode, const bool ignore_visibility)
Definition: pose_select.c:389
void ED_armature_ebone_to_mat4(struct EditBone *ebone, float r_mat[4][4])
void ED_armature_transform(struct bArmature *arm, const float mat[4][4], const bool do_props)
void ED_pose_bone_select_tag_update(struct Object *ob)
Definition: pose_select.c:96
void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob, ePosePathCalcRange range)
Definition: pose_edit.c:203
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)
void ED_armature_ebone_transform_mirror_update(struct bArmature *arm, struct EditBone *ebo, bool check_select)
struct EditBone * ED_armature_ebone_find_shared_parent(struct EditBone *ebone_child[], const unsigned int ebone_child_tot)
int ED_armature_ebone_selectflag_get(const struct EditBone *ebone)
float ED_armature_ebone_roll_to_vector(const struct EditBone *bone, const float align_axis[3], const bool axis_only)
bool ED_armature_edit_deselect_all_multi_ex(struct Base **bases, uint bases_len)
bool ED_armature_edit_select_pick_bone(struct bContext *C, struct Base *basact, struct EditBone *ebone, int selmask, bool extend, bool deselect, bool toggle)
struct EditBone * ED_armature_ebone_add(struct bArmature *arm, const char *name)
Definition: armature_add.c:69
bool ED_pose_deselect_all_multi(struct bContext *C, int select_mode, const bool ignore_visibility)
Definition: pose_select.c:411
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_armature_ebone_is_child_recursive(struct EditBone *ebone_parent, struct EditBone *ebone_child)
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:94
void ED_armature_edit_transform_mirror_update(struct Object *obedit)
struct Base * ED_armature_base_and_pchan_from_select_buffer(struct Base **bases, uint bases_len, int hit, struct bPoseChannel **r_pchan)
void ED_mesh_deform_bind_callback(struct MeshDeformModifierData *mmd, struct Mesh *cagemesh, float *vertexcos, int totvert, float cagemat[4][4])
struct EditBone * ED_armature_ebone_find_name(const struct ListBase *edbo, const char *name)
void ED_armature_edit_refresh_layer_used(struct bArmature *arm)
void ED_armature_pose_select_pick_bone(struct ViewLayer *view_layer, struct View3D *v3d, struct Object *ob, struct Bone *bone, bool extend, bool deselect, bool toggle)
Definition: pose_select.c:141
void ED_armature_edit_transform(struct bArmature *arm, const float mat[4][4], const bool do_props)
Definition: armature_edit.c:72
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_undosys_type(struct UndoType *ut)
void ED_pose_bone_select(struct Object *ob, struct bPoseChannel *pchan, bool select)
Definition: pose_select.c:112
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_ebone_listbase_copy(struct ListBase *lb_dst, struct ListBase *lb_src, const bool do_id_user)
void ED_armature_ebone_listbase_free(struct ListBase *lb, const bool do_id_user)
struct Base * ED_armature_base_and_ebone_from_select_buffer(struct Base **bases, uint bases_len, int hit, struct EditBone **r_ebone)
void ED_armature_origin_set(struct Main *bmain, struct Object *ob, const float cursor[3], int centermode, int around)
bool ED_armature_edit_deselect_all_visible_multi_ex(struct Base **bases, uint bases_len)
struct Base * ED_armature_base_and_bone_from_select_buffer(struct Base **bases, uint bases_len, int hit, struct Bone **r_bone)
struct Object * ED_pose_object_from_context(struct bContext *C)
Definition: pose_edit.c:76
#define C
Definition: RandGen.cpp:39
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
Definition: btQuaternion.h:895
Scene scene
const Depsgraph * depsgraph
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
char name[64]
Definition: BKE_armature.h:57
struct EditBone * ebone
Definition: BKE_armature.h:112
struct Bone * bone
Definition: BKE_armature.h:113
Definition: BKE_main.h:116
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: util_avxb.h:167