Blender V4.3
DNA_armature_types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
11#include "DNA_ID.h"
12#include "DNA_defs.h"
13#include "DNA_listBase.h"
14#include "DNA_userdef_types.h"
15
16#include "BLI_utildefines.h"
17
18#include "BLI_utildefines.h"
19
20#ifdef __cplusplus
21# include "BLI_span.hh"
22namespace blender::animrig {
23class BoneColor;
24}
25#endif
26
27struct AnimData;
28struct BoneCollection;
29
30/* this system works on different transformation space levels;
31 *
32 * 1) Bone Space; with each Bone having its own (0,0,0) origin
33 * 2) Armature Space; the rest position, in Object space, Bones Spaces are applied hierarchical
34 * 3) Pose Space; the animation position, in Object space
35 * 4) World Space; Object matrix applied to Pose or Armature space
36 */
37
53
54typedef struct Bone_Runtime {
55 /* #BoneCollectionReference */
58
59typedef struct Bone {
61 struct Bone *next, *prev;
65 struct Bone *parent;
69 char name[64];
70
72 float roll;
73 float head[3];
75 float tail[3];
77 float bone_mat[3][3];
78
79 int flag;
80
81 char _pad1[4];
82 BoneColor color; /* MUST be named the same as in bPoseChannel and EditBone structs. */
83
85 char _pad[3];
86
87 float arm_head[3];
89 float arm_tail[3];
91 float arm_mat[4][4];
93 float arm_roll;
94
96 float dist, weight;
109
111 float roll1, roll2;
115 float ease1, ease2;
116 float scale_in_x DNA_DEPRECATED, scale_in_z DNA_DEPRECATED;
117 float scale_out_x DNA_DEPRECATED, scale_out_z DNA_DEPRECATED;
118 float scale_in[3], scale_out[3];
119
121 float size[3];
123 int layer;
125 short segments;
128 char _pad2[7];
129
140
141 /* Keep last. */
144
156
157typedef struct bArmature {
159 struct AnimData *adt;
160
162
165 void *_pad1;
166
169
170 /* active bones should work like active object where possible
171 * - active and selection are unrelated
172 * - active & hidden is not allowed
173 * - from the user perspective active == last selected
174 * - active should be ignored when not visible (hidden layer) */
175
180
183 char _pad0[3];
184
185 int flag;
187
189 short pathflag;
190
197 ListBase collections_legacy; /* BoneCollection. */
198
199 struct BoneCollection **collection_array; /* Array of `collection_array_num` BoneCollections. */
207
212 char active_collection_name[64]; /* MAX_NAME. */
213
215 unsigned int layer_used DNA_DEPRECATED;
217 unsigned int layer DNA_DEPRECATED, layer_protected DNA_DEPRECATED;
218
221
224
225#ifdef __cplusplus
226 /* Collection array access for convenient for-loop iteration. */
227 blender::Span<const BoneCollection *> collections_span() const;
228 blender::Span<BoneCollection *> collections_span();
229
230 /* Span of all root collections. */
231 blender::Span<const BoneCollection *> collections_roots() const;
232 blender::Span<BoneCollection *> collections_roots();
233
234 /* Return the span of children of the given bone collection. */
235 blender::Span<const BoneCollection *> collection_children(const BoneCollection *parent) const;
236 blender::Span<BoneCollection *> collection_children(BoneCollection *parent);
237#endif
239
251typedef struct BoneCollection {
253
255 char name[64];
256
259
263
264 /*
265 * Hierarchy information. The Armature has an array of BoneCollection pointers. These are ordered
266 * such that siblings are always stored in consecutive array elements.
267 */
272
275
276#ifdef __cplusplus
286 bool is_visible() const;
287
293 bool is_visible_ancestors() const;
294
303 bool is_visible_with_ancestors() const;
304
308 bool is_solo() const;
314 bool is_expanded() const;
315#endif
317
323
334
335/* armature->flag */
336/* don't use bit 7, was saved in files to disable stuff */
337typedef enum eArmature_Flag {
338 ARM_RESTPOS = (1 << 0),
340 ARM_FLAG_UNUSED_1 = (1 << 1), /* cleared */
341 ARM_DRAWAXES = (1 << 2),
342 ARM_DRAWNAMES = (1 << 3),
343 /* ARM_POSEMODE = (1 << 4), Deprecated. */
347 ARM_DRAW_RELATION_FROM_HEAD = (1 << 5), /* Cleared in versioning of pre-2.80 files. */
354 ARM_BCOLL_SOLO_ACTIVE = (1 << 6), /* Cleared in versioning of pre-2.80 files. */
355 ARM_FLAG_UNUSED_7 = (1 << 7), /* cleared */
356 ARM_MIRROR_EDIT = (1 << 8),
359 ARM_NO_CUSTOM = (1 << 10),
361 ARM_COL_CUSTOM = (1 << 11),
363 ARM_FLAG_UNUSED_12 = (1 << 12), /* cleared */
365 ARM_DS_EXPAND = (1 << 13),
367 ARM_HAS_VIZ_DEPS = (1 << 14),
369
370/* armature->drawtype */
378
379/* armature->deformflag */
381 ARM_DEF_VGROUP = (1 << 0),
385 ARM_DEF_B_BONE_REST = (1 << 3), /* deprecated */
386#endif
389
390#ifdef DNA_DEPRECATED_ALLOW /* Old animation system (armature only viz). */
392typedef enum eArmature_PathFlag {
393 ARM_PATH_FNUMS = (1 << 0),
394 ARM_PATH_KFRAS = (1 << 1),
395 ARM_PATH_HEADS = (1 << 2),
396 ARM_PATH_ACFRA = (1 << 3),
397 ARM_PATH_KFNOS = (1 << 4),
398} eArmature_PathFlag;
399#endif
400
401/* bone->flag */
402typedef enum eBone_Flag {
403 BONE_SELECTED = (1 << 0),
404 BONE_ROOTSEL = (1 << 1),
405 BONE_TIPSEL = (1 << 2),
407 BONE_TRANSFORM = (1 << 3),
409 BONE_CONNECTED = (1 << 4),
410 /* 32 used to be quatrot, was always set in files, do not reuse unless you clear it always */
412 BONE_HIDDEN_P = (1 << 6),
414 BONE_DONE = (1 << 7),
418 BONE_HINGE = (1 << 9),
420 BONE_HIDDEN_A = (1 << 10),
422 BONE_MULT_VG_ENV = (1 << 11),
424 BONE_NO_DEFORM = (1 << 12),
425#ifdef DNA_DEPRECATED_ALLOW
427 BONE_UNKEYED = (1 << 13),
428#endif
431#ifdef DNA_DEPRECATED_ALLOW
433 BONE_NO_SCALE = (1 << 15),
434#endif
436 BONE_HIDDEN_PG = (1 << 16),
438 BONE_DRAWWIRE = (1 << 17),
446 BONE_UNSELECTABLE = (1 << 21),
453 BONE_ADD_PARENT_END_ROLL = (1 << 24),
454#endif
461
462/* bone->inherit_scale_mode */
464 /* Inherit all scale and shear. */
466 /* Inherit scale, but remove final shear. */
468 /* Inherit average scale. */
470 /* Inherit no scale or shear. */
472 /* Inherit effects of shear on parent (same as old disabled Inherit Scale). */
474 /* Inherit parent X scale as child X scale etc. */
477
478/* bone->bbone_prev_type, bbone_next_type */
480 BBONE_HANDLE_AUTO = 0, /* Default mode based on parents & children. */
481 BBONE_HANDLE_ABSOLUTE = 1, /* Custom handle in absolute position mode. */
482 BBONE_HANDLE_RELATIVE = 2, /* Custom handle in relative position mode. */
483 BBONE_HANDLE_TANGENT = 3, /* Custom handle in tangent mode (use direction, not location). */
485
486/* bone->bbone_mapping_mode */
488 BBONE_MAPPING_STRAIGHT = 0, /* Default mode that ignores the rest pose curvature. */
489 BBONE_MAPPING_CURVED = 1, /* Mode that takes the rest pose curvature into account. */
491
492/* bone->bbone_flag */
499
500/* bone->bbone_prev/next_flag */
514
515#define MAXBONENAME 64
516
519 BONE_COLLECTION_VISIBLE = (1 << 0), /* Visibility flag of this particular collection. */
520 BONE_COLLECTION_SELECTABLE = (1 << 1), /* Intended to be implemented in the not-so-far future. */
521 BONE_COLLECTION_OVERRIDE_LIBRARY_LOCAL = (1 << 2), /* Added by a local library override. */
522
530
543
544 BONE_COLLECTION_EXPANDED = (1 << 5), /* Expanded in the tree view. */
547
548#ifdef __cplusplus
549
550inline blender::animrig::BoneColor &BoneColor::wrap()
551{
552 return *reinterpret_cast<blender::animrig::BoneColor *>(this);
553}
554inline const blender::animrig::BoneColor &BoneColor::wrap() const
555{
556 return *reinterpret_cast<const blender::animrig::BoneColor *>(this);
557}
558#endif
#define ENUM_OPERATORS(_type, _max)
ID and Library types, which are fundamental for SDNA.
struct BoneCollectionReference BoneCollectionReference
struct BoneColor BoneColor
struct Bone Bone
eBoneCollection_Flag
@ BONE_COLLECTION_VISIBLE
@ BONE_COLLECTION_SELECTABLE
@ BONE_COLLECTION_ANCESTORS_VISIBLE
@ BONE_COLLECTION_SOLO
@ BONE_COLLECTION_EXPANDED
@ BONE_COLLECTION_OVERRIDE_LIBRARY_LOCAL
struct bArmature_Runtime bArmature_Runtime
eArmature_DeformFlag
@ ARM_DEF_VGROUP
@ ARM_DEF_QUATERNION
@ ARM_DEF_INVERT_VGROUP
@ ARM_DEF_ENVELOPE
struct BoneCollectionMember BoneCollectionMember
eBone_BBoneMappingMode
@ BBONE_MAPPING_STRAIGHT
@ BBONE_MAPPING_CURVED
struct BoneCollection BoneCollection
eBone_BBoneHandleType
@ BBONE_HANDLE_AUTO
@ BBONE_HANDLE_TANGENT
@ BBONE_HANDLE_ABSOLUTE
@ BBONE_HANDLE_RELATIVE
struct Bone_Runtime Bone_Runtime
@ BONE_DRAW_LOCKED_WEIGHT
@ BONE_ROOTSEL
@ BONE_DRAWWIRE
@ BONE_SELECTED
@ BONE_NO_CYCLICOFFSET
@ BONE_TRANSFORM
@ BONE_UNSELECTABLE
@ BONE_DONE
@ BONE_HIDDEN_A
@ BONE_EDITMODE_LOCKED
@ BONE_TRANSFORM_MIRROR
@ BONE_NO_LOCAL_LOCATION
@ BONE_TRANSFORM_CHILD
@ BONE_MULT_VG_ENV
@ BONE_HIDDEN_P
@ BONE_DRAW_ACTIVE
@ BONE_TIPSEL
@ BONE_NO_DEFORM
@ BONE_CONNECTED
@ BONE_RELATIVE_PARENTING
@ BONE_HIDDEN_PG
@ BONE_HINGE
@ BONE_HINGE_CHILD_TRANSFORM
@ ARM_DRAW_RELATION_FROM_HEAD
@ ARM_NO_CUSTOM
@ ARM_HAS_VIZ_DEPS
@ ARM_COL_CUSTOM
@ ARM_DRAWNAMES
@ ARM_DS_EXPAND
@ ARM_BCOLL_SOLO_ACTIVE
@ ARM_FLAG_UNUSED_12
@ ARM_FLAG_UNUSED_7
@ ARM_FLAG_UNUSED_1
@ ARM_MIRROR_EDIT
@ ARM_DRAWAXES
@ ARM_FLAG_UNUSED_9
@ ARM_RESTPOS
struct bArmature bArmature
eArmature_Drawtype
@ ARM_B_BONE
@ ARM_ENVELOPE
eBone_BBoneFlag
@ BBONE_ADD_PARENT_END_ROLL
@ BBONE_SCALE_EASING
eBone_BBoneHandleFlag
@ BBONE_HANDLE_SCALE_EASE
@ BBONE_HANDLE_SCALE_Y
@ BBONE_HANDLE_SCALE_X
@ BBONE_HANDLE_SCALE_ANY
@ BBONE_HANDLE_SCALE_Z
eBone_InheritScaleMode
@ BONE_INHERIT_SCALE_FULL
@ BONE_INHERIT_SCALE_NONE
@ BONE_INHERIT_SCALE_FIX_SHEAR
@ BONE_INHERIT_SCALE_NONE_LEGACY
@ BONE_INHERIT_SCALE_ALIGNED
@ BONE_INHERIT_SCALE_AVERAGE
These structs are the foundation for all linked lists in the library system.
#define DNA_DEPRECATED_ALLOW
float wrap(float value, float max, float min)
Definition node_math.h:71
unsigned char uint8_t
Definition stdint.h:78
signed char int8_t
Definition stdint.h:75
struct BoneCollectionMember * next
struct BoneCollectionMember * prev
struct BoneCollectionReference * next
struct BoneCollectionReference * prev
struct BoneCollection * bcoll
struct IDProperty * prop
struct BoneCollection * next
struct BoneCollection * prev
ThemeWireColor custom
uint8_t _pad0[7]
char _pad[3]
float curve_in_z
float scale_in_x DNA_DEPRECATED
BoneColor color
short bbone_next_flag
short bbone_prev_flag
Bone_Runtime runtime
struct Bone * parent
struct Bone * bbone_prev
float arm_head[3]
float tail[3]
float arm_tail[3]
struct Bone * bbone_next
char inherit_scale_mode
char bbone_prev_type
float curve_in_x
char _pad1[4]
char _pad2[7]
float scale_out[3]
IDProperty * prop
float curve_out_z
char bbone_mapping_mode
float arm_mat[4][4]
float scale_out_x DNA_DEPRECATED
float bone_mat[3][3]
float scale_in[3]
float head[3]
char bbone_next_type
struct Bone * next
float curve_out_x
ListBase childbase
struct Bone * prev
float arm_roll
Definition DNA_ID.h:413
struct BoneCollection * active_collection
unsigned int layer DNA_DEPRECATED
struct AnimData * adt
struct BoneCollection ** collection_array
char active_collection_name[64]
struct GHash * bonehash
struct EditBone * act_edbone
unsigned int layer_used DNA_DEPRECATED
ListBase collections_legacy
ListBase * edbo
struct bArmature_Runtime runtime