Blender V4.5
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
8
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
38typedef struct BoneColor {
46 uint8_t _pad0[7];
48#ifdef __cplusplus
50 const blender::animrig::BoneColor &wrap() const;
51#endif
53
54typedef struct Bone_Runtime {
55 /* #BoneCollectionReference */
58
59typedef struct Bone {
61 struct Bone *next, *prev;
71 void *_pad0;
73 struct Bone *parent;
77 char name[/*MAXBONENAME*/ 64];
78
80 float roll;
81 float head[3];
83 float tail[3];
85 float bone_mat[3][3];
86
87 int flag;
88 int8_t drawtype; /* eArmature_Drawtype */
89 char _pad1[3];
90 BoneColor color; /* MUST be named the same as in bPoseChannel and EditBone structs. */
91
93 char _pad[3];
94
95 float arm_head[3];
97 float arm_tail[3];
99 float arm_mat[4][4];
101 float arm_roll;
102
104 float dist, weight;
117
119 float roll1, roll2;
123 float ease1, ease2;
124 float scale_in_x DNA_DEPRECATED, scale_in_z DNA_DEPRECATED;
125 float scale_out_x DNA_DEPRECATED, scale_out_z DNA_DEPRECATED;
126 float scale_in[3], scale_out[3];
127
129 float size[3];
131 int layer;
133 short segments;
136 char _pad2[7];
137
148
149 /* Keep last. */
152
164
165typedef struct bArmature {
166#ifdef __cplusplus
168 static constexpr ID_Type id_type = ID_AR;
169#endif
170
172 struct AnimData *adt;
173
175
178 void *_pad1;
179
182
183 /* active bones should work like active object where possible
184 * - active and selection are unrelated
185 * - active & hidden is not allowed
186 * - from the user perspective active == last selected
187 * - active should be ignored when not visible (hidden layer) */
188
193
196 char _pad0[3];
197
198 int flag;
199 int drawtype; /* eArmature_Drawtype */
200
202 short pathflag;
203
210 ListBase collections_legacy; /* BoneCollection. */
211
212 struct BoneCollection **collection_array; /* Array of `collection_array_num` BoneCollections. */
220
225 char active_collection_name[/*MAX_NAME*/ 64];
226
228 unsigned int layer_used DNA_DEPRECATED;
230 unsigned int layer DNA_DEPRECATED, layer_protected DNA_DEPRECATED;
231
234
237
238#ifdef __cplusplus
239 /* Collection array access for convenient for-loop iteration. */
240 blender::Span<const BoneCollection *> collections_span() const;
241 blender::Span<BoneCollection *> collections_span();
242
243 /* Span of all root collections. */
244 blender::Span<const BoneCollection *> collections_roots() const;
245 blender::Span<BoneCollection *> collections_roots();
246
247 /* Return the span of children of the given bone collection. */
248 blender::Span<const BoneCollection *> collection_children(const BoneCollection *parent) const;
249 blender::Span<BoneCollection *> collection_children(BoneCollection *parent);
250#endif
252
264typedef struct BoneCollection {
266
267 char name[/*MAX_NAME*/ 64];
268
271
273 uint8_t flags;
274 uint8_t _pad0[7];
275
276 /*
277 * Hierarchy information. The Armature has an array of BoneCollection pointers. These are ordered
278 * such that siblings are always stored in consecutive array elements.
279 */
284
294
295#ifdef __cplusplus
305 bool is_visible() const;
306
312 bool is_visible_ancestors() const;
313
322 bool is_visible_with_ancestors() const;
323
327 bool is_solo() const;
333 bool is_expanded() const;
334#endif
336
342
353
354/* armature->flag */
355/* don't use bit 7, was saved in files to disable stuff */
356typedef enum eArmature_Flag {
357 ARM_RESTPOS = (1 << 0),
359 ARM_FLAG_UNUSED_1 = (1 << 1), /* cleared */
360 ARM_DRAWAXES = (1 << 2),
361 ARM_DRAWNAMES = (1 << 3),
362 /* ARM_POSEMODE = (1 << 4), Deprecated. */
366 ARM_DRAW_RELATION_FROM_HEAD = (1 << 5), /* Cleared in versioning of pre-2.80 files. */
373 ARM_BCOLL_SOLO_ACTIVE = (1 << 6), /* Cleared in versioning of pre-2.80 files. */
374 ARM_FLAG_UNUSED_7 = (1 << 7), /* cleared */
375 ARM_MIRROR_EDIT = (1 << 8),
378 ARM_NO_CUSTOM = (1 << 10),
380 ARM_COL_CUSTOM = (1 << 11),
382 ARM_FLAG_UNUSED_12 = (1 << 12), /* cleared */
384 ARM_DS_EXPAND = (1 << 13),
386 ARM_HAS_VIZ_DEPS = (1 << 14),
388
389/* armature->drawtype */
398
399/* armature->deformflag */
401 ARM_DEF_VGROUP = (1 << 0),
405 ARM_DEF_B_BONE_REST = (1 << 3), /* deprecated */
406#endif
409
410#ifdef DNA_DEPRECATED_ALLOW /* Old animation system (armature only viz). */
412typedef enum eArmature_PathFlag {
413 ARM_PATH_FNUMS = (1 << 0),
414 ARM_PATH_KFRAS = (1 << 1),
415 ARM_PATH_HEADS = (1 << 2),
416 ARM_PATH_ACFRA = (1 << 3),
417 ARM_PATH_KFNOS = (1 << 4),
418} eArmature_PathFlag;
419#endif
420
421/* bone->flag */
422typedef enum eBone_Flag {
433 BONE_SELECTED = (1 << 0),
434 BONE_ROOTSEL = (1 << 1),
435 BONE_TIPSEL = (1 << 2),
437 BONE_TRANSFORM = (1 << 3),
439 BONE_CONNECTED = (1 << 4),
440 /* 32 used to be quatrot, was always set in files, do not reuse unless you clear it always */
445 BONE_HIDDEN_P = (1 << 6),
447 BONE_DONE = (1 << 7),
451 BONE_HINGE = (1 << 9),
456 BONE_HIDDEN_A = (1 << 10),
458 BONE_MULT_VG_ENV = (1 << 11),
460 BONE_NO_DEFORM = (1 << 12),
461#ifdef DNA_DEPRECATED_ALLOW
463 BONE_UNKEYED = (1 << 13),
464#endif
467#ifdef DNA_DEPRECATED_ALLOW
469 BONE_NO_SCALE = (1 << 15),
470#endif
472 BONE_DRAWWIRE = (1 << 17),
480 BONE_UNSELECTABLE = (1 << 21),
485#ifdef DNA_DEPRECATED_ALLOW
487 BONE_ADD_PARENT_END_ROLL = (1 << 24),
488#endif
495
496/* bone->inherit_scale_mode */
498 /* Inherit all scale and shear. */
500 /* Inherit scale, but remove final shear. */
502 /* Inherit average scale. */
504 /* Inherit no scale or shear. */
506 /* Inherit effects of shear on parent (same as old disabled Inherit Scale). */
508 /* Inherit parent X scale as child X scale etc. */
511
512/* bone->bbone_prev_type, bbone_next_type */
514 BBONE_HANDLE_AUTO = 0, /* Default mode based on parents & children. */
515 BBONE_HANDLE_ABSOLUTE = 1, /* Custom handle in absolute position mode. */
516 BBONE_HANDLE_RELATIVE = 2, /* Custom handle in relative position mode. */
517 BBONE_HANDLE_TANGENT = 3, /* Custom handle in tangent mode (use direction, not location). */
519
520/* bone->bbone_mapping_mode */
522 BBONE_MAPPING_STRAIGHT = 0, /* Default mode that ignores the rest pose curvature. */
523 BBONE_MAPPING_CURVED = 1, /* Mode that takes the rest pose curvature into account. */
525
526/* bone->bbone_flag */
533
534/* bone->bbone_prev/next_flag */
548
549#define MAXBONENAME 64
550
553 BONE_COLLECTION_VISIBLE = (1 << 0), /* Visibility flag of this particular collection. */
554 BONE_COLLECTION_SELECTABLE = (1 << 1), /* Intended to be implemented in the not-so-far future. */
555 BONE_COLLECTION_OVERRIDE_LIBRARY_LOCAL = (1 << 2), /* Added by a local library override. */
556
564
577
578 BONE_COLLECTION_EXPANDED = (1 << 5), /* Expanded in the tree view. */
581
582#ifdef __cplusplus
583
584inline blender::animrig::BoneColor &BoneColor::wrap()
585{
586 return *reinterpret_cast<blender::animrig::BoneColor *>(this);
587}
588inline const blender::animrig::BoneColor &BoneColor::wrap() const
589{
590 return *reinterpret_cast<const blender::animrig::BoneColor *>(this);
591}
592#endif
#define ENUM_OPERATORS(_type, _max)
ID and Library types, which are fundamental for SDNA.
ID_Type
@ ID_AR
eBoneCollection_Flag
@ BONE_COLLECTION_VISIBLE
@ BONE_COLLECTION_SELECTABLE
@ BONE_COLLECTION_ANCESTORS_VISIBLE
@ BONE_COLLECTION_SOLO
@ BONE_COLLECTION_EXPANDED
@ BONE_COLLECTION_OVERRIDE_LIBRARY_LOCAL
eArmature_DeformFlag
@ ARM_DEF_VGROUP
@ ARM_DEF_QUATERNION
@ ARM_DEF_INVERT_VGROUP
@ ARM_DEF_ENVELOPE
eBone_BBoneMappingMode
@ BBONE_MAPPING_STRAIGHT
@ BBONE_MAPPING_CURVED
eBone_BBoneHandleType
@ BBONE_HANDLE_AUTO
@ BBONE_HANDLE_TANGENT
@ BBONE_HANDLE_ABSOLUTE
@ BBONE_HANDLE_RELATIVE
@ 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_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
eArmature_Drawtype
@ ARM_DRAW_TYPE_ENVELOPE
@ ARM_DRAW_TYPE_STICK
@ ARM_DRAW_TYPE_B_BONE
@ ARM_DRAW_TYPE_WIRE
@ ARM_DRAW_TYPE_ARMATURE_DEFINED
@ ARM_DRAW_TYPE_OCTA
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 typedef
float wrap(float value, float max, float min)
Definition node_math.h:71
struct BoneCollectionMember * next
struct BoneCollectionMember * prev
struct BoneCollectionReference * next
struct BoneCollectionReference * prev
struct BoneCollection * bcoll
struct IDProperty * system_properties
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
int8_t drawtype
BoneColor color
short bbone_next_flag
short bbone_prev_flag
Bone_Runtime runtime
struct Bone * parent
struct Bone * bbone_prev
float arm_head[3]
char name[64]
float tail[3]
float arm_tail[3]
struct Bone * bbone_next
char inherit_scale_mode
char bbone_prev_type
float curve_in_x
char _pad2[7]
float scale_out[3]
float size[3]
IDProperty * prop
char _pad1[3]
float curve_out_z
char bbone_mapping_mode
void * _pad0
float arm_mat[4][4]
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
IDProperty * system_properties
Definition DNA_ID.h:404
struct BoneCollection * active_collection
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
#define DNA_DEPRECATED_ALLOW
Definition versioning.cc:11