Blender V5.0
rna_constraint.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "BLI_math_rotation.h"
12
13#include "BLT_translation.hh"
14
16#include "DNA_modifier_types.h"
17#include "DNA_scene_types.h"
18
19#include "RNA_define.hh"
20#include "RNA_enum_types.hh"
21
22#include "rna_internal.hh"
23
24#include "WM_types.hh"
25
26#include "ED_object.hh"
27
28/* Please keep the names in sync with `constraint.cc`. */
30 RNA_ENUM_ITEM_HEADING(N_("Motion Tracking"), nullptr),
31 {CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CON_CAMERASOLVER, "Camera Solver", ""},
32 {CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CON_FOLLOWTRACK, "Follow Track", ""},
33 {CONSTRAINT_TYPE_OBJECTSOLVER, "OBJECT_SOLVER", ICON_CON_OBJECTSOLVER, "Object Solver", ""},
34
35 RNA_ENUM_ITEM_HEADING(N_("Transform"), nullptr),
37 "COPY_LOCATION",
38 ICON_CON_LOCLIKE,
39 "Copy Location",
40 "Copy the location of a target (with an optional offset), so that they move together"},
42 "COPY_ROTATION",
43 ICON_CON_ROTLIKE,
44 "Copy Rotation",
45 "Copy the rotation of a target (with an optional offset), so that they rotate together"},
47 "COPY_SCALE",
48 ICON_CON_SIZELIKE,
49 "Copy Scale",
50 "Copy the scale factors of a target (with an optional offset), so that they are scaled by "
51 "the same amount"},
53 "COPY_TRANSFORMS",
54 ICON_CON_TRANSLIKE,
55 "Copy Transforms",
56 "Copy all the transformations of a target, so that they move together"},
58 "LIMIT_DISTANCE",
59 ICON_CON_DISTLIMIT,
60 "Limit Distance",
61 "Restrict movements to within a certain distance of a target (at the time of constraint "
62 "evaluation only)"},
64 "LIMIT_LOCATION",
65 ICON_CON_LOCLIMIT,
66 "Limit Location",
67 "Restrict movement along each axis within given ranges"},
69 "LIMIT_ROTATION",
70 ICON_CON_ROTLIMIT,
71 "Limit Rotation",
72 "Restrict rotation along each axis within given ranges"},
74 "LIMIT_SCALE",
75 ICON_CON_SIZELIMIT,
76 "Limit Scale",
77 "Restrict scaling along each axis with given ranges"},
79 "MAINTAIN_VOLUME",
80 ICON_CON_SAMEVOL,
81 "Maintain Volume",
82 "Compensate for scaling one axis by applying suitable scaling to the other two axes"},
84 "TRANSFORM",
85 ICON_CON_TRANSFORM,
86 "Transformation",
87 "Use one transform property from target to control another (or same) property on owner"},
89 "TRANSFORM_CACHE",
90 ICON_CON_TRANSFORM_CACHE,
91 "Transform Cache",
92 "Look up the transformation matrix from an external file"},
93
94 RNA_ENUM_ITEM_HEADING(N_("Tracking"), nullptr),
96 "CLAMP_TO",
97 ICON_CON_CLAMPTO,
98 "Clamp To",
99 "Restrict movements to lie along a curve by remapping location along curve's longest axis"},
101 "DAMPED_TRACK",
102 ICON_CON_TRACKTO,
103 "Damped Track",
104 "Point towards a target by performing the smallest rotation necessary"},
106 "IK",
107 ICON_CON_KINEMATIC,
108 "Inverse Kinematics",
109 "Control a chain of bones by specifying the endpoint target (Bones only)"},
111 "LOCKED_TRACK",
112 ICON_CON_LOCKTRACK,
113 "Locked Track",
114 "Rotate around the specified ('locked') axis to point towards a target"},
116 "SPLINE_IK",
117 ICON_CON_SPLINEIK,
118 "Spline IK",
119 "Align chain of bones along a curve (Bones only)"},
121 "STRETCH_TO",
122 ICON_CON_STRETCHTO,
123 "Stretch To",
124 "Stretch along Y-Axis to point towards a target"},
126 "TRACK_TO",
127 ICON_CON_TRACKTO,
128 "Track To",
129 "Legacy tracking constraint prone to twisting artifacts"},
130
131 RNA_ENUM_ITEM_HEADING(N_("Relationship"), nullptr),
133 "ACTION",
134 ICON_ACTION,
135 "Action",
136 "Use transform property of target to look up pose for owner from an Action"},
138 "ARMATURE",
139 ICON_CON_ARMATURE,
140 "Armature",
141 "Apply weight-blended transformation from multiple bones like the Armature modifier"},
143 "CHILD_OF",
144 ICON_CON_CHILDOF,
145 "Child Of",
146 "Make target the 'detachable' parent of owner"},
148 "FLOOR",
149 ICON_CON_FLOOR,
150 "Floor",
151 "Use position (and optionally rotation) of target to define a 'wall' or 'floor' that the "
152 "owner cannot cross"},
154 "FOLLOW_PATH",
155 ICON_CON_FOLLOWPATH,
156 "Follow Path",
157 "Use to animate an object/bone following a path"},
159 "GEOMETRY_ATTRIBUTE",
160 ICON_CON_GEOMETRYATTRIBUTE,
161 "Geometry Attribute",
162 "Retrieve transform from target geometry attribute data"},
164 "PIVOT",
165 ICON_CON_PIVOT,
166 "Pivot",
167 "Change pivot point for transforms (buggy)"},
169 "SHRINKWRAP",
170 ICON_CON_SHRINKWRAP,
171 "Shrinkwrap",
172 "Restrict movements to surface of target mesh"},
173 {0, nullptr, 0, nullptr, nullptr},
174};
175
178 "WORLD",
179 0,
180 "World Space",
181 "The transformation of the target is evaluated relative to the world "
182 "coordinate system"},
184 "CUSTOM",
185 0,
186 "Custom Space",
187 "The transformation of the target is evaluated relative to a custom object/bone/vertex "
188 "group"},
191 "POSE",
192 0,
193 "Pose Space",
194 "The transformation of the target is only evaluated in the Pose Space, "
195 "the target armature object transformation is ignored"},
197 "LOCAL_WITH_PARENT",
198 0,
199 "Local With Parent",
200 "The transformation of the target bone is evaluated relative to its rest pose "
201 "local coordinate system, thus including the parent-induced transformation"},
203 "LOCAL",
204 0,
205 "Local Space",
206 "The transformation of the target is evaluated relative to its local "
207 "coordinate system"},
209 "LOCAL_OWNER_ORIENT",
210 0,
211 "Local Space (Owner Orientation)",
212 "The transformation of the target bone is evaluated relative to its local coordinate "
213 "system, followed by a correction for the difference in target and owner rest pose "
214 "orientations. When applied as local transform to the owner produces the same global "
215 "motion as the target if the parents are still in rest pose."},
216 {0, nullptr, 0, nullptr, nullptr},
217};
218
221 "WORLD",
222 0,
223 "World Space",
224 "The constraint is applied relative to the world coordinate system"},
226 "CUSTOM",
227 0,
228 "Custom Space",
229 "The constraint is applied in local space of a custom object/bone/vertex group"},
232 "POSE",
233 0,
234 "Pose Space",
235 "The constraint is applied in Pose Space, the object transformation is ignored"},
237 "LOCAL_WITH_PARENT",
238 0,
239 "Local With Parent",
240 "The constraint is applied relative to the rest pose local coordinate system "
241 "of the bone, thus including the parent-induced transformation"},
243 "LOCAL",
244 0,
245 "Local Space",
246 "The constraint is applied relative to the local coordinate system of the object"},
247 {0, nullptr, 0, nullptr, nullptr},
248};
249
251 {TRACK_X, "TRACK_X", 0, "X", ""},
252 {TRACK_Y, "TRACK_Y", 0, "Y", ""},
253 {TRACK_Z, "TRACK_Z", 0, "Z", ""},
254 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
255 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
256 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
257 {0, nullptr, 0, nullptr, nullptr},
258};
259
261 {CONSTRAINT_EULER_AUTO, "AUTO", 0, "Default", "Euler using the default rotation order"},
262 {CONSTRAINT_EULER_XYZ, "XYZ", 0, "XYZ Euler", "Euler using the XYZ rotation order"},
263 {CONSTRAINT_EULER_XZY, "XZY", 0, "XZY Euler", "Euler using the XZY rotation order"},
264 {CONSTRAINT_EULER_YXZ, "YXZ", 0, "YXZ Euler", "Euler using the YXZ rotation order"},
265 {CONSTRAINT_EULER_YZX, "YZX", 0, "YZX Euler", "Euler using the YZX rotation order"},
266 {CONSTRAINT_EULER_ZXY, "ZXY", 0, "ZXY Euler", "Euler using the ZXY rotation order"},
267 {CONSTRAINT_EULER_ZYX, "ZYX", 0, "ZYX Euler", "Euler using the ZYX rotation order"},
268 {0, nullptr, 0, nullptr, nullptr},
269};
270
271#ifdef RNA_RUNTIME
272
273static const EnumPropertyItem owner_space_object_items[] = {
275 "WORLD",
276 0,
277 "World Space",
278 "The constraint is applied relative to the world coordinate system"},
280 "CUSTOM",
281 0,
282 "Custom Space",
283 "The constraint is applied in local space of a custom object/bone/vertex group"},
285 "LOCAL",
286 0,
287 "Local Space",
288 "The constraint is applied relative to the local coordinate system of the object"},
289 {0, nullptr, 0, nullptr, nullptr},
290};
291
292static const EnumPropertyItem target_space_object_items[] = {
294 "WORLD",
295 0,
296 "World Space",
297 "The transformation of the target is evaluated relative to the world coordinate system"},
299 "CUSTOM",
300 0,
301 "Custom Space",
302 "The transformation of the target is evaluated relative to a custom object/bone/vertex "
303 "group"},
305 "LOCAL",
306 0,
307 "Local Space",
308 "The transformation of the target is evaluated relative to its local coordinate system"},
309 {0, nullptr, 0, nullptr, nullptr},
310};
311
312# include <fmt/format.h>
313
314# include "DNA_cachefile_types.h"
315
316# include "BKE_action.hh"
317# include "BKE_animsys.h"
318# include "BKE_constraint.h"
319# include "BKE_context.hh"
320
321# ifdef WITH_ALEMBIC
322# include "ABC_alembic.h"
323# endif
324
325# include "ANIM_action.hh"
326# include "rna_action_tools.hh"
327
328static StructRNA *rna_ConstraintType_refine(PointerRNA *ptr)
329{
330 bConstraint *con = (bConstraint *)ptr->data;
331
332 switch (con->type) {
334 return &RNA_ChildOfConstraint;
336 return &RNA_TrackToConstraint;
338 return &RNA_KinematicConstraint;
340 return &RNA_FollowPathConstraint;
342 return &RNA_CopyRotationConstraint;
344 return &RNA_CopyLocationConstraint;
346 return &RNA_CopyScaleConstraint;
348 return &RNA_MaintainVolumeConstraint;
350 return &RNA_ArmatureConstraint;
352 return &RNA_ActionConstraint;
354 return &RNA_LockedTrackConstraint;
356 return &RNA_StretchToConstraint;
358 return &RNA_FloorConstraint;
360 return &RNA_ClampToConstraint;
362 return &RNA_TransformConstraint;
364 return &RNA_LimitRotationConstraint;
366 return &RNA_LimitLocationConstraint;
368 return &RNA_LimitScaleConstraint;
370 return &RNA_LimitDistanceConstraint;
372 return &RNA_ShrinkwrapConstraint;
374 return &RNA_DampedTrackConstraint;
376 return &RNA_SplineIKConstraint;
378 return &RNA_CopyTransformsConstraint;
380 return &RNA_PivotConstraint;
382 return &RNA_FollowTrackConstraint;
384 return &RNA_CameraSolverConstraint;
386 return &RNA_ObjectSolverConstraint;
388 return &RNA_TransformCacheConstraint;
390 return &RNA_GeometryAttributeConstraint;
391 default:
392 return &RNA_UnknownType;
393 }
394}
395
396static void rna_ConstraintTargetBone_target_set(PointerRNA *ptr,
397 PointerRNA value,
398 ReportList * /*reports*/)
399{
401 Object *ob = static_cast<Object *>(value.data);
402
403 if (!ob || ob->type == OB_ARMATURE) {
404 id_lib_extern((ID *)ob);
405 tgt->tar = ob;
406 }
407}
408
409static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
410{
411 bConstraint *con = static_cast<bConstraint *>(ptr->data);
412 char oldname[sizeof(con->name)];
413
414 /* make a copy of the old name first */
415 STRNCPY(oldname, con->name);
416
417 /* copy the new name into the name slot */
418 STRNCPY_UTF8(con->name, value);
419
420 /* make sure name is unique */
421 if (ptr->owner_id) {
422 Object *ob = (Object *)ptr->owner_id;
424
425 /* if we have the list, check for unique name, otherwise give up */
426 if (list) {
428 }
429 }
430
431 /* fix all the animation data which may link to this */
432 BKE_animdata_fix_paths_rename_all(nullptr, "constraints", oldname, con->name);
433}
434
435static std::optional<std::string> rna_Constraint_do_compute_path(Object *ob, bConstraint *con)
436{
437 bPoseChannel *pchan;
439
440 if (lb == nullptr) {
441 printf("%s: internal error, constraint '%s' not found in object '%s'\n",
442 __func__,
443 con->name,
444 ob->id.name);
445 }
446
447 if (pchan) {
448 char name_esc_pchan[sizeof(pchan->name) * 2];
449 char name_esc_const[sizeof(con->name) * 2];
450 BLI_str_escape(name_esc_pchan, pchan->name, sizeof(name_esc_pchan));
451 BLI_str_escape(name_esc_const, con->name, sizeof(name_esc_const));
452 return fmt::format("pose.bones[\"{}\"].constraints[\"{}\"]", name_esc_pchan, name_esc_const);
453 }
454 char name_esc_const[sizeof(con->name) * 2];
455 BLI_str_escape(name_esc_const, con->name, sizeof(name_esc_const));
456 return fmt::format("constraints[\"{}\"]", name_esc_const);
457}
458
459static std::optional<std::string> rna_Constraint_path(const PointerRNA *ptr)
460{
461 Object *ob = (Object *)ptr->owner_id;
462 bConstraint *con = static_cast<bConstraint *>(ptr->data);
463
464 return rna_Constraint_do_compute_path(ob, con);
465}
466
467static bConstraint *rna_constraint_from_target(const PointerRNA *ptr)
468{
469 Object *ob = (Object *)ptr->owner_id;
470 bConstraintTarget *tgt = static_cast<bConstraintTarget *>(ptr->data);
471
472 return BKE_constraint_find_from_target(ob, tgt, nullptr);
473}
474
475static std::optional<std::string> rna_ConstraintTarget_path(const PointerRNA *ptr)
476{
477 Object *ob = (Object *)ptr->owner_id;
478 bConstraintTarget *tgt = static_cast<bConstraintTarget *>(ptr->data);
479 bConstraint *con = rna_constraint_from_target(ptr);
480 int index = -1;
481
482 if (con != nullptr) {
483 if (con->type == CONSTRAINT_TYPE_ARMATURE) {
484 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
485 index = BLI_findindex(&acon->targets, tgt);
486 }
487 }
488
489 if (index >= 0) {
490 return fmt::format(
491 "{}.targets[{}]", rna_Constraint_do_compute_path(ob, con).value_or(""), index);
492 }
493 printf("%s: internal error, constraint '%s' of object '%s' does not contain the target\n",
494 __func__,
495 con->name,
496 ob->id.name);
497
498 return std::nullopt;
499}
500
501static void rna_Constraint_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
502{
504 bmain, (Object *)ptr->owner_id, static_cast<bConstraint *>(ptr->data));
505}
506
507static void rna_Constraint_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
508{
510 bmain, (Object *)ptr->owner_id, static_cast<bConstraint *>(ptr->data));
511}
512
513static void rna_ConstraintTarget_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
514{
516 bmain, (Object *)ptr->owner_id, rna_constraint_from_target(ptr));
517}
518
519static void rna_ConstraintTarget_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
520{
522 bmain, (Object *)ptr->owner_id, rna_constraint_from_target(ptr));
523}
524
525static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
526{
527 Object *ob = (Object *)ptr->owner_id;
528
529 if (ob->pose) {
531 }
532
533 rna_Constraint_update(bmain, scene, ptr);
534}
535
536/* Update only needed so this isn't overwritten on first evaluation. */
537static void rna_Constraint_childof_inverse_matrix_update(Main *bmain,
538 Scene *scene,
540{
541 bConstraint *con = static_cast<bConstraint *>(ptr->data);
542 bChildOfConstraint *data = static_cast<bChildOfConstraint *>(con->data);
543 data->flag &= ~CHILDOF_SET_INVERSE;
544 rna_Constraint_update(bmain, scene, ptr);
545}
546
547static void rna_Constraint_ik_type_set(PointerRNA *ptr, int value)
548{
549 bConstraint *con = static_cast<bConstraint *>(ptr->data);
550 bKinematicConstraint *ikdata = static_cast<bKinematicConstraint *>(con->data);
551
552 if (ikdata->type != value) {
553 /* the type of IK constraint has changed, set suitable default values */
554 /* in case constraints reuse same fields incompatible */
555 switch (value) {
557 break;
559 break;
560 }
561 ikdata->type = value;
562 }
563}
564
565/* DEPRECATED: use_offset replaced with mix_mode */
566static bool rna_Constraint_RotLike_use_offset_get(PointerRNA *ptr)
567{
568 bConstraint *con = static_cast<bConstraint *>(ptr->data);
569 bRotateLikeConstraint *rotlike = static_cast<bRotateLikeConstraint *>(con->data);
570 return rotlike->mix_mode != ROTLIKE_MIX_REPLACE;
571}
572
573static void rna_Constraint_RotLike_use_offset_set(PointerRNA *ptr, bool value)
574{
575 bConstraint *con = static_cast<bConstraint *>(ptr->data);
576 bRotateLikeConstraint *rotlike = static_cast<bRotateLikeConstraint *>(con->data);
577 bool curval = (rotlike->mix_mode != ROTLIKE_MIX_REPLACE);
578 if (curval != value) {
579 rotlike->mix_mode = (value ? ROTLIKE_MIX_OFFSET : ROTLIKE_MIX_REPLACE);
580 }
581}
582
583static const EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext * /*C*/,
585 PropertyRNA * /*prop*/,
586 bool * /*r_free*/)
587{
588 Object *ob = (Object *)ptr->owner_id;
589 bConstraint *con = (bConstraint *)ptr->data;
590
591 if (BLI_findindex(&ob->constraints, con) == -1) {
593 }
594 else {
595 /* object */
596 return owner_space_object_items;
597 }
598}
599
600static const EnumPropertyItem *rna_Constraint_target_space_itemf(bContext * /*C*/,
602 PropertyRNA * /*prop*/,
603 bool * /*r_free*/)
604{
605 bConstraint *con = (bConstraint *)ptr->data;
606 ListBase targets = {nullptr, nullptr};
608
609 if (BKE_constraint_targets_get(con, &targets)) {
610 for (ct = static_cast<bConstraintTarget *>(targets.first); ct; ct = ct->next) {
611 if (ct->tar && ct->tar->type == OB_ARMATURE && !(ct->flag & CONSTRAINT_TAR_CUSTOM_SPACE)) {
612 break;
613 }
614 }
615
616 BKE_constraint_targets_flush(con, &targets, 1);
617
618 if (ct) {
620 }
621 }
622
623 return target_space_object_items;
624}
625
626static bConstraintTarget *rna_ArmatureConstraint_target_new(ID *id, bConstraint *con, Main *bmain)
627{
628 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
629 bConstraintTarget *tgt = MEM_callocN<bConstraintTarget>("Constraint Target");
630
631 tgt->weight = 1.0f;
632 BLI_addtail(&acon->targets, tgt);
633
635 return tgt;
636}
637
638static void rna_ArmatureConstraint_target_remove(
639 ID *id, bConstraint *con, Main *bmain, ReportList *reports, PointerRNA *target_ptr)
640{
641 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
642 bConstraintTarget *tgt = static_cast<bConstraintTarget *>(target_ptr->data);
643
644 if (BLI_findindex(&acon->targets, tgt) == -1) {
645 BKE_report(reports, RPT_ERROR, "Target is not in the constraint target list");
646 return;
647 }
648
649 BLI_freelinkN(&acon->targets, tgt);
650
652}
653
654static void rna_ArmatureConstraint_target_clear(ID *id, bConstraint *con, Main *bmain)
655{
656 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
657
658 BLI_freelistN(&acon->targets);
659
661}
662
663static void rna_ActionConstraint_mix_mode_set(PointerRNA *ptr, int value)
664{
665 bConstraint *con = (bConstraint *)ptr->data;
667
668 acon->mix_mode = value;
669
670 /* The After mode can be computed in world space for efficiency
671 * and backward compatibility, while Before or Split requires Local. */
674 }
675 else {
677 }
678}
679
680static void rna_ActionConstraint_minmax_range(
681 PointerRNA *ptr, float *min, float *max, float * /*softmin*/, float * /*softmax*/)
682{
683 bConstraint *con = (bConstraint *)ptr->data;
685
686 /* 0, 1, 2 = magic numbers for rotX, rotY, rotZ */
687 if (ELEM(acon->type, 0, 1, 2)) {
688 *min = -180.0f;
689 *max = 180.0f;
690 }
691 else {
692 *min = -1000.0f;
693 *max = 1000.0f;
694 }
695}
696
697static void rna_ActionConstraint_action_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
698{
699 using namespace blender::animrig;
700 BLI_assert(ptr->owner_id);
701 BLI_assert(ptr->data);
702
703 ID &animated_id = *ptr->owner_id;
704 bConstraint *con = static_cast<bConstraint *>(ptr->data);
705 bActionConstraint *acon = static_cast<bActionConstraint *>(con->data);
706
707 Action *action = static_cast<Action *>(value.data);
708
709 if (!action) {
710 const bool ok = generic_assign_action(
711 animated_id, nullptr, acon->act, acon->action_slot_handle, acon->last_slot_identifier);
712 BLI_assert_msg(ok, "Un-assigning an Action from an Action Constraint should always work.");
714 return;
715 }
716
717 const bool ok = generic_assign_action(
718 animated_id, action, acon->act, acon->action_slot_handle, acon->last_slot_identifier);
719 if (!ok) {
720 BKE_reportf(reports,
721 RPT_ERROR,
722 "Could not assign action %s to Action Constraint %s",
723 action->id.name + 2,
724 con->name);
725 return;
726 }
727
728 /* For the Action Constraint, the auto slot selection gets one more fallback
729 * option (compared to the generic code). This is to support the following
730 * scenario, which used to be necessary as a workaround for a bug in Blender (#127976):
731 *
732 * - Python script creates an Action,
733 * - assigns it to the animated object,
734 * - unassigns it from that object,
735 * - and assigns it to the object's Action Constraint.
736 *
737 * The generic code doesn't work for this. The first assignment would see the slot
738 * `XXSlot`, and because it has never been used, just use it. This would change its name to
739 * `OBSlot`. The assignment to the Action Constraint would not see a 'virgin' slot, and thus not
740 * auto-select `OBSlot`. This behavior makes sense when assigning Actions in the Action editor
741 * (it shouldn't automatically pick the first slot of matching ID type), but for the Action
742 * Constraint I (Sybren) feel that it could be a bit more 'enthusiastic' in auto-picking a slot.
743 *
744 * Note that this is the same behavior as for NLA strips, albeit for a slightly different
745 * reason. Because of that it's not sharing code with the NLA.
746 */
747 if (acon->action_slot_handle == Slot::unassigned && action->slots().size() == 1) {
748 Slot *first_slot = action->slot(0);
749 if (first_slot->is_suitable_for(animated_id)) {
751 first_slot,
752 animated_id,
753 acon->act,
754 acon->action_slot_handle,
758 }
759 }
760}
761
762static void rna_ActionConstraint_action_slot_handle_set(
763 PointerRNA *ptr, const blender::animrig::slot_handle_t new_slot_handle)
764{
765 bConstraint *con = (bConstraint *)ptr->data;
767
768 rna_generic_action_slot_handle_set(new_slot_handle,
769 *ptr->owner_id,
770 acon->act,
771 acon->action_slot_handle,
773}
774
780static void rna_ActionConstraint_action_slot_handle_override_diff(
781 Main *bmain, RNAPropertyOverrideDiffContext &rnadiff_ctx)
782{
783 const bConstraint *con_a = static_cast<bConstraint *>(rnadiff_ctx.prop_a->ptr->data);
784 const bConstraint *con_b = static_cast<bConstraint *>(rnadiff_ctx.prop_b->ptr->data);
785
786 const bActionConstraint *act_con_a = static_cast<bActionConstraint *>(con_a->data);
787 const bActionConstraint *act_con_b = static_cast<bActionConstraint *>(con_b->data);
788
789 rna_generic_action_slot_handle_override_diff(bmain, rnadiff_ctx, act_con_a->act, act_con_b->act);
790}
791
792static PointerRNA rna_ActionConstraint_action_slot_get(PointerRNA *ptr)
793{
794 bConstraint *con = (bConstraint *)ptr->data;
796
797 return rna_generic_action_slot_get(acon->act, acon->action_slot_handle);
798}
799
800static void rna_ActionConstraint_action_slot_set(PointerRNA *ptr,
801 PointerRNA value,
802 ReportList *reports)
803{
804 bConstraint *con = (bConstraint *)ptr->data;
806
807 rna_generic_action_slot_set(value,
808 *ptr->owner_id,
809 acon->act,
810 acon->action_slot_handle,
811 acon->last_slot_identifier,
812 reports);
813}
814
815static void rna_iterator_ActionConstraint_action_suitable_slots_begin(
817{
818 bConstraint *con = (bConstraint *)ptr->data;
820
821 rna_iterator_generic_action_suitable_slots_begin(iter, ptr, acon->act);
822}
823
824static int rna_SplineIKConstraint_joint_bindings_get_length(const PointerRNA *ptr,
826{
827 const bConstraint *con = (bConstraint *)ptr->data;
828 const bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
829
830 if (ikData) {
831 length[0] = ikData->numpoints;
832 }
833 else {
834 length[0] = 0;
835 }
836
837 return length[0];
838}
839
840static void rna_SplineIKConstraint_joint_bindings_get(PointerRNA *ptr, float *values)
841{
842 bConstraint *con = (bConstraint *)ptr->data;
844
845 memcpy(values, ikData->points, ikData->numpoints * sizeof(float));
846}
847
848static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const float *values)
849{
850 bConstraint *con = (bConstraint *)ptr->data;
852
853 memcpy(ikData->points, values, ikData->numpoints * sizeof(float));
854}
855
856static int rna_ShrinkwrapConstraint_face_cull_get(PointerRNA *ptr)
857{
858 bConstraint *con = (bConstraint *)ptr->data;
860 return swc->flag & CON_SHRINKWRAP_PROJECT_CULL_MASK;
861}
862
863static void rna_ShrinkwrapConstraint_face_cull_set(PointerRNA *ptr, int value)
864{
865 bConstraint *con = (bConstraint *)ptr->data;
867 swc->flag = (swc->flag & ~CON_SHRINKWRAP_PROJECT_CULL_MASK) | value;
868}
869
870static bool rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value)
871{
872 Object *ob = (Object *)value.data;
873
874 if (ob) {
875 if (ob->type == OB_CAMERA && ob != (Object *)ptr->owner_id) {
876 return 1;
877 }
878 }
879
880 return 0;
881}
882
883static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr,
884 PointerRNA value,
885 ReportList * /*reports*/)
886{
887 bConstraint *con = (bConstraint *)ptr->data;
889 Object *ob = (Object *)value.data;
890
891 if (ob) {
892 if (ob->type == OB_CAMERA && ob != (Object *)ptr->owner_id) {
893 data->camera = ob;
894 id_lib_extern((ID *)ob);
895 }
896 }
897 else {
898 data->camera = nullptr;
899 }
900}
901
902static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr,
903 PointerRNA value,
904 ReportList * /*reports*/)
905{
906 bConstraint *con = (bConstraint *)ptr->data;
908 Object *ob = (Object *)value.data;
909
910 if (ob) {
911 if (ob->type == OB_MESH && ob != (Object *)ptr->owner_id) {
912 data->depth_ob = ob;
913 id_lib_extern((ID *)ob);
914 }
915 }
916 else {
917 data->depth_ob = nullptr;
918 }
919}
920
921static bool rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, PointerRNA value)
922{
923 Object *ob = (Object *)value.data;
924
925 if (ob) {
926 if (ob->type == OB_MESH && ob != (Object *)ptr->owner_id) {
927 return 1;
928 }
929 }
930
931 return 0;
932}
933
934static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr,
935 PointerRNA value,
936 ReportList * /*reports*/)
937{
938 bConstraint *con = (bConstraint *)ptr->data;
940 Object *ob = (Object *)value.data;
941
942 if (ob) {
943 if (ob->type == OB_CAMERA && ob != (Object *)ptr->owner_id) {
944 data->camera = ob;
945 id_lib_extern((ID *)ob);
946 }
947 }
948 else {
949 data->camera = nullptr;
950 }
951}
952
953#else
954
957 "LIMITDIST_INSIDE",
958 0,
959 "Inside",
960 "The object is constrained inside a virtual sphere around the target object, "
961 "with a radius defined by the limit distance"},
963 "LIMITDIST_OUTSIDE",
964 0,
965 "Outside",
966 "The object is constrained outside a virtual sphere around the target object, "
967 "with a radius defined by the limit distance"},
969 "LIMITDIST_ONSURFACE",
970 0,
971 "On Surface",
972 "The object is constrained on the surface of a virtual sphere around the target object, "
973 "with a radius defined by the limit distance"},
974 {0, nullptr, 0, nullptr, nullptr},
975};
976
978{
979 PropertyRNA *prop;
980
982
983 prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
984 RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
985 RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head is 0, Tail is 1");
986 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
987
988 prop = RNA_def_property(srna, "use_bbone_shape", PROP_BOOLEAN, PROP_NONE);
989 RNA_def_property_boolean_sdna(prop, "bConstraint", "flag", CONSTRAINT_BBONE_SHAPE);
991 "Follow B-Bone",
992 "Follow shape of B-Bone segments when calculating Head/Tail position");
993 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
994
996}
997
999{
1000 PropertyRNA *prop;
1001
1003
1004 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1005 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
1006 RNA_def_property_ui_text(prop, "Target", "Target object");
1008 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1009
1010 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1011 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
1012 RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
1013 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1014
1016}
1017
1019{
1020 StructRNA *srna;
1021 PropertyRNA *prop;
1022
1023 srna = RNA_def_struct(brna, "ConstraintTarget", nullptr);
1024 RNA_def_struct_ui_text(srna, "Constraint Target", "Target object for multi-target constraints");
1025 RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
1026 RNA_def_struct_sdna(srna, "bConstraintTarget");
1027
1029
1030 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1031 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
1032 RNA_def_property_ui_text(prop, "Target", "Target object");
1035 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1036
1037 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1038 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
1039 RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
1041 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1042
1043 /* space, flag and type still to do. */
1044
1046}
1047
1049{
1050 StructRNA *srna;
1051 PropertyRNA *prop;
1052
1053 srna = RNA_def_struct(brna, "ConstraintTargetBone", nullptr);
1055 srna, "Constraint Target Bone", "Target bone for multi-target constraints");
1056 RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
1057 RNA_def_struct_sdna(srna, "bConstraintTarget");
1058
1060
1061 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1062 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
1063 RNA_def_property_ui_text(prop, "Target", "Target armature");
1065 prop, nullptr, "rna_ConstraintTargetBone_target_set", nullptr, "rna_Armature_object_poll");
1068 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1069
1070 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1071 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
1072 RNA_def_property_ui_text(prop, "Sub-Target", "Target armature bone");
1074 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1075
1076 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
1077 RNA_def_property_float_sdna(prop, nullptr, "weight");
1078 RNA_def_property_range(prop, 0.0f, 1.0f);
1079 RNA_def_property_ui_text(prop, "Blend Weight", "Blending weight of this bone");
1080 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_update");
1081
1083}
1084
1086{
1087 StructRNA *srna;
1088 PropertyRNA *prop;
1089
1090 srna = RNA_def_struct(brna, "ChildOfConstraint", "Constraint");
1092 srna, "Child Of Constraint", "Create constraint-based parent-child relationship");
1093 RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data");
1094 RNA_def_struct_ui_icon(srna, ICON_CON_CHILDOF);
1095
1097
1099
1100 prop = RNA_def_property(srna, "use_location_x", PROP_BOOLEAN, PROP_NONE);
1101 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_LOCX);
1102 RNA_def_property_ui_text(prop, "Location X", "Use X Location of Parent");
1103 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1104
1105 prop = RNA_def_property(srna, "use_location_y", PROP_BOOLEAN, PROP_NONE);
1106 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_LOCY);
1107 RNA_def_property_ui_text(prop, "Location Y", "Use Y Location of Parent");
1108 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1109
1110 prop = RNA_def_property(srna, "use_location_z", PROP_BOOLEAN, PROP_NONE);
1111 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_LOCZ);
1112 RNA_def_property_ui_text(prop, "Location Z", "Use Z Location of Parent");
1113 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1114
1115 prop = RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
1116 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_ROTX);
1117 RNA_def_property_ui_text(prop, "Rotation X", "Use X Rotation of Parent");
1118 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1119
1120 prop = RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
1121 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_ROTY);
1122 RNA_def_property_ui_text(prop, "Rotation Y", "Use Y Rotation of Parent");
1123 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1124
1125 prop = RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
1126 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_ROTZ);
1127 RNA_def_property_ui_text(prop, "Rotation Z", "Use Z Rotation of Parent");
1128 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1129
1130 prop = RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
1131 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SIZEX);
1132 RNA_def_property_ui_text(prop, "Scale X", "Use X Scale of Parent");
1133 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1134
1135 prop = RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
1136 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SIZEY);
1137 RNA_def_property_ui_text(prop, "Scale Y", "Use Y Scale of Parent");
1138 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1139
1140 prop = RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
1141 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SIZEZ);
1142 RNA_def_property_ui_text(prop, "Scale Z", "Use Z Scale of Parent");
1143 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1144
1145 prop = RNA_def_property(srna, "set_inverse_pending", PROP_BOOLEAN, PROP_NONE);
1146 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SET_INVERSE);
1148 prop, "Set Inverse Pending", "Set to true to request recalculation of the inverse matrix");
1149 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1150
1151 prop = RNA_def_property(srna, "inverse_matrix", PROP_FLOAT, PROP_MATRIX);
1152 RNA_def_property_float_sdna(prop, nullptr, "invmat");
1155 RNA_def_property_ui_text(prop, "Inverse Matrix", "Transformation matrix to apply before");
1157 prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_childof_inverse_matrix_update");
1158
1160}
1161
1163{
1164 StructRNA *srna;
1165 FunctionRNA *func;
1166 PropertyRNA *parm;
1167
1168 RNA_def_property_srna(cprop, "ArmatureConstraintTargets");
1169 srna = RNA_def_struct(brna, "ArmatureConstraintTargets", nullptr);
1170 RNA_def_struct_sdna(srna, "bConstraint");
1172 srna, "Armature Deform Constraint Targets", "Collection of target bones and weights");
1173 RNA_def_struct_ui_icon(srna, ICON_CON_ARMATURE);
1174
1175 func = RNA_def_function(srna, "new", "rna_ArmatureConstraint_target_new");
1177 RNA_def_function_ui_description(func, "Add a new target to the constraint");
1178 parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "New target bone");
1179 RNA_def_function_return(func, parm);
1180
1181 func = RNA_def_function(srna, "remove", "rna_ArmatureConstraint_target_remove");
1183 RNA_def_function_ui_description(func, "Delete target from the constraint");
1184 parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "Target to remove");
1187
1188 func = RNA_def_function(srna, "clear", "rna_ArmatureConstraint_target_clear");
1190 RNA_def_function_ui_description(func, "Delete all targets from object");
1191}
1192
1194{
1195 StructRNA *srna;
1196 PropertyRNA *prop;
1197
1198 srna = RNA_def_struct(brna, "ArmatureConstraint", "Constraint");
1200 srna, "Armature Constraint", "Applies transformations done by the Armature modifier");
1201 RNA_def_struct_sdna_from(srna, "bArmatureConstraint", "data");
1202 RNA_def_struct_ui_icon(srna, ICON_CON_ARMATURE);
1203
1205
1206 prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
1207 RNA_def_property_collection_sdna(prop, nullptr, "targets", nullptr);
1208 RNA_def_property_struct_type(prop, "ConstraintTargetBone");
1209 RNA_def_property_ui_text(prop, "Targets", "Target Bones");
1211
1212 prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
1215 prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
1216 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1217
1218 prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
1221 prop,
1222 "Use Envelopes",
1223 "Multiply weights by envelope for all bones, instead of acting like Vertex Group based "
1224 "blending. "
1225 "The specified weights are still used, and only the listed bones are considered.");
1226 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1227
1228 prop = RNA_def_property(srna, "use_current_location", PROP_BOOLEAN, PROP_NONE);
1231 "Use Current Location",
1232 "Use the current bone location for envelopes and choosing B-Bone "
1233 "segments instead of rest position");
1234 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1235
1237}
1238
1240{
1241 StructRNA *srna;
1242 PropertyRNA *prop;
1243
1244 static const EnumPropertyItem constraint_ik_axisref_items[] = {
1245 {0, "BONE", 0, "Bone", ""},
1246 {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""},
1247 {0, nullptr, 0, nullptr, nullptr},
1248 };
1249
1250 static const EnumPropertyItem constraint_ik_type_items[] = {
1251 {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
1252 {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
1253 {0, nullptr, 0, nullptr, nullptr},
1254 };
1255
1256 srna = RNA_def_struct(brna, "KinematicConstraint", "Constraint");
1257 RNA_def_struct_ui_text(srna, "Kinematic Constraint", "Inverse Kinematics");
1258 RNA_def_struct_sdna_from(srna, "bKinematicConstraint", "data");
1259 RNA_def_struct_ui_icon(srna, ICON_CON_KINEMATIC);
1260
1262
1264
1265 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
1266 RNA_def_property_range(prop, 0, 10000);
1267 RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving iterations");
1268 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1269
1270 prop = RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE);
1271 RNA_def_property_pointer_sdna(prop, nullptr, "poletar");
1272 RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation");
1274 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1275
1276 prop = RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE);
1277 RNA_def_property_string_sdna(prop, nullptr, "polesubtarget");
1278 RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
1279 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1280
1281 prop = RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE);
1282 RNA_def_property_float_sdna(prop, nullptr, "poleangle");
1284 RNA_def_property_ui_range(prop, -M_PI, M_PI, 10, 4);
1285 RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset");
1286 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1287
1288 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
1289 RNA_def_property_range(prop, 0.01, 1.0f);
1291 prop, "Weight", "For Tree-IK: Weight of position control for this target");
1292
1293 prop = RNA_def_property(srna, "orient_weight", PROP_FLOAT, PROP_NONE);
1294 RNA_def_property_float_sdna(prop, nullptr, "orientweight");
1295 RNA_def_property_range(prop, 0.01, 1.0f);
1297 prop, "Orientation Weight", "For Tree-IK: Weight of orientation control for this target");
1298 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1299
1300 prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
1301 RNA_def_property_int_sdna(prop, nullptr, "rootbone");
1302 /* Changing the IK chain length requires a rebuild of depsgraph relations. This makes it
1303 * unsuitable for animation. */
1305 RNA_def_property_range(prop, 0, 255);
1307 prop, "Chain Length", "How many bones are included in the IK effect - 0 uses all bones");
1308 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1309
1310 prop = RNA_def_property(srna, "use_tail", PROP_BOOLEAN, PROP_NONE);
1311 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_IK_TIP);
1312 RNA_def_property_ui_text(prop, "Use Tail", "Include bone's tail as last element in chain");
1313 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1314
1315 prop = RNA_def_property(srna, "reference_axis", PROP_ENUM, PROP_NONE);
1316 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1317 RNA_def_property_enum_items(prop, constraint_ik_axisref_items);
1319 prop, "Axis Reference", "Constraint axis Lock options relative to Bone or Target reference");
1320 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1321
1322 prop = RNA_def_property(srna, "use_location", PROP_BOOLEAN, PROP_NONE);
1323 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_IK_POS);
1324 RNA_def_property_ui_text(prop, "Position", "Chain follows position of target");
1325 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1326
1327 prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
1329 RNA_def_property_ui_text(prop, "Lock X Pos", "Constraint position along X axis");
1330 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1331
1332 prop = RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
1334 RNA_def_property_ui_text(prop, "Lock Y Pos", "Constraint position along Y axis");
1335 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1336
1337 prop = RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
1339 RNA_def_property_ui_text(prop, "Lock Z Pos", "Constraint position along Z axis");
1340 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1341
1342 prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
1343 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_IK_ROT);
1344 RNA_def_property_ui_text(prop, "Rotation", "Chain follows rotation of target");
1345 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1346
1347 prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
1349 RNA_def_property_ui_text(prop, "Lock X Rotation", "Constraint rotation along X axis");
1350 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1351
1352 prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
1354 RNA_def_property_ui_text(prop, "Lock Y Rotation", "Constraint rotation along Y axis");
1355 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1356
1357 prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
1359 RNA_def_property_ui_text(prop, "Lock Z Rotation", "Constraint rotation along Z axis");
1360 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1361
1362 prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
1364 RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching");
1365 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1366
1367 prop = RNA_def_property(srna, "ik_type", PROP_ENUM, PROP_NONE);
1368 RNA_def_property_enum_sdna(prop, nullptr, "type");
1369 RNA_def_property_enum_funcs(prop, nullptr, "rna_Constraint_ik_type_set", nullptr);
1370 RNA_def_property_enum_items(prop, constraint_ik_type_items);
1371 RNA_def_property_ui_text(prop, "IK Type", "");
1372 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1373
1374 prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
1375 RNA_def_property_enum_sdna(prop, nullptr, "mode");
1378 prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
1379 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1380
1381 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
1382 RNA_def_property_float_sdna(prop, nullptr, "dist");
1383 RNA_def_property_range(prop, 0.0, 100.0f);
1384 RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
1385 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1386
1388}
1389
1391{
1392 StructRNA *srna;
1393 PropertyRNA *prop;
1394
1395 static const EnumPropertyItem up_items[] = {
1396 {TRACK_X, "UP_X", 0, "X", ""},
1397 {TRACK_Y, "UP_Y", 0, "Y", ""},
1398 {TRACK_Z, "UP_Z", 0, "Z", ""},
1399 {0, nullptr, 0, nullptr, nullptr},
1400 };
1401
1402 srna = RNA_def_struct(brna, "TrackToConstraint", "Constraint");
1404 srna, "Track To Constraint", "Aim the constrained object toward the target");
1405
1407
1408 RNA_def_struct_sdna_from(srna, "bTrackToConstraint", "data");
1409
1411
1412 RNA_def_struct_ui_icon(srna, ICON_CON_TRACKTO);
1413
1415
1416 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
1417 RNA_def_property_enum_sdna(prop, nullptr, "reserved1");
1419 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
1420 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1421
1422 prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
1423 RNA_def_property_enum_sdna(prop, nullptr, "reserved2");
1424 RNA_def_property_enum_items(prop, up_items);
1425 RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
1426 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1427
1428 prop = RNA_def_property(srna, "use_target_z", PROP_BOOLEAN, PROP_NONE);
1429 RNA_def_property_boolean_sdna(prop, nullptr, "flags", TARGET_Z_UP);
1431 prop, "Target Z", "Target's Z axis, not World Z axis, will constrain the Up direction");
1432 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1433
1435}
1436
1438{
1439 StructRNA *srna;
1440 PropertyRNA *prop;
1441
1442 srna = RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
1443 RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copy the location of the target");
1444 RNA_def_struct_ui_icon(srna, ICON_CON_LOCLIKE);
1445
1447
1448 RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data");
1449
1451
1453
1454 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1455 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_X);
1456 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X location");
1457 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1458
1459 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1460 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Y);
1461 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y location");
1462 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1463
1464 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1465 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Z);
1466 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z location");
1467 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1468
1469 prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
1470 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_X_INVERT);
1471 RNA_def_property_ui_text(prop, "Invert X", "Invert the X location");
1472 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1473
1474 prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
1475 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Y_INVERT);
1476 RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location");
1477 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1478
1479 prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
1480 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Z_INVERT);
1481 RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location");
1482 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1483
1484 prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
1485 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_OFFSET);
1486 RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location");
1487 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1488
1490}
1491
1493{
1494 StructRNA *srna;
1495 PropertyRNA *prop;
1496
1497 static const EnumPropertyItem mix_mode_items[] = {
1498 {ROTLIKE_MIX_REPLACE, "REPLACE", 0, "Replace", "Replace the original rotation with copied"},
1499 {ROTLIKE_MIX_ADD, "ADD", 0, "Add", "Add euler component values together"},
1501 "BEFORE",
1502 0,
1503 "Before Original",
1504 "Apply copied rotation before original, as if the constraint target is a parent"},
1506 "AFTER",
1507 0,
1508 "After Original",
1509 "Apply copied rotation after original, as if the constraint target is a child"},
1511 "OFFSET",
1512 0,
1513 "Offset (Legacy)",
1514 "Combine rotations like the original Offset checkbox. Does not work well for "
1515 "multiple axis rotations."},
1516 {0, nullptr, 0, nullptr, nullptr},
1517 };
1518
1519 srna = RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
1520 RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copy the rotation of the target");
1521 RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data");
1522 RNA_def_struct_ui_icon(srna, ICON_CON_ROTLIKE);
1523
1525
1527
1528 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1529 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_X);
1530 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X rotation");
1531 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1532
1533 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1534 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Y);
1535 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y rotation");
1536 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1537
1538 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1539 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Z);
1540 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z rotation");
1541 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1542
1543 prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
1544 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_X_INVERT);
1545 RNA_def_property_ui_text(prop, "Invert X", "Invert the X rotation");
1546 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1547
1548 prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
1549 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Y_INVERT);
1550 RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y rotation");
1551 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1552
1553 prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
1554 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Z_INVERT);
1555 RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z rotation");
1556 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1557
1558 prop = RNA_def_property(srna, "euler_order", PROP_ENUM, PROP_NONE);
1559 RNA_def_property_enum_sdna(prop, nullptr, "euler_order");
1561 RNA_def_property_ui_text(prop, "Euler Order", "Explicitly specify the euler rotation order");
1562 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1563
1564 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
1565 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode");
1566 RNA_def_property_enum_items(prop, mix_mode_items);
1568 prop, "Mix Mode", "Specify how the copied and existing rotations are combined");
1569 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1570
1571 /* DEPRECATED: replaced with mix_mode */
1572 prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
1574 prop, "rna_Constraint_RotLike_use_offset_get", "rna_Constraint_RotLike_use_offset_set");
1576 prop, "Offset", "DEPRECATED: Add original rotation into copied rotation");
1577 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1578
1580}
1581
1583{
1584 StructRNA *srna;
1585 PropertyRNA *prop;
1586
1587 srna = RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
1588 RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copy the scale of the target");
1589 RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
1590 RNA_def_struct_ui_icon(srna, ICON_CON_SIZELIKE);
1591
1593
1595
1596 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1597 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_X);
1598 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X scale");
1599 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1600
1601 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1602 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_Y);
1603 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y scale");
1604 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1605
1606 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1607 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_Z);
1608 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale");
1609 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1610
1611 prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_NONE);
1612 RNA_def_property_float_sdna(prop, nullptr, "power");
1615 RNA_def_property_ui_text(prop, "Power", "Raise the target's scale to the specified power");
1617 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1618
1619 prop = RNA_def_property(srna, "use_make_uniform", PROP_BOOLEAN, PROP_NONE);
1620 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_UNIFORM);
1622 "Make Uniform",
1623 "Redistribute the copied change in volume equally "
1624 "between the three axes of the owner");
1625 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1626
1627 prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
1628 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_OFFSET);
1629 RNA_def_property_ui_text(prop, "Offset", "Combine original scale with copied scale");
1630 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1631
1632 prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
1635 prop,
1636 "Additive",
1637 "Use addition instead of multiplication to combine scale (2.7 compatibility)");
1639 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1640
1642}
1643
1645{
1646 StructRNA *srna;
1647 PropertyRNA *prop;
1648
1649 static const EnumPropertyItem axis_items[] = {
1650 {SAMEVOL_X, "SAMEVOL_X", 0, "X", ""},
1651 {SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""},
1652 {SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""},
1653 {0, nullptr, 0, nullptr, nullptr},
1654 };
1655
1656 static const EnumPropertyItem mode_items[] = {
1658 "STRICT",
1659 0,
1660 "Strict",
1661 "Volume is strictly preserved, overriding the scaling of non-free axes"},
1663 "UNIFORM",
1664 0,
1665 "Uniform",
1666 "Volume is preserved when the object is scaled uniformly. "
1667 "Deviations from uniform scale on non-free axes are passed through."},
1669 "SINGLE_AXIS",
1670 0,
1671 "Single Axis",
1672 "Volume is preserved when the object is scaled only on the free axis. "
1673 "Non-free axis scaling is passed through."},
1674 {0, nullptr, 0, nullptr, nullptr},
1675 };
1676
1677 srna = RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
1679 "Maintain Volume Constraint",
1680 "Maintain a constant volume along a single scaling axis");
1681 RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
1682 RNA_def_struct_ui_icon(srna, ICON_CON_SAMEVOL);
1683
1685
1686 prop = RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
1687 RNA_def_property_enum_sdna(prop, nullptr, "free_axis");
1688 RNA_def_property_enum_items(prop, axis_items);
1689 RNA_def_property_ui_text(prop, "Free Axis", "The free scaling axis of the object");
1690 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1691
1692 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1693 RNA_def_property_enum_sdna(prop, nullptr, "mode");
1694 RNA_def_property_enum_items(prop, mode_items);
1696 prop, "Mode", "The way the constraint treats original non-free axis scaling");
1697 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1698
1699 prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
1700 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1701 RNA_def_property_ui_range(prop, 0.001f, 100.0f, 1, 3);
1702 RNA_def_property_ui_text(prop, "Volume", "Volume of the bone at rest");
1703 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1704
1706}
1707
1709{
1710 StructRNA *srna;
1711 PropertyRNA *prop;
1712
1713 static const EnumPropertyItem mix_mode_items[] = {
1715 "REPLACE",
1716 0,
1717 "Replace",
1718 "Replace the original transformation with copied"},
1721 "BEFORE_FULL",
1722 0,
1723 "Before Original (Full)",
1724 "Apply copied transformation before original, using simple matrix multiplication as if "
1725 "the constraint target is a parent in Full Inherit Scale mode. "
1726 "Will create shear when combining rotation and non-uniform scale."},
1728 "BEFORE",
1729 0,
1730 "Before Original (Aligned)",
1731 "Apply copied transformation before original, as if the constraint target is a parent in "
1732 "Aligned Inherit Scale mode. This effectively uses Full for location and Split Channels "
1733 "for rotation and scale."},
1735 "BEFORE_SPLIT",
1736 0,
1737 "Before Original (Split Channels)",
1738 "Apply copied transformation before original, handling location, rotation and scale "
1739 "separately, similar to a sequence of three Copy constraints"},
1742 "AFTER_FULL",
1743 0,
1744 "After Original (Full)",
1745 "Apply copied transformation after original, using simple matrix multiplication as if "
1746 "the constraint target is a child in Full Inherit Scale mode. "
1747 "Will create shear when combining rotation and non-uniform scale."},
1749 "AFTER",
1750 0,
1751 "After Original (Aligned)",
1752 "Apply copied transformation after original, as if the constraint target is a child in "
1753 "Aligned Inherit Scale mode. This effectively uses Full for location and Split Channels "
1754 "for rotation and scale."},
1756 "AFTER_SPLIT",
1757 0,
1758 "After Original (Split Channels)",
1759 "Apply copied transformation after original, handling location, rotation and scale "
1760 "separately, similar to a sequence of three Copy constraints"},
1761 {0, nullptr, 0, nullptr, nullptr},
1762 };
1763
1764 srna = RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
1766 srna, "Copy Transforms Constraint", "Copy all the transforms of the target");
1767
1769
1770 RNA_def_struct_sdna_from(srna, "bTransLikeConstraint", "data");
1771
1772 RNA_def_struct_ui_icon(srna, ICON_CON_TRANSLIKE);
1773
1775
1777
1778 prop = RNA_def_property(srna, "remove_target_shear", PROP_BOOLEAN, PROP_NONE);
1781 prop, "Remove Target Shear", "Remove shear from the target transformation before combining");
1782 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1783
1784 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
1785 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode");
1786 RNA_def_property_enum_items(prop, mix_mode_items);
1788 prop, "Mix Mode", "Specify how the copied and existing transformations are combined");
1789 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1790
1792}
1793
1795{
1796 StructRNA *srna;
1797 PropertyRNA *prop;
1798
1799 static const EnumPropertyItem minmax_items[] = {
1800 {TRACK_X, "FLOOR_X", 0, "X", ""},
1801 {TRACK_Y, "FLOOR_Y", 0, "Y", ""},
1802 {TRACK_Z, "FLOOR_Z", 0, "Z", ""},
1803 {TRACK_nX, "FLOOR_NEGATIVE_X", 0, "-X", ""},
1804 {TRACK_nY, "FLOOR_NEGATIVE_Y", 0, "-Y", ""},
1805 {TRACK_nZ, "FLOOR_NEGATIVE_Z", 0, "-Z", ""},
1806 {0, nullptr, 0, nullptr, nullptr},
1807 };
1808
1809 srna = RNA_def_struct(brna, "FloorConstraint", "Constraint");
1811 srna, "Floor Constraint", "Use the target object for location limitation");
1812 RNA_def_struct_sdna_from(srna, "bMinMaxConstraint", "data");
1813 RNA_def_struct_ui_icon(srna, ICON_CON_FLOOR);
1814
1816
1818
1819 prop = RNA_def_property(srna, "floor_location", PROP_ENUM, PROP_NONE);
1820 RNA_def_property_enum_sdna(prop, nullptr, "minmaxflag");
1821 RNA_def_property_enum_items(prop, minmax_items);
1823 prop, "Floor Location", "Location of target that object will not pass through");
1824 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1825
1826 prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
1827 RNA_def_property_boolean_sdna(prop, nullptr, "flag", MINMAX_USEROT);
1828 RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor");
1829 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1830
1831 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
1832 RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, -1);
1833 RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object origin");
1834 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1835
1837}
1838
1840{
1841 StructRNA *srna;
1842 PropertyRNA *prop;
1843
1844 static const EnumPropertyItem transform_channel_items[] = {
1845 {20, "LOCATION_X", 0, "X Location", ""},
1846 {21, "LOCATION_Y", 0, "Y Location", ""},
1847 {22, "LOCATION_Z", 0, "Z Location", ""},
1848 {00, "ROTATION_X", 0, "X Rotation", ""},
1849 {01, "ROTATION_Y", 0, "Y Rotation", ""},
1850 {02, "ROTATION_Z", 0, "Z Rotation", ""},
1851 {10, "SCALE_X", 0, "X Scale", ""},
1852 {11, "SCALE_Y", 0, "Y Scale", ""},
1853 {12, "SCALE_Z", 0, "Z Scale", ""},
1854 {0, nullptr, 0, nullptr, nullptr},
1855 };
1856
1857 static const EnumPropertyItem mix_mode_items[] = {
1859 "REPLACE",
1860 0,
1861 "Replace",
1862 "Replace the original transformation with the action channels"},
1865 "BEFORE_FULL",
1866 0,
1867 "Before Original (Full)",
1868 "Apply the action channels before the original transformation, as if applied to an "
1869 "imaginary parent in Full Inherit Scale mode. Will create shear when combining rotation "
1870 "and non-uniform scale."},
1872 "BEFORE",
1873 0,
1874 "Before Original (Aligned)",
1875 "Apply the action channels before the original transformation, as if applied to an "
1876 "imaginary parent in Aligned Inherit Scale mode. This effectively uses Full for location "
1877 "and Split Channels for rotation and scale."},
1879 "BEFORE_SPLIT",
1880 0,
1881 "Before Original (Split Channels)",
1882 "Apply the action channels before the original transformation, handling location, rotation "
1883 "and scale separately"},
1886 "AFTER_FULL",
1887 0,
1888 "After Original (Full)",
1889 "Apply the action channels after the original transformation, as if applied to an "
1890 "imaginary child in Full Inherit Scale mode. Will create shear when combining rotation "
1891 "and non-uniform scale."},
1893 "AFTER",
1894 0,
1895 "After Original (Aligned)",
1896 "Apply the action channels after the original transformation, as if applied to an "
1897 "imaginary child in Aligned Inherit Scale mode. This effectively uses Full for location "
1898 "and Split Channels for rotation and scale."},
1900 "AFTER_SPLIT",
1901 0,
1902 "After Original (Split Channels)",
1903 "Apply the action channels after the original transformation, handling location, rotation "
1904 "and scale separately"},
1905 {0, nullptr, 0, nullptr, nullptr},
1906 };
1907
1908 srna = RNA_def_struct(brna, "ActionConstraint", "Constraint");
1910 srna, "Action Constraint", "Map an action to the transform axes of a bone");
1911 RNA_def_struct_sdna_from(srna, "bActionConstraint", "data");
1912 RNA_def_struct_ui_icon(srna, ICON_ACTION);
1913
1915
1917
1918 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
1919 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode");
1920 RNA_def_property_enum_items(prop, mix_mode_items);
1921 RNA_def_property_enum_funcs(prop, nullptr, "rna_ActionConstraint_mix_mode_set", nullptr);
1923 prop,
1924 "Mix Mode",
1925 "Specify how existing transformations and the action channels are combined");
1926 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1927
1928 prop = RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE);
1929 RNA_def_property_enum_sdna(prop, nullptr, "type");
1930 RNA_def_property_enum_items(prop, transform_channel_items);
1932 prop,
1933 "Transform Channel",
1934 "Transformation channel from the target that is used to key the Action");
1935 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1936
1937 prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
1938 RNA_def_property_pointer_sdna(prop, nullptr, "act");
1940 prop, nullptr, "rna_ActionConstraint_action_set", nullptr, "rna_Action_id_poll");
1941 RNA_def_property_ui_text(prop, "Action", "The constraining action");
1943 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1944
1945 /* This property is not necessary for the Python API (that is better off using
1946 * slot references/pointers directly), but it is needed for library overrides
1947 * to work. */
1948 prop = RNA_def_property(srna, "action_slot_handle", PROP_INT, PROP_NONE);
1949 RNA_def_property_int_sdna(prop, nullptr, "action_slot_handle");
1951 prop, nullptr, "rna_ActionConstraint_action_slot_handle_set", nullptr);
1953 "Action Slot Handle",
1954 "A number that identifies which sub-set of the Action is considered "
1955 "to be for this Action Constraint");
1958 prop, "rna_ActionConstraint_action_slot_handle_override_diff", nullptr, nullptr);
1959 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_Constraint_update");
1960
1961 prop = RNA_def_property(srna, "last_slot_identifier", PROP_STRING, PROP_NONE);
1962 RNA_def_property_string_sdna(prop, nullptr, "last_slot_identifier");
1964 prop,
1965 "Last Action Slot Identifier",
1966 "The identifier of the most recently assigned action slot. The slot identifies which "
1967 "sub-set of the Action is considered to be for this constraint, and its identifier is used "
1968 "to find the right slot when assigning an Action.");
1969
1970 prop = RNA_def_property(srna, "action_slot", PROP_POINTER, PROP_NONE);
1971 RNA_def_property_struct_type(prop, "ActionSlot");
1975 prop,
1976 "Action Slot",
1977 "The slot identifies which sub-set of the Action is considered to be for this "
1978 "strip, and its name is used to find the right slot when assigning another Action");
1980 "rna_ActionConstraint_action_slot_get",
1981 "rna_ActionConstraint_action_slot_set",
1982 nullptr,
1983 nullptr);
1984 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_Constraint_update");
1985 /* `strip.action_slot` is exposed to RNA as a pointer for things like the action slot selector in
1986 * the GUI. The ground truth of the assigned slot, however, is `action_slot_handle` declared
1987 * above. That property is used for library override operations, and this pointer property should
1988 * just be ignored.
1989 *
1990 * This needs PROPOVERRIDE_IGNORE; PROPOVERRIDE_NO_COMPARISON is not suitable here. This property
1991 * should act as if it is an overridable property (as from the user's perspective, it is), but an
1992 * override operation should not be created for it. It will be created for `action_slot_handle`,
1993 * and that's enough. */
1995
1996 prop = RNA_def_property(srna, "action_suitable_slots", PROP_COLLECTION, PROP_NONE);
1997 RNA_def_property_struct_type(prop, "ActionSlot");
1999 "rna_iterator_ActionConstraint_action_suitable_slots_begin",
2000 "rna_iterator_array_next",
2001 "rna_iterator_array_end",
2002 "rna_iterator_array_dereference_get",
2003 nullptr,
2004 nullptr,
2005 nullptr,
2006 nullptr);
2008 prop, "Action Slots", "The list of action slots suitable for this NLA strip");
2009
2010 prop = RNA_def_property(srna, "use_bone_object_action", PROP_BOOLEAN, PROP_NONE);
2013 "Object Action",
2014 "Bones only: apply the object's transformation channels of the action "
2015 "to the constrained bone, instead of bone's channels");
2016 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2017
2018 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
2019 RNA_def_property_int_sdna(prop, nullptr, "start");
2021 RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use");
2022 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2023
2024 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
2025 RNA_def_property_int_sdna(prop, nullptr, "end");
2027 RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use");
2028 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2029
2030 prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
2031 RNA_def_property_float_sdna(prop, nullptr, "max");
2032 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2033 RNA_def_property_ui_text(prop, "Maximum", "Maximum value for target channel range");
2034 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2035 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_ActionConstraint_minmax_range");
2036
2037 prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
2038 RNA_def_property_float_sdna(prop, nullptr, "min");
2039 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2040 RNA_def_property_ui_text(prop, "Minimum", "Minimum value for target channel range");
2041 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2042 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_ActionConstraint_minmax_range");
2043
2044 prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_FACTOR);
2045 RNA_def_property_float_sdna(prop, nullptr, "eval_time");
2046 RNA_def_property_range(prop, 0.0f, 1.0f);
2048 prop, "Evaluation Time", "Interpolates between Action Start and End frames");
2049 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2050
2051 prop = RNA_def_property(srna, "use_eval_time", PROP_BOOLEAN, PROP_NONE);
2054 "Use Evaluation Time",
2055 "Interpolate between Action Start and End frames, with the Evaluation "
2056 "Time slider instead of the Target object/bone");
2057 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2058
2060}
2061
2063{
2064 StructRNA *srna;
2065 PropertyRNA *prop;
2066
2067 static const EnumPropertyItem lock_items[] = {
2068 {TRACK_X, "LOCK_X", 0, "X", ""},
2069 {TRACK_Y, "LOCK_Y", 0, "Y", ""},
2070 {TRACK_Z, "LOCK_Z", 0, "Z", ""},
2071 {0, nullptr, 0, nullptr, nullptr},
2072 };
2073
2074 srna = RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
2076 srna,
2077 "Locked Track Constraint",
2078 "Point toward the target along the track axis, while locking the other axis");
2079 RNA_def_struct_ui_icon(srna, ICON_CON_LOCKTRACK);
2080
2082
2083 RNA_def_struct_sdna_from(srna, "bLockTrackConstraint", "data");
2084
2086
2088
2089 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
2090 RNA_def_property_enum_sdna(prop, nullptr, "trackflag");
2092 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
2093 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2094
2095 prop = RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
2096 RNA_def_property_enum_sdna(prop, nullptr, "lockflag");
2097 RNA_def_property_enum_items(prop, lock_items);
2098 RNA_def_property_ui_text(prop, "Locked Axis", "Axis that points upward");
2099 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2100
2102}
2103
2105{
2106 StructRNA *srna;
2107 PropertyRNA *prop;
2108
2109 static const EnumPropertyItem forwardpath_items[] = {
2110 {TRACK_X, "FORWARD_X", 0, "X", ""},
2111 {TRACK_Y, "FORWARD_Y", 0, "Y", ""},
2112 {TRACK_Z, "FORWARD_Z", 0, "Z", ""},
2113 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
2114 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
2115 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
2116 {0, nullptr, 0, nullptr, nullptr},
2117 };
2118
2119 static const EnumPropertyItem pathup_items[] = {
2120 {TRACK_X, "UP_X", 0, "X", ""},
2121 {TRACK_Y, "UP_Y", 0, "Y", ""},
2122 {TRACK_Z, "UP_Z", 0, "Z", ""},
2123 {0, nullptr, 0, nullptr, nullptr},
2124 };
2125
2126 srna = RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
2127 RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Lock motion to the target path");
2128 RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data");
2129 RNA_def_struct_ui_icon(srna, ICON_CON_FOLLOWPATH);
2130
2132
2133 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
2134 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
2135 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Curve_object_poll");
2136 RNA_def_property_ui_text(prop, "Target", "Target Curve object");
2138 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
2139
2140 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TIME);
2143 prop, "Offset", "Offset from the position corresponding to the time frame");
2144 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2145
2146 prop = RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR);
2147 RNA_def_property_float_sdna(prop, nullptr, "offset_fac");
2149 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 3);
2151 prop, "Offset Factor", "Percentage value defining target position along length of curve");
2152 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2153
2154 prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
2155 RNA_def_property_enum_sdna(prop, nullptr, "trackflag");
2156 RNA_def_property_enum_items(prop, forwardpath_items);
2157 RNA_def_property_ui_text(prop, "Forward Axis", "Axis that points forward along the path");
2158 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2159
2160 prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
2161 RNA_def_property_enum_sdna(prop, nullptr, "upflag");
2162 RNA_def_property_enum_items(prop, pathup_items);
2163 RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
2164 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2165
2166 prop = RNA_def_property(srna, "use_curve_follow", PROP_BOOLEAN, PROP_NONE);
2167 RNA_def_property_boolean_sdna(prop, nullptr, "followflag", FOLLOWPATH_FOLLOW);
2169 prop, "Follow Curve", "Object will follow the heading and banking of the curve");
2170 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2171
2172 prop = RNA_def_property(srna, "use_fixed_location", PROP_BOOLEAN, PROP_NONE);
2173 RNA_def_property_boolean_sdna(prop, nullptr, "followflag", FOLLOWPATH_STATIC);
2175 prop,
2176 "Fixed Position",
2177 "Object will stay locked to a single point somewhere along the length of the curve "
2178 "regardless of time");
2179 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2180
2181 prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
2182 RNA_def_property_boolean_sdna(prop, nullptr, "followflag", FOLLOWPATH_RADIUS);
2183 RNA_def_property_ui_text(prop, "Curve Radius", "Object is scaled by the curve radius");
2184 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2185
2187}
2188
2190{
2191 StructRNA *srna;
2192 PropertyRNA *prop;
2193
2194 static const EnumPropertyItem volume_items[] = {
2195 {VOLUME_XZ, "VOLUME_XZX", 0, "XZ", ""},
2196 {VOLUME_X, "VOLUME_X", 0, "X", ""},
2197 {VOLUME_Z, "VOLUME_Z", 0, "Z", ""},
2198 {NO_VOLUME, "NO_VOLUME", 0, "None", ""},
2199 {0, nullptr, 0, nullptr, nullptr},
2200 };
2201
2202 static const EnumPropertyItem plane_items[] = {
2203 {PLANE_X, "PLANE_X", 0, "XZ", "Rotate around local X, then Z"},
2204 {PLANE_Z, "PLANE_Z", 0, "ZX", "Rotate around local Z, then X"},
2205 {SWING_Y,
2206 "SWING_Y",
2207 0,
2208 "Swing",
2209 "Use the smallest single axis rotation, similar to Damped Track"},
2210 {0, nullptr, 0, nullptr, nullptr},
2211 };
2212
2213 srna = RNA_def_struct(brna, "StretchToConstraint", "Constraint");
2214 RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretch to meet the target object");
2215 RNA_def_struct_ui_icon(srna, ICON_CON_STRETCHTO);
2216
2218
2219 RNA_def_struct_sdna_from(srna, "bStretchToConstraint", "data");
2220
2222
2224
2225 prop = RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
2226 RNA_def_property_enum_sdna(prop, nullptr, "volmode");
2227 RNA_def_property_enum_items(prop, volume_items);
2229 prop, "Maintain Volume", "Maintain the object's volume as it stretches");
2230 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2231
2232 prop = RNA_def_property(srna, "keep_axis", PROP_ENUM, PROP_NONE);
2233 RNA_def_property_enum_sdna(prop, nullptr, "plane");
2234 RNA_def_property_enum_items(prop, plane_items);
2235 RNA_def_property_ui_text(prop, "Keep Axis", "The rotation type and axis order to use");
2236 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2237
2238 prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_DISTANCE);
2239 RNA_def_property_float_sdna(prop, nullptr, "orglength");
2240 RNA_def_property_range(prop, 0.0f, 1000.0f);
2242 RNA_def_property_ui_text(prop, "Original Length", "Length at rest position");
2243 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2244
2245 prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
2246 RNA_def_property_range(prop, 0.0, 100.0f);
2248 prop, "Volume Variation", "Factor between volume variation and stretching");
2249 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2250
2251 prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
2254 prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
2255 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2256
2257 prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
2260 prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
2261 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2262
2263 prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
2264 RNA_def_property_range(prop, 0.0, 1.0f);
2265 RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
2266 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2267
2268 prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
2269 RNA_def_property_range(prop, 1.0, 100.0f);
2270 RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
2271 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2272
2273 prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
2274 RNA_def_property_range(prop, 0.0, 1.0f);
2276 prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
2277 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2278
2280}
2281
2283{
2284 StructRNA *srna;
2285 PropertyRNA *prop;
2286
2287 static const EnumPropertyItem clamp_items[] = {
2288 {CLAMPTO_AUTO, "CLAMPTO_AUTO", 0, "Auto", ""},
2289 {CLAMPTO_X, "CLAMPTO_X", 0, "X", ""},
2290 {CLAMPTO_Y, "CLAMPTO_Y", 0, "Y", ""},
2291 {CLAMPTO_Z, "CLAMPTO_Z", 0, "Z", ""},
2292 {0, nullptr, 0, nullptr, nullptr},
2293 };
2294
2295 srna = RNA_def_struct(brna, "ClampToConstraint", "Constraint");
2297 srna,
2298 "Clamp To Constraint",
2299 "Constrain an object's location to the nearest point along the target path");
2300 RNA_def_struct_sdna_from(srna, "bClampToConstraint", "data");
2301 RNA_def_struct_ui_icon(srna, ICON_CON_CLAMPTO);
2302
2304
2305 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
2306 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
2307 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Curve_object_poll");
2308 RNA_def_property_ui_text(prop, "Target", "Target Object (Curves only)");
2310 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
2311
2312 prop = RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE);
2313 RNA_def_property_enum_sdna(prop, nullptr, "flag");
2314 RNA_def_property_enum_items(prop, clamp_items);
2315 RNA_def_property_ui_text(prop, "Main Axis", "Main axis of movement");
2316 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2317
2318 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
2319 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", CLAMPTO_CYCLIC);
2321 prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box)");
2322 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2323
2325}
2326
2328{
2329 StructRNA *srna;
2330 PropertyRNA *prop;
2331
2332 static const EnumPropertyItem transform_items[] = {
2333 {TRANS_LOCATION, "LOCATION", 0, "Location", ""},
2334 {TRANS_ROTATION, "ROTATION", 0, "Rotation", ""},
2335 {TRANS_SCALE, "SCALE", 0, "Scale", ""},
2336 {0, nullptr, 0, nullptr, nullptr},
2337 };
2338
2339 static const EnumPropertyItem mix_mode_loc_items[] = {
2340 {TRANS_MIXLOC_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
2341 {TRANS_MIXLOC_ADD, "ADD", 0, "Add", "Add component values together"},
2342 {0, nullptr, 0, nullptr, nullptr},
2343 };
2344
2345 static const EnumPropertyItem mix_mode_rot_items[] = {
2346 {TRANS_MIXROT_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
2347 {TRANS_MIXROT_ADD, "ADD", 0, "Add", "Add component values together"},
2349 "BEFORE",
2350 0,
2351 "Before Original",
2352 "Apply new rotation before original, as if it was on a parent"},
2354 "AFTER",
2355 0,
2356 "After Original",
2357 "Apply new rotation after original, as if it was on a child"},
2358 {0, nullptr, 0, nullptr, nullptr},
2359 };
2360
2361 static const EnumPropertyItem mix_mode_scale_items[] = {
2362 {TRANS_MIXSCALE_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
2363 {TRANS_MIXSCALE_MULTIPLY, "MULTIPLY", 0, "Multiply", "Multiply component values together"},
2364 {0, nullptr, 0, nullptr, nullptr},
2365 };
2366
2367 srna = RNA_def_struct(brna, "TransformConstraint", "Constraint");
2369 srna, "Transformation Constraint", "Map transformations of the target to the object");
2370 RNA_def_struct_sdna_from(srna, "bTransformConstraint", "data");
2371 RNA_def_struct_ui_icon(srna, ICON_CON_TRANSFORM);
2372
2374
2376
2377 prop = RNA_def_property(srna, "map_from", PROP_ENUM, PROP_NONE);
2378 RNA_def_property_enum_sdna(prop, nullptr, "from");
2379 RNA_def_property_enum_items(prop, transform_items);
2380 RNA_def_property_ui_text(prop, "Map From", "The transformation type to use from the target");
2381 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2382
2383 prop = RNA_def_property(srna, "map_to", PROP_ENUM, PROP_NONE);
2384 RNA_def_property_enum_sdna(prop, nullptr, "to");
2385 RNA_def_property_enum_items(prop, transform_items);
2387 prop, "Map To", "The transformation type to affect on the constrained object");
2388 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2389
2390 prop = RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE);
2391 RNA_def_property_enum_sdna(prop, nullptr, "map[0]");
2394 prop, "Map To X From", "The source axis constrained object's X axis uses");
2395 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2396
2397 prop = RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE);
2398 RNA_def_property_enum_sdna(prop, nullptr, "map[1]");
2401 prop, "Map To Y From", "The source axis constrained object's Y axis uses");
2402 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2403
2404 prop = RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE);
2405 RNA_def_property_enum_sdna(prop, nullptr, "map[2]");
2408 prop, "Map To Z From", "The source axis constrained object's Z axis uses");
2409 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2410
2411 prop = RNA_def_property(srna, "use_motion_extrapolate", PROP_BOOLEAN, PROP_NONE);
2412 RNA_def_property_boolean_sdna(prop, nullptr, "expo", CLAMPTO_CYCLIC);
2413 RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges");
2414 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2415
2416 prop = RNA_def_property(srna, "from_rotation_mode", PROP_ENUM, PROP_NONE);
2417 RNA_def_property_enum_sdna(prop, nullptr, "from_rotation_mode");
2419 RNA_def_property_ui_text(prop, "From Mode", "Specify the type of rotation channels to use");
2420 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2421
2422 prop = RNA_def_property(srna, "to_euler_order", PROP_ENUM, PROP_NONE);
2423 RNA_def_property_enum_sdna(prop, nullptr, "to_euler_order");
2425 RNA_def_property_ui_text(prop, "To Order", "Explicitly specify the output euler rotation order");
2426 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2427
2428 /* Loc */
2429 prop = RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
2430 RNA_def_property_float_sdna(prop, nullptr, "from_min[0]");
2431 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2432 RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
2433 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2434
2435 prop = RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
2436 RNA_def_property_float_sdna(prop, nullptr, "from_min[1]");
2437 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2438 RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
2439 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2440
2441 prop = RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
2442 RNA_def_property_float_sdna(prop, nullptr, "from_min[2]");
2443 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2444 RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
2445 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2446
2447 prop = RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
2448 RNA_def_property_float_sdna(prop, nullptr, "from_max[0]");
2449 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2450 RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
2451 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2452
2453 prop = RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
2454 RNA_def_property_float_sdna(prop, nullptr, "from_max[1]");
2455 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2456 RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
2457 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2458
2459 prop = RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
2460 RNA_def_property_float_sdna(prop, nullptr, "from_max[2]");
2461 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2462 RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
2463 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2464
2465 prop = RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
2466 RNA_def_property_float_sdna(prop, nullptr, "to_min[0]");
2467 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2468 RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
2469 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2470
2471 prop = RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
2472 RNA_def_property_float_sdna(prop, nullptr, "to_min[1]");
2473 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2474 RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
2475 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2476
2477 prop = RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
2478 RNA_def_property_float_sdna(prop, nullptr, "to_min[2]");
2479 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2480 RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
2481 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2482
2483 prop = RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
2484 RNA_def_property_float_sdna(prop, nullptr, "to_max[0]");
2485 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2486 RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
2487 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2488
2489 prop = RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
2490 RNA_def_property_float_sdna(prop, nullptr, "to_max[1]");
2491 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2492 RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
2493 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2494
2495 prop = RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
2496 RNA_def_property_float_sdna(prop, nullptr, "to_max[2]");
2497 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2498 RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
2499 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2500
2501 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
2502 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode_loc");
2503 RNA_def_property_enum_items(prop, mix_mode_loc_items);
2505 prop, "Location Mix Mode", "Specify how to combine the new location with original");
2506 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2507
2508 /* Rot */
2509 prop = RNA_def_property(srna, "from_min_x_rot", PROP_FLOAT, PROP_ANGLE);
2510 RNA_def_property_float_sdna(prop, nullptr, "from_min_rot[0]");
2511 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2512 RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
2513 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2514
2515 prop = RNA_def_property(srna, "from_min_y_rot", PROP_FLOAT, PROP_ANGLE);
2516 RNA_def_property_float_sdna(prop, nullptr, "from_min_rot[1]");
2517 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2518 RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
2519 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2520
2521 prop = RNA_def_property(srna, "from_min_z_rot", PROP_FLOAT, PROP_ANGLE);
2522 RNA_def_property_float_sdna(prop, nullptr, "from_min_rot[2]");
2523 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2524 RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
2525 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2526
2527 prop = RNA_def_property(srna, "from_max_x_rot", PROP_FLOAT, PROP_ANGLE);
2528 RNA_def_property_float_sdna(prop, nullptr, "from_max_rot[0]");
2529 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2530 RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
2531 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2532
2533 prop = RNA_def_property(srna, "from_max_y_rot", PROP_FLOAT, PROP_ANGLE);
2534 RNA_def_property_float_sdna(prop, nullptr, "from_max_rot[1]");
2535 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2536 RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
2537 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2538
2539 prop = RNA_def_property(srna, "from_max_z_rot", PROP_FLOAT, PROP_ANGLE);
2540 RNA_def_property_float_sdna(prop, nullptr, "from_max_rot[2]");
2541 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2542 RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
2543 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2544
2545 prop = RNA_def_property(srna, "to_min_x_rot", PROP_FLOAT, PROP_ANGLE);
2546 RNA_def_property_float_sdna(prop, nullptr, "to_min_rot[0]");
2547 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2548 RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
2549 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2550
2551 prop = RNA_def_property(srna, "to_min_y_rot", PROP_FLOAT, PROP_ANGLE);
2552 RNA_def_property_float_sdna(prop, nullptr, "to_min_rot[1]");
2553 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2554 RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
2555 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2556
2557 prop = RNA_def_property(srna, "to_min_z_rot", PROP_FLOAT, PROP_ANGLE);
2558 RNA_def_property_float_sdna(prop, nullptr, "to_min_rot[2]");
2559 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2560 RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
2561 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2562
2563 prop = RNA_def_property(srna, "to_max_x_rot", PROP_FLOAT, PROP_ANGLE);
2564 RNA_def_property_float_sdna(prop, nullptr, "to_max_rot[0]");
2565 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2566 RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
2567 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2568
2569 prop = RNA_def_property(srna, "to_max_y_rot", PROP_FLOAT, PROP_ANGLE);
2570 RNA_def_property_float_sdna(prop, nullptr, "to_max_rot[1]");
2571 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2572 RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
2573 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2574
2575 prop = RNA_def_property(srna, "to_max_z_rot", PROP_FLOAT, PROP_ANGLE);
2576 RNA_def_property_float_sdna(prop, nullptr, "to_max_rot[2]");
2577 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2578 RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
2579 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2580
2581 prop = RNA_def_property(srna, "mix_mode_rot", PROP_ENUM, PROP_NONE);
2582 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode_rot");
2583 RNA_def_property_enum_items(prop, mix_mode_rot_items);
2585 prop, "Rotation Mix Mode", "Specify how to combine the new rotation with original");
2586 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2587
2588 /* Scale */
2589 prop = RNA_def_property(srna, "from_min_x_scale", PROP_FLOAT, PROP_NONE);
2590 RNA_def_property_float_sdna(prop, nullptr, "from_min_scale[0]");
2591 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2592 RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
2593 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2594
2595 prop = RNA_def_property(srna, "from_min_y_scale", PROP_FLOAT, PROP_NONE);
2596 RNA_def_property_float_sdna(prop, nullptr, "from_min_scale[1]");
2597 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2598 RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
2599 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2600
2601 prop = RNA_def_property(srna, "from_min_z_scale", PROP_FLOAT, PROP_NONE);
2602 RNA_def_property_float_sdna(prop, nullptr, "from_min_scale[2]");
2603 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2604 RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
2605 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2606
2607 prop = RNA_def_property(srna, "from_max_x_scale", PROP_FLOAT, PROP_NONE);
2608 RNA_def_property_float_sdna(prop, nullptr, "from_max_scale[0]");
2609 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2610 RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
2611 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2612
2613 prop = RNA_def_property(srna, "from_max_y_scale", PROP_FLOAT, PROP_NONE);
2614 RNA_def_property_float_sdna(prop, nullptr, "from_max_scale[1]");
2615 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2616 RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
2617 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2618
2619 prop = RNA_def_property(srna, "from_max_z_scale", PROP_FLOAT, PROP_NONE);
2620 RNA_def_property_float_sdna(prop, nullptr, "from_max_scale[2]");
2621 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2622 RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
2623 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2624
2625 prop = RNA_def_property(srna, "to_min_x_scale", PROP_FLOAT, PROP_NONE);
2626 RNA_def_property_float_sdna(prop, nullptr, "to_min_scale[0]");
2627 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2628 RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
2629 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2630
2631 prop = RNA_def_property(srna, "to_min_y_scale", PROP_FLOAT, PROP_NONE);
2632 RNA_def_property_float_sdna(prop, nullptr, "to_min_scale[1]");
2633 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2634 RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
2635 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2636
2637 prop = RNA_def_property(srna, "to_min_z_scale", PROP_FLOAT, PROP_NONE);
2638 RNA_def_property_float_sdna(prop, nullptr, "to_min_scale[2]");
2639 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2640 RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
2641 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2642
2643 prop = RNA_def_property(srna, "to_max_x_scale", PROP_FLOAT, PROP_NONE);
2644 RNA_def_property_float_sdna(prop, nullptr, "to_max_scale[0]");
2645 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2646 RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
2647 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2648
2649 prop = RNA_def_property(srna, "to_max_y_scale", PROP_FLOAT, PROP_NONE);
2650 RNA_def_property_float_sdna(prop, nullptr, "to_max_scale[1]");
2651 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2652 RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
2653 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2654
2655 prop = RNA_def_property(srna, "to_max_z_scale", PROP_FLOAT, PROP_NONE);
2656 RNA_def_property_float_sdna(prop, nullptr, "to_max_scale[2]");
2657 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2658 RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
2659 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2660
2661 prop = RNA_def_property(srna, "mix_mode_scale", PROP_ENUM, PROP_NONE);
2662 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode_scale");
2663 RNA_def_property_enum_items(prop, mix_mode_scale_items);
2665 prop, "Scale Mix Mode", "Specify how to combine the new scale with original");
2666 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2667
2669}
2670
2672{
2673 StructRNA *srna;
2674 PropertyRNA *prop;
2675
2676 srna = RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
2678 srna, "Limit Location Constraint", "Limit the location of the constrained object");
2679 RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data");
2680 RNA_def_struct_ui_icon(srna, ICON_CON_LOCLIMIT);
2681
2683
2684 prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
2685 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMIN);
2686 RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
2687 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2688
2689 prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
2690 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMIN);
2691 RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
2692 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2693
2694 prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
2695 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMIN);
2696 RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
2697 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2698
2699 prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
2700 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMAX);
2701 RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
2702 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2703
2704 prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
2705 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMAX);
2706 RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
2707 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2708
2709 prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
2710 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMAX);
2711 RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
2712 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2713
2714 prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_DISTANCE);
2715 RNA_def_property_float_sdna(prop, nullptr, "xmin");
2716 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2717 RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
2718 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2719
2720 prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_DISTANCE);
2721 RNA_def_property_float_sdna(prop, nullptr, "ymin");
2722 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2723 RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
2724 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2725
2726 prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_DISTANCE);
2727 RNA_def_property_float_sdna(prop, nullptr, "zmin");
2728 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2729 RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
2730 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2731
2732 prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_DISTANCE);
2733 RNA_def_property_float_sdna(prop, nullptr, "xmax");
2734 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2735 RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
2736 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2737
2738 prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_DISTANCE);
2739 RNA_def_property_float_sdna(prop, nullptr, "ymax");
2740 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2741 RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
2742 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2743
2744 prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_DISTANCE);
2745 RNA_def_property_float_sdna(prop, nullptr, "zmax");
2746 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2747 RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
2748 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2749
2750 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
2751 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", LIMIT_TRANSFORM);
2753 prop, "Affect Transform", "Transform tools are affected by this constraint as well");
2754 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2755
2757}
2758
2760{
2761 StructRNA *srna;
2762 PropertyRNA *prop;
2763
2764 srna = RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
2766 srna, "Limit Rotation Constraint", "Limit the rotation of the constrained object");
2767 RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data");
2768 RNA_def_struct_ui_icon(srna, ICON_CON_ROTLIMIT);
2769
2771
2772 prop = RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
2773 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XROT);
2774 RNA_def_property_ui_text(prop, "Limit X", "Use the minimum X value");
2775 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2776
2777 prop = RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
2778 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YROT);
2779 RNA_def_property_ui_text(prop, "Limit Y", "Use the minimum Y value");
2780 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2781
2782 prop = RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
2783 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZROT);
2784 RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value");
2785 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2786
2787 prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE);
2788 RNA_def_property_float_sdna(prop, nullptr, "xmin");
2789 RNA_def_property_range(prop, -1000.0, 1000.0f);
2790 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2791 RNA_def_property_ui_text(prop, "Minimum X", "Lower X angle bound");
2792 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2793
2794 prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE);
2795 RNA_def_property_float_sdna(prop, nullptr, "ymin");
2796 RNA_def_property_range(prop, -1000.0, 1000.0f);
2797 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2798 RNA_def_property_ui_text(prop, "Minimum Y", "Lower Y angle bound");
2799 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2800
2801 prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_ANGLE);
2802 RNA_def_property_float_sdna(prop, nullptr, "zmin");
2803 RNA_def_property_range(prop, -1000.0, 1000.0f);
2804 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2805 RNA_def_property_ui_text(prop, "Minimum Z", "Lower Z angle bound");
2806 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2807
2808 prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE);
2809 RNA_def_property_float_sdna(prop, nullptr, "xmax");
2810 RNA_def_property_range(prop, -1000.0, 1000.0f);
2811 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2812 RNA_def_property_ui_text(prop, "Maximum X", "Upper X angle bound");
2813 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2814
2815 prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE);
2816 RNA_def_property_float_sdna(prop, nullptr, "ymax");
2817 RNA_def_property_range(prop, -1000.0, 1000.0f);
2818 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2819 RNA_def_property_ui_text(prop, "Maximum Y", "Upper Y angle bound");
2820 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2821
2822 prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_ANGLE);
2823 RNA_def_property_float_sdna(prop, nullptr, "zmax");
2824 RNA_def_property_range(prop, -1000.0, 1000.0f);
2825 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2826 RNA_def_property_ui_text(prop, "Maximum Z", "Upper Z angle bound");
2827 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2828
2829 prop = RNA_def_property(srna, "euler_order", PROP_ENUM, PROP_NONE);
2830 RNA_def_property_enum_sdna(prop, nullptr, "euler_order");
2832 RNA_def_property_ui_text(prop, "Euler Order", "Explicitly specify the euler rotation order");
2833 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2834
2835 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
2836 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", LIMIT_TRANSFORM);
2838 prop, "Affect Transform", "Transform tools are affected by this constraint as well");
2839 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2840
2841 prop = RNA_def_property(srna, "use_legacy_behavior", PROP_BOOLEAN, PROP_NONE);
2844 prop,
2845 "Legacy Behavior",
2846 "Use the old semi-broken behavior that does not understand that rotations loop around");
2847 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2848
2850}
2851
2853{
2854 StructRNA *srna;
2855 PropertyRNA *prop;
2856
2857 srna = RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
2859 srna, "Limit Size Constraint", "Limit the scaling of the constrained object");
2860 RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data");
2861 RNA_def_struct_ui_icon(srna, ICON_CON_SIZELIMIT);
2862
2864
2865 prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
2866 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMIN);
2867 RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
2868 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2869
2870 prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
2871 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMIN);
2872 RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
2873 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2874
2875 prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
2876 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMIN);
2877 RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
2878 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2879
2880 prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
2881 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMAX);
2882 RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
2883 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2884
2885 prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
2886 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMAX);
2887 RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
2888 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2889
2890 prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
2891 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMAX);
2892 RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
2893 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2894
2895 prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
2896 RNA_def_property_float_sdna(prop, nullptr, "xmin");
2897 RNA_def_property_range(prop, -1000.0, 1000.0f);
2898 RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
2899 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2900
2901 prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
2902 RNA_def_property_float_sdna(prop, nullptr, "ymin");
2903 RNA_def_property_range(prop, -1000.0, 1000.0f);
2904 RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
2905 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2906
2907 prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_NONE);
2908 RNA_def_property_float_sdna(prop, nullptr, "zmin");
2909 RNA_def_property_range(prop, -1000.0, 1000.0f);
2910 RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
2911 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2912
2913 prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
2914 RNA_def_property_float_sdna(prop, nullptr, "xmax");
2915 RNA_def_property_range(prop, -1000.0, 1000.0f);
2916 RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
2917 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2918
2919 prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
2920 RNA_def_property_float_sdna(prop, nullptr, "ymax");
2921 RNA_def_property_range(prop, -1000.0, 1000.0f);
2922 RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
2923 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2924
2925 prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_NONE);
2926 RNA_def_property_float_sdna(prop, nullptr, "zmax");
2927 RNA_def_property_range(prop, -1000.0, 1000.0f);
2928 RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
2929 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2930
2931 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
2932 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", LIMIT_TRANSFORM);
2934 prop, "Affect Transform", "Transform tools are affected by this constraint as well");
2935 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2936
2938}
2939
2941{
2942 StructRNA *srna;
2943 PropertyRNA *prop;
2944
2945 srna = RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
2947 srna, "Limit Distance Constraint", "Limit the distance from target object");
2948
2950
2951 RNA_def_struct_sdna_from(srna, "bDistLimitConstraint", "data");
2952 RNA_def_struct_ui_icon(srna, ICON_CON_DISTLIMIT);
2953
2955
2957
2958 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
2959 RNA_def_property_float_sdna(prop, nullptr, "dist");
2960 RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
2961 RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
2962 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2963
2964 prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
2965 RNA_def_property_enum_sdna(prop, nullptr, "mode");
2968 prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
2969 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2970
2971 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
2972 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMITDIST_TRANSFORM);
2974 prop, "Affect Transform", "Transforms are affected by this constraint as well");
2975 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2976
2978}
2979
2981{
2982 StructRNA *srna;
2983 PropertyRNA *prop;
2984
2985 static const EnumPropertyItem type_items[] = {
2987 "NEAREST_SURFACE",
2988 0,
2989 "Nearest Surface Point",
2990 "Shrink the location to the nearest target surface"},
2992 "PROJECT",
2993 0,
2994 "Project",
2995 "Shrink the location to the nearest target surface along a given axis"},
2997 "NEAREST_VERTEX",
2998 0,
2999 "Nearest Vertex",
3000 "Shrink the location to the nearest target vertex"},
3002 "TARGET_PROJECT",
3003 0,
3004 "Target Normal Project",
3005 "Shrink the location to the nearest target surface "
3006 "along the interpolated vertex normals of the target"},
3007 {0, nullptr, 0, nullptr, nullptr},
3008 };
3009
3010 static const EnumPropertyItem shrink_face_cull_items[] = {
3011 {0, "OFF", 0, "Off", "No culling"},
3013 "FRONT",
3014 0,
3015 "Front",
3016 "No projection when in front of the face"},
3018 "BACK",
3019 0,
3020 "Back",
3021 "No projection when behind the face"},
3022 {0, nullptr, 0, nullptr, nullptr},
3023 };
3024
3025 srna = RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
3027 srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship");
3028 RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
3029 RNA_def_struct_ui_icon(srna, ICON_CON_SHRINKWRAP);
3030
3032
3033 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3034 RNA_def_property_pointer_sdna(prop, nullptr, "target"); /* TODO: mesh type. */
3035 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Mesh_object_poll");
3036 RNA_def_property_ui_text(prop, "Target", "Target Mesh object");
3038 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3039
3040 prop = RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
3041 RNA_def_property_enum_sdna(prop, nullptr, "shrinkType");
3042 RNA_def_property_enum_items(prop, type_items);
3044 prop, "Shrinkwrap Type", "Select type of shrinkwrap algorithm for target position");
3045 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3046
3047 prop = RNA_def_property(srna, "wrap_mode", PROP_ENUM, PROP_NONE);
3048 RNA_def_property_enum_sdna(prop, nullptr, "shrinkMode");
3051 prop, "Snap Mode", "Select how to constrain the object to the target surface");
3052 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3053
3054 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
3055 RNA_def_property_float_sdna(prop, nullptr, "dist");
3056 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3057 RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
3058 RNA_def_property_ui_text(prop, "Distance", "Distance to Target");
3059 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3060
3061 prop = RNA_def_property(srna, "project_axis", PROP_ENUM, PROP_NONE);
3062 RNA_def_property_enum_sdna(prop, nullptr, "projAxis");
3064 RNA_def_property_ui_text(prop, "Project Axis", "Axis constrain to");
3065 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3066
3067 prop = RNA_def_property(srna, "project_axis_space", PROP_ENUM, PROP_NONE);
3068 RNA_def_property_enum_sdna(prop, nullptr, "projAxisSpace");
3070 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Constraint_owner_space_itemf");
3071 RNA_def_property_ui_text(prop, "Axis Space", "Space for the projection axis");
3072
3073 prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_DISTANCE);
3074 RNA_def_property_float_sdna(prop, nullptr, "projLimit");
3075 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3076 RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
3078 prop, "Project Distance", "Limit the distance used for projection (zero disables)");
3079 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3080
3081 prop = RNA_def_property(srna, "use_project_opposite", PROP_BOOLEAN, PROP_NONE);
3084 prop, "Project Opposite", "Project in both specified and opposite directions");
3085 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3086
3087 prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
3088 RNA_def_property_enum_sdna(prop, nullptr, "flag");
3089 RNA_def_property_enum_items(prop, shrink_face_cull_items);
3091 "rna_ShrinkwrapConstraint_face_cull_get",
3092 "rna_ShrinkwrapConstraint_face_cull_set",
3093 nullptr);
3095 prop,
3096 "Face Cull",
3097 "Stop vertices from projecting to a face on the target when facing towards/away");
3098 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3099
3100 prop = RNA_def_property(srna, "use_invert_cull", PROP_BOOLEAN, PROP_NONE);
3103 prop, "Invert Cull", "When projecting in the opposite direction invert the face cull mode");
3104 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3105
3106 prop = RNA_def_property(srna, "use_track_normal", PROP_BOOLEAN, PROP_NONE);
3109 prop, "Align Axis To Normal", "Align the specified axis to the surface normal");
3110 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3111
3112 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
3113 RNA_def_property_enum_sdna(prop, nullptr, "trackAxis");
3115 RNA_def_property_ui_text(prop, "Track Axis", "Axis that is aligned to the normal");
3116 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3117
3119}
3120
3122{
3123 StructRNA *srna;
3124 PropertyRNA *prop;
3125
3126 srna = RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
3128 srna, "Damped Track Constraint", "Point toward target by taking the shortest rotation path");
3129 RNA_def_struct_ui_icon(srna, ICON_CON_TRACKTO);
3130
3132
3133 RNA_def_struct_sdna_from(srna, "bDampTrackConstraint", "data");
3134
3136
3138
3139 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
3140 RNA_def_property_enum_sdna(prop, nullptr, "trackflag");
3142 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
3143 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3144
3146}
3147
3149{
3150 StructRNA *srna;
3151 PropertyRNA *prop;
3152
3153 static const EnumPropertyItem splineik_xz_scale_mode[] = {
3154 {CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes"},
3156 "BONE_ORIGINAL",
3157 0,
3158 "Bone Original",
3159 "Use the original scaling of the bones"},
3161 "INVERSE_PRESERVE",
3162 0,
3163 "Inverse Scale",
3164 "Scale of the X and Z axes is the inverse of the Y-Scale"},
3166 "VOLUME_PRESERVE",
3167 0,
3168 "Volume Preservation",
3169 "Scale of the X and Z axes are adjusted to preserve the volume of the bones"},
3170 {0, nullptr, 0, nullptr, nullptr},
3171 };
3172
3173 static const EnumPropertyItem splineik_y_scale_mode[] = {
3174 {CONSTRAINT_SPLINEIK_YS_NONE, "NONE", 0, "None", "Don't scale in the Y axis"},
3176 "FIT_CURVE",
3177 0,
3178 "Fit Curve",
3179 "Scale the bones to fit the entire length of the curve"},
3181 "BONE_ORIGINAL",
3182 0,
3183 "Bone Original",
3184 "Use the original Y scale of the bone"},
3185 {0, nullptr, 0, nullptr, nullptr},
3186 };
3187
3188 srna = RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
3189 RNA_def_struct_ui_text(srna, "Spline IK Constraint", "Align 'n' bones along a curve");
3190 RNA_def_struct_sdna_from(srna, "bSplineIKConstraint", "data");
3191 RNA_def_struct_ui_icon(srna, ICON_CON_SPLINEIK);
3192
3194
3195 /* target chain */
3196 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3197 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
3198 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Curve_object_poll");
3199 RNA_def_property_ui_text(prop, "Target", "Curve that controls this relationship");
3201 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3202
3203 prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
3204 RNA_def_property_int_sdna(prop, nullptr, "chainlen");
3205 /* Changing the IK chain length requires a rebuild of depsgraph relations. This makes it
3206 * unsuitable for animation. */
3208 /* TODO: this should really check the max length of the chain the constraint is attached to */
3209 RNA_def_property_range(prop, 1, 255);
3210 RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain");
3211 /* XXX: this update goes wrong... needs extra flush? */
3212 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3213
3214 /* direct access to bindings */
3215 /* NOTE: only to be used by experienced users */
3216 prop = RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR);
3217 RNA_def_property_array(prop, 32); /* XXX this is the maximum value allowed - why? */
3219 RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length");
3221 "rna_SplineIKConstraint_joint_bindings_get",
3222 "rna_SplineIKConstraint_joint_bindings_set",
3223 nullptr);
3225 prop,
3226 "Joint Bindings",
3227 "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain, "
3228 "as percentages");
3229 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3230
3231 /* settings */
3232 prop = RNA_def_property(srna, "use_chain_offset", PROP_BOOLEAN, PROP_NONE);
3235 prop, "Chain Offset", "Offset the entire chain relative to the root joint");
3236 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3237
3238 prop = RNA_def_property(srna, "use_even_divisions", PROP_BOOLEAN, PROP_NONE);
3241 "Even Divisions",
3242 "Ignore the relative lengths of the bones when fitting to the curve");
3243 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3244
3245 prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
3248 prop,
3249 "Use Curve Radius",
3250 "Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, "
3251 "on top of XZ Scale mode");
3252 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3253
3254 /* xz scaling mode */
3255 prop = RNA_def_property(srna, "xz_scale_mode", PROP_ENUM, PROP_NONE);
3256 RNA_def_property_enum_sdna(prop, nullptr, "xzScaleMode");
3257 RNA_def_property_enum_items(prop, splineik_xz_scale_mode);
3259 prop,
3260 "XZ Scale Mode",
3261 "Method used for determining the scaling of the X and Z axes of the bones");
3262 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3263
3264 /* y scaling mode */
3265 prop = RNA_def_property(srna, "y_scale_mode", PROP_ENUM, PROP_NONE);
3266 RNA_def_property_enum_sdna(prop, nullptr, "yScaleMode");
3267 RNA_def_property_enum_items(prop, splineik_y_scale_mode);
3269 "Y Scale Mode",
3270 "Method used for determining the scaling of the Y axis of the bones, "
3271 "on top of the shape and scaling of the curve itself");
3272 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3273
3274 /* take original scaling of the bone into account in volume preservation */
3275 prop = RNA_def_property(srna, "use_original_scale", PROP_BOOLEAN, PROP_NONE);
3278 prop, "Use Original Scale", "Apply volume preservation over the original scaling");
3279 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3280
3281 /* Volume preservation for "volumetric" scale mode. */
3282 prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
3283 RNA_def_property_range(prop, 0.0, 100.0f);
3285 prop, "Volume Variation", "Factor between volume variation and stretching");
3286 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3287
3288 prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
3291 prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
3292 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3293
3294 prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
3297 prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
3298 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3299
3300 prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
3301 RNA_def_property_range(prop, 0.0, 1.0f);
3302 RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
3303 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3304
3305 prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
3306 RNA_def_property_range(prop, 1.0, 100.0f);
3307 RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
3308 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3309
3310 prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
3311 RNA_def_property_range(prop, 0.0, 1.0f);
3313 prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
3314 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3315
3317}
3318
3320{
3321 StructRNA *srna;
3322 PropertyRNA *prop;
3323
3324 static const EnumPropertyItem pivot_rotAxis_items[] = {
3325 {PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"},
3327 "NX",
3328 0,
3329 "-X Rotation",
3330 "Use the pivot point in the negative rotation range around the X-axis"},
3332 "NY",
3333 0,
3334 "-Y Rotation",
3335 "Use the pivot point in the negative rotation range around the Y-axis"},
3337 "NZ",
3338 0,
3339 "-Z Rotation",
3340 "Use the pivot point in the negative rotation range around the Z-axis"},
3342 "X",
3343 0,
3344 "X Rotation",
3345 "Use the pivot point in the positive rotation range around the X-axis"},
3347 "Y",
3348 0,
3349 "Y Rotation",
3350 "Use the pivot point in the positive rotation range around the Y-axis"},
3352 "Z",
3353 0,
3354 "Z Rotation",
3355 "Use the pivot point in the positive rotation range around the Z-axis"},
3356 {0, nullptr, 0, nullptr, nullptr},
3357 };
3358
3359 srna = RNA_def_struct(brna, "PivotConstraint", "Constraint");
3360 RNA_def_struct_ui_text(srna, "Pivot Constraint", "Rotate around a different point");
3361
3363
3364 RNA_def_struct_sdna_from(srna, "bPivotConstraint", "data");
3365
3366 RNA_def_struct_ui_icon(srna, ICON_CON_PIVOT);
3367
3369
3370 /* target-defined pivot */
3371 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3372 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
3374 prop, "Target", "Target Object, defining the position of the pivot when defined");
3376 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3377
3378 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
3379 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
3380 RNA_def_property_ui_text(prop, "Sub-Target", "");
3381 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3382
3383 /* pivot offset */
3384 prop = RNA_def_property(srna, "use_relative_location", PROP_BOOLEAN, PROP_NONE);
3387 prop,
3388 "Use Relative Offset",
3389 "Offset will be an absolute point in space instead of relative to the target");
3390 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3391
3392 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
3393 RNA_def_property_float_sdna(prop, nullptr, "offset");
3395 "Offset",
3396 "Offset of pivot from target (when set), or from owner's location "
3397 "(when Fixed Position is off), or the absolute pivot point");
3398 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3399
3400 /* rotation-based activation */
3401 prop = RNA_def_property(srna, "rotation_range", PROP_ENUM, PROP_NONE);
3402 RNA_def_property_enum_sdna(prop, nullptr, "rotAxis");
3403 RNA_def_property_enum_items(prop, pivot_rotAxis_items);
3405 prop, "Enabled Rotation Range", "Rotation range on which pivoting should occur");
3406 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3407
3409}
3410
3412{
3413 StructRNA *srna;
3414 PropertyRNA *prop;
3415
3416 static const EnumPropertyItem frame_method_items[] = {
3417 {FOLLOWTRACK_FRAME_STRETCH, "STRETCH", 0, "Stretch", ""},
3418 {FOLLOWTRACK_FRAME_FIT, "FIT", 0, "Fit", ""},
3419 {FOLLOWTRACK_FRAME_CROP, "CROP", 0, "Crop", ""},
3420 {0, nullptr, 0, nullptr, nullptr},
3421 };
3422
3423 srna = RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
3425 srna, "Follow Track Constraint", "Lock motion to the target motion track");
3426 RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
3427 RNA_def_struct_ui_icon(srna, ICON_CON_FOLLOWTRACK);
3428
3430
3431 /* movie clip */
3432 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
3433 RNA_def_property_pointer_sdna(prop, nullptr, "clip");
3434 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
3436 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3437
3438 /* track */
3439 prop = RNA_def_property(srna, "track", PROP_STRING, PROP_NONE);
3440 RNA_def_property_string_sdna(prop, nullptr, "track");
3441 RNA_def_property_ui_text(prop, "Track", "Movie tracking track to follow");
3443 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3444
3445 /* use default clip */
3446 prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
3448 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
3449 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3450
3451 /* use 3d position */
3452 prop = RNA_def_property(srna, "use_3d_position", PROP_BOOLEAN, PROP_NONE);
3454 RNA_def_property_ui_text(prop, "3D Position", "Use 3D position of track to parent to");
3455 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3456
3457 /* object */
3458 prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
3459 RNA_def_property_string_sdna(prop, nullptr, "object");
3461 prop, "Object", "Movie tracking object to follow (if empty, camera object is used)");
3462 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3463
3464 /* camera */
3465 prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
3466 RNA_def_property_pointer_sdna(prop, nullptr, "camera");
3468 prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
3470 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3472 nullptr,
3473 "rna_Constraint_followTrack_camera_set",
3474 nullptr,
3475 "rna_Constraint_cameraObject_poll");
3476
3477 /* depth object */
3478 prop = RNA_def_property(srna, "depth_object", PROP_POINTER, PROP_NONE);
3479 RNA_def_property_pointer_sdna(prop, nullptr, "depth_ob");
3481 prop,
3482 "Depth Object",
3483 "Object used to define depth in camera space by projecting onto surface of this object");
3485 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3487 nullptr,
3488 "rna_Constraint_followTrack_depthObject_set",
3489 nullptr,
3490 "rna_Constraint_followTrack_depthObject_poll");
3491
3492 /* frame method */
3493 prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
3494 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "frame_method");
3495 RNA_def_property_enum_items(prop, frame_method_items);
3496 RNA_def_property_ui_text(prop, "Frame Method", "How the footage fits in the camera frame");
3497 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3498
3499 /* use undistortion */
3500 prop = RNA_def_property(srna, "use_undistorted_position", PROP_BOOLEAN, PROP_NONE);
3502 RNA_def_property_ui_text(prop, "Undistort", "Parent to undistorted position of 2D track");
3503 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3504
3506}
3507
3509{
3510 StructRNA *srna;
3511 PropertyRNA *prop;
3512
3513 srna = RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
3515 srna, "Camera Solver Constraint", "Lock motion to the reconstructed camera movement");
3516 RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data");
3517 RNA_def_struct_ui_icon(srna, ICON_CON_CAMERASOLVER);
3518
3520
3521 /* movie clip */
3522 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
3523 RNA_def_property_pointer_sdna(prop, nullptr, "clip");
3524 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
3526 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3527
3528 /* use default clip */
3529 prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
3531 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
3532 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3533
3535}
3536
3538{
3539 StructRNA *srna;
3540 PropertyRNA *prop;
3541
3542 srna = RNA_def_struct(brna, "ObjectSolverConstraint", "Constraint");
3544 srna, "Object Solver Constraint", "Lock motion to the reconstructed object movement");
3545 RNA_def_struct_sdna_from(srna, "bObjectSolverConstraint", "data");
3546 RNA_def_struct_ui_icon(srna, ICON_CON_OBJECTSOLVER);
3547
3549
3550 /* movie clip */
3551 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
3552 RNA_def_property_pointer_sdna(prop, nullptr, "clip");
3553 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
3555 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3556
3557 /* use default clip */
3558 prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
3560 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
3561 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3562
3563 prop = RNA_def_property(srna, "set_inverse_pending", PROP_BOOLEAN, PROP_NONE);
3566 prop, "Set Inverse Pending", "Set to true to request recalculation of the inverse matrix");
3567 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3568
3569 /* object */
3570 prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
3571 RNA_def_property_string_sdna(prop, nullptr, "object");
3572 RNA_def_property_ui_text(prop, "Object", "Movie tracking object to follow");
3573 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3574
3575 /* camera */
3576 prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
3577 RNA_def_property_pointer_sdna(prop, nullptr, "camera");
3579 prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
3581 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3583 nullptr,
3584 "rna_Constraint_objectSolver_camera_set",
3585 nullptr,
3586 "rna_Constraint_cameraObject_poll");
3587
3589}
3590
3592{
3593 StructRNA *srna;
3594 PropertyRNA *prop;
3595
3596 srna = RNA_def_struct(brna, "TransformCacheConstraint", "Constraint");
3598 srna, "Transform Cache Constraint", "Look up transformation from an external file");
3599 RNA_def_struct_sdna_from(srna, "bTransformCacheConstraint", "data");
3600 RNA_def_struct_ui_icon(srna, ICON_CON_TRANSFORM_CACHE);
3601
3603
3604 prop = RNA_def_property(srna, "cache_file", PROP_POINTER, PROP_NONE);
3605 RNA_def_property_pointer_sdna(prop, nullptr, "cache_file");
3606 RNA_def_property_struct_type(prop, "CacheFile");
3607 RNA_def_property_ui_text(prop, "Cache File", "");
3609 RNA_def_property_update(prop, 0, "rna_Constraint_dependency_update");
3610
3611 prop = RNA_def_property(srna, "object_path", PROP_STRING, PROP_NONE);
3613 prop,
3614 "Object Path",
3615 "Path to the object in the Alembic archive used to lookup the transform matrix");
3616 RNA_def_property_update(prop, 0, "rna_Constraint_update");
3617
3619}
3620
3622{
3623 StructRNA *srna;
3624 PropertyRNA *prop;
3625
3626 static const EnumPropertyItem domain_items[] = {
3627 {CON_ATTRIBUTE_DOMAIN_POINT, "POINT", 0, "Point"},
3628 {CON_ATTRIBUTE_DOMAIN_EDGE, "EDGE", 0, "Edge"},
3629 {CON_ATTRIBUTE_DOMAIN_FACE, "FACE", 0, "Face"},
3630 {CON_ATTRIBUTE_DOMAIN_FACE_CORNER, "FACE_CORNER", 0, "Face Corner"},
3631 {CON_ATTRIBUTE_DOMAIN_CURVE, "CURVE", 0, "Spline"},
3632 {CON_ATTRIBUTE_DOMAIN_INSTANCE, "INSTANCE", 0, "Instance"},
3633 {0, nullptr, 0, nullptr, nullptr},
3634 };
3635
3636 static const EnumPropertyItem type_items[] = {
3637 {CON_ATTRIBUTE_VECTOR, "VECTOR", 0, "Vector", "Vector data type, affects position"},
3639 "QUATERNION",
3640 0,
3641 "Quaternion",
3642 "Quaternion data type, affects rotation"},
3644 "FLOAT4X4",
3645 0,
3646 "4x4 Matrix",
3647 "4x4 Matrix data type, affects transform"},
3648 {0, nullptr, 0, nullptr, nullptr},
3649 };
3650
3651 static const EnumPropertyItem attribute_mix_mode_items[] = {
3653 "REPLACE",
3654 0,
3655 "Replace",
3656 "Replace the original transformation with the transform from the attribute"},
3659 "BEFORE_FULL",
3660 0,
3661 "Before Original (Full)",
3662 "Apply copied transformation before original, using simple matrix multiplication as if "
3663 "the constraint target is a parent in Full Inherit Scale mode. "
3664 "Will create shear when combining rotation and non-uniform scale."},
3666 "BEFORE_SPLIT",
3667 0,
3668 "Before Original (Split Channels)",
3669 "Apply copied transformation before original, handling location, rotation and scale "
3670 "separately, similar to a sequence of three Copy constraints"},
3673 "AFTER_FULL",
3674 0,
3675 "After Original (Full)",
3676 "Apply copied transformation after original, using simple matrix multiplication as if "
3677 "the constraint target is a child in Full Inherit Scale mode. "
3678 "Will create shear when combining rotation and non-uniform scale."},
3680 "AFTER_SPLIT",
3681 0,
3682 "After Original (Split Channels)",
3683 "Apply copied transformation after original, handling location, rotation and scale "
3684 "separately, similar to a sequence of three Copy constraints"},
3685 {0, nullptr, 0, nullptr, nullptr},
3686 };
3687
3688 srna = RNA_def_struct(brna, "GeometryAttributeConstraint", "Constraint");
3690 "Geometry Attribute Constraint",
3691 "Create a constraint-based relationship with an attribute from geometry");
3692 RNA_def_struct_sdna_from(srna, "bGeometryAttributeConstraint", "data");
3693 RNA_def_struct_ui_icon(srna, ICON_CON_GEOMETRYATTRIBUTE);
3694
3696
3697 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3698 RNA_def_property_pointer_sdna(prop, nullptr, "target");
3699 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, nullptr);
3700 RNA_def_property_ui_text(prop, "Target", "Target geometry object");
3702 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3703
3704 prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE);
3705 RNA_def_property_string_sdna(prop, nullptr, "attribute_name");
3707 prop, "Attribute Name", "Name of the attribute to retrieve the transform from");
3709 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3710
3711 prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
3712 RNA_def_property_enum_sdna(prop, nullptr, "domain");
3713 RNA_def_property_enum_items(prop, domain_items);
3714 RNA_def_property_ui_text(prop, "Domain Type", "Attribute domain");
3715 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3716
3717 prop = RNA_def_property(srna, "apply_target_transform", PROP_BOOLEAN, PROP_NONE);
3718 RNA_def_property_boolean_sdna(prop, nullptr, "apply_target_transform", 1);
3720 prop,
3721 "Target Transform",
3722 "Apply the target object's world transform on top of the attribute's transform");
3723 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3724
3725 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
3726 RNA_def_property_enum_sdna(prop, nullptr, "data_type");
3727 RNA_def_property_enum_items(prop, type_items);
3728 RNA_def_property_ui_text(prop, "Data Type", "Select data type of attribute");
3729 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3730
3731 prop = RNA_def_property(srna, "sample_index", PROP_INT, PROP_NONE);
3732 RNA_def_property_int_sdna(prop, nullptr, "sample_index");
3733 RNA_def_property_range(prop, 0, INT_MAX);
3734 RNA_def_property_ui_text(prop, "Sample Index", "Sample Index");
3735 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3736
3737 prop = RNA_def_property(srna, "mix_loc", PROP_BOOLEAN, PROP_NONE);
3738 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MIX_LOC);
3739 RNA_def_property_ui_text(prop, "Mix Location", "Mix Location");
3740 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3741
3742 prop = RNA_def_property(srna, "mix_rot", PROP_BOOLEAN, PROP_NONE);
3743 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MIX_ROT);
3744 RNA_def_property_ui_text(prop, "Mix Rotation", "Mix Rotation");
3745 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3746
3747 prop = RNA_def_property(srna, "mix_scl", PROP_BOOLEAN, PROP_NONE);
3748 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MIX_SCALE);
3749 RNA_def_property_ui_text(prop, "Mix Scale", "Mix Scale");
3750 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3751
3752 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
3753 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode");
3754 RNA_def_property_enum_items(prop, attribute_mix_mode_items);
3756 prop, "Mix Mode", "Specify how the copied and existing transformations are combined");
3757 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3758
3760}
3761
3762/* Define the base struct for constraints. */
3763
3765{
3766 StructRNA *srna;
3767 PropertyRNA *prop;
3768
3769 /* data */
3770 srna = RNA_def_struct(brna, "Constraint", nullptr);
3772 srna, "Constraint", "Constraint modifying the transformation of objects and bones");
3773 RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine");
3774 RNA_def_struct_path_func(srna, "rna_Constraint_path");
3775 RNA_def_struct_sdna(srna, "bConstraint");
3776 RNA_def_struct_ui_icon(srna, ICON_CONSTRAINT);
3777
3778 /* strings */
3779 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
3780 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Constraint_name_set");
3781 RNA_def_property_ui_text(prop, "Name", "Constraint name");
3782 RNA_def_struct_name_property(srna, prop);
3784
3785 /* enums */
3786 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
3788 RNA_def_property_enum_sdna(prop, nullptr, "type");
3790 RNA_def_property_ui_text(prop, "Type", "");
3791
3792 prop = RNA_def_boolean(srna,
3793 "is_override_data",
3794 false,
3795 "Override Constraint",
3796 "In a local override object, whether this constraint comes from the "
3797 "linked reference object, or is local to the override");
3800
3802
3803 prop = RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
3804 RNA_def_property_enum_sdna(prop, nullptr, "ownspace");
3806 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Constraint_owner_space_itemf");
3807 RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in");
3808 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3809
3810 prop = RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
3811 RNA_def_property_enum_sdna(prop, nullptr, "tarspace");
3813 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Constraint_target_space_itemf");
3814 RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in");
3815 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3816
3817 prop = RNA_def_property(srna, "space_object", PROP_POINTER, PROP_NONE);
3818 RNA_def_property_pointer_sdna(prop, nullptr, "space_object");
3819 RNA_def_property_ui_text(prop, "Object", "Object for Custom Space");
3822 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3823
3824 prop = RNA_def_property(srna, "space_subtarget", PROP_STRING, PROP_NONE);
3825 RNA_def_property_string_sdna(prop, nullptr, "space_subtarget");
3826 RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
3827 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3828
3829 /* flags */
3830 prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
3831 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_OFF);
3832 RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint");
3833 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3834 RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
3835
3836 prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
3838 RNA_def_property_ui_text(prop, "Enabled", "Use the results of this constraint");
3839 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3840 RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
3841
3842 prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
3844 RNA_def_property_boolean_sdna(prop, nullptr, "ui_expand_flag", 0);
3845 RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
3846 RNA_def_property_ui_icon(prop, ICON_RIGHTARROW, 1);
3847
3848 /* XXX this is really an internal flag,
3849 * but it may be useful for some tools to be able to access this... */
3850 prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
3853 RNA_def_property_ui_text(prop, "Valid", "Constraint has valid settings and can be evaluated");
3854
3855 /* TODO: setting this to true must ensure that all others in stack are turned off too... */
3856 prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
3857 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_ACTIVE);
3858 RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited");
3859
3860 /* values */
3861 prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
3862 RNA_def_property_float_sdna(prop, nullptr, "enforce");
3863 RNA_def_property_range(prop, 0.0f, 1.0f);
3865 prop, "Influence", "Amount of influence constraint will have on the final solution");
3866 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_influence_update");
3867
3868 /* readonly values */
3869 prop = RNA_def_property(srna, "error_location", PROP_FLOAT, PROP_NONE);
3870 RNA_def_property_float_sdna(prop, nullptr, "lin_error");
3873 prop,
3874 "Lin error",
3875 "Amount of residual error in Blender space unit for constraints that work on position");
3876
3877 prop = RNA_def_property(srna, "error_rotation", PROP_FLOAT, PROP_NONE);
3878 RNA_def_property_float_sdna(prop, nullptr, "rot_error");
3881 prop,
3882 "Rotation error",
3883 "Amount of residual error in radians for constraints that work on orientation");
3884
3886
3887 /* pointers */
3890
3920}
3921
3922#endif
Functions and classes to work with Actions.
Blender kernel action and pose functionality.
void BKE_animdata_fix_paths_rename_all(struct ID *ref_id, const char *prefix, const char *oldName, const char *newName)
struct bConstraint * BKE_constraint_find_from_target(struct Object *ob, struct bConstraintTarget *tgt, struct bPoseChannel **r_pchan)
void BKE_constraint_targets_flush(struct bConstraint *con, struct ListBase *targets, bool no_copy)
int BKE_constraint_targets_get(struct bConstraint *con, struct ListBase *r_targets)
void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list)
void id_lib_extern(ID *id)
Definition lib_id.cc:290
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:586
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:270
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
Definition listbase.cc:497
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
#define DEG2RADF(_deg)
#define M_PI
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:693
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
#define UNUSED_VARS_NDEBUG(...)
#define ELEM(...)
#define BLT_I18NCONTEXT_CONSTRAINT
#define BLT_I18NCONTEXT_ID_MOVIECLIP
@ POSE_LOCKED
@ POSE_DO_UNLOCK
@ CONSTRAINT_BBONE_SHAPE
@ CONSTRAINT_OFF
@ CONSTRAINT_OVERRIDE_LIBRARY_LOCAL
@ CONSTRAINT_ACTIVE
@ CONSTRAINT_DISABLE
@ SIZELIKE_MULTIPLY
@ SIZELIKE_UNIFORM
@ SIZELIKE_OFFSET
@ CONSTRAINT_IK_ROT
@ CONSTRAINT_IK_NO_ROT_X
@ CONSTRAINT_IK_TARGETAXIS
@ CONSTRAINT_IK_NO_POS_Z
@ CONSTRAINT_IK_NO_POS_Y
@ CONSTRAINT_IK_NO_ROT_Y
@ CONSTRAINT_IK_POS
@ CONSTRAINT_IK_NO_POS_X
@ CONSTRAINT_IK_NO_ROT_Z
@ CONSTRAINT_IK_STRETCH
@ CONSTRAINT_IK_TIP
@ CONSTRAINT_TAR_CUSTOM_SPACE
@ ROTLIKE_MIX_OFFSET
@ ROTLIKE_MIX_BEFORE
@ ROTLIKE_MIX_AFTER
@ ROTLIKE_MIX_REPLACE
@ ROTLIKE_MIX_ADD
@ CONSTRAINT_TYPE_TRACKTO
@ CONSTRAINT_TYPE_PIVOT
@ CONSTRAINT_TYPE_CHILDOF
@ CONSTRAINT_TYPE_TRANSFORM
@ CONSTRAINT_TYPE_FOLLOWTRACK
@ CONSTRAINT_TYPE_OBJECTSOLVER
@ CONSTRAINT_TYPE_ARMATURE
@ CONSTRAINT_TYPE_LOCLIKE
@ CONSTRAINT_TYPE_SHRINKWRAP
@ CONSTRAINT_TYPE_MINMAX
@ CONSTRAINT_TYPE_ROTLIMIT
@ CONSTRAINT_TYPE_CAMERASOLVER
@ CONSTRAINT_TYPE_GEOMETRY_ATTRIBUTE
@ CONSTRAINT_TYPE_ROTLIKE
@ CONSTRAINT_TYPE_SPLINEIK
@ CONSTRAINT_TYPE_KINEMATIC
@ CONSTRAINT_TYPE_DISTLIMIT
@ CONSTRAINT_TYPE_TRANSLIKE
@ CONSTRAINT_TYPE_LOCLIMIT
@ CONSTRAINT_TYPE_CLAMPTO
@ CONSTRAINT_TYPE_LOCKTRACK
@ CONSTRAINT_TYPE_SIZELIMIT
@ CONSTRAINT_TYPE_ACTION
@ CONSTRAINT_TYPE_FOLLOWPATH
@ CONSTRAINT_TYPE_STRETCHTO
@ CONSTRAINT_TYPE_SIZELIKE
@ CONSTRAINT_TYPE_SAMEVOL
@ CONSTRAINT_TYPE_DAMPTRACK
@ CONSTRAINT_TYPE_TRANSFORM_CACHE
@ CON_ATTRIBUTE_QUATERNION
@ CON_ATTRIBUTE_4X4MATRIX
@ CON_ATTRIBUTE_VECTOR
@ LIMITDIST_INSIDE
@ LIMITDIST_OUTSIDE
@ LIMITDIST_ONSURFACE
@ CONSTRAINT_ARMATURE_QUATERNION
@ CONSTRAINT_ARMATURE_ENVELOPE
@ CONSTRAINT_ARMATURE_CUR_LOCATION
@ CAMERASOLVER_ACTIVECLIP
@ FOLLOWTRACK_USE_UNDISTORTION
@ FOLLOWTRACK_USE_3D_POSITION
@ FOLLOWTRACK_ACTIVECLIP
@ ACTCON_BONE_USE_OBJECT_ACTION
@ ACTCON_USE_EVAL_TIME
@ LIMIT_ROT_LEGACY_BEHAVIOR
#define CON_SHRINKWRAP_PROJECT_CULL_MASK
@ TRANS_MIXSCALE_MULTIPLY
@ TRANS_MIXSCALE_REPLACE
@ CONSTRAINT_SPLINEIK_YS_NONE
@ CONSTRAINT_SPLINEIK_YS_FIT_CURVE
@ CONSTRAINT_SPLINEIK_YS_ORIGINAL
@ TRANS_MIXLOC_ADD
@ TRANS_MIXLOC_REPLACE
@ CONSTRAINT_SPACE_CUSTOM
@ CONSTRAINT_SPACE_POSE
@ CONSTRAINT_SPACE_WORLD
@ CONSTRAINT_SPACE_OWNLOCAL
@ CONSTRAINT_SPACE_LOCAL
@ CONSTRAINT_SPACE_PARLOCAL
@ CON_ATTRIBUTE_DOMAIN_EDGE
@ CON_ATTRIBUTE_DOMAIN_POINT
@ CON_ATTRIBUTE_DOMAIN_CURVE
@ CON_ATTRIBUTE_DOMAIN_FACE_CORNER
@ CON_ATTRIBUTE_DOMAIN_FACE
@ CON_ATTRIBUTE_DOMAIN_INSTANCE
@ ACTCON_MIX_BEFORE
@ ACTCON_MIX_REPLACE
@ ACTCON_MIX_BEFORE_SPLIT
@ ACTCON_MIX_BEFORE_FULL
@ ACTCON_MIX_AFTER_FULL
@ ACTCON_MIX_AFTER_SPLIT
@ ACTCON_MIX_AFTER
@ FOLLOWPATH_FOLLOW
@ FOLLOWPATH_RADIUS
@ FOLLOWPATH_STATIC
@ LIMIT_TRANSFORM
@ CON_ATTRIBUTE_MIX_AFTER_FULL
@ CON_ATTRIBUTE_MIX_AFTER_SPLIT
@ CON_ATTRIBUTE_MIX_BEFORE_SPLIT
@ CON_ATTRIBUTE_MIX_BEFORE_FULL
@ CON_ATTRIBUTE_MIX_REPLACE
@ CONSTRAINT_SPLINEIK_EVENSPLITS
@ CONSTRAINT_SPLINEIK_USE_BULGE_MAX
@ CONSTRAINT_SPLINEIK_USE_ORIGINAL_SCALE
@ CONSTRAINT_SPLINEIK_USE_BULGE_MIN
@ CONSTRAINT_SPLINEIK_NO_CURVERAD
@ CONSTRAINT_SPLINEIK_NO_ROOT
@ TRANSLIKE_MIX_AFTER
@ TRANSLIKE_MIX_AFTER_FULL
@ TRANSLIKE_MIX_BEFORE
@ TRANSLIKE_MIX_BEFORE_SPLIT
@ TRANSLIKE_MIX_REPLACE
@ TRANSLIKE_MIX_BEFORE_FULL
@ TRANSLIKE_MIX_AFTER_SPLIT
@ OBJECTSOLVER_SET_INVERSE
@ CON_SHRINKWRAP_PROJECT_INVERT_CULL
@ CON_SHRINKWRAP_PROJECT_OPPOSITE
@ CON_SHRINKWRAP_PROJECT_CULL_FRONTFACE
@ CON_SHRINKWRAP_PROJECT_CULL_BACKFACE
@ CON_SHRINKWRAP_TRACK_NORMAL
@ CLAMPTO_CYCLIC
@ CONSTRAINT_IK_COPYPOSE
@ CONSTRAINT_IK_DISTANCE
@ PIVOTCON_AXIS_X_NEG
@ PIVOTCON_AXIS_X
@ PIVOTCON_AXIS_Z
@ PIVOTCON_AXIS_Z_NEG
@ PIVOTCON_AXIS_Y
@ PIVOTCON_AXIS_NONE
@ PIVOTCON_AXIS_Y_NEG
@ SAMEVOL_SINGLE_AXIS
@ SAMEVOL_STRICT
@ SAMEVOL_UNIFORM
@ PIVOTCON_FLAG_OFFSET_ABS
@ CONSTRAINT_EULER_XZY
@ CONSTRAINT_EULER_YXZ
@ CONSTRAINT_EULER_ZYX
@ CONSTRAINT_EULER_AUTO
@ CONSTRAINT_EULER_ZXY
@ CONSTRAINT_EULER_YZX
@ CONSTRAINT_EULER_XYZ
@ TRANSLIKE_REMOVE_TARGET_SHEAR
@ LIMITDIST_TRANSFORM
@ STRETCHTOCON_USE_BULGE_MAX
@ STRETCHTOCON_USE_BULGE_MIN
@ ROTLIKE_Y_INVERT
@ ROTLIKE_Z_INVERT
@ ROTLIKE_X_INVERT
@ LOCLIKE_Z_INVERT
@ LOCLIKE_Y_INVERT
@ LOCLIKE_OFFSET
@ LOCLIKE_X_INVERT
@ CHILDOF_SET_INVERSE
@ CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC
@ CONSTRAINT_SPLINEIK_XZS_ORIGINAL
@ CONSTRAINT_SPLINEIK_XZS_NONE
@ CONSTRAINT_SPLINEIK_XZS_INVERSE
@ TRANS_ROTATION
@ TRANS_LOCATION
@ TRANS_MIXROT_REPLACE
@ TRANS_MIXROT_ADD
@ TRANS_MIXROT_BEFORE
@ TRANS_MIXROT_AFTER
@ FOLLOWTRACK_FRAME_CROP
@ FOLLOWTRACK_FRAME_FIT
@ FOLLOWTRACK_FRAME_STRETCH
@ MOD_SHRINKWRAP_TARGET_PROJECT
@ MOD_SHRINKWRAP_NEAREST_VERTEX
@ MOD_SHRINKWRAP_PROJECT
@ MOD_SHRINKWRAP_NEAREST_SURFACE
@ OB_CAMERA
@ OB_ARMATURE
@ OB_MESH
#define MINAFRAME
#define MAXFRAME
#define RNA_MAX_ARRAY_DIMENSION
Definition RNA_define.hh:27
ParameterFlag
Definition RNA_types.hh:544
@ PARM_RNAPTR
Definition RNA_types.hh:547
@ PARM_REQUIRED
Definition RNA_types.hh:545
@ FUNC_USE_REPORTS
Definition RNA_types.hh:914
@ FUNC_USE_MAIN
Definition RNA_types.hh:912
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:889
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_STRING
Definition RNA_types.hh:165
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROP_COLLECTION
Definition RNA_types.hh:168
#define RNA_ENUM_ITEM_SEPR
Definition RNA_types.hh:676
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:224
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:503
@ PROPOVERRIDE_IGNORE
Definition RNA_types.hh:523
@ PROP_THICK_WRAP
Definition RNA_types.hh:423
@ PROP_DYNAMIC
Definition RNA_types.hh:428
@ PROP_ANIMATABLE
Definition RNA_types.hh:319
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
@ PROP_NO_DEG_UPDATE
Definition RNA_types.hh:439
@ PROP_ID_SELF_CHECK
Definition RNA_types.hh:370
#define RNA_ENUM_ITEM_HEADING(name, description)
Definition RNA_types.hh:673
@ PROP_TIME
Definition RNA_types.hh:253
@ PROP_MATRIX
Definition RNA_types.hh:265
@ PROP_DISTANCE
Definition RNA_types.hh:256
@ PROP_ANGLE
Definition RNA_types.hh:252
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_FACTOR
Definition RNA_types.hh:251
@ PROP_TRANSLATION
Definition RNA_types.hh:261
#define ND_NLA_ACTCHANGE
Definition WM_types.hh:498
#define NC_ANIMATION
Definition WM_types.hh:388
#define ND_POSE
Definition WM_types.hh:458
#define ND_CONSTRAINT
Definition WM_types.hh:464
#define NA_RENAME
Definition WM_types.hh:588
#define NC_OBJECT
Definition WM_types.hh:379
BMesh const char void * data
const Slot * slot(int64_t index) const
blender::Span< const Slot * > slots() const
bool is_suitable_for(const ID &animated_id) const
static constexpr slot_handle_t unassigned
#define printf(...)
float length(VecOp< float, D >) RET
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
bool generic_assign_action(ID &animated_id, bAction *action_to_assign, bAction *&action_ptr_ref, slot_handle_t &slot_handle_ref, char *slot_identifier)
ActionSlotAssignmentResult generic_assign_action_slot(Slot *slot_to_assign, ID &animated_id, bAction *&action_ptr_ref, slot_handle_t &slot_handle_ref, char *slot_identifier)
decltype(::ActionSlot::handle) slot_handle_t
void constraint_dependency_tag_update(Main *bmain, Object *ob, bConstraint *con)
void constraint_tag_update(Main *bmain, Object *ob, bConstraint *con)
ListBase * constraint_list_from_constraint(Object *ob, bConstraint *con, bPoseChannel **r_pchan)
static void rna_def_constraint_rotate_like(BlenderRNA *brna)
static void rna_def_constraint_same_volume(BlenderRNA *brna)
static const EnumPropertyItem constraint_distance_items[]
static void rna_def_constraint_location_limit(BlenderRNA *brna)
static const EnumPropertyItem owner_space_pchan_items[]
static void rna_def_constraint_stretch_to(BlenderRNA *brna)
static void rna_def_constraint_follow_track(BlenderRNA *brna)
static void rna_def_constraint_size_limit(BlenderRNA *brna)
static void rna_def_constraint_object_solver(BlenderRNA *brna)
static void rna_def_constraint_track_to(BlenderRNA *brna)
static void rna_def_constraint_transform(BlenderRNA *brna)
static void rna_def_constraint_geometry_attribute(BlenderRNA *brna)
static void rna_def_constraint_locate_like(BlenderRNA *brna)
static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
static void rna_def_constraint_headtail_common(StructRNA *srna)
static void rna_def_constrainttarget(BlenderRNA *brna)
static void rna_def_constraint_distance_limit(BlenderRNA *brna)
static void rna_def_constraint_transform_like(BlenderRNA *brna)
static void rna_def_constraint_kinematic(BlenderRNA *brna)
static const EnumPropertyItem target_space_pchan_items[]
static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
static void rna_def_constraint_target_common(StructRNA *srna)
static void rna_def_constraint_follow_path(BlenderRNA *brna)
static void rna_def_constraint_action(BlenderRNA *brna)
static void rna_def_constraint_childof(BlenderRNA *brna)
static void rna_def_constraint_locked_track(BlenderRNA *brna)
static void rna_def_constraint_damped_track(BlenderRNA *brna)
static void rna_def_constraint_minmax(BlenderRNA *brna)
static void rna_def_constraint_size_like(BlenderRNA *brna)
static void rna_def_constraint_spline_ik(BlenderRNA *brna)
static void rna_def_constrainttarget_bone(BlenderRNA *brna)
static void rna_def_constraint_armature_deform_targets(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_constraint(BlenderRNA *brna)
static void rna_def_constraint_clamp_to(BlenderRNA *brna)
static const EnumPropertyItem euler_order_items[]
static void rna_def_constraint_pivot(BlenderRNA *brna)
static const EnumPropertyItem track_axis_items[]
static void rna_def_constraint_armature_deform(BlenderRNA *brna)
static void rna_def_constraint_camera_solver(BlenderRNA *brna)
const EnumPropertyItem rna_enum_constraint_type_items[]
static void rna_def_constraint_transform_cache(BlenderRNA *brna)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_define_lib_overridable(const bool make_overridable)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
const int rna_matrix_dimsize_4x4[]
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
const EnumPropertyItem rna_enum_driver_target_rotation_mode_items[]
const EnumPropertyItem rna_enum_axis_xyz_items[]
const EnumPropertyItem rna_enum_modifier_shrinkwrap_mode_items[]
const EnumPropertyItem rna_enum_object_axis_items[]
#define min(a, b)
Definition sort.cc:36
#define FLT_MAX
Definition stdcycles.h:14
Definition DNA_ID.h:414
char name[258]
Definition DNA_ID.h:432
void * first
ListBase constraints
struct bPose * pose
void * data
Definition RNA_types.hh:53
struct bConstraintTarget * next
max
Definition text_draw.cc:251
#define N_(msgid)
PointerRNA * ptr
Definition wm_files.cc:4238