Blender V5.3
DNA_constraint_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
10#pragma once
11
12#include "BLI_enum_flags.hh"
13#include "BLI_sys_types.hh"
14
15#include "DNA_listBase.h"
16
17namespace blender {
18
19struct Text;
20
21#define CON_SHRINKWRAP_PROJECT_CULL_MASK \
22 (CON_SHRINKWRAP_PROJECT_CULL_FRONTFACE | CON_SHRINKWRAP_PROJECT_CULL_BACKFACE)
23
24/* bConstraintTarget -> flag */
32
33/* bConstraintTarget/bConstraintOb -> type */
34enum eConstraintObType : short {
42 /* CONSTRAINT_OBTYPE_CV = 4, */ /* UNUSED */
43};
44
51
52/* bGeometryAttributeConstraint->flag */
55 MIX_LOC = (1 << 1),
56 MIX_ROT = (1 << 2),
57 MIX_SCALE = (1 << 3),
58};
60
61
70
77
80 /* Replace rotation channel values. */
82 /* Multiply the copied transformation on the left, handling loc/rot/scale separately. */
84 /* Multiply the copied transformation on the right, handling loc/rot/scale separately. */
86 /* Multiply the copied transformation on the left, using simple matrix multiplication. */
88 /* Multiply the copied transformation on the right, using simple matrix multiplication. */
90};
91
92/* bConstraint->type
93 * - Do not ever change the order of these, or else files could get
94 * broken as their correct value cannot be resolved
95 */
140
141/* bConstraint->flag */
142/* flags 0x2 (1 << 1) and 0x8 (1 << 3) were used in past */
143/* flag 0x20 (1 << 5) was used to indicate that a constraint was evaluated
144 * using a 'local' hack for pose-bones only. */
145enum eBConstraint_Flags : short {
146#ifdef DNA_DEPRECATED_ALLOW
147 /* Expansion for old box constraint layouts. Just for versioning. */
148 CONSTRAINT_EXPAND_DEPRECATED = (1 << 0),
149#endif
150 /* Constraint is disabled because it is considered invalid. `is_valid` in RNA. */
152 /* to indicate which Ipo should be shown, maybe for 3d access later too */
154 /* to indicate that the owner's space should only be changed into ownspace, but not out of it */
156 /* influence ipo is on constraint itself, not in action channel */
158 /* Constraint is disabled by the user or the animation system (eye icon in the interface). */
159 CONSTRAINT_OFF = (1 << 9),
160 /* use bbone curve shape when calculating headtail values (also used by dependency graph!) */
162 /* That constraint has been inserted in local override (i.e. it can be fully edited!). */
164 /* use full transformation (not just segment locations) - only set at runtime. */
166};
168
169/* bConstraint->ownspace/tarspace */
189
190/* Common enum for constraints that support override. */
203
206 ROTLIKE_X = (1 << 0),
207 ROTLIKE_Y = (1 << 1),
208 ROTLIKE_Z = (1 << 2),
212#ifdef DNA_DEPRECATED_ALLOW
213 ROTLIKE_OFFSET = (1 << 7),
214#endif
215};
217
218
220 /* Replace rotation channel values. */
222 /* Legacy Offset mode - don't use. */
224 /* Add Euler components together. */
226 /* Multiply the copied rotation on the left. */
228 /* Multiply the copied rotation on the right. */
230};
231
234 LOCLIKE_X = (1 << 0),
235 LOCLIKE_Y = (1 << 1),
236 LOCLIKE_Z = (1 << 2),
238 LOCLIKE_TIP = (1 << 3),
242 LOCLIKE_OFFSET = (1 << 7),
243};
245
246
248 SIZELIKE_X = (1 << 0),
249 SIZELIKE_Y = (1 << 1),
250 SIZELIKE_Z = (1 << 2),
251 SIZELIKE_OFFSET = (1 << 3),
254};
256
257
259 /* Remove shear from the target matrix. */
261};
263
264
266 /* Replace rotation channel values. */
268 /* Multiply the copied transformation on the left, with anti-shear scale handling. */
270 /* Multiply the copied transformation on the right, with anti-shear scale handling. */
272 /* Multiply the copied transformation on the left, handling loc/rot/scale separately. */
274 /* Multiply the copied transformation on the right, handling loc/rot/scale separately. */
276 /* Multiply the copied transformation on the left, using simple matrix multiplication. */
278 /* Multiply the copied transformation on the right, using simple matrix multiplication. */
280};
281
282/* bTransformConstraint.to/from */
288
291 /* Add component values together (default). */
293 /* Replace component values. */
295};
296
299 /* Add component values together (default). */
301 /* Replace component values. */
303 /* Multiply the generated rotation on the left. */
305 /* Multiply the generated rotation on the right. */
307};
308
311 /* Replace component values (default). */
313 /* Multiply component values together. */
315};
316
323
325enum eSameVolume_Mode : char {
326 /* Strictly maintain the volume, overriding non-free axis scale. */
328 /* Maintain the volume when scale is uniform, pass non-uniform other axis scale through. */
330 /* Maintain the volume when scaled only on the free axis, pass other axis scale through. */
332};
333
336 /* Bones use "object" part of target action, instead of "same bone name" part */
338 /* Ignore the transform of 'tar' and use 'eval_time' instead: */
340};
342
343
345 /* Replace the input transformation. */
347 /* Multiply the action transformation on the right. */
349 /* Multiply the action transformation on the left. */
351 /* Multiply the action transformation on the right, with anti-shear scale handling. */
353 /* Multiply the action transformation on the left, with anti-shear scale handling. */
355 /* Separately combine Translation, Rotation and Scale, with rotation on the right. */
357 /* Separately combine Translation, Rotation and Scale, with rotation on the left. */
359};
360
361/* Locked-Axis Values (Locked Track) */
362enum eLockAxis_Modes : int {
366};
367
368/* Up-Axis Values (TrackTo and Locked Track) */
369enum eUpAxis_Modes : int {
370 UP_X = 0,
371 UP_Y = 1,
372 UP_Z = 2,
373};
374
375/* Tracking axis (TrackTo, Locked Track, Damped Track) and minmax (floor) constraint */
384
385/* Shrinkwrap flags */
386enum eShrinkwrap_Flags : char {
387 /* Also ray-cast in the opposite direction. */
389 /* Invert the cull mode when projecting opposite. */
391 /* Align the specified axis to the target normal. */
393
394 /* Ignore front faces in project; same value as MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE */
396 /* Ignore back faces in project; same value as MOD_SHRINKWRAP_CULL_TARGET_BACKFACE */
398};
400
401/* FollowPath flags */
406};
408
409/* bTrackToConstraint->flags */
410enum eTrackTo_Flags : int {
411 TARGET_Z_UP = (1 << 0),
412};
414
415/* Stretch To Constraint -> volmode */
422
423/* Stretch To Constraint -> plane mode */
428};
429
430/* Clamp-To Constraint ->flag */
437
438/* ClampTo Constraint ->flag2 */
439enum eClampTo_Flags : int {
440 CLAMPTO_CYCLIC = (1 << 0),
441};
443
444/* bKinematicConstraint->flag */
445enum eKinematic_Flags : short {
448 /* targetless */
450 /* autoik */
456 /* limit axis */
463 /* axis relative to target */
465};
467
468
469enum eSplineIK_Flags : short {
474#ifdef DNA_DEPRECATED_ALLOW
476 CONSTRAINT_SPLINEIK_SCALE_LIMITED = (1 << 2),
477#endif
482
486
489};
491
492
503
513
524
525/* MinMax (floor) flags */
526enum eFloor_Flags : int {
527 /* MINMAX_STICKY = (1 << 0), */ /* Deprecated. */
528 /* MINMAX_STUCK = (1 << 1), */ /* Deprecated. */
529 MINMAX_USEROT = (1 << 2),
530};
532
533/* transform limiting constraints -> flag2 */
535 /* not used anymore - for older Limit Location constraints only */
536 /* LIMIT_NOPARENT = (1 << 0), */ /* UNUSED */
537 /* for all Limit constraints - allow to be used during transform? */
538 LIMIT_TRANSFORM = (1 << 1),
539};
541
542/* transform limiting constraints -> flag. */
544 LIMIT_XMIN = (1 << 0),
545 LIMIT_XMAX = (1 << 1),
546 LIMIT_YMIN = (1 << 2),
547 LIMIT_YMAX = (1 << 3),
548 LIMIT_ZMIN = (1 << 4),
549 LIMIT_ZMAX = (1 << 5),
550};
552
553/* limit rotation constraint -> flag. */
554enum eRotLimit_Flags : short {
555 LIMIT_XROT = (1 << 0),
556 LIMIT_YROT = (1 << 1),
557 LIMIT_ZROT = (1 << 2),
558
559 /* Use the legacy behavior of the Limit Rotation constraint. See the
560 * implementation of `rotlimit_evaluate()` in constraint.cc for more
561 * details. */
563};
565
566/* distance limit constraint */
567/* bDistLimitConstraint->flag */
568enum eDistLimit_Flag : short {
569 /* "soft" cushion effect when reaching the limit sphere */ /* NOT IMPLEMENTED! */
571 /* as for all Limit constraints - allow to be used during transform? */
573};
575
576/* bDistLimitConstraint->mode */
582
583/* ChildOf Constraint -> flag */
584enum eChildOf_Flags : int {
585 CHILDOF_LOCX = (1 << 0),
586 CHILDOF_LOCY = (1 << 1),
587 CHILDOF_LOCZ = (1 << 2),
588 CHILDOF_ROTX = (1 << 3),
589 CHILDOF_ROTY = (1 << 4),
590 CHILDOF_ROTZ = (1 << 5),
591 CHILDOF_SIZEX = (1 << 6),
592 CHILDOF_SIZEY = (1 << 7),
593 CHILDOF_SIZEZ = (1 << 8),
595 /* Temporary flag used by the Set Inverse operator. */
597};
599
600
623
624/* settings for Pivot Constraint in general */
626 /* offset is to be interpreted as being a fixed-point in space */
628 /* rotation-based activation uses negative rotation to drive result */
630};
632
639
645
646/* CameraSolver Constraint -> flag */
651
652/* ObjectSolver Constraint -> flag */
655 /* Temporary flag used by the Set Inverse operator. */
657};
659
660/* ObjectSolver Constraint -> flag */
666
667
669 struct bConstraint *next = nullptr, *prev = nullptr;
670
672 void *data = nullptr;
677
682
683 /* An "expand" bit for each of the constraint's (sub)panels (uiPanelDataExpansion). */
684 short ui_expand_flag = 0;
685
687 struct Object *space_object = nullptr;
689 char space_subtarget[/*MAX_NAME*/ 64] = "";
690
692 char name[/*MAX_NAME*/ 64] = "";
693
695 float enforce = 1.0f;
697 float headtail = 0;
698
699 /* Below are read-only fields that are set at runtime
700 * by the solver for use in the GE (only IK at the moment). */
702 float lin_error = 0;
704 float rot_error = 0;
705};
706
707/* Multiple-target constraints --------------------- */
708
709/* This struct defines a constraint target.
710 * It is used during constraint solving regardless of how many targets the
711 * constraint has.
712 */
714 struct bConstraintTarget *next = nullptr, *prev = nullptr;
715
717 struct Object *tar = nullptr;
719 char subtarget[/*MAX_NAME*/ 64] = "";
720
722 float matrix[4][4] = {};
723
726 char _pad1;
732 short rotOrder = 0;
734 float weight = 0;
735 char _pad[4] = {};
736};
737
738/* Inverse-Kinematics (IK) constraint
739 * This constraint supports a variety of mode determine by the type field
740 * according to eConstraint_IK_Type.
741 * Some fields are used by all types, some are specific to some types
742 * This is indicated in the comments for each field
743 */
746 struct Object *tar = nullptr;
748 short iterations = 0;
752 short rootbone = 0;
754 short max_rootbone = 0;
756 char subtarget[/*MAX_NAME*/ 64] = "";
758 struct Object *poletar = nullptr;
760 char polesubtarget[/*MAX_NAME*/ 64] = "";
762 float poleangle = 0;
764 float weight = 0;
766 float orientweight = 0;
768 float grabtarget[3] = {};
774 float dist = 0;
775};
776
777/* Spline IK Constraint
778 * Aligns 'n' bones to the curvature defined by the curve,
779 * with the chain ending on the bone that owns this constraint,
780 * and starting on the nth parent.
781 */
783 /* target(s) */
785 struct Object *tar = nullptr;
786
787 /* binding details */
792 float *points = nullptr;
794 short numpoints = 0;
796 short chainlen = 0;
797
798 /* settings */
805 short _pad[3] = {};
806
807 /* volume preservation settings */
808 float bulge = 0;
809 float bulge_min = 0;
810 float bulge_max = 0;
811 float bulge_smooth = 0;
812};
813
814/* Armature Constraint */
818 char _pad[4] = {};
819
821 ListBaseT<bConstraintTarget> targets = {nullptr, nullptr};
822};
823
824/* Single-target sub-object constraints --------------------- */
825
826/* Track To Constraint */
828 struct Object *tar = nullptr;
837 char _pad[4] = {};
838 char subtarget[/*MAX_NAME*/ 64] = "";
839};
840
841/* Copy Rotation Constraint */
850
851/* Copy Location Constraint */
853 struct Object *tar = nullptr;
855 int reserved1 = 0;
856 char subtarget[/*MAX_NAME*/ 64] = "";
857};
858
859/* Copy Scale Constraint */
861 struct Object *tar = nullptr;
863 float power = 0;
864 char subtarget[/*MAX_NAME*/ 64] = "";
865};
866
867/* Maintain Volume Constraint */
874
875/* Copy Transform Constraint */
883
884/* Floor Constraint */
886 struct Object *tar = nullptr;
887 int minmaxflag = 0;
888 float offset = 0;
890 char subtarget[/*MAX_NAME*/ 64] = "";
891 int _pad = {};
892};
893
894/* Action Constraint */
896 struct Object *tar = nullptr;
898 short type = 0;
900 short local = 0;
902 int start = 0;
904 int end = 0;
906 float min = 0;
908 float max = 0;
911 char _pad[3] = {};
912 float eval_time = 0; /* Only used when flag ACTCON_USE_EVAL_TIME is set. */
913 struct bAction *act = nullptr;
915 char last_slot_identifier[/*MAX_ID_NAME*/ 258] = "";
916 char _pad1[2] = {};
917 char subtarget[/*MAX_NAME*/ 64] = "";
918};
919
920/* Locked Axis Tracking constraint */
927
928/* Damped Tracking constraint */
930 struct Object *tar = nullptr;
932 char _pad[4] = {};
933 char subtarget[/*MAX_NAME*/ 64] = "";
934};
935
936/* Follow Path constraints */
939 struct Object *tar = nullptr;
940
942 float offset = 0;
944 float offset_fac = 0;
945
947
948 short trackflag = 0;
949 short upflag = 0;
950};
951
952/* Stretch to constraint */
954 struct Object *tar = nullptr;
958 float orglength = 0;
959 float bulge = 0;
960 float bulge_min = 0;
961 float bulge_max = 0;
962 float bulge_smooth = 0;
963 char subtarget[/*MAX_NAME*/ 64] = "";
964};
965
966/* DEPRECATED: Rigid Body constraint */
968 struct Object *tar = nullptr;
969 struct Object *child = nullptr;
970 int type = 0;
971 float pivX = 0;
972 float pivY = 0;
973 float pivZ = 0;
974 float axX = 0;
975 float axY = 0;
976 float axZ = 0;
977 float minLimit[6] = {};
978 float maxLimit[6] = {};
979 float extraFz = 0;
980 short flag = 0;
981 char _pad[6] = {};
982};
983
984/* Clamp-To Constraint */
993
994/* Child Of Constraint */
997 struct Object *tar = nullptr;
1000 char _pad[4] = {};
1002 float invmat[4][4] = {};
1004 char subtarget[/*MAX_NAME*/ 64] = "";
1005};
1006
1007/* Generic Transform->Transform Constraint */
1056
1057/* Pivot Constraint */
1059 /* Pivot Point:
1060 * Either target object + offset, or just offset is used
1061 */
1063 struct Object *tar = nullptr;
1065 char subtarget[/*MAX_NAME*/ 64] = "";
1067 float offset[3] = {};
1068
1069 /* Rotation-driven activation:
1070 * This option provides easier one-stop setups for foot-rolls.
1071 */
1074
1075 /* General flags */
1077};
1078
1079/* transform limiting constraints - zero target ---------------------------- */
1080/* Limit Location Constraint */
1082 float xmin = 0, xmax = 0;
1083 float ymin = 0, ymax = 0;
1084 float zmin = 0, zmax = 0;
1087};
1088
1089/* Limit Rotation Constraint */
1099
1100/* Limit Scale Constraint */
1102 float xmin = 0, xmax = 0;
1103 float ymin = 0, ymax = 0;
1104 float zmin = 0, zmax = 0;
1107};
1108
1109/* Limit Distance Constraint */
1111 struct Object *tar = nullptr;
1112 char subtarget[/*MAX_NAME*/ 64] = "";
1113
1115 float dist = 0;
1117 float soft = 0;
1118
1123 char _pad[4] = {};
1124};
1125
1126/* ShrinkWrap Constraint */
1128 struct Object *target = nullptr;
1130 float dist = 0;
1132 short shrinkType = 0;
1134 char projAxis = 0;
1138 float projLimit = 0;
1140 char shrinkMode = 0;
1144 char trackAxis = 0;
1145 char _pad = {};
1146};
1147
1148/* Follow Track constraints */
1150 struct MovieClip *clip = nullptr;
1151 char track[/*MAX_NAME*/ 64] = "";
1154 char object[/*MAX_NAME*/ 64] = "";
1155 struct Object *camera = nullptr;
1156 struct Object *depth_ob = nullptr;
1157};
1158
1159/* Camera Solver constraints */
1161 struct MovieClip *clip = nullptr;
1163 char _pad[4] = {};
1164};
1165
1166/* Camera Solver constraints */
1168 struct MovieClip *clip = nullptr;
1170 char _pad[4] = {};
1171 char object[/*MAX_NAME*/ 64] = "";
1173 float invmat[4][4] = {};
1174 struct Object *camera = nullptr;
1175};
1176
1177/* Transform matrix cache constraint */
1179 struct CacheFile *cache_file = nullptr;
1180 char object_path[/*FILE_MAX*/ 1024] = "";
1181
1182 /* Runtime. */
1183 struct CacheReader *reader = nullptr;
1184 char reader_object_path[/*FILE_MAX*/ 1024] = "";
1185};
1186
1187/* Geometry Attribute Constraint */
1199
1200/* ------------------------------------------ */
1201
1202/* -------------------------------------- */
1203
1204} // namespace blender
#define ENUM_OPERATORS(_enum_type)
These structs are the foundation for all linked lists in the library system.
BMesh Iterators.
@ CONSTRAINT_TYPE_GEOMETRY_ATTRIBUTE
@ CONSTRAINT_TYPE_TRANSFORM_CACHE
@ CON_ATTRIBUTE_MIX_AFTER_SPLIT
@ CON_ATTRIBUTE_MIX_BEFORE_SPLIT
@ CON_ATTRIBUTE_MIX_BEFORE_FULL
@ CON_ATTRIBUTE_DOMAIN_FACE_CORNER
@ CON_ATTRIBUTE_DOMAIN_INSTANCE
@ CONSTRAINT_SPLINEIK_NO_CURVERAD
@ CONSTRAINT_SPLINEIK_USE_BULGE_MAX
@ CONSTRAINT_SPLINEIK_USE_BULGE_MIN
@ CONSTRAINT_SPLINEIK_USE_ORIGINAL_SCALE
@ CONSTRAINT_SPLINEIK_XZS_ORIGINAL
@ CONSTRAINT_SPLINEIK_XZS_INVERSE
@ CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC
@ CONSTRAINT_SPLINEIK_YS_FIT_CURVE
@ CONSTRAINT_SPLINEIK_YS_ORIGINAL
unsigned char uint8_t
Definition BKE_text.h:79
@ CONSTRAINT_ARMATURE_CUR_LOCATION
@ CON_SHRINKWRAP_PROJECT_CULL_FRONTFACE
@ CON_SHRINKWRAP_PROJECT_OPPOSITE
@ CON_SHRINKWRAP_PROJECT_INVERT_CULL
@ CON_SHRINKWRAP_PROJECT_CULL_BACKFACE
signed int int32_t
Definition BKE_text.h:78
@ CONSTRAINT_OVERRIDE_LIBRARY_LOCAL
eActionConstraint_Flags flag
eActionConstraint_MixMode mix_mode
ListBaseT< bConstraintTarget > targets
eBConstraint_SpaceTypes space
struct bConstraintTarget * prev
struct bConstraintTarget * next
eBConstraint_SpaceTypes ownspace
struct bConstraint * prev
struct bConstraint * next
eBConstraint_SpaceTypes tarspace
eFollowTrack_FrameMethod frame_method
eGeometryAttributeConstraint_Flags flags
eSplineIK_XZScaleModes xzScaleMode
eTransform_MixModeScale mix_mode_scale
eConstraint_EulerOrder to_euler_order