Blender V4.5
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 "PIVOT",
160 ICON_CON_PIVOT,
161 "Pivot",
162 "Change pivot point for transforms (buggy)"},
164 "SHRINKWRAP",
165 ICON_CON_SHRINKWRAP,
166 "Shrinkwrap",
167 "Restrict movements to surface of target mesh"},
168 {0, nullptr, 0, nullptr, nullptr},
169};
170
173 "WORLD",
174 0,
175 "World Space",
176 "The transformation of the target is evaluated relative to the world "
177 "coordinate system"},
179 "CUSTOM",
180 0,
181 "Custom Space",
182 "The transformation of the target is evaluated relative to a custom object/bone/vertex "
183 "group"},
186 "POSE",
187 0,
188 "Pose Space",
189 "The transformation of the target is only evaluated in the Pose Space, "
190 "the target armature object transformation is ignored"},
192 "LOCAL_WITH_PARENT",
193 0,
194 "Local With Parent",
195 "The transformation of the target bone is evaluated relative to its rest pose "
196 "local coordinate system, thus including the parent-induced transformation"},
198 "LOCAL",
199 0,
200 "Local Space",
201 "The transformation of the target is evaluated relative to its local "
202 "coordinate system"},
204 "LOCAL_OWNER_ORIENT",
205 0,
206 "Local Space (Owner Orientation)",
207 "The transformation of the target bone is evaluated relative to its local coordinate "
208 "system, followed by a correction for the difference in target and owner rest pose "
209 "orientations. When applied as local transform to the owner produces the same global "
210 "motion as the target if the parents are still in rest pose."},
211 {0, nullptr, 0, nullptr, nullptr},
212};
213
216 "WORLD",
217 0,
218 "World Space",
219 "The constraint is applied relative to the world coordinate system"},
221 "CUSTOM",
222 0,
223 "Custom Space",
224 "The constraint is applied in local space of a custom object/bone/vertex group"},
227 "POSE",
228 0,
229 "Pose Space",
230 "The constraint is applied in Pose Space, the object transformation is ignored"},
232 "LOCAL_WITH_PARENT",
233 0,
234 "Local With Parent",
235 "The constraint is applied relative to the rest pose local coordinate system "
236 "of the bone, thus including the parent-induced transformation"},
238 "LOCAL",
239 0,
240 "Local Space",
241 "The constraint is applied relative to the local coordinate system of the object"},
242 {0, nullptr, 0, nullptr, nullptr},
243};
244
246 {TRACK_X, "TRACK_X", 0, "X", ""},
247 {TRACK_Y, "TRACK_Y", 0, "Y", ""},
248 {TRACK_Z, "TRACK_Z", 0, "Z", ""},
249 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
250 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
251 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
252 {0, nullptr, 0, nullptr, nullptr},
253};
254
256 {CONSTRAINT_EULER_AUTO, "AUTO", 0, "Default", "Euler using the default rotation order"},
257 {CONSTRAINT_EULER_XYZ, "XYZ", 0, "XYZ Euler", "Euler using the XYZ rotation order"},
258 {CONSTRAINT_EULER_XZY, "XZY", 0, "XZY Euler", "Euler using the XZY rotation order"},
259 {CONSTRAINT_EULER_YXZ, "YXZ", 0, "YXZ Euler", "Euler using the YXZ rotation order"},
260 {CONSTRAINT_EULER_YZX, "YZX", 0, "YZX Euler", "Euler using the YZX rotation order"},
261 {CONSTRAINT_EULER_ZXY, "ZXY", 0, "ZXY Euler", "Euler using the ZXY rotation order"},
262 {CONSTRAINT_EULER_ZYX, "ZYX", 0, "ZYX Euler", "Euler using the ZYX rotation order"},
263 {0, nullptr, 0, nullptr, nullptr},
264};
265
266#ifdef RNA_RUNTIME
267
268static const EnumPropertyItem owner_space_object_items[] = {
270 "WORLD",
271 0,
272 "World Space",
273 "The constraint is applied relative to the world coordinate system"},
275 "CUSTOM",
276 0,
277 "Custom Space",
278 "The constraint is applied in local space of a custom object/bone/vertex group"},
280 "LOCAL",
281 0,
282 "Local Space",
283 "The constraint is applied relative to the local coordinate system of the object"},
284 {0, nullptr, 0, nullptr, nullptr},
285};
286
287static const EnumPropertyItem target_space_object_items[] = {
289 "WORLD",
290 0,
291 "World Space",
292 "The transformation of the target is evaluated relative to the world coordinate system"},
294 "CUSTOM",
295 0,
296 "Custom Space",
297 "The transformation of the target is evaluated relative to a custom object/bone/vertex "
298 "group"},
300 "LOCAL",
301 0,
302 "Local Space",
303 "The transformation of the target is evaluated relative to its local coordinate system"},
304 {0, nullptr, 0, nullptr, nullptr},
305};
306
307# include <fmt/format.h>
308
309# include "DNA_cachefile_types.h"
310
311# include "BKE_action.hh"
312# include "BKE_animsys.h"
313# include "BKE_constraint.h"
314# include "BKE_context.hh"
315
316# ifdef WITH_ALEMBIC
317# include "ABC_alembic.h"
318# endif
319
320# include "ANIM_action.hh"
321# include "rna_action_tools.hh"
322
323static StructRNA *rna_ConstraintType_refine(PointerRNA *ptr)
324{
325 bConstraint *con = (bConstraint *)ptr->data;
326
327 switch (con->type) {
329 return &RNA_ChildOfConstraint;
331 return &RNA_TrackToConstraint;
333 return &RNA_KinematicConstraint;
335 return &RNA_FollowPathConstraint;
337 return &RNA_CopyRotationConstraint;
339 return &RNA_CopyLocationConstraint;
341 return &RNA_CopyScaleConstraint;
343 return &RNA_MaintainVolumeConstraint;
345 return &RNA_ArmatureConstraint;
347 return &RNA_ActionConstraint;
349 return &RNA_LockedTrackConstraint;
351 return &RNA_StretchToConstraint;
353 return &RNA_FloorConstraint;
355 return &RNA_ClampToConstraint;
357 return &RNA_TransformConstraint;
359 return &RNA_LimitRotationConstraint;
361 return &RNA_LimitLocationConstraint;
363 return &RNA_LimitScaleConstraint;
365 return &RNA_LimitDistanceConstraint;
367 return &RNA_ShrinkwrapConstraint;
369 return &RNA_DampedTrackConstraint;
371 return &RNA_SplineIKConstraint;
373 return &RNA_CopyTransformsConstraint;
375 return &RNA_PivotConstraint;
377 return &RNA_FollowTrackConstraint;
379 return &RNA_CameraSolverConstraint;
381 return &RNA_ObjectSolverConstraint;
383 return &RNA_TransformCacheConstraint;
384 default:
385 return &RNA_UnknownType;
386 }
387}
388
389static void rna_ConstraintTargetBone_target_set(PointerRNA *ptr,
390 PointerRNA value,
391 ReportList * /*reports*/)
392{
394 Object *ob = static_cast<Object *>(value.data);
395
396 if (!ob || ob->type == OB_ARMATURE) {
397 id_lib_extern((ID *)ob);
398 tgt->tar = ob;
399 }
400}
401
402static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
403{
404 bConstraint *con = static_cast<bConstraint *>(ptr->data);
405 char oldname[sizeof(con->name)];
406
407 /* make a copy of the old name first */
408 STRNCPY(oldname, con->name);
409
410 /* copy the new name into the name slot */
411 STRNCPY_UTF8(con->name, value);
412
413 /* make sure name is unique */
414 if (ptr->owner_id) {
415 Object *ob = (Object *)ptr->owner_id;
417
418 /* if we have the list, check for unique name, otherwise give up */
419 if (list) {
421 }
422 }
423
424 /* fix all the animation data which may link to this */
425 BKE_animdata_fix_paths_rename_all(nullptr, "constraints", oldname, con->name);
426}
427
428static std::optional<std::string> rna_Constraint_do_compute_path(Object *ob, bConstraint *con)
429{
430 bPoseChannel *pchan;
432
433 if (lb == nullptr) {
434 printf("%s: internal error, constraint '%s' not found in object '%s'\n",
435 __func__,
436 con->name,
437 ob->id.name);
438 }
439
440 if (pchan) {
441 char name_esc_pchan[sizeof(pchan->name) * 2];
442 char name_esc_const[sizeof(con->name) * 2];
443 BLI_str_escape(name_esc_pchan, pchan->name, sizeof(name_esc_pchan));
444 BLI_str_escape(name_esc_const, con->name, sizeof(name_esc_const));
445 return fmt::format("pose.bones[\"{}\"].constraints[\"{}\"]", name_esc_pchan, name_esc_const);
446 }
447 char name_esc_const[sizeof(con->name) * 2];
448 BLI_str_escape(name_esc_const, con->name, sizeof(name_esc_const));
449 return fmt::format("constraints[\"{}\"]", name_esc_const);
450}
451
452static std::optional<std::string> rna_Constraint_path(const PointerRNA *ptr)
453{
454 Object *ob = (Object *)ptr->owner_id;
455 bConstraint *con = static_cast<bConstraint *>(ptr->data);
456
457 return rna_Constraint_do_compute_path(ob, con);
458}
459
460static bConstraint *rna_constraint_from_target(const PointerRNA *ptr)
461{
462 Object *ob = (Object *)ptr->owner_id;
463 bConstraintTarget *tgt = static_cast<bConstraintTarget *>(ptr->data);
464
465 return BKE_constraint_find_from_target(ob, tgt, nullptr);
466}
467
468static std::optional<std::string> rna_ConstraintTarget_path(const PointerRNA *ptr)
469{
470 Object *ob = (Object *)ptr->owner_id;
471 bConstraintTarget *tgt = static_cast<bConstraintTarget *>(ptr->data);
472 bConstraint *con = rna_constraint_from_target(ptr);
473 int index = -1;
474
475 if (con != nullptr) {
476 if (con->type == CONSTRAINT_TYPE_ARMATURE) {
477 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
478 index = BLI_findindex(&acon->targets, tgt);
479 }
480 }
481
482 if (index >= 0) {
483 return fmt::format(
484 "{}.targets[{}]", rna_Constraint_do_compute_path(ob, con).value_or(""), index);
485 }
486 printf("%s: internal error, constraint '%s' of object '%s' does not contain the target\n",
487 __func__,
488 con->name,
489 ob->id.name);
490
491 return std::nullopt;
492}
493
494static void rna_Constraint_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
495{
497 bmain, (Object *)ptr->owner_id, static_cast<bConstraint *>(ptr->data));
498}
499
500static void rna_Constraint_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
501{
503 bmain, (Object *)ptr->owner_id, static_cast<bConstraint *>(ptr->data));
504}
505
506static void rna_ConstraintTarget_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
507{
509 bmain, (Object *)ptr->owner_id, rna_constraint_from_target(ptr));
510}
511
512static void rna_ConstraintTarget_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
513{
515 bmain, (Object *)ptr->owner_id, rna_constraint_from_target(ptr));
516}
517
518static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
519{
520 Object *ob = (Object *)ptr->owner_id;
521
522 if (ob->pose) {
524 }
525
526 rna_Constraint_update(bmain, scene, ptr);
527}
528
529/* Update only needed so this isn't overwritten on first evaluation. */
530static void rna_Constraint_childof_inverse_matrix_update(Main *bmain,
531 Scene *scene,
533{
534 bConstraint *con = static_cast<bConstraint *>(ptr->data);
535 bChildOfConstraint *data = static_cast<bChildOfConstraint *>(con->data);
536 data->flag &= ~CHILDOF_SET_INVERSE;
537 rna_Constraint_update(bmain, scene, ptr);
538}
539
540static void rna_Constraint_ik_type_set(PointerRNA *ptr, int value)
541{
542 bConstraint *con = static_cast<bConstraint *>(ptr->data);
543 bKinematicConstraint *ikdata = static_cast<bKinematicConstraint *>(con->data);
544
545 if (ikdata->type != value) {
546 /* the type of IK constraint has changed, set suitable default values */
547 /* in case constraints reuse same fields incompatible */
548 switch (value) {
550 break;
552 break;
553 }
554 ikdata->type = value;
555 }
556}
557
558/* DEPRECATED: use_offset replaced with mix_mode */
559static bool rna_Constraint_RotLike_use_offset_get(PointerRNA *ptr)
560{
561 bConstraint *con = static_cast<bConstraint *>(ptr->data);
562 bRotateLikeConstraint *rotlike = static_cast<bRotateLikeConstraint *>(con->data);
563 return rotlike->mix_mode != ROTLIKE_MIX_REPLACE;
564}
565
566static void rna_Constraint_RotLike_use_offset_set(PointerRNA *ptr, bool value)
567{
568 bConstraint *con = static_cast<bConstraint *>(ptr->data);
569 bRotateLikeConstraint *rotlike = static_cast<bRotateLikeConstraint *>(con->data);
570 bool curval = (rotlike->mix_mode != ROTLIKE_MIX_REPLACE);
571 if (curval != value) {
572 rotlike->mix_mode = (value ? ROTLIKE_MIX_OFFSET : ROTLIKE_MIX_REPLACE);
573 }
574}
575
576static const EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext * /*C*/,
578 PropertyRNA * /*prop*/,
579 bool * /*r_free*/)
580{
581 Object *ob = (Object *)ptr->owner_id;
582 bConstraint *con = (bConstraint *)ptr->data;
583
584 if (BLI_findindex(&ob->constraints, con) == -1) {
586 }
587 else {
588 /* object */
589 return owner_space_object_items;
590 }
591}
592
593static const EnumPropertyItem *rna_Constraint_target_space_itemf(bContext * /*C*/,
595 PropertyRNA * /*prop*/,
596 bool * /*r_free*/)
597{
598 bConstraint *con = (bConstraint *)ptr->data;
599 ListBase targets = {nullptr, nullptr};
601
602 if (BKE_constraint_targets_get(con, &targets)) {
603 for (ct = static_cast<bConstraintTarget *>(targets.first); ct; ct = ct->next) {
604 if (ct->tar && ct->tar->type == OB_ARMATURE && !(ct->flag & CONSTRAINT_TAR_CUSTOM_SPACE)) {
605 break;
606 }
607 }
608
609 BKE_constraint_targets_flush(con, &targets, 1);
610
611 if (ct) {
613 }
614 }
615
616 return target_space_object_items;
617}
618
619static bConstraintTarget *rna_ArmatureConstraint_target_new(ID *id, bConstraint *con, Main *bmain)
620{
621 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
622 bConstraintTarget *tgt = MEM_callocN<bConstraintTarget>("Constraint Target");
623
624 tgt->weight = 1.0f;
625 BLI_addtail(&acon->targets, tgt);
626
628 return tgt;
629}
630
631static void rna_ArmatureConstraint_target_remove(
632 ID *id, bConstraint *con, Main *bmain, ReportList *reports, PointerRNA *target_ptr)
633{
634 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
635 bConstraintTarget *tgt = static_cast<bConstraintTarget *>(target_ptr->data);
636
637 if (BLI_findindex(&acon->targets, tgt) == -1) {
638 BKE_report(reports, RPT_ERROR, "Target is not in the constraint target list");
639 return;
640 }
641
642 BLI_freelinkN(&acon->targets, tgt);
643
645}
646
647static void rna_ArmatureConstraint_target_clear(ID *id, bConstraint *con, Main *bmain)
648{
649 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
650
651 BLI_freelistN(&acon->targets);
652
654}
655
656static void rna_ActionConstraint_mix_mode_set(PointerRNA *ptr, int value)
657{
658 bConstraint *con = (bConstraint *)ptr->data;
660
661 acon->mix_mode = value;
662
663 /* The After mode can be computed in world space for efficiency
664 * and backward compatibility, while Before or Split requires Local. */
667 }
668 else {
670 }
671}
672
673static void rna_ActionConstraint_minmax_range(
674 PointerRNA *ptr, float *min, float *max, float * /*softmin*/, float * /*softmax*/)
675{
676 bConstraint *con = (bConstraint *)ptr->data;
678
679 /* 0, 1, 2 = magic numbers for rotX, rotY, rotZ */
680 if (ELEM(acon->type, 0, 1, 2)) {
681 *min = -180.0f;
682 *max = 180.0f;
683 }
684 else {
685 *min = -1000.0f;
686 *max = 1000.0f;
687 }
688}
689
690static void rna_ActionConstraint_action_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
691{
692 using namespace blender::animrig;
693 BLI_assert(ptr->owner_id);
694 BLI_assert(ptr->data);
695
696 ID &animated_id = *ptr->owner_id;
697 bConstraint *con = static_cast<bConstraint *>(ptr->data);
698 bActionConstraint *acon = static_cast<bActionConstraint *>(con->data);
699
700 Action *action = static_cast<Action *>(value.data);
701
702 if (!action) {
703 const bool ok = generic_assign_action(
704 animated_id, nullptr, acon->act, acon->action_slot_handle, acon->last_slot_identifier);
705 BLI_assert_msg(ok, "Un-assigning an Action from an Action Constraint should always work.");
707 return;
708 }
709
710 const bool ok = generic_assign_action(
711 animated_id, action, acon->act, acon->action_slot_handle, acon->last_slot_identifier);
712 if (!ok) {
714 RPT_ERROR,
715 "Could not assign action %s to Action Constraint %s",
716 action->id.name + 2,
717 con->name);
718 return;
719 }
720
721 /* For the Action Constraint, the auto slot selection gets one more fallback
722 * option (compared to the generic code). This is to support the following
723 * scenario, which used to be necessary as a workaround for a bug in Blender (#127976):
724 *
725 * - Python script creates an Action,
726 * - assigns it to the animated object,
727 * - unassigns it from that object,
728 * - and assigns it to the object's Action Constraint.
729 *
730 * The generic code doesn't work for this. The first assignment would see the slot
731 * `XXSlot`, and because it has never been used, just use it. This would change its name to
732 * `OBSlot`. The assignment to the Action Constraint would not see a 'virgin' slot, and thus not
733 * auto-select `OBSlot`. This behavior makes sense when assigning Actions in the Action editor
734 * (it shouldn't automatically pick the first slot of matching ID type), but for the Action
735 * Constraint I (Sybren) feel that it could be a bit more 'enthusiastic' in auto-picking a slot.
736 *
737 * Note that this is the same behavior as for NLA strips, albeit for a slightly different
738 * reason. Because of that it's not sharing code with the NLA.
739 */
740 if (acon->action_slot_handle == Slot::unassigned && action->slots().size() == 1) {
741 Slot *first_slot = action->slot(0);
742 if (first_slot->is_suitable_for(animated_id)) {
744 first_slot,
745 animated_id,
746 acon->act,
747 acon->action_slot_handle,
751 }
752 }
753}
754
755static void rna_ActionConstraint_action_slot_handle_set(
756 PointerRNA *ptr, const blender::animrig::slot_handle_t new_slot_handle)
757{
758 bConstraint *con = (bConstraint *)ptr->data;
760
761 rna_generic_action_slot_handle_set(new_slot_handle,
762 *ptr->owner_id,
763 acon->act,
764 acon->action_slot_handle,
766}
767
773static void rna_ActionConstraint_action_slot_handle_override_diff(
774 Main *bmain, RNAPropertyOverrideDiffContext &rnadiff_ctx)
775{
776 const bConstraint *con_a = static_cast<bConstraint *>(rnadiff_ctx.prop_a->ptr->data);
777 const bConstraint *con_b = static_cast<bConstraint *>(rnadiff_ctx.prop_b->ptr->data);
778
779 const bActionConstraint *act_con_a = static_cast<bActionConstraint *>(con_a->data);
780 const bActionConstraint *act_con_b = static_cast<bActionConstraint *>(con_b->data);
781
782 rna_generic_action_slot_handle_override_diff(bmain, rnadiff_ctx, act_con_a->act, act_con_b->act);
783}
784
785static PointerRNA rna_ActionConstraint_action_slot_get(PointerRNA *ptr)
786{
787 bConstraint *con = (bConstraint *)ptr->data;
789
790 return rna_generic_action_slot_get(acon->act, acon->action_slot_handle);
791}
792
793static void rna_ActionConstraint_action_slot_set(PointerRNA *ptr,
794 PointerRNA value,
796{
797 bConstraint *con = (bConstraint *)ptr->data;
799
800 rna_generic_action_slot_set(value,
801 *ptr->owner_id,
802 acon->act,
803 acon->action_slot_handle,
804 acon->last_slot_identifier,
805 reports);
806}
807
808static void rna_iterator_ActionConstraint_action_suitable_slots_begin(
810{
811 bConstraint *con = (bConstraint *)ptr->data;
813
814 rna_iterator_generic_action_suitable_slots_begin(iter, ptr, acon->act);
815}
816
817static int rna_SplineIKConstraint_joint_bindings_get_length(const PointerRNA *ptr,
819{
820 const bConstraint *con = (bConstraint *)ptr->data;
821 const bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
822
823 if (ikData) {
824 length[0] = ikData->numpoints;
825 }
826 else {
827 length[0] = 0;
828 }
829
830 return length[0];
831}
832
833static void rna_SplineIKConstraint_joint_bindings_get(PointerRNA *ptr, float *values)
834{
835 bConstraint *con = (bConstraint *)ptr->data;
837
838 memcpy(values, ikData->points, ikData->numpoints * sizeof(float));
839}
840
841static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const float *values)
842{
843 bConstraint *con = (bConstraint *)ptr->data;
845
846 memcpy(ikData->points, values, ikData->numpoints * sizeof(float));
847}
848
849static int rna_ShrinkwrapConstraint_face_cull_get(PointerRNA *ptr)
850{
851 bConstraint *con = (bConstraint *)ptr->data;
853 return swc->flag & CON_SHRINKWRAP_PROJECT_CULL_MASK;
854}
855
856static void rna_ShrinkwrapConstraint_face_cull_set(PointerRNA *ptr, int value)
857{
858 bConstraint *con = (bConstraint *)ptr->data;
860 swc->flag = (swc->flag & ~CON_SHRINKWRAP_PROJECT_CULL_MASK) | value;
861}
862
863static bool rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value)
864{
865 Object *ob = (Object *)value.data;
866
867 if (ob) {
868 if (ob->type == OB_CAMERA && ob != (Object *)ptr->owner_id) {
869 return 1;
870 }
871 }
872
873 return 0;
874}
875
876static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr,
877 PointerRNA value,
878 ReportList * /*reports*/)
879{
880 bConstraint *con = (bConstraint *)ptr->data;
882 Object *ob = (Object *)value.data;
883
884 if (ob) {
885 if (ob->type == OB_CAMERA && ob != (Object *)ptr->owner_id) {
886 data->camera = ob;
887 id_lib_extern((ID *)ob);
888 }
889 }
890 else {
891 data->camera = nullptr;
892 }
893}
894
895static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr,
896 PointerRNA value,
897 ReportList * /*reports*/)
898{
899 bConstraint *con = (bConstraint *)ptr->data;
901 Object *ob = (Object *)value.data;
902
903 if (ob) {
904 if (ob->type == OB_MESH && ob != (Object *)ptr->owner_id) {
905 data->depth_ob = ob;
906 id_lib_extern((ID *)ob);
907 }
908 }
909 else {
910 data->depth_ob = nullptr;
911 }
912}
913
914static bool rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, PointerRNA value)
915{
916 Object *ob = (Object *)value.data;
917
918 if (ob) {
919 if (ob->type == OB_MESH && ob != (Object *)ptr->owner_id) {
920 return 1;
921 }
922 }
923
924 return 0;
925}
926
927static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr,
928 PointerRNA value,
929 ReportList * /*reports*/)
930{
931 bConstraint *con = (bConstraint *)ptr->data;
933 Object *ob = (Object *)value.data;
934
935 if (ob) {
936 if (ob->type == OB_CAMERA && ob != (Object *)ptr->owner_id) {
937 data->camera = ob;
938 id_lib_extern((ID *)ob);
939 }
940 }
941 else {
942 data->camera = nullptr;
943 }
944}
945
946#else
947
950 "LIMITDIST_INSIDE",
951 0,
952 "Inside",
953 "The object is constrained inside a virtual sphere around the target object, "
954 "with a radius defined by the limit distance"},
956 "LIMITDIST_OUTSIDE",
957 0,
958 "Outside",
959 "The object is constrained outside a virtual sphere around the target object, "
960 "with a radius defined by the limit distance"},
962 "LIMITDIST_ONSURFACE",
963 0,
964 "On Surface",
965 "The object is constrained on the surface of a virtual sphere around the target object, "
966 "with a radius defined by the limit distance"},
967 {0, nullptr, 0, nullptr, nullptr},
968};
969
971{
972 PropertyRNA *prop;
973
975
976 prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
977 RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
978 RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head is 0, Tail is 1");
979 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
980
981 prop = RNA_def_property(srna, "use_bbone_shape", PROP_BOOLEAN, PROP_NONE);
982 RNA_def_property_boolean_sdna(prop, "bConstraint", "flag", CONSTRAINT_BBONE_SHAPE);
984 "Follow B-Bone",
985 "Follow shape of B-Bone segments when calculating Head/Tail position");
986 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
987
989}
990
992{
993 PropertyRNA *prop;
994
996
997 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
998 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
999 RNA_def_property_ui_text(prop, "Target", "Target object");
1001 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1002
1003 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1004 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
1005 RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
1006 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1007
1009}
1010
1012{
1013 StructRNA *srna;
1014 PropertyRNA *prop;
1015
1016 srna = RNA_def_struct(brna, "ConstraintTarget", nullptr);
1017 RNA_def_struct_ui_text(srna, "Constraint Target", "Target object for multi-target constraints");
1018 RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
1019 RNA_def_struct_sdna(srna, "bConstraintTarget");
1020
1022
1023 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1024 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
1025 RNA_def_property_ui_text(prop, "Target", "Target object");
1028 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1029
1030 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1031 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
1032 RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
1034 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1035
1036 /* space, flag and type still to do. */
1037
1039}
1040
1042{
1043 StructRNA *srna;
1044 PropertyRNA *prop;
1045
1046 srna = RNA_def_struct(brna, "ConstraintTargetBone", nullptr);
1048 srna, "Constraint Target Bone", "Target bone for multi-target constraints");
1049 RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
1050 RNA_def_struct_sdna(srna, "bConstraintTarget");
1051
1053
1054 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1055 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
1056 RNA_def_property_ui_text(prop, "Target", "Target armature");
1058 prop, nullptr, "rna_ConstraintTargetBone_target_set", nullptr, "rna_Armature_object_poll");
1061 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1062
1063 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1064 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
1065 RNA_def_property_ui_text(prop, "Sub-Target", "Target armature bone");
1067 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1068
1069 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
1070 RNA_def_property_float_sdna(prop, nullptr, "weight");
1071 RNA_def_property_range(prop, 0.0f, 1.0f);
1072 RNA_def_property_ui_text(prop, "Blend Weight", "Blending weight of this bone");
1073 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_update");
1074
1076}
1077
1079{
1080 StructRNA *srna;
1081 PropertyRNA *prop;
1082
1083 srna = RNA_def_struct(brna, "ChildOfConstraint", "Constraint");
1085 srna, "Child Of Constraint", "Create constraint-based parent-child relationship");
1086 RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data");
1087 RNA_def_struct_ui_icon(srna, ICON_CON_CHILDOF);
1088
1090
1092
1093 prop = RNA_def_property(srna, "use_location_x", PROP_BOOLEAN, PROP_NONE);
1094 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_LOCX);
1095 RNA_def_property_ui_text(prop, "Location X", "Use X Location of Parent");
1096 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1097
1098 prop = RNA_def_property(srna, "use_location_y", PROP_BOOLEAN, PROP_NONE);
1099 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_LOCY);
1100 RNA_def_property_ui_text(prop, "Location Y", "Use Y Location of Parent");
1101 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1102
1103 prop = RNA_def_property(srna, "use_location_z", PROP_BOOLEAN, PROP_NONE);
1104 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_LOCZ);
1105 RNA_def_property_ui_text(prop, "Location Z", "Use Z Location of Parent");
1106 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1107
1108 prop = RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
1109 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_ROTX);
1110 RNA_def_property_ui_text(prop, "Rotation X", "Use X Rotation of Parent");
1111 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1112
1113 prop = RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
1114 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_ROTY);
1115 RNA_def_property_ui_text(prop, "Rotation Y", "Use Y Rotation of Parent");
1116 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1117
1118 prop = RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
1119 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_ROTZ);
1120 RNA_def_property_ui_text(prop, "Rotation Z", "Use Z Rotation of Parent");
1121 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1122
1123 prop = RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
1124 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SIZEX);
1125 RNA_def_property_ui_text(prop, "Scale X", "Use X Scale of Parent");
1126 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1127
1128 prop = RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
1129 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SIZEY);
1130 RNA_def_property_ui_text(prop, "Scale Y", "Use Y Scale of Parent");
1131 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1132
1133 prop = RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
1134 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SIZEZ);
1135 RNA_def_property_ui_text(prop, "Scale Z", "Use Z Scale of Parent");
1136 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1137
1138 prop = RNA_def_property(srna, "set_inverse_pending", PROP_BOOLEAN, PROP_NONE);
1139 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SET_INVERSE);
1141 prop, "Set Inverse Pending", "Set to true to request recalculation of the inverse matrix");
1142 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1143
1144 prop = RNA_def_property(srna, "inverse_matrix", PROP_FLOAT, PROP_MATRIX);
1145 RNA_def_property_float_sdna(prop, nullptr, "invmat");
1148 RNA_def_property_ui_text(prop, "Inverse Matrix", "Transformation matrix to apply before");
1150 prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_childof_inverse_matrix_update");
1151
1153}
1154
1156{
1157 StructRNA *srna;
1158 FunctionRNA *func;
1159 PropertyRNA *parm;
1160
1161 RNA_def_property_srna(cprop, "ArmatureConstraintTargets");
1162 srna = RNA_def_struct(brna, "ArmatureConstraintTargets", nullptr);
1163 RNA_def_struct_sdna(srna, "bConstraint");
1165 srna, "Armature Deform Constraint Targets", "Collection of target bones and weights");
1166 RNA_def_struct_ui_icon(srna, ICON_CON_ARMATURE);
1167
1168 func = RNA_def_function(srna, "new", "rna_ArmatureConstraint_target_new");
1170 RNA_def_function_ui_description(func, "Add a new target to the constraint");
1171 parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "New target bone");
1172 RNA_def_function_return(func, parm);
1173
1174 func = RNA_def_function(srna, "remove", "rna_ArmatureConstraint_target_remove");
1176 RNA_def_function_ui_description(func, "Delete target from the constraint");
1177 parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "Target to remove");
1180
1181 func = RNA_def_function(srna, "clear", "rna_ArmatureConstraint_target_clear");
1183 RNA_def_function_ui_description(func, "Delete all targets from object");
1184}
1185
1187{
1188 StructRNA *srna;
1189 PropertyRNA *prop;
1190
1191 srna = RNA_def_struct(brna, "ArmatureConstraint", "Constraint");
1193 srna, "Armature Constraint", "Applies transformations done by the Armature modifier");
1194 RNA_def_struct_sdna_from(srna, "bArmatureConstraint", "data");
1195 RNA_def_struct_ui_icon(srna, ICON_CON_ARMATURE);
1196
1198
1199 prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
1200 RNA_def_property_collection_sdna(prop, nullptr, "targets", nullptr);
1201 RNA_def_property_struct_type(prop, "ConstraintTargetBone");
1202 RNA_def_property_ui_text(prop, "Targets", "Target Bones");
1204
1205 prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
1208 prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
1209 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1210
1211 prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
1214 prop,
1215 "Use Envelopes",
1216 "Multiply weights by envelope for all bones, instead of acting like Vertex Group based "
1217 "blending. "
1218 "The specified weights are still used, and only the listed bones are considered.");
1219 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1220
1221 prop = RNA_def_property(srna, "use_current_location", PROP_BOOLEAN, PROP_NONE);
1224 "Use Current Location",
1225 "Use the current bone location for envelopes and choosing B-Bone "
1226 "segments instead of rest position");
1227 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1228
1230}
1231
1233{
1234 StructRNA *srna;
1235 PropertyRNA *prop;
1236
1237 static const EnumPropertyItem constraint_ik_axisref_items[] = {
1238 {0, "BONE", 0, "Bone", ""},
1239 {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""},
1240 {0, nullptr, 0, nullptr, nullptr},
1241 };
1242
1243 static const EnumPropertyItem constraint_ik_type_items[] = {
1244 {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
1245 {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
1246 {0, nullptr, 0, nullptr, nullptr},
1247 };
1248
1249 srna = RNA_def_struct(brna, "KinematicConstraint", "Constraint");
1250 RNA_def_struct_ui_text(srna, "Kinematic Constraint", "Inverse Kinematics");
1251 RNA_def_struct_sdna_from(srna, "bKinematicConstraint", "data");
1252 RNA_def_struct_ui_icon(srna, ICON_CON_KINEMATIC);
1253
1255
1257
1258 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
1259 RNA_def_property_range(prop, 0, 10000);
1260 RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving iterations");
1261 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1262
1263 prop = RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE);
1264 RNA_def_property_pointer_sdna(prop, nullptr, "poletar");
1265 RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation");
1267 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1268
1269 prop = RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE);
1270 RNA_def_property_string_sdna(prop, nullptr, "polesubtarget");
1271 RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
1272 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1273
1274 prop = RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE);
1275 RNA_def_property_float_sdna(prop, nullptr, "poleangle");
1277 RNA_def_property_ui_range(prop, -M_PI, M_PI, 10, 4);
1278 RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset");
1279 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1280
1281 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
1282 RNA_def_property_range(prop, 0.01, 1.0f);
1284 prop, "Weight", "For Tree-IK: Weight of position control for this target");
1285
1286 prop = RNA_def_property(srna, "orient_weight", PROP_FLOAT, PROP_NONE);
1287 RNA_def_property_float_sdna(prop, nullptr, "orientweight");
1288 RNA_def_property_range(prop, 0.01, 1.0f);
1290 prop, "Orientation Weight", "For Tree-IK: Weight of orientation control for this target");
1291 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1292
1293 prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
1294 RNA_def_property_int_sdna(prop, nullptr, "rootbone");
1295 /* Changing the IK chain length requires a rebuild of depsgraph relations. This makes it
1296 * unsuitable for animation. */
1298 RNA_def_property_range(prop, 0, 255);
1300 prop, "Chain Length", "How many bones are included in the IK effect - 0 uses all bones");
1301 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1302
1303 prop = RNA_def_property(srna, "use_tail", PROP_BOOLEAN, PROP_NONE);
1304 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_IK_TIP);
1305 RNA_def_property_ui_text(prop, "Use Tail", "Include bone's tail as last element in chain");
1306 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1307
1308 prop = RNA_def_property(srna, "reference_axis", PROP_ENUM, PROP_NONE);
1309 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1310 RNA_def_property_enum_items(prop, constraint_ik_axisref_items);
1312 prop, "Axis Reference", "Constraint axis Lock options relative to Bone or Target reference");
1313 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1314
1315 prop = RNA_def_property(srna, "use_location", PROP_BOOLEAN, PROP_NONE);
1316 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_IK_POS);
1317 RNA_def_property_ui_text(prop, "Position", "Chain follows position of target");
1318 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1319
1320 prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
1322 RNA_def_property_ui_text(prop, "Lock X Pos", "Constraint position along X axis");
1323 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1324
1325 prop = RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
1327 RNA_def_property_ui_text(prop, "Lock Y Pos", "Constraint position along Y axis");
1328 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1329
1330 prop = RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
1332 RNA_def_property_ui_text(prop, "Lock Z Pos", "Constraint position along Z axis");
1333 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1334
1335 prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
1336 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_IK_ROT);
1337 RNA_def_property_ui_text(prop, "Rotation", "Chain follows rotation of target");
1338 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1339
1340 prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
1342 RNA_def_property_ui_text(prop, "Lock X Rotation", "Constraint rotation along X axis");
1343 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1344
1345 prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
1347 RNA_def_property_ui_text(prop, "Lock Y Rotation", "Constraint rotation along Y axis");
1348 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1349
1350 prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
1352 RNA_def_property_ui_text(prop, "Lock Z Rotation", "Constraint rotation along Z axis");
1353 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1354
1355 prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
1357 RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching");
1358 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1359
1360 prop = RNA_def_property(srna, "ik_type", PROP_ENUM, PROP_NONE);
1361 RNA_def_property_enum_sdna(prop, nullptr, "type");
1362 RNA_def_property_enum_funcs(prop, nullptr, "rna_Constraint_ik_type_set", nullptr);
1363 RNA_def_property_enum_items(prop, constraint_ik_type_items);
1364 RNA_def_property_ui_text(prop, "IK Type", "");
1365 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1366
1367 prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
1368 RNA_def_property_enum_sdna(prop, nullptr, "mode");
1371 prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
1372 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1373
1374 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
1375 RNA_def_property_float_sdna(prop, nullptr, "dist");
1376 RNA_def_property_range(prop, 0.0, 100.0f);
1377 RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
1378 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1379
1381}
1382
1384{
1385 StructRNA *srna;
1386 PropertyRNA *prop;
1387
1388 static const EnumPropertyItem up_items[] = {
1389 {TRACK_X, "UP_X", 0, "X", ""},
1390 {TRACK_Y, "UP_Y", 0, "Y", ""},
1391 {TRACK_Z, "UP_Z", 0, "Z", ""},
1392 {0, nullptr, 0, nullptr, nullptr},
1393 };
1394
1395 srna = RNA_def_struct(brna, "TrackToConstraint", "Constraint");
1397 srna, "Track To Constraint", "Aim the constrained object toward the target");
1398
1400
1401 RNA_def_struct_sdna_from(srna, "bTrackToConstraint", "data");
1402
1404
1405 RNA_def_struct_ui_icon(srna, ICON_CON_TRACKTO);
1406
1408
1409 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
1410 RNA_def_property_enum_sdna(prop, nullptr, "reserved1");
1412 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
1413 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1414
1415 prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
1416 RNA_def_property_enum_sdna(prop, nullptr, "reserved2");
1417 RNA_def_property_enum_items(prop, up_items);
1418 RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
1419 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1420
1421 prop = RNA_def_property(srna, "use_target_z", PROP_BOOLEAN, PROP_NONE);
1422 RNA_def_property_boolean_sdna(prop, nullptr, "flags", TARGET_Z_UP);
1424 prop, "Target Z", "Target's Z axis, not World Z axis, will constrain the Up direction");
1425 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1426
1428}
1429
1431{
1432 StructRNA *srna;
1433 PropertyRNA *prop;
1434
1435 srna = RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
1436 RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copy the location of the target");
1437 RNA_def_struct_ui_icon(srna, ICON_CON_LOCLIKE);
1438
1440
1441 RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data");
1442
1444
1446
1447 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1448 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_X);
1449 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X location");
1450 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1451
1452 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1453 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Y);
1454 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y location");
1455 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1456
1457 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1458 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Z);
1459 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z location");
1460 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1461
1462 prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
1463 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_X_INVERT);
1464 RNA_def_property_ui_text(prop, "Invert X", "Invert the X location");
1465 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1466
1467 prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
1468 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Y_INVERT);
1469 RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location");
1470 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1471
1472 prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
1473 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Z_INVERT);
1474 RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location");
1475 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1476
1477 prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
1478 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_OFFSET);
1479 RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location");
1480 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1481
1483}
1484
1486{
1487 StructRNA *srna;
1488 PropertyRNA *prop;
1489
1490 static const EnumPropertyItem mix_mode_items[] = {
1491 {ROTLIKE_MIX_REPLACE, "REPLACE", 0, "Replace", "Replace the original rotation with copied"},
1492 {ROTLIKE_MIX_ADD, "ADD", 0, "Add", "Add euler component values together"},
1494 "BEFORE",
1495 0,
1496 "Before Original",
1497 "Apply copied rotation before original, as if the constraint target is a parent"},
1499 "AFTER",
1500 0,
1501 "After Original",
1502 "Apply copied rotation after original, as if the constraint target is a child"},
1504 "OFFSET",
1505 0,
1506 "Offset (Legacy)",
1507 "Combine rotations like the original Offset checkbox. Does not work well for "
1508 "multiple axis rotations."},
1509 {0, nullptr, 0, nullptr, nullptr},
1510 };
1511
1512 srna = RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
1513 RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copy the rotation of the target");
1514 RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data");
1515 RNA_def_struct_ui_icon(srna, ICON_CON_ROTLIKE);
1516
1518
1520
1521 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1522 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_X);
1523 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X rotation");
1524 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1525
1526 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1527 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Y);
1528 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y rotation");
1529 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1530
1531 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1532 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Z);
1533 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z rotation");
1534 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1535
1536 prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
1537 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_X_INVERT);
1538 RNA_def_property_ui_text(prop, "Invert X", "Invert the X rotation");
1539 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1540
1541 prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
1542 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Y_INVERT);
1543 RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y rotation");
1544 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1545
1546 prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
1547 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Z_INVERT);
1548 RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z rotation");
1549 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1550
1551 prop = RNA_def_property(srna, "euler_order", PROP_ENUM, PROP_NONE);
1552 RNA_def_property_enum_sdna(prop, nullptr, "euler_order");
1554 RNA_def_property_ui_text(prop, "Euler Order", "Explicitly specify the euler rotation order");
1555 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1556
1557 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
1558 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode");
1559 RNA_def_property_enum_items(prop, mix_mode_items);
1561 prop, "Mix Mode", "Specify how the copied and existing rotations are combined");
1562 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1563
1564 /* DEPRECATED: replaced with mix_mode */
1565 prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
1567 prop, "rna_Constraint_RotLike_use_offset_get", "rna_Constraint_RotLike_use_offset_set");
1569 prop, "Offset", "DEPRECATED: Add original rotation into copied rotation");
1570 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1571
1573}
1574
1576{
1577 StructRNA *srna;
1578 PropertyRNA *prop;
1579
1580 srna = RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
1581 RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copy the scale of the target");
1582 RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
1583 RNA_def_struct_ui_icon(srna, ICON_CON_SIZELIKE);
1584
1586
1588
1589 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1590 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_X);
1591 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X scale");
1592 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1593
1594 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1595 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_Y);
1596 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y scale");
1597 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1598
1599 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1600 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_Z);
1601 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale");
1602 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1603
1604 prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_NONE);
1605 RNA_def_property_float_sdna(prop, nullptr, "power");
1608 RNA_def_property_ui_text(prop, "Power", "Raise the target's scale to the specified power");
1610 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1611
1612 prop = RNA_def_property(srna, "use_make_uniform", PROP_BOOLEAN, PROP_NONE);
1613 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_UNIFORM);
1615 "Make Uniform",
1616 "Redistribute the copied change in volume equally "
1617 "between the three axes of the owner");
1618 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1619
1620 prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
1621 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_OFFSET);
1622 RNA_def_property_ui_text(prop, "Offset", "Combine original scale with copied scale");
1623 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1624
1625 prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
1628 prop,
1629 "Additive",
1630 "Use addition instead of multiplication to combine scale (2.7 compatibility)");
1632 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1633
1635}
1636
1638{
1639 StructRNA *srna;
1640 PropertyRNA *prop;
1641
1642 static const EnumPropertyItem axis_items[] = {
1643 {SAMEVOL_X, "SAMEVOL_X", 0, "X", ""},
1644 {SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""},
1645 {SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""},
1646 {0, nullptr, 0, nullptr, nullptr},
1647 };
1648
1649 static const EnumPropertyItem mode_items[] = {
1651 "STRICT",
1652 0,
1653 "Strict",
1654 "Volume is strictly preserved, overriding the scaling of non-free axes"},
1656 "UNIFORM",
1657 0,
1658 "Uniform",
1659 "Volume is preserved when the object is scaled uniformly. "
1660 "Deviations from uniform scale on non-free axes are passed through."},
1662 "SINGLE_AXIS",
1663 0,
1664 "Single Axis",
1665 "Volume is preserved when the object is scaled only on the free axis. "
1666 "Non-free axis scaling is passed through."},
1667 {0, nullptr, 0, nullptr, nullptr},
1668 };
1669
1670 srna = RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
1672 "Maintain Volume Constraint",
1673 "Maintain a constant volume along a single scaling axis");
1674 RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
1675 RNA_def_struct_ui_icon(srna, ICON_CON_SAMEVOL);
1676
1678
1679 prop = RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
1680 RNA_def_property_enum_sdna(prop, nullptr, "free_axis");
1681 RNA_def_property_enum_items(prop, axis_items);
1682 RNA_def_property_ui_text(prop, "Free Axis", "The free scaling axis of the object");
1683 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1684
1685 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1686 RNA_def_property_enum_sdna(prop, nullptr, "mode");
1687 RNA_def_property_enum_items(prop, mode_items);
1689 prop, "Mode", "The way the constraint treats original non-free axis scaling");
1690 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1691
1692 prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
1693 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1694 RNA_def_property_ui_range(prop, 0.001f, 100.0f, 1, 3);
1695 RNA_def_property_ui_text(prop, "Volume", "Volume of the bone at rest");
1696 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1697
1699}
1700
1702{
1703 StructRNA *srna;
1704 PropertyRNA *prop;
1705
1706 static const EnumPropertyItem mix_mode_items[] = {
1708 "REPLACE",
1709 0,
1710 "Replace",
1711 "Replace the original transformation with copied"},
1714 "BEFORE_FULL",
1715 0,
1716 "Before Original (Full)",
1717 "Apply copied transformation before original, using simple matrix multiplication as if "
1718 "the constraint target is a parent in Full Inherit Scale mode. "
1719 "Will create shear when combining rotation and non-uniform scale."},
1721 "BEFORE",
1722 0,
1723 "Before Original (Aligned)",
1724 "Apply copied transformation before original, as if the constraint target is a parent in "
1725 "Aligned Inherit Scale mode. This effectively uses Full for location and Split Channels "
1726 "for rotation and scale."},
1728 "BEFORE_SPLIT",
1729 0,
1730 "Before Original (Split Channels)",
1731 "Apply copied transformation before original, handling location, rotation and scale "
1732 "separately, similar to a sequence of three Copy constraints"},
1735 "AFTER_FULL",
1736 0,
1737 "After Original (Full)",
1738 "Apply copied transformation after original, using simple matrix multiplication as if "
1739 "the constraint target is a child in Full Inherit Scale mode. "
1740 "Will create shear when combining rotation and non-uniform scale."},
1742 "AFTER",
1743 0,
1744 "After Original (Aligned)",
1745 "Apply copied transformation after original, as if the constraint target is a child in "
1746 "Aligned Inherit Scale mode. This effectively uses Full for location and Split Channels "
1747 "for rotation and scale."},
1749 "AFTER_SPLIT",
1750 0,
1751 "After Original (Split Channels)",
1752 "Apply copied transformation after original, handling location, rotation and scale "
1753 "separately, similar to a sequence of three Copy constraints"},
1754 {0, nullptr, 0, nullptr, nullptr},
1755 };
1756
1757 srna = RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
1759 srna, "Copy Transforms Constraint", "Copy all the transforms of the target");
1760
1762
1763 RNA_def_struct_sdna_from(srna, "bTransLikeConstraint", "data");
1764
1765 RNA_def_struct_ui_icon(srna, ICON_CON_TRANSLIKE);
1766
1768
1770
1771 prop = RNA_def_property(srna, "remove_target_shear", PROP_BOOLEAN, PROP_NONE);
1774 prop, "Remove Target Shear", "Remove shear from the target transformation before combining");
1775 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1776
1777 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
1778 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode");
1779 RNA_def_property_enum_items(prop, mix_mode_items);
1781 prop, "Mix Mode", "Specify how the copied and existing transformations are combined");
1782 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1783
1785}
1786
1788{
1789 StructRNA *srna;
1790 PropertyRNA *prop;
1791
1792 static const EnumPropertyItem minmax_items[] = {
1793 {TRACK_X, "FLOOR_X", 0, "X", ""},
1794 {TRACK_Y, "FLOOR_Y", 0, "Y", ""},
1795 {TRACK_Z, "FLOOR_Z", 0, "Z", ""},
1796 {TRACK_nX, "FLOOR_NEGATIVE_X", 0, "-X", ""},
1797 {TRACK_nY, "FLOOR_NEGATIVE_Y", 0, "-Y", ""},
1798 {TRACK_nZ, "FLOOR_NEGATIVE_Z", 0, "-Z", ""},
1799 {0, nullptr, 0, nullptr, nullptr},
1800 };
1801
1802 srna = RNA_def_struct(brna, "FloorConstraint", "Constraint");
1804 srna, "Floor Constraint", "Use the target object for location limitation");
1805 RNA_def_struct_sdna_from(srna, "bMinMaxConstraint", "data");
1806 RNA_def_struct_ui_icon(srna, ICON_CON_FLOOR);
1807
1809
1811
1812 prop = RNA_def_property(srna, "floor_location", PROP_ENUM, PROP_NONE);
1813 RNA_def_property_enum_sdna(prop, nullptr, "minmaxflag");
1814 RNA_def_property_enum_items(prop, minmax_items);
1816 prop, "Floor Location", "Location of target that object will not pass through");
1817 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1818
1819 prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
1820 RNA_def_property_boolean_sdna(prop, nullptr, "flag", MINMAX_USEROT);
1821 RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor");
1822 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1823
1824 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
1825 RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, -1);
1826 RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object origin");
1827 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1828
1830}
1831
1833{
1834 StructRNA *srna;
1835 PropertyRNA *prop;
1836
1837 static const EnumPropertyItem transform_channel_items[] = {
1838 {20, "LOCATION_X", 0, "X Location", ""},
1839 {21, "LOCATION_Y", 0, "Y Location", ""},
1840 {22, "LOCATION_Z", 0, "Z Location", ""},
1841 {00, "ROTATION_X", 0, "X Rotation", ""},
1842 {01, "ROTATION_Y", 0, "Y Rotation", ""},
1843 {02, "ROTATION_Z", 0, "Z Rotation", ""},
1844 {10, "SCALE_X", 0, "X Scale", ""},
1845 {11, "SCALE_Y", 0, "Y Scale", ""},
1846 {12, "SCALE_Z", 0, "Z Scale", ""},
1847 {0, nullptr, 0, nullptr, nullptr},
1848 };
1849
1850 static const EnumPropertyItem mix_mode_items[] = {
1852 "REPLACE",
1853 0,
1854 "Replace",
1855 "Replace the original transformation with the action channels"},
1858 "BEFORE_FULL",
1859 0,
1860 "Before Original (Full)",
1861 "Apply the action channels before the original transformation, as if applied to an "
1862 "imaginary parent in Full Inherit Scale mode. Will create shear when combining rotation "
1863 "and non-uniform scale."},
1865 "BEFORE",
1866 0,
1867 "Before Original (Aligned)",
1868 "Apply the action channels before the original transformation, as if applied to an "
1869 "imaginary parent in Aligned Inherit Scale mode. This effectively uses Full for location "
1870 "and Split Channels for rotation and scale."},
1872 "BEFORE_SPLIT",
1873 0,
1874 "Before Original (Split Channels)",
1875 "Apply the action channels before the original transformation, handling location, rotation "
1876 "and scale separately"},
1879 "AFTER_FULL",
1880 0,
1881 "After Original (Full)",
1882 "Apply the action channels after the original transformation, as if applied to an "
1883 "imaginary child in Full Inherit Scale mode. Will create shear when combining rotation "
1884 "and non-uniform scale."},
1886 "AFTER",
1887 0,
1888 "After Original (Aligned)",
1889 "Apply the action channels after the original transformation, as if applied to an "
1890 "imaginary child in Aligned Inherit Scale mode. This effectively uses Full for location "
1891 "and Split Channels for rotation and scale."},
1893 "AFTER_SPLIT",
1894 0,
1895 "After Original (Split Channels)",
1896 "Apply the action channels after the original transformation, handling location, rotation "
1897 "and scale separately"},
1898 {0, nullptr, 0, nullptr, nullptr},
1899 };
1900
1901 srna = RNA_def_struct(brna, "ActionConstraint", "Constraint");
1903 srna, "Action Constraint", "Map an action to the transform axes of a bone");
1904 RNA_def_struct_sdna_from(srna, "bActionConstraint", "data");
1905 RNA_def_struct_ui_icon(srna, ICON_ACTION);
1906
1908
1910
1911 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
1912 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode");
1913 RNA_def_property_enum_items(prop, mix_mode_items);
1914 RNA_def_property_enum_funcs(prop, nullptr, "rna_ActionConstraint_mix_mode_set", nullptr);
1916 prop,
1917 "Mix Mode",
1918 "Specify how existing transformations and the action channels are combined");
1919 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1920
1921 prop = RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE);
1922 RNA_def_property_enum_sdna(prop, nullptr, "type");
1923 RNA_def_property_enum_items(prop, transform_channel_items);
1925 prop,
1926 "Transform Channel",
1927 "Transformation channel from the target that is used to key the Action");
1928 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1929
1930 prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
1931 RNA_def_property_pointer_sdna(prop, nullptr, "act");
1933 prop, nullptr, "rna_ActionConstraint_action_set", nullptr, "rna_Action_id_poll");
1934 RNA_def_property_ui_text(prop, "Action", "The constraining action");
1936 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1937
1938 /* This property is not necessary for the Python API (that is better off using
1939 * slot references/pointers directly), but it is needed for library overrides
1940 * to work. */
1941 prop = RNA_def_property(srna, "action_slot_handle", PROP_INT, PROP_NONE);
1942 RNA_def_property_int_sdna(prop, nullptr, "action_slot_handle");
1944 prop, nullptr, "rna_ActionConstraint_action_slot_handle_set", nullptr);
1946 "Action Slot Handle",
1947 "A number that identifies which sub-set of the Action is considered "
1948 "to be for this Action Constraint");
1951 prop, "rna_ActionConstraint_action_slot_handle_override_diff", nullptr, nullptr);
1952 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_Constraint_update");
1953
1954 prop = RNA_def_property(srna, "last_slot_identifier", PROP_STRING, PROP_NONE);
1955 RNA_def_property_string_sdna(prop, nullptr, "last_slot_identifier");
1957 prop,
1958 "Last Action Slot Identifier",
1959 "The identifier of the most recently assigned action slot. The slot identifies which "
1960 "sub-set of the Action is considered to be for this constraint, and its identifier is used "
1961 "to find the right slot when assigning an Action.");
1962
1963 prop = RNA_def_property(srna, "action_slot", PROP_POINTER, PROP_NONE);
1964 RNA_def_property_struct_type(prop, "ActionSlot");
1968 prop,
1969 "Action Slot",
1970 "The slot identifies which sub-set of the Action is considered to be for this "
1971 "strip, and its name is used to find the right slot when assigning another Action");
1973 "rna_ActionConstraint_action_slot_get",
1974 "rna_ActionConstraint_action_slot_set",
1975 nullptr,
1976 nullptr);
1977 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_Constraint_update");
1978 /* `strip.action_slot` is exposed to RNA as a pointer for things like the action slot selector in
1979 * the GUI. The ground truth of the assigned slot, however, is `action_slot_handle` declared
1980 * above. That property is used for library override operations, and this pointer property should
1981 * just be ignored.
1982 *
1983 * This needs PROPOVERRIDE_IGNORE; PROPOVERRIDE_NO_COMPARISON is not suitable here. This property
1984 * should act as if it is an overridable property (as from the user's perspective, it is), but an
1985 * override operation should not be created for it. It will be created for `action_slot_handle`,
1986 * and that's enough. */
1988
1989 prop = RNA_def_property(srna, "action_suitable_slots", PROP_COLLECTION, PROP_NONE);
1990 RNA_def_property_struct_type(prop, "ActionSlot");
1992 "rna_iterator_ActionConstraint_action_suitable_slots_begin",
1993 "rna_iterator_array_next",
1994 "rna_iterator_array_end",
1995 "rna_iterator_array_dereference_get",
1996 nullptr,
1997 nullptr,
1998 nullptr,
1999 nullptr);
2001 prop, "Action Slots", "The list of action slots suitable for this NLA strip");
2002
2003 prop = RNA_def_property(srna, "use_bone_object_action", PROP_BOOLEAN, PROP_NONE);
2006 "Object Action",
2007 "Bones only: apply the object's transformation channels of the action "
2008 "to the constrained bone, instead of bone's channels");
2009 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2010
2011 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
2012 RNA_def_property_int_sdna(prop, nullptr, "start");
2014 RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use");
2015 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2016
2017 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
2018 RNA_def_property_int_sdna(prop, nullptr, "end");
2020 RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use");
2021 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2022
2023 prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
2024 RNA_def_property_float_sdna(prop, nullptr, "max");
2025 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2026 RNA_def_property_ui_text(prop, "Maximum", "Maximum value for target channel range");
2027 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2028 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_ActionConstraint_minmax_range");
2029
2030 prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
2031 RNA_def_property_float_sdna(prop, nullptr, "min");
2032 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2033 RNA_def_property_ui_text(prop, "Minimum", "Minimum 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, "eval_time", PROP_FLOAT, PROP_FACTOR);
2038 RNA_def_property_float_sdna(prop, nullptr, "eval_time");
2039 RNA_def_property_range(prop, 0.0f, 1.0f);
2041 prop, "Evaluation Time", "Interpolates between Action Start and End frames");
2042 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2043
2044 prop = RNA_def_property(srna, "use_eval_time", PROP_BOOLEAN, PROP_NONE);
2047 "Use Evaluation Time",
2048 "Interpolate between Action Start and End frames, with the Evaluation "
2049 "Time slider instead of the Target object/bone");
2050 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2051
2053}
2054
2056{
2057 StructRNA *srna;
2058 PropertyRNA *prop;
2059
2060 static const EnumPropertyItem lock_items[] = {
2061 {TRACK_X, "LOCK_X", 0, "X", ""},
2062 {TRACK_Y, "LOCK_Y", 0, "Y", ""},
2063 {TRACK_Z, "LOCK_Z", 0, "Z", ""},
2064 {0, nullptr, 0, nullptr, nullptr},
2065 };
2066
2067 srna = RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
2069 srna,
2070 "Locked Track Constraint",
2071 "Point toward the target along the track axis, while locking the other axis");
2072 RNA_def_struct_ui_icon(srna, ICON_CON_LOCKTRACK);
2073
2075
2076 RNA_def_struct_sdna_from(srna, "bLockTrackConstraint", "data");
2077
2079
2081
2082 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
2083 RNA_def_property_enum_sdna(prop, nullptr, "trackflag");
2085 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
2086 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2087
2088 prop = RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
2089 RNA_def_property_enum_sdna(prop, nullptr, "lockflag");
2090 RNA_def_property_enum_items(prop, lock_items);
2091 RNA_def_property_ui_text(prop, "Locked Axis", "Axis that points upward");
2092 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2093
2095}
2096
2098{
2099 StructRNA *srna;
2100 PropertyRNA *prop;
2101
2102 static const EnumPropertyItem forwardpath_items[] = {
2103 {TRACK_X, "FORWARD_X", 0, "X", ""},
2104 {TRACK_Y, "FORWARD_Y", 0, "Y", ""},
2105 {TRACK_Z, "FORWARD_Z", 0, "Z", ""},
2106 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
2107 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
2108 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
2109 {0, nullptr, 0, nullptr, nullptr},
2110 };
2111
2112 static const EnumPropertyItem pathup_items[] = {
2113 {TRACK_X, "UP_X", 0, "X", ""},
2114 {TRACK_Y, "UP_Y", 0, "Y", ""},
2115 {TRACK_Z, "UP_Z", 0, "Z", ""},
2116 {0, nullptr, 0, nullptr, nullptr},
2117 };
2118
2119 srna = RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
2120 RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Lock motion to the target path");
2121 RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data");
2122 RNA_def_struct_ui_icon(srna, ICON_CON_FOLLOWPATH);
2123
2125
2126 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
2127 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
2128 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Curve_object_poll");
2129 RNA_def_property_ui_text(prop, "Target", "Target Curve object");
2131 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
2132
2133 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TIME);
2136 prop, "Offset", "Offset from the position corresponding to the time frame");
2137 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2138
2139 prop = RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR);
2140 RNA_def_property_float_sdna(prop, nullptr, "offset_fac");
2142 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 3);
2144 prop, "Offset Factor", "Percentage value defining target position along length of curve");
2145 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2146
2147 prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
2148 RNA_def_property_enum_sdna(prop, nullptr, "trackflag");
2149 RNA_def_property_enum_items(prop, forwardpath_items);
2150 RNA_def_property_ui_text(prop, "Forward Axis", "Axis that points forward along the path");
2151 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2152
2153 prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
2154 RNA_def_property_enum_sdna(prop, nullptr, "upflag");
2155 RNA_def_property_enum_items(prop, pathup_items);
2156 RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
2157 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2158
2159 prop = RNA_def_property(srna, "use_curve_follow", PROP_BOOLEAN, PROP_NONE);
2160 RNA_def_property_boolean_sdna(prop, nullptr, "followflag", FOLLOWPATH_FOLLOW);
2162 prop, "Follow Curve", "Object will follow the heading and banking of the curve");
2163 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2164
2165 prop = RNA_def_property(srna, "use_fixed_location", PROP_BOOLEAN, PROP_NONE);
2166 RNA_def_property_boolean_sdna(prop, nullptr, "followflag", FOLLOWPATH_STATIC);
2168 prop,
2169 "Fixed Position",
2170 "Object will stay locked to a single point somewhere along the length of the curve "
2171 "regardless of time");
2172 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2173
2174 prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
2175 RNA_def_property_boolean_sdna(prop, nullptr, "followflag", FOLLOWPATH_RADIUS);
2176 RNA_def_property_ui_text(prop, "Curve Radius", "Object is scaled by the curve radius");
2177 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2178
2180}
2181
2183{
2184 StructRNA *srna;
2185 PropertyRNA *prop;
2186
2187 static const EnumPropertyItem volume_items[] = {
2188 {VOLUME_XZ, "VOLUME_XZX", 0, "XZ", ""},
2189 {VOLUME_X, "VOLUME_X", 0, "X", ""},
2190 {VOLUME_Z, "VOLUME_Z", 0, "Z", ""},
2191 {NO_VOLUME, "NO_VOLUME", 0, "None", ""},
2192 {0, nullptr, 0, nullptr, nullptr},
2193 };
2194
2195 static const EnumPropertyItem plane_items[] = {
2196 {PLANE_X, "PLANE_X", 0, "XZ", "Rotate around local X, then Z"},
2197 {PLANE_Z, "PLANE_Z", 0, "ZX", "Rotate around local Z, then X"},
2198 {SWING_Y,
2199 "SWING_Y",
2200 0,
2201 "Swing",
2202 "Use the smallest single axis rotation, similar to Damped Track"},
2203 {0, nullptr, 0, nullptr, nullptr},
2204 };
2205
2206 srna = RNA_def_struct(brna, "StretchToConstraint", "Constraint");
2207 RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretch to meet the target object");
2208 RNA_def_struct_ui_icon(srna, ICON_CON_STRETCHTO);
2209
2211
2212 RNA_def_struct_sdna_from(srna, "bStretchToConstraint", "data");
2213
2215
2217
2218 prop = RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
2219 RNA_def_property_enum_sdna(prop, nullptr, "volmode");
2220 RNA_def_property_enum_items(prop, volume_items);
2222 prop, "Maintain Volume", "Maintain the object's volume as it stretches");
2223 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2224
2225 prop = RNA_def_property(srna, "keep_axis", PROP_ENUM, PROP_NONE);
2226 RNA_def_property_enum_sdna(prop, nullptr, "plane");
2227 RNA_def_property_enum_items(prop, plane_items);
2228 RNA_def_property_ui_text(prop, "Keep Axis", "The rotation type and axis order to use");
2229 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2230
2231 prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_DISTANCE);
2232 RNA_def_property_float_sdna(prop, nullptr, "orglength");
2233 RNA_def_property_range(prop, 0.0f, 1000.0f);
2235 RNA_def_property_ui_text(prop, "Original Length", "Length at rest position");
2236 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2237
2238 prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
2239 RNA_def_property_range(prop, 0.0, 100.0f);
2241 prop, "Volume Variation", "Factor between volume variation and stretching");
2242 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2243
2244 prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
2247 prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
2248 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2249
2250 prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
2253 prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
2254 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2255
2256 prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
2257 RNA_def_property_range(prop, 0.0, 1.0f);
2258 RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
2259 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2260
2261 prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
2262 RNA_def_property_range(prop, 1.0, 100.0f);
2263 RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
2264 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2265
2266 prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
2267 RNA_def_property_range(prop, 0.0, 1.0f);
2269 prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
2270 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2271
2273}
2274
2276{
2277 StructRNA *srna;
2278 PropertyRNA *prop;
2279
2280 static const EnumPropertyItem clamp_items[] = {
2281 {CLAMPTO_AUTO, "CLAMPTO_AUTO", 0, "Auto", ""},
2282 {CLAMPTO_X, "CLAMPTO_X", 0, "X", ""},
2283 {CLAMPTO_Y, "CLAMPTO_Y", 0, "Y", ""},
2284 {CLAMPTO_Z, "CLAMPTO_Z", 0, "Z", ""},
2285 {0, nullptr, 0, nullptr, nullptr},
2286 };
2287
2288 srna = RNA_def_struct(brna, "ClampToConstraint", "Constraint");
2290 srna,
2291 "Clamp To Constraint",
2292 "Constrain an object's location to the nearest point along the target path");
2293 RNA_def_struct_sdna_from(srna, "bClampToConstraint", "data");
2294 RNA_def_struct_ui_icon(srna, ICON_CON_CLAMPTO);
2295
2297
2298 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
2299 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
2300 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Curve_object_poll");
2301 RNA_def_property_ui_text(prop, "Target", "Target Object (Curves only)");
2303 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
2304
2305 prop = RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE);
2306 RNA_def_property_enum_sdna(prop, nullptr, "flag");
2307 RNA_def_property_enum_items(prop, clamp_items);
2308 RNA_def_property_ui_text(prop, "Main Axis", "Main axis of movement");
2309 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2310
2311 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
2312 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", CLAMPTO_CYCLIC);
2314 prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box)");
2315 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2316
2318}
2319
2321{
2322 StructRNA *srna;
2323 PropertyRNA *prop;
2324
2325 static const EnumPropertyItem transform_items[] = {
2326 {TRANS_LOCATION, "LOCATION", 0, "Location", ""},
2327 {TRANS_ROTATION, "ROTATION", 0, "Rotation", ""},
2328 {TRANS_SCALE, "SCALE", 0, "Scale", ""},
2329 {0, nullptr, 0, nullptr, nullptr},
2330 };
2331
2332 static const EnumPropertyItem mix_mode_loc_items[] = {
2333 {TRANS_MIXLOC_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
2334 {TRANS_MIXLOC_ADD, "ADD", 0, "Add", "Add component values together"},
2335 {0, nullptr, 0, nullptr, nullptr},
2336 };
2337
2338 static const EnumPropertyItem mix_mode_rot_items[] = {
2339 {TRANS_MIXROT_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
2340 {TRANS_MIXROT_ADD, "ADD", 0, "Add", "Add component values together"},
2342 "BEFORE",
2343 0,
2344 "Before Original",
2345 "Apply new rotation before original, as if it was on a parent"},
2347 "AFTER",
2348 0,
2349 "After Original",
2350 "Apply new rotation after original, as if it was on a child"},
2351 {0, nullptr, 0, nullptr, nullptr},
2352 };
2353
2354 static const EnumPropertyItem mix_mode_scale_items[] = {
2355 {TRANS_MIXSCALE_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
2356 {TRANS_MIXSCALE_MULTIPLY, "MULTIPLY", 0, "Multiply", "Multiply component values together"},
2357 {0, nullptr, 0, nullptr, nullptr},
2358 };
2359
2360 srna = RNA_def_struct(brna, "TransformConstraint", "Constraint");
2362 srna, "Transformation Constraint", "Map transformations of the target to the object");
2363 RNA_def_struct_sdna_from(srna, "bTransformConstraint", "data");
2364 RNA_def_struct_ui_icon(srna, ICON_CON_TRANSFORM);
2365
2367
2369
2370 prop = RNA_def_property(srna, "map_from", PROP_ENUM, PROP_NONE);
2371 RNA_def_property_enum_sdna(prop, nullptr, "from");
2372 RNA_def_property_enum_items(prop, transform_items);
2373 RNA_def_property_ui_text(prop, "Map From", "The transformation type to use from the target");
2374 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2375
2376 prop = RNA_def_property(srna, "map_to", PROP_ENUM, PROP_NONE);
2377 RNA_def_property_enum_sdna(prop, nullptr, "to");
2378 RNA_def_property_enum_items(prop, transform_items);
2380 prop, "Map To", "The transformation type to affect on the constrained object");
2381 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2382
2383 prop = RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE);
2384 RNA_def_property_enum_sdna(prop, nullptr, "map[0]");
2387 prop, "Map To X From", "The source axis constrained object's X axis uses");
2388 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2389
2390 prop = RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE);
2391 RNA_def_property_enum_sdna(prop, nullptr, "map[1]");
2394 prop, "Map To Y From", "The source axis constrained object's Y axis uses");
2395 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2396
2397 prop = RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE);
2398 RNA_def_property_enum_sdna(prop, nullptr, "map[2]");
2401 prop, "Map To Z From", "The source axis constrained object's Z axis uses");
2402 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2403
2404 prop = RNA_def_property(srna, "use_motion_extrapolate", PROP_BOOLEAN, PROP_NONE);
2405 RNA_def_property_boolean_sdna(prop, nullptr, "expo", CLAMPTO_CYCLIC);
2406 RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges");
2407 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2408
2409 prop = RNA_def_property(srna, "from_rotation_mode", PROP_ENUM, PROP_NONE);
2410 RNA_def_property_enum_sdna(prop, nullptr, "from_rotation_mode");
2412 RNA_def_property_ui_text(prop, "From Mode", "Specify the type of rotation channels to use");
2413 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2414
2415 prop = RNA_def_property(srna, "to_euler_order", PROP_ENUM, PROP_NONE);
2416 RNA_def_property_enum_sdna(prop, nullptr, "to_euler_order");
2418 RNA_def_property_ui_text(prop, "To Order", "Explicitly specify the output euler rotation order");
2419 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2420
2421 /* Loc */
2422 prop = RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
2423 RNA_def_property_float_sdna(prop, nullptr, "from_min[0]");
2424 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2425 RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
2426 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2427
2428 prop = RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
2429 RNA_def_property_float_sdna(prop, nullptr, "from_min[1]");
2430 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2431 RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
2432 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2433
2434 prop = RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
2435 RNA_def_property_float_sdna(prop, nullptr, "from_min[2]");
2436 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2437 RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
2438 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2439
2440 prop = RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
2441 RNA_def_property_float_sdna(prop, nullptr, "from_max[0]");
2442 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2443 RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
2444 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2445
2446 prop = RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
2447 RNA_def_property_float_sdna(prop, nullptr, "from_max[1]");
2448 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2449 RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
2450 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2451
2452 prop = RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
2453 RNA_def_property_float_sdna(prop, nullptr, "from_max[2]");
2454 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2455 RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
2456 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2457
2458 prop = RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
2459 RNA_def_property_float_sdna(prop, nullptr, "to_min[0]");
2460 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2461 RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
2462 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2463
2464 prop = RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
2465 RNA_def_property_float_sdna(prop, nullptr, "to_min[1]");
2466 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2467 RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
2468 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2469
2470 prop = RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
2471 RNA_def_property_float_sdna(prop, nullptr, "to_min[2]");
2472 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2473 RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
2474 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2475
2476 prop = RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
2477 RNA_def_property_float_sdna(prop, nullptr, "to_max[0]");
2478 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2479 RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
2480 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2481
2482 prop = RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
2483 RNA_def_property_float_sdna(prop, nullptr, "to_max[1]");
2484 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2485 RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
2486 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2487
2488 prop = RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
2489 RNA_def_property_float_sdna(prop, nullptr, "to_max[2]");
2490 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2491 RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
2492 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2493
2494 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
2495 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode_loc");
2496 RNA_def_property_enum_items(prop, mix_mode_loc_items);
2498 prop, "Location Mix Mode", "Specify how to combine the new location with original");
2499 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2500
2501 /* Rot */
2502 prop = RNA_def_property(srna, "from_min_x_rot", PROP_FLOAT, PROP_ANGLE);
2503 RNA_def_property_float_sdna(prop, nullptr, "from_min_rot[0]");
2504 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2505 RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
2506 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2507
2508 prop = RNA_def_property(srna, "from_min_y_rot", PROP_FLOAT, PROP_ANGLE);
2509 RNA_def_property_float_sdna(prop, nullptr, "from_min_rot[1]");
2510 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2511 RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
2512 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2513
2514 prop = RNA_def_property(srna, "from_min_z_rot", PROP_FLOAT, PROP_ANGLE);
2515 RNA_def_property_float_sdna(prop, nullptr, "from_min_rot[2]");
2516 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2517 RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
2518 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2519
2520 prop = RNA_def_property(srna, "from_max_x_rot", PROP_FLOAT, PROP_ANGLE);
2521 RNA_def_property_float_sdna(prop, nullptr, "from_max_rot[0]");
2522 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2523 RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
2524 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2525
2526 prop = RNA_def_property(srna, "from_max_y_rot", PROP_FLOAT, PROP_ANGLE);
2527 RNA_def_property_float_sdna(prop, nullptr, "from_max_rot[1]");
2528 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2529 RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
2530 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2531
2532 prop = RNA_def_property(srna, "from_max_z_rot", PROP_FLOAT, PROP_ANGLE);
2533 RNA_def_property_float_sdna(prop, nullptr, "from_max_rot[2]");
2534 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2535 RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
2536 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2537
2538 prop = RNA_def_property(srna, "to_min_x_rot", PROP_FLOAT, PROP_ANGLE);
2539 RNA_def_property_float_sdna(prop, nullptr, "to_min_rot[0]");
2540 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2541 RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
2542 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2543
2544 prop = RNA_def_property(srna, "to_min_y_rot", PROP_FLOAT, PROP_ANGLE);
2545 RNA_def_property_float_sdna(prop, nullptr, "to_min_rot[1]");
2546 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2547 RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
2548 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2549
2550 prop = RNA_def_property(srna, "to_min_z_rot", PROP_FLOAT, PROP_ANGLE);
2551 RNA_def_property_float_sdna(prop, nullptr, "to_min_rot[2]");
2552 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2553 RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
2554 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2555
2556 prop = RNA_def_property(srna, "to_max_x_rot", PROP_FLOAT, PROP_ANGLE);
2557 RNA_def_property_float_sdna(prop, nullptr, "to_max_rot[0]");
2558 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2559 RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
2560 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2561
2562 prop = RNA_def_property(srna, "to_max_y_rot", PROP_FLOAT, PROP_ANGLE);
2563 RNA_def_property_float_sdna(prop, nullptr, "to_max_rot[1]");
2564 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2565 RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
2566 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2567
2568 prop = RNA_def_property(srna, "to_max_z_rot", PROP_FLOAT, PROP_ANGLE);
2569 RNA_def_property_float_sdna(prop, nullptr, "to_max_rot[2]");
2570 RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
2571 RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
2572 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2573
2574 prop = RNA_def_property(srna, "mix_mode_rot", PROP_ENUM, PROP_NONE);
2575 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode_rot");
2576 RNA_def_property_enum_items(prop, mix_mode_rot_items);
2578 prop, "Rotation Mix Mode", "Specify how to combine the new rotation with original");
2579 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2580
2581 /* Scale */
2582 prop = RNA_def_property(srna, "from_min_x_scale", PROP_FLOAT, PROP_NONE);
2583 RNA_def_property_float_sdna(prop, nullptr, "from_min_scale[0]");
2584 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2585 RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
2586 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2587
2588 prop = RNA_def_property(srna, "from_min_y_scale", PROP_FLOAT, PROP_NONE);
2589 RNA_def_property_float_sdna(prop, nullptr, "from_min_scale[1]");
2590 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2591 RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
2592 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2593
2594 prop = RNA_def_property(srna, "from_min_z_scale", PROP_FLOAT, PROP_NONE);
2595 RNA_def_property_float_sdna(prop, nullptr, "from_min_scale[2]");
2596 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2597 RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
2598 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2599
2600 prop = RNA_def_property(srna, "from_max_x_scale", PROP_FLOAT, PROP_NONE);
2601 RNA_def_property_float_sdna(prop, nullptr, "from_max_scale[0]");
2602 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2603 RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
2604 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2605
2606 prop = RNA_def_property(srna, "from_max_y_scale", PROP_FLOAT, PROP_NONE);
2607 RNA_def_property_float_sdna(prop, nullptr, "from_max_scale[1]");
2608 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2609 RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
2610 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2611
2612 prop = RNA_def_property(srna, "from_max_z_scale", PROP_FLOAT, PROP_NONE);
2613 RNA_def_property_float_sdna(prop, nullptr, "from_max_scale[2]");
2614 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2615 RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
2616 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2617
2618 prop = RNA_def_property(srna, "to_min_x_scale", PROP_FLOAT, PROP_NONE);
2619 RNA_def_property_float_sdna(prop, nullptr, "to_min_scale[0]");
2620 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2621 RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
2622 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2623
2624 prop = RNA_def_property(srna, "to_min_y_scale", PROP_FLOAT, PROP_NONE);
2625 RNA_def_property_float_sdna(prop, nullptr, "to_min_scale[1]");
2626 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2627 RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
2628 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2629
2630 prop = RNA_def_property(srna, "to_min_z_scale", PROP_FLOAT, PROP_NONE);
2631 RNA_def_property_float_sdna(prop, nullptr, "to_min_scale[2]");
2632 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2633 RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
2634 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2635
2636 prop = RNA_def_property(srna, "to_max_x_scale", PROP_FLOAT, PROP_NONE);
2637 RNA_def_property_float_sdna(prop, nullptr, "to_max_scale[0]");
2638 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2639 RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
2640 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2641
2642 prop = RNA_def_property(srna, "to_max_y_scale", PROP_FLOAT, PROP_NONE);
2643 RNA_def_property_float_sdna(prop, nullptr, "to_max_scale[1]");
2644 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2645 RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
2646 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2647
2648 prop = RNA_def_property(srna, "to_max_z_scale", PROP_FLOAT, PROP_NONE);
2649 RNA_def_property_float_sdna(prop, nullptr, "to_max_scale[2]");
2650 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2651 RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
2652 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2653
2654 prop = RNA_def_property(srna, "mix_mode_scale", PROP_ENUM, PROP_NONE);
2655 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode_scale");
2656 RNA_def_property_enum_items(prop, mix_mode_scale_items);
2658 prop, "Scale Mix Mode", "Specify how to combine the new scale with original");
2659 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2660
2662}
2663
2665{
2666 StructRNA *srna;
2667 PropertyRNA *prop;
2668
2669 srna = RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
2671 srna, "Limit Location Constraint", "Limit the location of the constrained object");
2672 RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data");
2673 RNA_def_struct_ui_icon(srna, ICON_CON_LOCLIMIT);
2674
2676
2677 prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
2678 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMIN);
2679 RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
2680 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2681
2682 prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
2683 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMIN);
2684 RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
2685 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2686
2687 prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
2688 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMIN);
2689 RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
2690 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2691
2692 prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
2693 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMAX);
2694 RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
2695 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2696
2697 prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
2698 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMAX);
2699 RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
2700 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2701
2702 prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
2703 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMAX);
2704 RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
2705 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2706
2707 prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_DISTANCE);
2708 RNA_def_property_float_sdna(prop, nullptr, "xmin");
2709 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2710 RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
2711 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2712
2713 prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_DISTANCE);
2714 RNA_def_property_float_sdna(prop, nullptr, "ymin");
2715 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2716 RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
2717 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2718
2719 prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_DISTANCE);
2720 RNA_def_property_float_sdna(prop, nullptr, "zmin");
2721 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2722 RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
2723 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2724
2725 prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_DISTANCE);
2726 RNA_def_property_float_sdna(prop, nullptr, "xmax");
2727 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2728 RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
2729 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2730
2731 prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_DISTANCE);
2732 RNA_def_property_float_sdna(prop, nullptr, "ymax");
2733 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2734 RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
2735 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2736
2737 prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_DISTANCE);
2738 RNA_def_property_float_sdna(prop, nullptr, "zmax");
2739 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2740 RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
2741 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2742
2743 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
2744 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", LIMIT_TRANSFORM);
2746 prop, "Affect Transform", "Transform tools are affected by this constraint as well");
2747 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2748
2750}
2751
2753{
2754 StructRNA *srna;
2755 PropertyRNA *prop;
2756
2757 srna = RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
2759 srna, "Limit Rotation Constraint", "Limit the rotation of the constrained object");
2760 RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data");
2761 RNA_def_struct_ui_icon(srna, ICON_CON_ROTLIMIT);
2762
2764
2765 prop = RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
2766 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XROT);
2767 RNA_def_property_ui_text(prop, "Limit X", "Use the minimum X value");
2768 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2769
2770 prop = RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
2771 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YROT);
2772 RNA_def_property_ui_text(prop, "Limit Y", "Use the minimum Y value");
2773 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2774
2775 prop = RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
2776 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZROT);
2777 RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value");
2778 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2779
2780 prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE);
2781 RNA_def_property_float_sdna(prop, nullptr, "xmin");
2782 RNA_def_property_range(prop, -1000.0, 1000.0f);
2783 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2784 RNA_def_property_ui_text(prop, "Minimum X", "Lower X angle bound");
2785 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2786
2787 prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE);
2788 RNA_def_property_float_sdna(prop, nullptr, "ymin");
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 Y", "Lower Y angle bound");
2792 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2793
2794 prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_ANGLE);
2795 RNA_def_property_float_sdna(prop, nullptr, "zmin");
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 Z", "Lower Z angle bound");
2799 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2800
2801 prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE);
2802 RNA_def_property_float_sdna(prop, nullptr, "xmax");
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, "Maximum X", "Upper X angle bound");
2806 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2807
2808 prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE);
2809 RNA_def_property_float_sdna(prop, nullptr, "ymax");
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 Y", "Upper Y angle bound");
2813 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2814
2815 prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_ANGLE);
2816 RNA_def_property_float_sdna(prop, nullptr, "zmax");
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 Z", "Upper Z angle bound");
2820 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2821
2822 prop = RNA_def_property(srna, "euler_order", PROP_ENUM, PROP_NONE);
2823 RNA_def_property_enum_sdna(prop, nullptr, "euler_order");
2825 RNA_def_property_ui_text(prop, "Euler Order", "Explicitly specify the euler rotation order");
2826 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2827
2828 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
2829 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", LIMIT_TRANSFORM);
2831 prop, "Affect Transform", "Transform tools are affected by this constraint as well");
2832 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2833
2834 prop = RNA_def_property(srna, "use_legacy_behavior", PROP_BOOLEAN, PROP_NONE);
2837 prop,
2838 "Legacy Behavior",
2839 "Use the old semi-broken behavior that doesn't understand that rotations loop around");
2840 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2841
2843}
2844
2846{
2847 StructRNA *srna;
2848 PropertyRNA *prop;
2849
2850 srna = RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
2852 srna, "Limit Size Constraint", "Limit the scaling of the constrained object");
2853 RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data");
2854 RNA_def_struct_ui_icon(srna, ICON_CON_SIZELIMIT);
2855
2857
2858 prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
2859 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMIN);
2860 RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
2861 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2862
2863 prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
2864 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMIN);
2865 RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
2866 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2867
2868 prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
2869 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMIN);
2870 RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
2871 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2872
2873 prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
2874 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMAX);
2875 RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
2876 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2877
2878 prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
2879 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMAX);
2880 RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
2881 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2882
2883 prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
2884 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMAX);
2885 RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
2886 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2887
2888 prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
2889 RNA_def_property_float_sdna(prop, nullptr, "xmin");
2890 RNA_def_property_range(prop, -1000.0, 1000.0f);
2891 RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
2892 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2893
2894 prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
2895 RNA_def_property_float_sdna(prop, nullptr, "ymin");
2896 RNA_def_property_range(prop, -1000.0, 1000.0f);
2897 RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
2898 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2899
2900 prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_NONE);
2901 RNA_def_property_float_sdna(prop, nullptr, "zmin");
2902 RNA_def_property_range(prop, -1000.0, 1000.0f);
2903 RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
2904 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2905
2906 prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
2907 RNA_def_property_float_sdna(prop, nullptr, "xmax");
2908 RNA_def_property_range(prop, -1000.0, 1000.0f);
2909 RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
2910 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2911
2912 prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
2913 RNA_def_property_float_sdna(prop, nullptr, "ymax");
2914 RNA_def_property_range(prop, -1000.0, 1000.0f);
2915 RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
2916 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2917
2918 prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_NONE);
2919 RNA_def_property_float_sdna(prop, nullptr, "zmax");
2920 RNA_def_property_range(prop, -1000.0, 1000.0f);
2921 RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
2922 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2923
2924 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
2925 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", LIMIT_TRANSFORM);
2927 prop, "Affect Transform", "Transform tools are affected by this constraint as well");
2928 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2929
2931}
2932
2934{
2935 StructRNA *srna;
2936 PropertyRNA *prop;
2937
2938 srna = RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
2940 srna, "Limit Distance Constraint", "Limit the distance from target object");
2941
2943
2944 RNA_def_struct_sdna_from(srna, "bDistLimitConstraint", "data");
2945 RNA_def_struct_ui_icon(srna, ICON_CON_DISTLIMIT);
2946
2948
2950
2951 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
2952 RNA_def_property_float_sdna(prop, nullptr, "dist");
2953 RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
2954 RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
2955 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2956
2957 prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
2958 RNA_def_property_enum_sdna(prop, nullptr, "mode");
2961 prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
2962 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2963
2964 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
2965 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMITDIST_TRANSFORM);
2967 prop, "Affect Transform", "Transforms are affected by this constraint as well");
2968 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2969
2971}
2972
2974{
2975 StructRNA *srna;
2976 PropertyRNA *prop;
2977
2978 static const EnumPropertyItem type_items[] = {
2980 "NEAREST_SURFACE",
2981 0,
2982 "Nearest Surface Point",
2983 "Shrink the location to the nearest target surface"},
2985 "PROJECT",
2986 0,
2987 "Project",
2988 "Shrink the location to the nearest target surface along a given axis"},
2990 "NEAREST_VERTEX",
2991 0,
2992 "Nearest Vertex",
2993 "Shrink the location to the nearest target vertex"},
2995 "TARGET_PROJECT",
2996 0,
2997 "Target Normal Project",
2998 "Shrink the location to the nearest target surface "
2999 "along the interpolated vertex normals of the target"},
3000 {0, nullptr, 0, nullptr, nullptr},
3001 };
3002
3003 static const EnumPropertyItem shrink_face_cull_items[] = {
3004 {0, "OFF", 0, "Off", "No culling"},
3006 "FRONT",
3007 0,
3008 "Front",
3009 "No projection when in front of the face"},
3011 "BACK",
3012 0,
3013 "Back",
3014 "No projection when behind the face"},
3015 {0, nullptr, 0, nullptr, nullptr},
3016 };
3017
3018 srna = RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
3020 srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship");
3021 RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
3022 RNA_def_struct_ui_icon(srna, ICON_CON_SHRINKWRAP);
3023
3025
3026 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3027 RNA_def_property_pointer_sdna(prop, nullptr, "target"); /* TODO: mesh type. */
3028 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Mesh_object_poll");
3029 RNA_def_property_ui_text(prop, "Target", "Target Mesh object");
3031 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3032
3033 prop = RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
3034 RNA_def_property_enum_sdna(prop, nullptr, "shrinkType");
3035 RNA_def_property_enum_items(prop, type_items);
3037 prop, "Shrinkwrap Type", "Select type of shrinkwrap algorithm for target position");
3038 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3039
3040 prop = RNA_def_property(srna, "wrap_mode", PROP_ENUM, PROP_NONE);
3041 RNA_def_property_enum_sdna(prop, nullptr, "shrinkMode");
3044 prop, "Snap Mode", "Select how to constrain the object to the target surface");
3045 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3046
3047 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
3048 RNA_def_property_float_sdna(prop, nullptr, "dist");
3049 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3050 RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
3051 RNA_def_property_ui_text(prop, "Distance", "Distance to Target");
3052 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3053
3054 prop = RNA_def_property(srna, "project_axis", PROP_ENUM, PROP_NONE);
3055 RNA_def_property_enum_sdna(prop, nullptr, "projAxis");
3057 RNA_def_property_ui_text(prop, "Project Axis", "Axis constrain to");
3058 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3059
3060 prop = RNA_def_property(srna, "project_axis_space", PROP_ENUM, PROP_NONE);
3061 RNA_def_property_enum_sdna(prop, nullptr, "projAxisSpace");
3063 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Constraint_owner_space_itemf");
3064 RNA_def_property_ui_text(prop, "Axis Space", "Space for the projection axis");
3065
3066 prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_DISTANCE);
3067 RNA_def_property_float_sdna(prop, nullptr, "projLimit");
3068 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3069 RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
3071 prop, "Project Distance", "Limit the distance used for projection (zero disables)");
3072 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3073
3074 prop = RNA_def_property(srna, "use_project_opposite", PROP_BOOLEAN, PROP_NONE);
3077 prop, "Project Opposite", "Project in both specified and opposite directions");
3078 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3079
3080 prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
3081 RNA_def_property_enum_sdna(prop, nullptr, "flag");
3082 RNA_def_property_enum_items(prop, shrink_face_cull_items);
3084 "rna_ShrinkwrapConstraint_face_cull_get",
3085 "rna_ShrinkwrapConstraint_face_cull_set",
3086 nullptr);
3088 prop,
3089 "Face Cull",
3090 "Stop vertices from projecting to a face on the target when facing towards/away");
3091 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3092
3093 prop = RNA_def_property(srna, "use_invert_cull", PROP_BOOLEAN, PROP_NONE);
3096 prop, "Invert Cull", "When projecting in the opposite direction invert the face cull mode");
3097 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3098
3099 prop = RNA_def_property(srna, "use_track_normal", PROP_BOOLEAN, PROP_NONE);
3102 prop, "Align Axis To Normal", "Align the specified axis to the surface normal");
3103 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3104
3105 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
3106 RNA_def_property_enum_sdna(prop, nullptr, "trackAxis");
3108 RNA_def_property_ui_text(prop, "Track Axis", "Axis that is aligned to the normal");
3109 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3110
3112}
3113
3115{
3116 StructRNA *srna;
3117 PropertyRNA *prop;
3118
3119 srna = RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
3121 srna, "Damped Track Constraint", "Point toward target by taking the shortest rotation path");
3122 RNA_def_struct_ui_icon(srna, ICON_CON_TRACKTO);
3123
3125
3126 RNA_def_struct_sdna_from(srna, "bDampTrackConstraint", "data");
3127
3129
3131
3132 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
3133 RNA_def_property_enum_sdna(prop, nullptr, "trackflag");
3135 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
3136 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3137
3139}
3140
3142{
3143 StructRNA *srna;
3144 PropertyRNA *prop;
3145
3146 static const EnumPropertyItem splineik_xz_scale_mode[] = {
3147 {CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes"},
3149 "BONE_ORIGINAL",
3150 0,
3151 "Bone Original",
3152 "Use the original scaling of the bones"},
3154 "INVERSE_PRESERVE",
3155 0,
3156 "Inverse Scale",
3157 "Scale of the X and Z axes is the inverse of the Y-Scale"},
3159 "VOLUME_PRESERVE",
3160 0,
3161 "Volume Preservation",
3162 "Scale of the X and Z axes are adjusted to preserve the volume of the bones"},
3163 {0, nullptr, 0, nullptr, nullptr},
3164 };
3165
3166 static const EnumPropertyItem splineik_y_scale_mode[] = {
3167 {CONSTRAINT_SPLINEIK_YS_NONE, "NONE", 0, "None", "Don't scale in the Y axis"},
3169 "FIT_CURVE",
3170 0,
3171 "Fit Curve",
3172 "Scale the bones to fit the entire length of the curve"},
3174 "BONE_ORIGINAL",
3175 0,
3176 "Bone Original",
3177 "Use the original Y scale of the bone"},
3178 {0, nullptr, 0, nullptr, nullptr},
3179 };
3180
3181 srna = RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
3182 RNA_def_struct_ui_text(srna, "Spline IK Constraint", "Align 'n' bones along a curve");
3183 RNA_def_struct_sdna_from(srna, "bSplineIKConstraint", "data");
3184 RNA_def_struct_ui_icon(srna, ICON_CON_SPLINEIK);
3185
3187
3188 /* target chain */
3189 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3190 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
3191 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Curve_object_poll");
3192 RNA_def_property_ui_text(prop, "Target", "Curve that controls this relationship");
3194 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3195
3196 prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
3197 RNA_def_property_int_sdna(prop, nullptr, "chainlen");
3198 /* Changing the IK chain length requires a rebuild of depsgraph relations. This makes it
3199 * unsuitable for animation. */
3201 /* TODO: this should really check the max length of the chain the constraint is attached to */
3202 RNA_def_property_range(prop, 1, 255);
3203 RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain");
3204 /* XXX: this update goes wrong... needs extra flush? */
3205 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3206
3207 /* direct access to bindings */
3208 /* NOTE: only to be used by experienced users */
3209 prop = RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR);
3210 RNA_def_property_array(prop, 32); /* XXX this is the maximum value allowed - why? */
3212 RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length");
3214 "rna_SplineIKConstraint_joint_bindings_get",
3215 "rna_SplineIKConstraint_joint_bindings_set",
3216 nullptr);
3218 prop,
3219 "Joint Bindings",
3220 "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain, "
3221 "as percentages");
3222 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3223
3224 /* settings */
3225 prop = RNA_def_property(srna, "use_chain_offset", PROP_BOOLEAN, PROP_NONE);
3228 prop, "Chain Offset", "Offset the entire chain relative to the root joint");
3229 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3230
3231 prop = RNA_def_property(srna, "use_even_divisions", PROP_BOOLEAN, PROP_NONE);
3234 "Even Divisions",
3235 "Ignore the relative lengths of the bones when fitting to the curve");
3236 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3237
3238 prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
3241 prop,
3242 "Use Curve Radius",
3243 "Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, "
3244 "on top of XZ Scale mode");
3245 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3246
3247 /* xz scaling mode */
3248 prop = RNA_def_property(srna, "xz_scale_mode", PROP_ENUM, PROP_NONE);
3249 RNA_def_property_enum_sdna(prop, nullptr, "xzScaleMode");
3250 RNA_def_property_enum_items(prop, splineik_xz_scale_mode);
3252 prop,
3253 "XZ Scale Mode",
3254 "Method used for determining the scaling of the X and Z axes of the bones");
3255 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3256
3257 /* y scaling mode */
3258 prop = RNA_def_property(srna, "y_scale_mode", PROP_ENUM, PROP_NONE);
3259 RNA_def_property_enum_sdna(prop, nullptr, "yScaleMode");
3260 RNA_def_property_enum_items(prop, splineik_y_scale_mode);
3262 "Y Scale Mode",
3263 "Method used for determining the scaling of the Y axis of the bones, "
3264 "on top of the shape and scaling of the curve itself");
3265 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3266
3267 /* take original scaling of the bone into account in volume preservation */
3268 prop = RNA_def_property(srna, "use_original_scale", PROP_BOOLEAN, PROP_NONE);
3271 prop, "Use Original Scale", "Apply volume preservation over the original scaling");
3272 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3273
3274 /* Volume preservation for "volumetric" scale mode. */
3275 prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
3276 RNA_def_property_range(prop, 0.0, 100.0f);
3278 prop, "Volume Variation", "Factor between volume variation and stretching");
3279 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3280
3281 prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
3284 prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
3285 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3286
3287 prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
3290 prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
3291 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3292
3293 prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
3294 RNA_def_property_range(prop, 0.0, 1.0f);
3295 RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
3296 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3297
3298 prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
3299 RNA_def_property_range(prop, 1.0, 100.0f);
3300 RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
3301 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3302
3303 prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
3304 RNA_def_property_range(prop, 0.0, 1.0f);
3306 prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
3307 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3308
3310}
3311
3313{
3314 StructRNA *srna;
3315 PropertyRNA *prop;
3316
3317 static const EnumPropertyItem pivot_rotAxis_items[] = {
3318 {PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"},
3320 "NX",
3321 0,
3322 "-X Rotation",
3323 "Use the pivot point in the negative rotation range around the X-axis"},
3325 "NY",
3326 0,
3327 "-Y Rotation",
3328 "Use the pivot point in the negative rotation range around the Y-axis"},
3330 "NZ",
3331 0,
3332 "-Z Rotation",
3333 "Use the pivot point in the negative rotation range around the Z-axis"},
3335 "X",
3336 0,
3337 "X Rotation",
3338 "Use the pivot point in the positive rotation range around the X-axis"},
3340 "Y",
3341 0,
3342 "Y Rotation",
3343 "Use the pivot point in the positive rotation range around the Y-axis"},
3345 "Z",
3346 0,
3347 "Z Rotation",
3348 "Use the pivot point in the positive rotation range around the Z-axis"},
3349 {0, nullptr, 0, nullptr, nullptr},
3350 };
3351
3352 srna = RNA_def_struct(brna, "PivotConstraint", "Constraint");
3353 RNA_def_struct_ui_text(srna, "Pivot Constraint", "Rotate around a different point");
3354
3356
3357 RNA_def_struct_sdna_from(srna, "bPivotConstraint", "data");
3358
3359 RNA_def_struct_ui_icon(srna, ICON_CON_PIVOT);
3360
3362
3363 /* target-defined pivot */
3364 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3365 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
3367 prop, "Target", "Target Object, defining the position of the pivot when defined");
3369 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3370
3371 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
3372 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
3373 RNA_def_property_ui_text(prop, "Sub-Target", "");
3374 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3375
3376 /* pivot offset */
3377 prop = RNA_def_property(srna, "use_relative_location", PROP_BOOLEAN, PROP_NONE);
3380 prop,
3381 "Use Relative Offset",
3382 "Offset will be an absolute point in space instead of relative to the target");
3383 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3384
3385 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
3386 RNA_def_property_float_sdna(prop, nullptr, "offset");
3388 "Offset",
3389 "Offset of pivot from target (when set), or from owner's location "
3390 "(when Fixed Position is off), or the absolute pivot point");
3391 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3392
3393 /* rotation-based activation */
3394 prop = RNA_def_property(srna, "rotation_range", PROP_ENUM, PROP_NONE);
3395 RNA_def_property_enum_sdna(prop, nullptr, "rotAxis");
3396 RNA_def_property_enum_items(prop, pivot_rotAxis_items);
3398 prop, "Enabled Rotation Range", "Rotation range on which pivoting should occur");
3399 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3400
3402}
3403
3405{
3406 StructRNA *srna;
3407 PropertyRNA *prop;
3408
3409 static const EnumPropertyItem frame_method_items[] = {
3410 {FOLLOWTRACK_FRAME_STRETCH, "STRETCH", 0, "Stretch", ""},
3411 {FOLLOWTRACK_FRAME_FIT, "FIT", 0, "Fit", ""},
3412 {FOLLOWTRACK_FRAME_CROP, "CROP", 0, "Crop", ""},
3413 {0, nullptr, 0, nullptr, nullptr},
3414 };
3415
3416 srna = RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
3418 srna, "Follow Track Constraint", "Lock motion to the target motion track");
3419 RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
3420 RNA_def_struct_ui_icon(srna, ICON_CON_FOLLOWTRACK);
3421
3423
3424 /* movie clip */
3425 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
3426 RNA_def_property_pointer_sdna(prop, nullptr, "clip");
3427 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
3429 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3430
3431 /* track */
3432 prop = RNA_def_property(srna, "track", PROP_STRING, PROP_NONE);
3433 RNA_def_property_string_sdna(prop, nullptr, "track");
3434 RNA_def_property_ui_text(prop, "Track", "Movie tracking track to follow");
3436 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3437
3438 /* use default clip */
3439 prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
3441 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
3442 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3443
3444 /* use 3d position */
3445 prop = RNA_def_property(srna, "use_3d_position", PROP_BOOLEAN, PROP_NONE);
3447 RNA_def_property_ui_text(prop, "3D Position", "Use 3D position of track to parent to");
3448 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3449
3450 /* object */
3451 prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
3452 RNA_def_property_string_sdna(prop, nullptr, "object");
3454 prop, "Object", "Movie tracking object to follow (if empty, camera object is used)");
3455 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3456
3457 /* camera */
3458 prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
3459 RNA_def_property_pointer_sdna(prop, nullptr, "camera");
3461 prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
3463 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3465 nullptr,
3466 "rna_Constraint_followTrack_camera_set",
3467 nullptr,
3468 "rna_Constraint_cameraObject_poll");
3469
3470 /* depth object */
3471 prop = RNA_def_property(srna, "depth_object", PROP_POINTER, PROP_NONE);
3472 RNA_def_property_pointer_sdna(prop, nullptr, "depth_ob");
3474 prop,
3475 "Depth Object",
3476 "Object used to define depth in camera space by projecting onto surface of this object");
3478 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3480 nullptr,
3481 "rna_Constraint_followTrack_depthObject_set",
3482 nullptr,
3483 "rna_Constraint_followTrack_depthObject_poll");
3484
3485 /* frame method */
3486 prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
3487 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "frame_method");
3488 RNA_def_property_enum_items(prop, frame_method_items);
3489 RNA_def_property_ui_text(prop, "Frame Method", "How the footage fits in the camera frame");
3490 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3491
3492 /* use undistortion */
3493 prop = RNA_def_property(srna, "use_undistorted_position", PROP_BOOLEAN, PROP_NONE);
3495 RNA_def_property_ui_text(prop, "Undistort", "Parent to undistorted position of 2D track");
3496 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3497
3499}
3500
3502{
3503 StructRNA *srna;
3504 PropertyRNA *prop;
3505
3506 srna = RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
3508 srna, "Camera Solver Constraint", "Lock motion to the reconstructed camera movement");
3509 RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data");
3510 RNA_def_struct_ui_icon(srna, ICON_CON_CAMERASOLVER);
3511
3513
3514 /* movie clip */
3515 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
3516 RNA_def_property_pointer_sdna(prop, nullptr, "clip");
3517 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
3519 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3520
3521 /* use default clip */
3522 prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
3524 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
3525 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3526
3528}
3529
3531{
3532 StructRNA *srna;
3533 PropertyRNA *prop;
3534
3535 srna = RNA_def_struct(brna, "ObjectSolverConstraint", "Constraint");
3537 srna, "Object Solver Constraint", "Lock motion to the reconstructed object movement");
3538 RNA_def_struct_sdna_from(srna, "bObjectSolverConstraint", "data");
3539 RNA_def_struct_ui_icon(srna, ICON_CON_OBJECTSOLVER);
3540
3542
3543 /* movie clip */
3544 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
3545 RNA_def_property_pointer_sdna(prop, nullptr, "clip");
3546 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
3548 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3549
3550 /* use default clip */
3551 prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
3553 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
3554 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3555
3556 prop = RNA_def_property(srna, "set_inverse_pending", PROP_BOOLEAN, PROP_NONE);
3559 prop, "Set Inverse Pending", "Set to true to request recalculation of the inverse matrix");
3560 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3561
3562 /* object */
3563 prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
3564 RNA_def_property_string_sdna(prop, nullptr, "object");
3565 RNA_def_property_ui_text(prop, "Object", "Movie tracking object to follow");
3566 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3567
3568 /* camera */
3569 prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
3570 RNA_def_property_pointer_sdna(prop, nullptr, "camera");
3572 prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
3574 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3576 nullptr,
3577 "rna_Constraint_objectSolver_camera_set",
3578 nullptr,
3579 "rna_Constraint_cameraObject_poll");
3580
3582}
3583
3585{
3586 StructRNA *srna;
3587 PropertyRNA *prop;
3588
3589 srna = RNA_def_struct(brna, "TransformCacheConstraint", "Constraint");
3591 srna, "Transform Cache Constraint", "Look up transformation from an external file");
3592 RNA_def_struct_sdna_from(srna, "bTransformCacheConstraint", "data");
3593 RNA_def_struct_ui_icon(srna, ICON_CON_TRANSFORM_CACHE);
3594
3596
3597 prop = RNA_def_property(srna, "cache_file", PROP_POINTER, PROP_NONE);
3598 RNA_def_property_pointer_sdna(prop, nullptr, "cache_file");
3599 RNA_def_property_struct_type(prop, "CacheFile");
3600 RNA_def_property_ui_text(prop, "Cache File", "");
3602 RNA_def_property_update(prop, 0, "rna_Constraint_dependency_update");
3603
3604 prop = RNA_def_property(srna, "object_path", PROP_STRING, PROP_NONE);
3606 prop,
3607 "Object Path",
3608 "Path to the object in the Alembic archive used to lookup the transform matrix");
3609 RNA_def_property_update(prop, 0, "rna_Constraint_update");
3610
3612}
3613
3614/* Define the base struct for constraints. */
3615
3617{
3618 StructRNA *srna;
3619 PropertyRNA *prop;
3620
3621 /* data */
3622 srna = RNA_def_struct(brna, "Constraint", nullptr);
3624 srna, "Constraint", "Constraint modifying the transformation of objects and bones");
3625 RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine");
3626 RNA_def_struct_path_func(srna, "rna_Constraint_path");
3627 RNA_def_struct_sdna(srna, "bConstraint");
3628 RNA_def_struct_ui_icon(srna, ICON_CONSTRAINT);
3629
3630 /* strings */
3631 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
3632 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Constraint_name_set");
3633 RNA_def_property_ui_text(prop, "Name", "Constraint name");
3634 RNA_def_struct_name_property(srna, prop);
3636
3637 /* enums */
3638 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
3640 RNA_def_property_enum_sdna(prop, nullptr, "type");
3642 RNA_def_property_ui_text(prop, "Type", "");
3643
3644 prop = RNA_def_boolean(srna,
3645 "is_override_data",
3646 false,
3647 "Override Constraint",
3648 "In a local override object, whether this constraint comes from the "
3649 "linked reference object, or is local to the override");
3652
3654
3655 prop = RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
3656 RNA_def_property_enum_sdna(prop, nullptr, "ownspace");
3658 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Constraint_owner_space_itemf");
3659 RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in");
3660 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3661
3662 prop = RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
3663 RNA_def_property_enum_sdna(prop, nullptr, "tarspace");
3665 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Constraint_target_space_itemf");
3666 RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in");
3667 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3668
3669 prop = RNA_def_property(srna, "space_object", PROP_POINTER, PROP_NONE);
3670 RNA_def_property_pointer_sdna(prop, nullptr, "space_object");
3671 RNA_def_property_ui_text(prop, "Object", "Object for Custom Space");
3674 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3675
3676 prop = RNA_def_property(srna, "space_subtarget", PROP_STRING, PROP_NONE);
3677 RNA_def_property_string_sdna(prop, nullptr, "space_subtarget");
3678 RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
3679 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3680
3681 /* flags */
3682 prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
3683 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_OFF);
3684 RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint");
3685 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3686 RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
3687
3688 prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
3690 RNA_def_property_ui_text(prop, "Enabled", "Use the results of this constraint");
3691 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3692 RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
3693
3694 prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
3696 RNA_def_property_boolean_sdna(prop, nullptr, "ui_expand_flag", 0);
3697 RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
3698 RNA_def_property_ui_icon(prop, ICON_RIGHTARROW, 1);
3699
3700 /* XXX this is really an internal flag,
3701 * but it may be useful for some tools to be able to access this... */
3702 prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
3705 RNA_def_property_ui_text(prop, "Valid", "Constraint has valid settings and can be evaluated");
3706
3707 /* TODO: setting this to true must ensure that all others in stack are turned off too... */
3708 prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
3709 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_ACTIVE);
3710 RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited");
3711
3712 /* values */
3713 prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
3714 RNA_def_property_float_sdna(prop, nullptr, "enforce");
3715 RNA_def_property_range(prop, 0.0f, 1.0f);
3717 prop, "Influence", "Amount of influence constraint will have on the final solution");
3718 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_influence_update");
3719
3720 /* readonly values */
3721 prop = RNA_def_property(srna, "error_location", PROP_FLOAT, PROP_NONE);
3722 RNA_def_property_float_sdna(prop, nullptr, "lin_error");
3725 prop,
3726 "Lin error",
3727 "Amount of residual error in Blender space unit for constraints that work on position");
3728
3729 prop = RNA_def_property(srna, "error_rotation", PROP_FLOAT, PROP_NONE);
3730 RNA_def_property_float_sdna(prop, nullptr, "rot_error");
3733 prop,
3734 "Rotation error",
3735 "Amount of residual error in radians for constraints that work on orientation");
3736
3738
3739 /* pointers */
3742
3771}
3772
3773#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:285
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:126
#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:688
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_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
@ 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
@ 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
@ 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:26
ParameterFlag
Definition RNA_types.hh:510
@ PARM_RNAPTR
Definition RNA_types.hh:513
@ PARM_REQUIRED
Definition RNA_types.hh:511
@ FUNC_USE_REPORTS
Definition RNA_types.hh:805
@ FUNC_USE_MAIN
Definition RNA_types.hh:803
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:792
@ PROP_FLOAT
Definition RNA_types.hh:152
@ PROP_BOOLEAN
Definition RNA_types.hh:150
@ PROP_ENUM
Definition RNA_types.hh:154
@ PROP_INT
Definition RNA_types.hh:151
@ PROP_STRING
Definition RNA_types.hh:153
@ PROP_POINTER
Definition RNA_types.hh:155
@ PROP_COLLECTION
Definition RNA_types.hh:156
#define RNA_ENUM_ITEM_SEPR
Definition RNA_types.hh:645
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:212
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:469
@ PROPOVERRIDE_IGNORE
Definition RNA_types.hh:489
@ PROP_THICK_WRAP
Definition RNA_types.hh:397
@ PROP_DYNAMIC
Definition RNA_types.hh:402
@ PROP_ANIMATABLE
Definition RNA_types.hh:305
@ PROP_EDITABLE
Definition RNA_types.hh:292
@ PROP_NEVER_NULL
Definition RNA_types.hh:351
@ PROP_NO_DEG_UPDATE
Definition RNA_types.hh:413
@ PROP_ID_SELF_CHECK
Definition RNA_types.hh:344
#define RNA_ENUM_ITEM_HEADING(name, description)
Definition RNA_types.hh:639
@ PROP_TIME
Definition RNA_types.hh:241
@ PROP_MATRIX
Definition RNA_types.hh:253
@ PROP_DISTANCE
Definition RNA_types.hh:244
@ PROP_ANGLE
Definition RNA_types.hh:240
@ PROP_NONE
Definition RNA_types.hh:221
@ PROP_FACTOR
Definition RNA_types.hh:239
@ PROP_TRANSLATION
Definition RNA_types.hh:249
#define ND_NLA_ACTCHANGE
Definition WM_types.hh:495
#define NC_ANIMATION
Definition WM_types.hh:385
#define ND_POSE
Definition WM_types.hh:455
ReportList * reports
Definition WM_types.hh:1025
#define ND_CONSTRAINT
Definition WM_types.hh:461
#define NA_RENAME
Definition WM_types.hh:585
#define NC_OBJECT
Definition WM_types.hh:376
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_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:404
char name[66]
Definition DNA_ID.h:415
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:4226