Blender V5.3
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
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
28namespace blender {
29
30/* Please keep the names in sync with `constraint.cc`. */
32 RNA_ENUM_ITEM_HEADING(N_("Motion Tracking"), nullptr),
33 {CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CON_CAMERASOLVER, "Camera Solver", ""},
34 {CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CON_FOLLOWTRACK, "Follow Track", ""},
35 {CONSTRAINT_TYPE_OBJECTSOLVER, "OBJECT_SOLVER", ICON_CON_OBJECTSOLVER, "Object Solver", ""},
36
37 RNA_ENUM_ITEM_HEADING(N_("Transform"), nullptr),
39 "COPY_LOCATION",
40 ICON_CON_LOCLIKE,
41 "Copy Location",
42 "Copy the location of a target (with an optional offset), so that they move together"},
44 "COPY_ROTATION",
45 ICON_CON_ROTLIKE,
46 "Copy Rotation",
47 "Copy the rotation of a target (with an optional offset), so that they rotate together"},
49 "COPY_SCALE",
50 ICON_CON_SIZELIKE,
51 "Copy Scale",
52 "Copy the scale factors of a target (with an optional offset), so that they are scaled by "
53 "the same amount"},
55 "COPY_TRANSFORMS",
56 ICON_CON_TRANSLIKE,
57 "Copy Transforms",
58 "Copy all the transformations of a target, so that they move together"},
60 "LIMIT_DISTANCE",
61 ICON_CON_DISTLIMIT,
62 "Limit Distance",
63 "Restrict movements to within a certain distance of a target (at the time of constraint "
64 "evaluation only)"},
66 "LIMIT_LOCATION",
67 ICON_CON_LOCLIMIT,
68 "Limit Location",
69 "Restrict movement along each axis within given ranges"},
71 "LIMIT_ROTATION",
72 ICON_CON_ROTLIMIT,
73 "Limit Rotation",
74 "Restrict rotation along each axis within given ranges"},
76 "LIMIT_SCALE",
77 ICON_CON_SIZELIMIT,
78 "Limit Scale",
79 "Restrict scaling along each axis with given ranges"},
81 "MAINTAIN_VOLUME",
82 ICON_CON_SAMEVOL,
83 "Maintain Volume",
84 "Compensate for scaling one axis by applying suitable scaling to the other two axes"},
86 "TRANSFORM",
87 ICON_CON_TRANSFORM,
88 "Transformation",
89 "Use one transform property from target to control another (or same) property on owner"},
91 "TRANSFORM_CACHE",
92 ICON_CON_TRANSFORM_CACHE,
93 "Transform Cache",
94 "Look up the transformation matrix from an external file"},
95
96 RNA_ENUM_ITEM_HEADING(N_("Tracking"), nullptr),
98 "CLAMP_TO",
99 ICON_CON_CLAMPTO,
100 "Clamp To",
101 "Restrict movements to lie along a curve by remapping location along curve's longest axis"},
103 "DAMPED_TRACK",
104 ICON_CON_TRACKTO,
105 "Damped Track",
106 "Point towards a target by performing the smallest rotation necessary"},
108 "IK",
109 ICON_CON_KINEMATIC,
110 "Inverse Kinematics",
111 "Control a chain of bones by specifying the endpoint target (Bones only)"},
113 "LOCKED_TRACK",
114 ICON_CON_LOCKTRACK,
115 "Locked Track",
116 "Rotate around the specified ('locked') axis to point towards a target"},
118 "SPLINE_IK",
119 ICON_CON_SPLINEIK,
120 "Spline IK",
121 "Align chain of bones along a curve (Bones only)"},
123 "STRETCH_TO",
124 ICON_CON_STRETCHTO,
125 "Stretch To",
126 "Stretch along Y-Axis to point towards a target"},
128 "TRACK_TO",
129 ICON_CON_TRACKTO,
130 "Track To",
131 "Legacy tracking constraint prone to twisting artifacts"},
132
133 RNA_ENUM_ITEM_HEADING(N_("Relationship"), nullptr),
135 "ACTION",
136 ICON_CON_ACTION,
137 "Action",
138 "Use transform property of target to look up pose for owner from an Action"},
140 "ARMATURE",
141 ICON_CON_ARMATURE,
142 "Armature",
143 "Apply weight-blended transformation from multiple bones like the Armature modifier"},
145 "CHILD_OF",
146 ICON_CON_CHILDOF,
147 "Child Of",
148 "Make target the 'detachable' parent of owner"},
150 "FLOOR",
151 ICON_CON_FLOOR,
152 "Floor",
153 "Use position (and optionally rotation) of target to define a 'wall' or 'floor' that the "
154 "owner cannot cross"},
156 "FOLLOW_PATH",
157 ICON_CON_FOLLOWPATH,
158 "Follow Path",
159 "Use to animate an object/bone following a path"},
161 "GEOMETRY_ATTRIBUTE",
162 ICON_CON_GEOMETRYATTRIBUTE,
163 "Geometry Attribute",
164 "Retrieve transform from target geometry attribute data"},
166 "PIVOT",
167 ICON_CON_PIVOT,
168 "Pivot",
169 "Change pivot point for transforms (buggy)"},
171 "SHRINKWRAP",
172 ICON_CON_SHRINKWRAP,
173 "Shrinkwrap",
174 "Restrict movements to surface of target mesh"},
175 {0, nullptr, 0, nullptr, nullptr},
176};
177
180 "WORLD",
181 0,
182 "World Space",
183 "The transformation of the target is evaluated relative to the world "
184 "coordinate system"},
186 "CUSTOM",
187 0,
188 "Custom Space",
189 "The transformation of the target is evaluated relative to a custom object/bone/vertex "
190 "group"},
193 "POSE",
194 0,
195 "Pose Space",
196 "The transformation of the target is only evaluated in the Pose Space, "
197 "the target armature object transformation is ignored"},
199 "LOCAL_WITH_PARENT",
200 0,
201 "Local With Parent",
202 "The transformation of the target bone is evaluated relative to its rest pose "
203 "local coordinate system, thus including the parent-induced transformation"},
205 "LOCAL",
206 0,
207 "Local Space",
208 "The transformation of the target is evaluated relative to its local "
209 "coordinate system"},
211 "LOCAL_OWNER_ORIENT",
212 0,
213 "Local Space (Owner Orientation)",
214 "The transformation of the target bone is evaluated relative to its local coordinate "
215 "system, followed by a correction for the difference in target and owner rest pose "
216 "orientations. When applied as local transform to the owner produces the same global "
217 "motion as the target if the parents are still in rest pose."},
218 {0, nullptr, 0, nullptr, nullptr},
219};
220
223 "WORLD",
224 0,
225 "World Space",
226 "The constraint is applied relative to the world coordinate system"},
228 "CUSTOM",
229 0,
230 "Custom Space",
231 "The constraint is applied in local space of a custom object/bone/vertex group"},
234 "POSE",
235 0,
236 "Pose Space",
237 "The constraint is applied in Pose Space, the object transformation is ignored"},
239 "LOCAL_WITH_PARENT",
240 0,
241 "Local With Parent",
242 "The constraint is applied relative to the rest pose local coordinate system "
243 "of the bone, thus including the parent-induced transformation"},
245 "LOCAL",
246 0,
247 "Local Space",
248 "The constraint is applied relative to the local coordinate system of the object"},
249 {0, nullptr, 0, nullptr, nullptr},
250};
251
253 {TRACK_X, "TRACK_X", 0, "X", ""},
254 {TRACK_Y, "TRACK_Y", 0, "Y", ""},
255 {TRACK_Z, "TRACK_Z", 0, "Z", ""},
256 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
257 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
258 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
259 {0, nullptr, 0, nullptr, nullptr},
260};
261
263 {CONSTRAINT_EULER_AUTO, "AUTO", 0, "Default", "Euler using the default rotation order"},
264 {CONSTRAINT_EULER_XYZ, "XYZ", 0, "XYZ Euler", "Euler using the XYZ rotation order"},
265 {CONSTRAINT_EULER_XZY, "XZY", 0, "XZY Euler", "Euler using the XZY rotation order"},
266 {CONSTRAINT_EULER_YXZ, "YXZ", 0, "YXZ Euler", "Euler using the YXZ rotation order"},
267 {CONSTRAINT_EULER_YZX, "YZX", 0, "YZX Euler", "Euler using the YZX rotation order"},
268 {CONSTRAINT_EULER_ZXY, "ZXY", 0, "ZXY Euler", "Euler using the ZXY rotation order"},
269 {CONSTRAINT_EULER_ZYX, "ZYX", 0, "ZYX Euler", "Euler using the ZYX rotation order"},
270 {0, nullptr, 0, nullptr, nullptr},
271};
272
273} // namespace blender
274
275#ifdef RNA_RUNTIME
276
277# include <fmt/format.h>
278
279# include "DNA_cachefile_types.h"
280
281# include "BLI_listbase.hh"
282# include "BLI_string.hh"
283# include "BLI_string_utf8.hh"
284
285# include "BKE_action.hh"
286# include "BKE_animsys.hh"
287# include "BKE_constraint.h"
288# include "BKE_context.hh"
289# include "BKE_global.hh"
290# include "BKE_lib_id.hh"
291
292# ifdef WITH_ALEMBIC
293# include "ABC_alembic.h"
294# endif
295
296# include "ANIM_action.hh"
297
298# include "rna_action_tools.hh"
299
300namespace blender {
301
302static const EnumPropertyItem owner_space_object_items[] = {
304 "WORLD",
305 0,
306 "World Space",
307 "The constraint is applied relative to the world coordinate system"},
309 "CUSTOM",
310 0,
311 "Custom Space",
312 "The constraint is applied in local space of a custom object/bone/vertex group"},
314 "LOCAL",
315 0,
316 "Local Space",
317 "The constraint is applied relative to the local coordinate system of the object"},
318 {0, nullptr, 0, nullptr, nullptr},
319};
320
321static const EnumPropertyItem target_space_object_items[] = {
323 "WORLD",
324 0,
325 "World Space",
326 "The transformation of the target is evaluated relative to the world coordinate system"},
328 "CUSTOM",
329 0,
330 "Custom Space",
331 "The transformation of the target is evaluated relative to a custom object/bone/vertex "
332 "group"},
334 "LOCAL",
335 0,
336 "Local Space",
337 "The transformation of the target is evaluated relative to its local coordinate system"},
338 {0, nullptr, 0, nullptr, nullptr},
339};
340
341static StructRNA *rna_ConstraintType_refine(PointerRNA *ptr)
342{
343 bConstraint *con = static_cast<bConstraint *>(ptr->data);
344
345 switch (con->type) {
347 return RNA_ChildOfConstraint;
349 return RNA_TrackToConstraint;
351 return RNA_KinematicConstraint;
353 return RNA_FollowPathConstraint;
355 return RNA_CopyRotationConstraint;
357 return RNA_CopyLocationConstraint;
359 return RNA_CopyScaleConstraint;
361 return RNA_MaintainVolumeConstraint;
363 return RNA_ArmatureConstraint;
365 return RNA_ActionConstraint;
367 return RNA_LockedTrackConstraint;
369 return RNA_StretchToConstraint;
371 return RNA_FloorConstraint;
373 return RNA_ClampToConstraint;
375 return RNA_TransformConstraint;
377 return RNA_LimitRotationConstraint;
379 return RNA_LimitLocationConstraint;
381 return RNA_LimitScaleConstraint;
383 return RNA_LimitDistanceConstraint;
385 return RNA_ShrinkwrapConstraint;
387 return RNA_DampedTrackConstraint;
389 return RNA_SplineIKConstraint;
391 return RNA_CopyTransformsConstraint;
393 return RNA_PivotConstraint;
395 return RNA_FollowTrackConstraint;
397 return RNA_CameraSolverConstraint;
399 return RNA_ObjectSolverConstraint;
401 return RNA_TransformCacheConstraint;
403 return RNA_GeometryAttributeConstraint;
404 default:
405 return RNA_UnknownType;
406 }
407}
408
409static void rna_ConstraintTargetBone_target_set(PointerRNA *ptr,
410 PointerRNA value,
411 ReportList * /*reports*/)
412{
413 bConstraintTarget *tgt = static_cast<bConstraintTarget *>(ptr->data);
414 Object *ob = static_cast<Object *>(value.data);
415
416 if (!ob || ob->type == OB_ARMATURE) {
417 id_lib_extern(id_cast<ID *>(ob));
418 tgt->tar = ob;
419 }
420}
421
422static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
423{
424 bConstraint *con = static_cast<bConstraint *>(ptr->data);
425 char oldname[sizeof(con->name)];
426
427 /* make a copy of the old name first */
428 STRNCPY(oldname, con->name);
429
430 /* copy the new name into the name slot */
431 STRNCPY_UTF8(con->name, value);
432
433 /* make sure name is unique */
434 if (ptr->owner_id) {
435 Object *ob = id_cast<Object *>(ptr->owner_id);
436 ListBaseT<bConstraint> *list = ed::object::constraint_list_from_constraint(ob, con, nullptr);
437
438 /* if we have the list, check for unique name, otherwise give up */
439 if (list) {
441 }
442 }
443
444 /* fix all the animation data which may link to this */
445 BKE_animdata_fix_paths(*ptr->owner_id,
446 "constraints",
447 RNA_path_name_to_infix(oldname),
448 RNA_path_name_to_infix(con->name),
449 /*verify_paths=*/true,
450 *G_MAIN);
451}
452
453static std::optional<std::string> rna_Constraint_do_compute_path(Object *ob, bConstraint *con)
454{
455 bPoseChannel *pchan;
456 ListBaseT<bConstraint> *lb = ed::object::constraint_list_from_constraint(ob, con, &pchan);
457
458 if (lb == nullptr) {
459 printf("%s: internal error, constraint '%s' not found in object '%s'\n",
460 __func__,
461 con->name,
462 ob->id.name);
463 }
464
465 if (pchan) {
466 char name_esc_pchan[sizeof(pchan->name) * 2];
467 char name_esc_const[sizeof(con->name) * 2];
468 BLI_str_escape(name_esc_pchan, pchan->name, sizeof(name_esc_pchan));
469 BLI_str_escape(name_esc_const, con->name, sizeof(name_esc_const));
470 return fmt::format("pose.bones[\"{}\"].constraints[\"{}\"]", name_esc_pchan, name_esc_const);
471 }
472 char name_esc_const[sizeof(con->name) * 2];
473 BLI_str_escape(name_esc_const, con->name, sizeof(name_esc_const));
474 return fmt::format("constraints[\"{}\"]", name_esc_const);
475}
476
477static std::optional<std::string> rna_Constraint_path(const PointerRNA *ptr)
478{
479 Object *ob = id_cast<Object *>(ptr->owner_id);
480 bConstraint *con = static_cast<bConstraint *>(ptr->data);
481
482 return rna_Constraint_do_compute_path(ob, con);
483}
484
485static bConstraint *rna_constraint_from_target(const PointerRNA *ptr)
486{
487 Object *ob = id_cast<Object *>(ptr->owner_id);
488 bConstraintTarget *tgt = static_cast<bConstraintTarget *>(ptr->data);
489
490 return BKE_constraint_find_from_target(ob, tgt, nullptr);
491}
492
493static std::optional<std::string> rna_ConstraintTarget_path(const PointerRNA *ptr)
494{
495 Object *ob = id_cast<Object *>(ptr->owner_id);
496 bConstraintTarget *tgt = static_cast<bConstraintTarget *>(ptr->data);
497 bConstraint *con = rna_constraint_from_target(ptr);
498 int index = -1;
499
500 if (con != nullptr) {
501 if (con->type == CONSTRAINT_TYPE_ARMATURE) {
502 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
503 index = BLI_findindex(&acon->targets, tgt);
504 }
505 }
506
507 if (index >= 0) {
508 return fmt::format(
509 "{}.targets[{}]", rna_Constraint_do_compute_path(ob, con).value_or(""), index);
510 }
511 printf("%s: internal error, constraint '%s' of object '%s' does not contain the target\n",
512 __func__,
513 con->name,
514 ob->id.name);
515
516 return std::nullopt;
517}
518
519static void rna_Constraint_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
520{
522 bmain, id_cast<Object *>(ptr->owner_id), static_cast<bConstraint *>(ptr->data));
523}
524
525static void rna_Constraint_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
526{
528 bmain, id_cast<Object *>(ptr->owner_id), static_cast<bConstraint *>(ptr->data));
529}
530
531static void rna_ConstraintTarget_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
532{
534 bmain, id_cast<Object *>(ptr->owner_id), rna_constraint_from_target(ptr));
535}
536
537static void rna_ConstraintTarget_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
538{
540 bmain, id_cast<Object *>(ptr->owner_id), rna_constraint_from_target(ptr));
541}
542
543/* Update only needed so this isn't overwritten on first evaluation. */
544static void rna_Constraint_childof_inverse_matrix_update(Main *bmain,
545 Scene *scene,
546 PointerRNA *ptr)
547{
548 bConstraint *con = static_cast<bConstraint *>(ptr->data);
549 bChildOfConstraint *data = static_cast<bChildOfConstraint *>(con->data);
550 data->flag &= ~CHILDOF_SET_INVERSE;
551 rna_Constraint_update(bmain, scene, ptr);
552}
553
554static void rna_Constraint_ik_type_set(PointerRNA *ptr, int value)
555{
556 bConstraint *con = static_cast<bConstraint *>(ptr->data);
557 bKinematicConstraint *ikdata = static_cast<bKinematicConstraint *>(con->data);
558
559 if (ikdata->type != value) {
560 /* the type of IK constraint has changed, set suitable default values */
561 /* in case constraints reuse same fields incompatible */
562 switch (value) {
564 break;
566 break;
567 }
568 ikdata->type = eConstraint_IK_Type(value);
569 }
570}
571
572/* DEPRECATED: use_offset replaced with mix_mode */
573static bool rna_Constraint_RotLike_use_offset_get(PointerRNA *ptr)
574{
575 bConstraint *con = static_cast<bConstraint *>(ptr->data);
576 bRotateLikeConstraint *rotlike = static_cast<bRotateLikeConstraint *>(con->data);
577 return rotlike->mix_mode != ROTLIKE_MIX_REPLACE;
578}
579
580static void rna_Constraint_RotLike_use_offset_set(PointerRNA *ptr, bool value)
581{
582 bConstraint *con = static_cast<bConstraint *>(ptr->data);
583 bRotateLikeConstraint *rotlike = static_cast<bRotateLikeConstraint *>(con->data);
584 bool curval = (rotlike->mix_mode != ROTLIKE_MIX_REPLACE);
585 if (curval != value) {
586 rotlike->mix_mode = (value ? ROTLIKE_MIX_OFFSET : ROTLIKE_MIX_REPLACE);
587 }
588}
589
590static const EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext * /*C*/,
591 PointerRNA *ptr,
592 PropertyRNA * /*prop*/,
593 bool * /*r_free*/)
594{
595 Object *ob = id_cast<Object *>(ptr->owner_id);
596 bConstraint *con = static_cast<bConstraint *>(ptr->data);
597
598 if (BLI_findindex(&ob->constraints, con) == -1) {
600 }
601 else {
602 /* object */
603 return owner_space_object_items;
604 }
605}
606
607static const EnumPropertyItem *rna_Constraint_target_space_itemf(bContext * /*C*/,
608 PointerRNA *ptr,
609 PropertyRNA * /*prop*/,
610 bool * /*r_free*/)
611{
612 bConstraint *con = static_cast<bConstraint *>(ptr->data);
613 ListBaseT<bConstraintTarget> targets = {nullptr, nullptr};
615
616 if (BKE_constraint_targets_get(con, &targets)) {
617 for (ct = targets.first(); ct; ct = ct->next) {
618 if (ct->tar && ct->tar->type == OB_ARMATURE && !(ct->flag & CONSTRAINT_TAR_CUSTOM_SPACE)) {
619 break;
620 }
621 }
622
623 BKE_constraint_targets_flush(con, &targets, 1);
624
625 if (ct) {
627 }
628 }
629
630 return target_space_object_items;
631}
632
633static bConstraintTarget *rna_ArmatureConstraint_target_new(ID *id, bConstraint *con, Main *bmain)
634{
635 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
636 bConstraintTarget *tgt = MEM_new<bConstraintTarget>("Constraint Target");
637
638 tgt->weight = 1.0f;
639 BLI_addtail(&acon->targets, tgt);
640
641 ed::object::constraint_dependency_tag_update(bmain, id_cast<Object *>(id), con);
642 return tgt;
643}
644
645static void rna_ArmatureConstraint_target_remove(
646 ID *id, bConstraint *con, Main *bmain, ReportList *reports, PointerRNA *target_ptr)
647{
648 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
649 bConstraintTarget *tgt = static_cast<bConstraintTarget *>(target_ptr->data);
650
651 if (BLI_findindex(&acon->targets, tgt) == -1) {
652 BKE_report(reports, RPT_ERROR, "Target is not in the constraint target list");
653 return;
654 }
655
656 BLI_freelinkN(&acon->targets, tgt);
657
658 ed::object::constraint_dependency_tag_update(bmain, id_cast<Object *>(id), con);
659}
660
661static void rna_ArmatureConstraint_target_clear(ID *id, bConstraint *con, Main *bmain)
662{
663 bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
664
665 acon->targets.free_no_destruct();
666
667 ed::object::constraint_dependency_tag_update(bmain, id_cast<Object *>(id), con);
668}
669
670static void rna_ActionConstraint_mix_mode_set(PointerRNA *ptr, int value)
671{
672 bConstraint *con = static_cast<bConstraint *>(ptr->data);
673 bActionConstraint *acon = static_cast<bActionConstraint *>(con->data);
674
675 acon->mix_mode = eActionConstraint_MixMode(value);
676
677 /* The After mode can be computed in world space for efficiency
678 * and backward compatibility, while Before or Split requires Local. */
680 con->ownspace = CONSTRAINT_SPACE_WORLD;
681 }
682 else {
683 con->ownspace = CONSTRAINT_SPACE_LOCAL;
684 }
685}
686
687static void rna_ActionConstraint_minmax_range(
688 PointerRNA *ptr, float *min, float *max, float * /*softmin*/, float * /*softmax*/)
689{
690 bConstraint *con = static_cast<bConstraint *>(ptr->data);
691 bActionConstraint *acon = static_cast<bActionConstraint *>(con->data);
692
693 /* 0, 1, 2 = magic numbers for rotX, rotY, rotZ */
694 if (ELEM(acon->type, 0, 1, 2)) {
695 *min = -180.0f;
696 *max = 180.0f;
697 }
698 else {
699 *min = -1000.0f;
700 *max = 1000.0f;
701 }
702}
703
704static void rna_ActionConstraint_action_set(PointerRNA *ptr, PointerRNA value, ReportList *reports)
705{
706 using namespace animrig;
707 BLI_assert(ptr->owner_id);
708 BLI_assert(*ptr);
709
710 ID &animated_id = *ptr->owner_id;
711 bConstraint *con = static_cast<bConstraint *>(ptr->data);
712 bActionConstraint *acon = static_cast<bActionConstraint *>(con->data);
713
714 Action *action = static_cast<Action *>(value.data);
715
716 if (!action) {
717 const bool ok = generic_assign_action(
718 animated_id, nullptr, acon->act, acon->action_slot_handle, acon->last_slot_identifier);
719 BLI_assert_msg(ok, "Un-assigning an Action from an Action Constraint should always work.");
721 return;
722 }
723
724 const bool ok = generic_assign_action(
725 animated_id, action, acon->act, acon->action_slot_handle, acon->last_slot_identifier);
726 if (!ok) {
727 BKE_reportf(reports,
728 RPT_ERROR,
729 "Could not assign action %s to Action Constraint %s",
730 action->id.name + 2,
731 con->name);
732 return;
733 }
734
735 /* For the Action Constraint, the auto slot selection gets one more fallback
736 * option (compared to the generic code). This is to support the following
737 * scenario, which used to be necessary as a workaround for a bug in Blender (#127976):
738 *
739 * - Python script creates an Action,
740 * - assigns it to the animated object,
741 * - unassigns it from that object,
742 * - and assigns it to the object's Action Constraint.
743 *
744 * The generic code doesn't work for this. The first assignment would see the slot
745 * `XXSlot`, and because it has never been used, just use it. This would change its name to
746 * `OBSlot`. The assignment to the Action Constraint would not see a 'virgin' slot, and thus not
747 * auto-select `OBSlot`. This behavior makes sense when assigning Actions in the Action editor
748 * (it shouldn't automatically pick the first slot of matching ID type), but for the Action
749 * Constraint I (Sybren) feel that it could be a bit more 'enthusiastic' in auto-picking a slot.
750 *
751 * Note that this is the same behavior as for NLA strips, albeit for a slightly different
752 * reason. Because of that it's not sharing code with the NLA.
753 */
754 if (acon->action_slot_handle == Slot::unassigned && action->slots().size() == 1) {
755 Slot *first_slot = action->slot(0);
756 if (first_slot->is_suitable_for(animated_id)) {
758 first_slot,
759 animated_id,
760 acon->act,
761 acon->action_slot_handle,
762 acon->last_slot_identifier);
763 BLI_assert(result == ActionSlotAssignmentResult::OK);
765 }
766 }
767}
768
769static void rna_ActionConstraint_action_slot_handle_set(
770 PointerRNA *ptr, const animrig::slot_handle_t new_slot_handle)
771{
772 bConstraint *con = static_cast<bConstraint *>(ptr->data);
773 bActionConstraint *acon = static_cast<bActionConstraint *>(con->data);
774
775 rna_generic_action_slot_handle_set(new_slot_handle,
776 *ptr->owner_id,
777 acon->act,
778 acon->action_slot_handle,
779 acon->last_slot_identifier);
780}
781
787static void rna_ActionConstraint_action_slot_handle_override_diff(
788 Main *bmain, RNAPropertyOverrideDiffContext &rnadiff_ctx)
789{
790 const bConstraint *con_a = static_cast<bConstraint *>(rnadiff_ctx.prop_a->ptr->data);
791 const bConstraint *con_b = static_cast<bConstraint *>(rnadiff_ctx.prop_b->ptr->data);
792
793 const bActionConstraint *act_con_a = static_cast<bActionConstraint *>(con_a->data);
794 const bActionConstraint *act_con_b = static_cast<bActionConstraint *>(con_b->data);
795
796 rna_generic_action_slot_handle_override_diff(bmain, rnadiff_ctx, act_con_a->act, act_con_b->act);
797}
798
799static PointerRNA rna_ActionConstraint_action_slot_get(PointerRNA *ptr)
800{
801 bConstraint *con = static_cast<bConstraint *>(ptr->data);
802 bActionConstraint *acon = static_cast<bActionConstraint *>(con->data);
803
804 return rna_generic_action_slot_get(acon->act, acon->action_slot_handle);
805}
806
807static void rna_ActionConstraint_action_slot_set(PointerRNA *ptr,
808 PointerRNA value,
809 ReportList *reports)
810{
811 bConstraint *con = static_cast<bConstraint *>(ptr->data);
812 bActionConstraint *acon = static_cast<bActionConstraint *>(con->data);
813
814 rna_generic_action_slot_set(value,
815 *ptr->owner_id,
816 acon->act,
817 acon->action_slot_handle,
818 acon->last_slot_identifier,
819 reports);
820}
821
822static void rna_iterator_ActionConstraint_action_suitable_slots_begin(
824{
825 bConstraint *con = static_cast<bConstraint *>(ptr->data);
826 bActionConstraint *acon = static_cast<bActionConstraint *>(con->data);
827
828 rna_iterator_generic_action_suitable_slots_begin(iter, ptr, acon->act);
829}
830
831static int rna_SplineIKConstraint_joint_bindings_get_length(const PointerRNA *ptr,
833{
834 const bConstraint *con = static_cast<bConstraint *>(ptr->data);
835 const bSplineIKConstraint *ikData = static_cast<bSplineIKConstraint *>(con->data);
836
837 if (ikData) {
838 length[0] = ikData->numpoints;
839 }
840 else {
841 length[0] = 0;
842 }
843
844 return length[0];
845}
846
847static void rna_SplineIKConstraint_joint_bindings_get(PointerRNA *ptr, float *values)
848{
849 bConstraint *con = static_cast<bConstraint *>(ptr->data);
850 bSplineIKConstraint *ikData = static_cast<bSplineIKConstraint *>(con->data);
851
852 memcpy(values, ikData->points, ikData->numpoints * sizeof(float));
853}
854
855static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const float *values)
856{
857 bConstraint *con = static_cast<bConstraint *>(ptr->data);
858 bSplineIKConstraint *ikData = static_cast<bSplineIKConstraint *>(con->data);
859
860 memcpy(ikData->points, values, ikData->numpoints * sizeof(float));
861}
862
863static int rna_ShrinkwrapConstraint_face_cull_get(PointerRNA *ptr)
864{
865 bConstraint *con = static_cast<bConstraint *>(ptr->data);
866 bShrinkwrapConstraint *swc = static_cast<bShrinkwrapConstraint *>(con->data);
868}
869
870static void rna_ShrinkwrapConstraint_face_cull_set(PointerRNA *ptr, int value)
871{
872 bConstraint *con = static_cast<bConstraint *>(ptr->data);
873 bShrinkwrapConstraint *swc = static_cast<bShrinkwrapConstraint *>(con->data);
874 swc->flag = (swc->flag & ~CON_SHRINKWRAP_PROJECT_CULL_MASK) | eShrinkwrap_Flags(value);
875}
876
877static bool rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value)
878{
879 Object *ob = static_cast<Object *>(value.data);
880
881 if (ob) {
882 if (ob->type == OB_CAMERA && ob != id_cast<Object *>(ptr->owner_id)) {
883 return 1;
884 }
885 }
886
887 return 0;
888}
889
890static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr,
891 PointerRNA value,
892 ReportList * /*reports*/)
893{
894 bConstraint *con = static_cast<bConstraint *>(ptr->data);
895 bFollowTrackConstraint *data = static_cast<bFollowTrackConstraint *>(con->data);
896 Object *ob = static_cast<Object *>(value.data);
897
898 if (ob) {
899 if (ob->type == OB_CAMERA && ob != id_cast<Object *>(ptr->owner_id)) {
900 data->camera = ob;
901 id_lib_extern(id_cast<ID *>(ob));
902 }
903 }
904 else {
905 data->camera = nullptr;
906 }
907}
908
909static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr,
910 PointerRNA value,
911 ReportList * /*reports*/)
912{
913 bConstraint *con = static_cast<bConstraint *>(ptr->data);
914 bFollowTrackConstraint *data = static_cast<bFollowTrackConstraint *>(con->data);
915 Object *ob = static_cast<Object *>(value.data);
916
917 if (ob) {
918 if (ob->type == OB_MESH && ob != id_cast<Object *>(ptr->owner_id)) {
919 data->depth_ob = ob;
920 id_lib_extern(id_cast<ID *>(ob));
921 }
922 }
923 else {
924 data->depth_ob = nullptr;
925 }
926}
927
928static bool rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, PointerRNA value)
929{
930 Object *ob = static_cast<Object *>(value.data);
931
932 if (ob) {
933 if (ob->type == OB_MESH && ob != id_cast<Object *>(ptr->owner_id)) {
934 return 1;
935 }
936 }
937
938 return 0;
939}
940
941static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr,
942 PointerRNA value,
943 ReportList * /*reports*/)
944{
945 bConstraint *con = static_cast<bConstraint *>(ptr->data);
946 bObjectSolverConstraint *data = static_cast<bObjectSolverConstraint *>(con->data);
947 Object *ob = static_cast<Object *>(value.data);
948
949 if (ob) {
950 if (ob->type == OB_CAMERA && ob != id_cast<Object *>(ptr->owner_id)) {
951 data->camera = ob;
952 id_lib_extern(id_cast<ID *>(ob));
953 }
954 }
955 else {
956 data->camera = nullptr;
957 }
958}
959
960} // namespace blender
961
962#else
963
964namespace blender {
965
968 "LIMITDIST_INSIDE",
969 0,
970 "Inside",
971 "The object is constrained inside a virtual sphere around the target object, "
972 "with a radius defined by the limit distance"},
974 "LIMITDIST_OUTSIDE",
975 0,
976 "Outside",
977 "The object is constrained outside a virtual sphere around the target object, "
978 "with a radius defined by the limit distance"},
980 "LIMITDIST_ONSURFACE",
981 0,
982 "On Surface",
983 "The object is constrained on the surface of a virtual sphere around the target object, "
984 "with a radius defined by the limit distance"},
985 {0, nullptr, 0, nullptr, nullptr},
986};
987
989{
990 PropertyRNA *prop;
991
993
994 prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
995 RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
996 RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head is 0, Tail is 1");
997 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
998
999 prop = RNA_def_property(srna, "use_bbone_shape", PROP_BOOLEAN, PROP_NONE);
1000 RNA_def_property_boolean_sdna(prop, "bConstraint", "flag", CONSTRAINT_BBONE_SHAPE);
1002 "Follow B-Bone",
1003 "Follow shape of B-Bone segments when calculating Head/Tail position");
1004 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1005
1007}
1008
1010{
1011 PropertyRNA *prop;
1012
1014
1015 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1016 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
1017 RNA_def_property_ui_text(prop, "Target", "Target object");
1019 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1020
1021 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1022 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
1023 RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
1024 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1025
1027}
1028
1030{
1031 StructRNA *srna;
1032 PropertyRNA *prop;
1033
1034 srna = RNA_def_struct(brna, "ConstraintTarget", nullptr);
1035 RNA_def_struct_ui_text(srna, "Constraint Target", "Target object for multi-target constraints");
1036 RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
1037 RNA_def_struct_sdna(srna, "bConstraintTarget");
1038
1040
1041 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1042 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
1043 RNA_def_property_ui_text(prop, "Target", "Target object");
1046 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1047
1048 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1049 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
1050 RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
1052 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1053
1054 /* space, flag and type still to do. */
1055
1057}
1058
1060{
1061 StructRNA *srna;
1062 PropertyRNA *prop;
1063
1064 srna = RNA_def_struct(brna, "ConstraintTargetBone", nullptr);
1066 srna, "Constraint Target Bone", "Target bone for multi-target constraints");
1067 RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
1068 RNA_def_struct_sdna(srna, "bConstraintTarget");
1069
1071
1072 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1073 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
1074 RNA_def_property_ui_text(prop, "Target", "Target armature");
1076 prop, nullptr, "rna_ConstraintTargetBone_target_set", nullptr, "rna_Armature_object_poll");
1079 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1080
1081 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1082 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
1083 RNA_def_property_ui_text(prop, "Sub-Target", "Target armature bone");
1085 prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
1086
1087 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
1088 RNA_def_property_float_sdna(prop, nullptr, "weight");
1089 RNA_def_property_range(prop, 0.0f, 1.0f);
1090 RNA_def_property_ui_text(prop, "Blend Weight", "Blending weight of this bone");
1091 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_update");
1092
1094}
1095
1097{
1098 StructRNA *srna;
1099 PropertyRNA *prop;
1100
1101 srna = RNA_def_struct(brna, "ChildOfConstraint", "Constraint");
1103 srna, "Child Of Constraint", "Create constraint-based parent-child relationship");
1104 RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data");
1105 RNA_def_struct_ui_icon(srna, ICON_CON_CHILDOF);
1106
1108
1110
1111 prop = RNA_def_property(srna, "use_location_x", PROP_BOOLEAN, PROP_NONE);
1112 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_LOCX);
1113 RNA_def_property_ui_text(prop, "Location X", "Use X Location of Parent");
1114 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1115
1116 prop = RNA_def_property(srna, "use_location_y", PROP_BOOLEAN, PROP_NONE);
1117 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_LOCY);
1118 RNA_def_property_ui_text(prop, "Location Y", "Use Y Location of Parent");
1119 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1120
1121 prop = RNA_def_property(srna, "use_location_z", PROP_BOOLEAN, PROP_NONE);
1122 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_LOCZ);
1123 RNA_def_property_ui_text(prop, "Location Z", "Use Z Location of Parent");
1124 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1125
1126 prop = RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
1127 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_ROTX);
1128 RNA_def_property_ui_text(prop, "Rotation X", "Use X Rotation of Parent");
1129 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1130
1131 prop = RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
1132 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_ROTY);
1133 RNA_def_property_ui_text(prop, "Rotation Y", "Use Y Rotation of Parent");
1134 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1135
1136 prop = RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
1137 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_ROTZ);
1138 RNA_def_property_ui_text(prop, "Rotation Z", "Use Z Rotation of Parent");
1139 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1140
1141 prop = RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
1142 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SIZEX);
1143 RNA_def_property_ui_text(prop, "Scale X", "Use X Scale of Parent");
1144 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1145
1146 prop = RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
1147 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SIZEY);
1148 RNA_def_property_ui_text(prop, "Scale Y", "Use Y Scale of Parent");
1149 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1150
1151 prop = RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
1152 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SIZEZ);
1153 RNA_def_property_ui_text(prop, "Scale Z", "Use Z Scale of Parent");
1154 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1155
1156 prop = RNA_def_property(srna, "set_inverse_pending", PROP_BOOLEAN, PROP_NONE);
1157 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CHILDOF_SET_INVERSE);
1159 prop, "Set Inverse Pending", "Set to true to request recalculation of the inverse matrix");
1160 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1161
1162 prop = RNA_def_property(srna, "inverse_matrix", PROP_FLOAT, PROP_MATRIX);
1163 RNA_def_property_float_sdna(prop, nullptr, "invmat");
1166 RNA_def_property_ui_text(prop, "Inverse Matrix", "Transformation matrix to apply before");
1168 prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_childof_inverse_matrix_update");
1169
1171}
1172
1174{
1175 StructRNA *srna;
1176 FunctionRNA *func;
1177 PropertyRNA *parm;
1178
1179 RNA_def_property_srna(cprop, "ArmatureConstraintTargets");
1180 srna = RNA_def_struct(brna, "ArmatureConstraintTargets", nullptr);
1181 RNA_def_struct_sdna(srna, "bConstraint");
1183 srna, "Armature Deform Constraint Targets", "Collection of target bones and weights");
1184 RNA_def_struct_ui_icon(srna, ICON_CON_ARMATURE);
1185
1186 func = RNA_def_function(srna, "new", "rna_ArmatureConstraint_target_new");
1188 RNA_def_function_ui_description(func, "Add a new target to the constraint");
1189 parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "New target bone");
1191 RNA_def_function_return(func, parm);
1192
1193 func = RNA_def_function(srna, "remove", "rna_ArmatureConstraint_target_remove");
1195 RNA_def_function_ui_description(func, "Delete target from the constraint");
1196 parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "Target to remove");
1199
1200 func = RNA_def_function(srna, "clear", "rna_ArmatureConstraint_target_clear");
1202 RNA_def_function_ui_description(func, "Delete all targets from object");
1203}
1204
1206{
1207 StructRNA *srna;
1208 PropertyRNA *prop;
1209
1210 srna = RNA_def_struct(brna, "ArmatureConstraint", "Constraint");
1212 srna, "Armature Constraint", "Applies transformations done by the Armature modifier");
1213 RNA_def_struct_sdna_from(srna, "bArmatureConstraint", "data");
1214 RNA_def_struct_ui_icon(srna, ICON_CON_ARMATURE);
1215
1217
1218 prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
1219 RNA_def_property_collection_sdna(prop, nullptr, "targets", nullptr);
1220 RNA_def_property_struct_type(prop, "ConstraintTargetBone");
1221 RNA_def_property_ui_text(prop, "Targets", "Target Bones");
1223
1224 prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
1227 prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
1228 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1229
1230 prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
1233 prop,
1234 "Use Envelopes",
1235 "Multiply weights by envelope for all bones, instead of acting like Vertex Group based "
1236 "blending. "
1237 "The specified weights are still used, and only the listed bones are considered.");
1238 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1239
1240 prop = RNA_def_property(srna, "use_current_location", PROP_BOOLEAN, PROP_NONE);
1243 "Use Current Location",
1244 "Use the current bone location for envelopes and choosing B-Bone "
1245 "segments instead of rest position");
1246 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1247
1249}
1250
1252{
1253 StructRNA *srna;
1254 PropertyRNA *prop;
1255
1256 static const EnumPropertyItem constraint_ik_axisref_items[] = {
1257 {0, "BONE", 0, "Bone", ""},
1258 {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""},
1259 {0, nullptr, 0, nullptr, nullptr},
1260 };
1261
1262 static const EnumPropertyItem constraint_ik_type_items[] = {
1263 {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
1264 {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
1265 {0, nullptr, 0, nullptr, nullptr},
1266 };
1267
1268 srna = RNA_def_struct(brna, "KinematicConstraint", "Constraint");
1269 RNA_def_struct_ui_text(srna, "Kinematic Constraint", "Inverse Kinematics");
1270 RNA_def_struct_sdna_from(srna, "bKinematicConstraint", "data");
1271 RNA_def_struct_ui_icon(srna, ICON_CON_KINEMATIC);
1272
1274
1276
1277 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
1278 RNA_def_property_range(prop, 0, 10000);
1280 RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving iterations");
1281 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1282
1283 prop = RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE);
1284 RNA_def_property_pointer_sdna(prop, nullptr, "poletar");
1285 RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation");
1287 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1288
1289 prop = RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE);
1290 RNA_def_property_string_sdna(prop, nullptr, "polesubtarget");
1291 RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
1292 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1293
1294 prop = RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE);
1295 RNA_def_property_float_sdna(prop, nullptr, "poleangle");
1297 RNA_def_property_ui_range(prop, -M_PI, M_PI, 10, 4);
1298 RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset");
1299 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1300
1301 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
1302 RNA_def_property_range(prop, 0.01, 1.0f);
1305 prop, "Weight", "For Tree-IK: Weight of position control for this target");
1306
1307 prop = RNA_def_property(srna, "orient_weight", PROP_FLOAT, PROP_NONE);
1308 RNA_def_property_float_sdna(prop, nullptr, "orientweight");
1309 RNA_def_property_range(prop, 0.01, 1.0f);
1312 prop, "Orientation Weight", "For Tree-IK: Weight of orientation control for this target");
1313 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1314
1315 prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
1316 RNA_def_property_int_sdna(prop, nullptr, "rootbone");
1317 /* Changing the IK chain length requires a rebuild of depsgraph relations. This makes it
1318 * unsuitable for animation. */
1320 RNA_def_property_range(prop, 0, 255);
1322 prop, "Chain Length", "How many bones are included in the IK effect - 0 uses all bones");
1323 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1324
1325 prop = RNA_def_property(srna, "use_tail", PROP_BOOLEAN, PROP_NONE);
1326 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_IK_TIP);
1328 RNA_def_property_ui_text(prop, "Use Tail", "Include bone's tail as last element in chain");
1329 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1330
1331 prop = RNA_def_property(srna, "reference_axis", PROP_ENUM, PROP_NONE);
1332 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1333 RNA_def_property_enum_items(prop, constraint_ik_axisref_items);
1335 prop, "Axis Reference", "Constraint axis Lock options relative to Bone or Target reference");
1336 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1337
1338 prop = RNA_def_property(srna, "use_location", PROP_BOOLEAN, PROP_NONE);
1339 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_IK_POS);
1341 RNA_def_property_ui_text(prop, "Position", "Chain follows position of target");
1342 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1343
1344 prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
1346 RNA_def_property_ui_text(prop, "Lock X Pos", "Constraint position along X axis");
1347 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1348
1349 prop = RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
1351 RNA_def_property_ui_text(prop, "Lock Y Pos", "Constraint position along Y axis");
1352 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1353
1354 prop = RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
1356 RNA_def_property_ui_text(prop, "Lock Z Pos", "Constraint position along Z axis");
1357 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1358
1359 prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
1360 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_IK_ROT);
1361 RNA_def_property_ui_text(prop, "Rotation", "Chain follows rotation of target");
1362 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1363
1364 prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
1366 RNA_def_property_ui_text(prop, "Lock X Rotation", "Constraint rotation along X axis");
1367 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1368
1369 prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
1371 RNA_def_property_ui_text(prop, "Lock Y Rotation", "Constraint rotation along Y axis");
1372 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1373
1374 prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
1376 RNA_def_property_ui_text(prop, "Lock Z Rotation", "Constraint rotation along Z axis");
1377 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
1378
1379 prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
1382 RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching");
1383 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1384
1385 prop = RNA_def_property(srna, "ik_type", PROP_ENUM, PROP_NONE);
1386 RNA_def_property_enum_sdna(prop, nullptr, "type");
1387 RNA_def_property_enum_funcs(prop, nullptr, "rna_Constraint_ik_type_set", nullptr);
1388 RNA_def_property_enum_items(prop, constraint_ik_type_items);
1389 RNA_def_property_ui_text(prop, "IK Type", "");
1390 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1391
1392 prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
1393 RNA_def_property_enum_sdna(prop, nullptr, "mode");
1396 prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
1397 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
1398
1399 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
1400 RNA_def_property_float_sdna(prop, nullptr, "dist");
1401 RNA_def_property_range(prop, 0.0, 100.0f);
1402 RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
1403 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1404
1406}
1407
1409{
1410 StructRNA *srna;
1411 PropertyRNA *prop;
1412
1413 static const EnumPropertyItem up_items[] = {
1414 {TRACK_X, "UP_X", 0, "X", ""},
1415 {TRACK_Y, "UP_Y", 0, "Y", ""},
1416 {TRACK_Z, "UP_Z", 0, "Z", ""},
1417 {0, nullptr, 0, nullptr, nullptr},
1418 };
1419
1420 srna = RNA_def_struct(brna, "TrackToConstraint", "Constraint");
1422 srna, "Track To Constraint", "Aim the constrained object toward the target");
1423
1425
1426 RNA_def_struct_sdna_from(srna, "bTrackToConstraint", "data");
1427
1429
1430 RNA_def_struct_ui_icon(srna, ICON_CON_TRACKTO);
1431
1433
1434 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
1435 RNA_def_property_enum_sdna(prop, nullptr, "reserved1");
1438 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
1439 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1440
1441 prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
1442 RNA_def_property_enum_sdna(prop, nullptr, "reserved2");
1443 RNA_def_property_enum_items(prop, up_items);
1444 RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
1445 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1446
1447 prop = RNA_def_property(srna, "use_target_z", PROP_BOOLEAN, PROP_NONE);
1448 RNA_def_property_boolean_sdna(prop, nullptr, "flags", TARGET_Z_UP);
1450 prop, "Target Z", "Target's Z axis, not World Z axis, will constrain the Up direction");
1451 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1452
1454}
1455
1457{
1458 StructRNA *srna;
1459 PropertyRNA *prop;
1460
1461 srna = RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
1462 RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copy the location of the target");
1463 RNA_def_struct_ui_icon(srna, ICON_CON_LOCLIKE);
1464
1466
1467 RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data");
1468
1470
1472
1473 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1474 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_X);
1476 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X location");
1477 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1478
1479 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1480 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Y);
1482 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y location");
1483 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1484
1485 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1486 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Z);
1488 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z location");
1489 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1490
1491 prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
1492 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_X_INVERT);
1493 RNA_def_property_ui_text(prop, "Invert X", "Invert the X location");
1494 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1495
1496 prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
1497 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Y_INVERT);
1498 RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location");
1499 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1500
1501 prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
1502 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_Z_INVERT);
1503 RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location");
1504 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1505
1506 prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
1507 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LOCLIKE_OFFSET);
1508 RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location");
1509 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1510
1512}
1513
1515{
1516 StructRNA *srna;
1517 PropertyRNA *prop;
1518
1519 static const EnumPropertyItem mix_mode_items[] = {
1520 {ROTLIKE_MIX_REPLACE, "REPLACE", 0, "Replace", "Replace the original rotation with copied"},
1521 {ROTLIKE_MIX_ADD, "ADD", 0, "Add", "Add euler component values together"},
1523 "BEFORE",
1524 0,
1525 "Before Original",
1526 "Apply copied rotation before original, as if the constraint target is a parent"},
1528 "AFTER",
1529 0,
1530 "After Original",
1531 "Apply copied rotation after original, as if the constraint target is a child"},
1533 "OFFSET",
1534 0,
1535 "Offset (Legacy)",
1536 "Combine rotations like the original Offset checkbox. Does not work well for "
1537 "multiple axis rotations."},
1538 {0, nullptr, 0, nullptr, nullptr},
1539 };
1540
1541 srna = RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
1542 RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copy the rotation of the target");
1543 RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data");
1544 RNA_def_struct_ui_icon(srna, ICON_CON_ROTLIKE);
1545
1547
1549
1550 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1551 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_X);
1553 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X rotation");
1554 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1555
1556 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1557 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Y);
1559 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y rotation");
1560 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1561
1562 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1563 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Z);
1565 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z rotation");
1566 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1567
1568 prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
1569 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_X_INVERT);
1570 RNA_def_property_ui_text(prop, "Invert X", "Invert the X rotation");
1571 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1572
1573 prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
1574 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Y_INVERT);
1575 RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y rotation");
1576 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1577
1578 prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
1579 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ROTLIKE_Z_INVERT);
1580 RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z rotation");
1581 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1582
1583 prop = RNA_def_property(srna, "euler_order", PROP_ENUM, PROP_NONE);
1584 RNA_def_property_enum_sdna(prop, nullptr, "euler_order");
1586 RNA_def_property_ui_text(prop, "Euler Order", "Explicitly specify the euler rotation order");
1587 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1588
1589 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
1590 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode");
1591 RNA_def_property_enum_items(prop, mix_mode_items);
1593 prop, "Mix Mode", "Specify how the copied and existing rotations are combined");
1594 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1595
1596 /* DEPRECATED: replaced with mix_mode */
1597 prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
1599 prop, "rna_Constraint_RotLike_use_offset_get", "rna_Constraint_RotLike_use_offset_set");
1601 prop, "Offset", "DEPRECATED: Add original rotation into copied rotation");
1602 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1603
1605}
1606
1608{
1609 StructRNA *srna;
1610 PropertyRNA *prop;
1611
1612 srna = RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
1613 RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copy the scale of the target");
1614 RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
1615 RNA_def_struct_ui_icon(srna, ICON_CON_SIZELIKE);
1616
1618
1620
1621 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1622 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_X);
1624 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X scale");
1625 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1626
1627 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1628 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_Y);
1630 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y scale");
1631 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1632
1633 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1634 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_Z);
1636 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale");
1637 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1638
1639 prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_NONE);
1640 RNA_def_property_float_sdna(prop, nullptr, "power");
1643 RNA_def_property_ui_text(prop, "Power", "Raise the target's scale to the specified power");
1645 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1646
1647 prop = RNA_def_property(srna, "use_make_uniform", PROP_BOOLEAN, PROP_NONE);
1648 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_UNIFORM);
1650 "Make Uniform",
1651 "Redistribute the copied change in volume equally "
1652 "between the three axes of the owner");
1653 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1654
1655 prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
1656 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SIZELIKE_OFFSET);
1657 RNA_def_property_ui_text(prop, "Offset", "Combine original scale with copied scale");
1658 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1659
1660 prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
1663 prop,
1664 "Additive",
1665 "Use addition instead of multiplication to combine scale (2.7 compatibility)");
1667 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1668
1670}
1671
1673{
1674 StructRNA *srna;
1675 PropertyRNA *prop;
1676
1677 static const EnumPropertyItem axis_items[] = {
1678 {SAMEVOL_X, "SAMEVOL_X", 0, "X", ""},
1679 {SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""},
1680 {SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""},
1681 {0, nullptr, 0, nullptr, nullptr},
1682 };
1683
1684 static const EnumPropertyItem mode_items[] = {
1686 "STRICT",
1687 0,
1688 "Strict",
1689 "Volume is strictly preserved, overriding the scaling of non-free axes"},
1691 "UNIFORM",
1692 0,
1693 "Uniform",
1694 "Volume is preserved when the object is scaled uniformly. "
1695 "Deviations from uniform scale on non-free axes are passed through."},
1697 "SINGLE_AXIS",
1698 0,
1699 "Single Axis",
1700 "Volume is preserved when the object is scaled only on the free axis. "
1701 "Non-free axis scaling is passed through."},
1702 {0, nullptr, 0, nullptr, nullptr},
1703 };
1704
1705 srna = RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
1707 "Maintain Volume Constraint",
1708 "Maintain a constant volume along a single scaling axis");
1709 RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
1710 RNA_def_struct_ui_icon(srna, ICON_CON_SAMEVOL);
1711
1713
1714 prop = RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
1715 RNA_def_property_enum_sdna(prop, nullptr, "free_axis");
1716 RNA_def_property_enum_items(prop, axis_items);
1718 RNA_def_property_ui_text(prop, "Free Axis", "The free scaling axis of the object");
1719 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1720
1721 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1722 RNA_def_property_enum_sdna(prop, nullptr, "mode");
1723 RNA_def_property_enum_items(prop, mode_items);
1725 prop, "Mode", "The way the constraint treats original non-free axis scaling");
1726 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1727
1728 prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
1729 RNA_def_property_range(prop, 0.0f, FLT_MAX);
1730 RNA_def_property_ui_range(prop, 0.001f, 100.0f, 1, 3);
1732 RNA_def_property_ui_text(prop, "Volume", "Volume of the bone at rest");
1733 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1734
1736}
1737
1739{
1740 StructRNA *srna;
1741 PropertyRNA *prop;
1742
1743 static const EnumPropertyItem mix_mode_items[] = {
1745 "REPLACE",
1746 0,
1747 "Replace",
1748 "Replace the original transformation with copied"},
1751 "BEFORE_FULL",
1752 0,
1753 "Before Original (Full)",
1754 "Apply copied transformation before original, using simple matrix multiplication as if "
1755 "the constraint target is a parent in Full Inherit Scale mode. "
1756 "Will create shear when combining rotation and non-uniform scale."},
1758 "BEFORE",
1759 0,
1760 "Before Original (Aligned)",
1761 "Apply copied transformation before original, as if the constraint target is a parent in "
1762 "Aligned Inherit Scale mode. This effectively uses Full for location and Split Channels "
1763 "for rotation and scale."},
1765 "BEFORE_SPLIT",
1766 0,
1767 "Before Original (Split Channels)",
1768 "Apply copied transformation before original, handling location, rotation and scale "
1769 "separately, similar to a sequence of three Copy constraints"},
1772 "AFTER_FULL",
1773 0,
1774 "After Original (Full)",
1775 "Apply copied transformation after original, using simple matrix multiplication as if "
1776 "the constraint target is a child in Full Inherit Scale mode. "
1777 "Will create shear when combining rotation and non-uniform scale."},
1779 "AFTER",
1780 0,
1781 "After Original (Aligned)",
1782 "Apply copied transformation after original, as if the constraint target is a child in "
1783 "Aligned Inherit Scale mode. This effectively uses Full for location and Split Channels "
1784 "for rotation and scale."},
1786 "AFTER_SPLIT",
1787 0,
1788 "After Original (Split Channels)",
1789 "Apply copied transformation after original, handling location, rotation and scale "
1790 "separately, similar to a sequence of three Copy constraints"},
1791 {0, nullptr, 0, nullptr, nullptr},
1792 };
1793
1794 srna = RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
1796 srna, "Copy Transforms Constraint", "Copy all the transforms of the target");
1797
1799
1800 RNA_def_struct_sdna_from(srna, "bTransLikeConstraint", "data");
1801
1802 RNA_def_struct_ui_icon(srna, ICON_CON_TRANSLIKE);
1803
1805
1807
1808 prop = RNA_def_property(srna, "remove_target_shear", PROP_BOOLEAN, PROP_NONE);
1811 prop, "Remove Target Shear", "Remove shear from the target transformation before combining");
1812 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1813
1814 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
1815 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode");
1816 RNA_def_property_enum_items(prop, mix_mode_items);
1818 prop, "Mix Mode", "Specify how the copied and existing transformations are combined");
1819 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1820
1822}
1823
1825{
1826 StructRNA *srna;
1827 PropertyRNA *prop;
1828
1829 static const EnumPropertyItem minmax_items[] = {
1830 {TRACK_X, "FLOOR_X", 0, "X", ""},
1831 {TRACK_Y, "FLOOR_Y", 0, "Y", ""},
1832 {TRACK_Z, "FLOOR_Z", 0, "Z", ""},
1833 {TRACK_nX, "FLOOR_NEGATIVE_X", 0, "-X", ""},
1834 {TRACK_nY, "FLOOR_NEGATIVE_Y", 0, "-Y", ""},
1835 {TRACK_nZ, "FLOOR_NEGATIVE_Z", 0, "-Z", ""},
1836 {0, nullptr, 0, nullptr, nullptr},
1837 };
1838
1839 srna = RNA_def_struct(brna, "FloorConstraint", "Constraint");
1841 srna, "Floor Constraint", "Use the target object for location limitation");
1842 RNA_def_struct_sdna_from(srna, "bMinMaxConstraint", "data");
1843 RNA_def_struct_ui_icon(srna, ICON_CON_FLOOR);
1844
1846
1848
1849 prop = RNA_def_property(srna, "floor_location", PROP_ENUM, PROP_NONE);
1850 RNA_def_property_enum_sdna(prop, nullptr, "minmaxflag");
1851 RNA_def_property_enum_items(prop, minmax_items);
1854 prop, "Floor Location", "Location of target that object will not pass through");
1855 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1856
1857 prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
1858 RNA_def_property_boolean_sdna(prop, nullptr, "flag", MINMAX_USEROT);
1859 RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor");
1860 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1861
1862 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
1864 RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object origin");
1865 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1866
1868}
1869
1871{
1872 StructRNA *srna;
1873 PropertyRNA *prop;
1874
1875 static const EnumPropertyItem transform_channel_items[] = {
1876 {20, "LOCATION_X", 0, "X Location", ""},
1877 {21, "LOCATION_Y", 0, "Y Location", ""},
1878 {22, "LOCATION_Z", 0, "Z Location", ""},
1879 {00, "ROTATION_X", 0, "X Rotation", ""},
1880 {01, "ROTATION_Y", 0, "Y Rotation", ""},
1881 {02, "ROTATION_Z", 0, "Z Rotation", ""},
1882 {10, "SCALE_X", 0, "X Scale", ""},
1883 {11, "SCALE_Y", 0, "Y Scale", ""},
1884 {12, "SCALE_Z", 0, "Z Scale", ""},
1885 {0, nullptr, 0, nullptr, nullptr},
1886 };
1887
1888 static const EnumPropertyItem mix_mode_items[] = {
1890 "REPLACE",
1891 0,
1892 "Replace",
1893 "Replace the original transformation with the action channels"},
1896 "BEFORE_FULL",
1897 0,
1898 "Before Original (Full)",
1899 "Apply the action channels before the original transformation, as if applied to an "
1900 "imaginary parent in Full Inherit Scale mode. Will create shear when combining rotation "
1901 "and non-uniform scale."},
1903 "BEFORE",
1904 0,
1905 "Before Original (Aligned)",
1906 "Apply the action channels before the original transformation, as if applied to an "
1907 "imaginary parent in Aligned Inherit Scale mode. This effectively uses Full for location "
1908 "and Split Channels for rotation and scale."},
1910 "BEFORE_SPLIT",
1911 0,
1912 "Before Original (Split Channels)",
1913 "Apply the action channels before the original transformation, handling location, rotation "
1914 "and scale separately"},
1917 "AFTER_FULL",
1918 0,
1919 "After Original (Full)",
1920 "Apply the action channels after the original transformation, as if applied to an "
1921 "imaginary child in Full Inherit Scale mode. Will create shear when combining rotation "
1922 "and non-uniform scale."},
1924 "AFTER",
1925 0,
1926 "After Original (Aligned)",
1927 "Apply the action channels after the original transformation, as if applied to an "
1928 "imaginary child in Aligned Inherit Scale mode. This effectively uses Full for location "
1929 "and Split Channels for rotation and scale."},
1931 "AFTER_SPLIT",
1932 0,
1933 "After Original (Split Channels)",
1934 "Apply the action channels after the original transformation, handling location, rotation "
1935 "and scale separately"},
1936 {0, nullptr, 0, nullptr, nullptr},
1937 };
1938
1939 srna = RNA_def_struct(brna, "ActionConstraint", "Constraint");
1941 srna, "Action Constraint", "Map an action to the transform axes of a bone");
1942 RNA_def_struct_sdna_from(srna, "bActionConstraint", "data");
1943 RNA_def_struct_ui_icon(srna, ICON_CON_ACTION);
1944
1946
1948
1949 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
1950 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode");
1951 RNA_def_property_enum_items(prop, mix_mode_items);
1952 RNA_def_property_enum_funcs(prop, nullptr, "rna_ActionConstraint_mix_mode_set", nullptr);
1954 prop,
1955 "Mix Mode",
1956 "Specify how existing transformations and the action channels are combined");
1957 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1958
1959 prop = RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE);
1960 RNA_def_property_enum_sdna(prop, nullptr, "type");
1962 RNA_def_property_enum_items(prop, transform_channel_items);
1964 prop,
1965 "Transform Channel",
1966 "Transformation channel from the target that is used to key the Action");
1967 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1968
1969 prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
1970 RNA_def_property_pointer_sdna(prop, nullptr, "act");
1972 prop, nullptr, "rna_ActionConstraint_action_set", nullptr, "rna_Action_id_poll");
1973 RNA_def_property_ui_text(prop, "Action", "The constraining action");
1975 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
1976
1977 /* This property is not necessary for the Python API (that is better off using
1978 * slot references/pointers directly), but it is needed for library overrides
1979 * to work. */
1980 prop = RNA_def_property(srna, "action_slot_handle", PROP_INT, PROP_NONE);
1981 RNA_def_property_int_sdna(prop, nullptr, "action_slot_handle");
1983 prop, nullptr, "rna_ActionConstraint_action_slot_handle_set", nullptr);
1985 "Action Slot Handle",
1986 "A number that identifies which sub-set of the Action is considered "
1987 "to be for this Action Constraint");
1990 prop, "rna_ActionConstraint_action_slot_handle_override_diff", nullptr, nullptr);
1991 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_Constraint_update");
1992
1993 prop = RNA_def_property(srna, "last_slot_identifier", PROP_STRING, PROP_NONE);
1994 RNA_def_property_string_sdna(prop, nullptr, "last_slot_identifier");
1996 prop,
1997 "Last Action Slot Identifier",
1998 "The identifier of the most recently assigned action slot. The slot identifies which "
1999 "sub-set of the Action is considered to be for this constraint, and its identifier is used "
2000 "to find the right slot when assigning an Action.");
2001
2002 prop = RNA_def_property(srna, "action_slot", PROP_POINTER, PROP_NONE);
2003 RNA_def_property_struct_type(prop, "ActionSlot");
2007 prop,
2008 "Action Slot",
2009 "The slot identifies which sub-set of the Action is considered to be for this "
2010 "strip, and its name is used to find the right slot when assigning another Action");
2012 "rna_ActionConstraint_action_slot_get",
2013 "rna_ActionConstraint_action_slot_set",
2014 nullptr,
2015 nullptr);
2016 RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_Constraint_update");
2017 /* `strip.action_slot` is exposed to RNA as a pointer for things like the action slot selector in
2018 * the GUI. The ground truth of the assigned slot, however, is `action_slot_handle` declared
2019 * above. That property is used for library override operations, and this pointer property should
2020 * just be ignored.
2021 *
2022 * This needs PROPOVERRIDE_IGNORE; PROPOVERRIDE_NO_COMPARISON is not suitable here. This property
2023 * should act as if it is an overridable property (as from the user's perspective, it is), but an
2024 * override operation should not be created for it. It will be created for `action_slot_handle`,
2025 * and that's enough. */
2027
2028 prop = RNA_def_property(srna, "action_suitable_slots", PROP_COLLECTION, PROP_NONE);
2029 RNA_def_property_struct_type(prop, "ActionSlot");
2031 "rna_iterator_ActionConstraint_action_suitable_slots_begin",
2032 "rna_iterator_array_next",
2033 "rna_iterator_array_end",
2034 "rna_iterator_array_dereference_get",
2035 nullptr,
2036 nullptr,
2037 nullptr,
2038 nullptr);
2040 prop, "Action Slots", "The list of action slots suitable for this NLA strip");
2041
2042 prop = RNA_def_property(srna, "use_bone_object_action", PROP_BOOLEAN, PROP_NONE);
2045 "Object Action",
2046 "Bones only: apply the object's transformation channels of the action "
2047 "to the constrained bone, instead of bone's channels");
2048 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2049
2050 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
2051 RNA_def_property_int_sdna(prop, nullptr, "start");
2053 RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use");
2054 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2055
2056 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
2057 RNA_def_property_int_sdna(prop, nullptr, "end");
2059 RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use");
2060 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2061
2062 prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
2063 RNA_def_property_float_sdna(prop, nullptr, "max");
2064 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2065 RNA_def_property_ui_text(prop, "Maximum", "Maximum value for target channel range");
2066 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2067 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_ActionConstraint_minmax_range");
2068
2069 prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
2070 RNA_def_property_float_sdna(prop, nullptr, "min");
2071 RNA_def_property_range(prop, -1000.0f, 1000.0f);
2072 RNA_def_property_ui_text(prop, "Minimum", "Minimum value for target channel range");
2073 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2074 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_ActionConstraint_minmax_range");
2075
2076 prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_FACTOR);
2077 RNA_def_property_float_sdna(prop, nullptr, "eval_time");
2078 RNA_def_property_range(prop, 0.0f, 1.0f);
2080 prop, "Evaluation Time", "Interpolates between Action Start and End frames");
2081 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2082
2083 prop = RNA_def_property(srna, "use_eval_time", PROP_BOOLEAN, PROP_NONE);
2086 "Use Evaluation Time",
2087 "Interpolate between Action Start and End frames, with the Evaluation "
2088 "Time slider instead of the Target object/bone");
2089 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2090
2092}
2093
2095{
2096 StructRNA *srna;
2097 PropertyRNA *prop;
2098
2099 static const EnumPropertyItem lock_items[] = {
2100 {TRACK_X, "LOCK_X", 0, "X", ""},
2101 {TRACK_Y, "LOCK_Y", 0, "Y", ""},
2102 {TRACK_Z, "LOCK_Z", 0, "Z", ""},
2103 {0, nullptr, 0, nullptr, nullptr},
2104 };
2105
2106 srna = RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
2108 srna,
2109 "Locked Track Constraint",
2110 "Point toward the target along the track axis, while locking the other axis");
2111 RNA_def_struct_ui_icon(srna, ICON_CON_LOCKTRACK);
2112
2114
2115 RNA_def_struct_sdna_from(srna, "bLockTrackConstraint", "data");
2116
2118
2120
2121 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
2122 RNA_def_property_enum_sdna(prop, nullptr, "trackflag");
2125 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
2126 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2127
2128 prop = RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
2129 RNA_def_property_enum_sdna(prop, nullptr, "lockflag");
2130 RNA_def_property_enum_items(prop, lock_items);
2132 RNA_def_property_ui_text(prop, "Locked Axis", "Axis that points upward");
2133 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2134
2136}
2137
2139{
2140 StructRNA *srna;
2141 PropertyRNA *prop;
2142
2143 static const EnumPropertyItem forwardpath_items[] = {
2144 {TRACK_X, "FORWARD_X", 0, "X", ""},
2145 {TRACK_Y, "FORWARD_Y", 0, "Y", ""},
2146 {TRACK_Z, "FORWARD_Z", 0, "Z", ""},
2147 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
2148 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
2149 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
2150 {0, nullptr, 0, nullptr, nullptr},
2151 };
2152
2153 static const EnumPropertyItem pathup_items[] = {
2154 {TRACK_X, "UP_X", 0, "X", ""},
2155 {TRACK_Y, "UP_Y", 0, "Y", ""},
2156 {TRACK_Z, "UP_Z", 0, "Z", ""},
2157 {0, nullptr, 0, nullptr, nullptr},
2158 };
2159
2160 srna = RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
2161 RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Lock motion to the target path");
2162 RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data");
2163 RNA_def_struct_ui_icon(srna, ICON_CON_FOLLOWPATH);
2164
2166
2167 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
2168 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
2169 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Curve_object_poll");
2170 RNA_def_property_ui_text(prop, "Target", "Target Curve object");
2172 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
2173
2174 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TIME);
2177 prop, "Offset", "Offset from the position corresponding to the time frame");
2178 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2179
2180 prop = RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR);
2181 RNA_def_property_float_sdna(prop, nullptr, "offset_fac");
2183 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 3);
2185 prop, "Offset Factor", "Percentage value defining target position along length of curve");
2186 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2187
2188 prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
2189 RNA_def_property_enum_sdna(prop, nullptr, "trackflag");
2190 RNA_def_property_enum_items(prop, forwardpath_items);
2192 RNA_def_property_ui_text(prop, "Forward Axis", "Axis that points forward along the path");
2193 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2194
2195 prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
2196 RNA_def_property_enum_sdna(prop, nullptr, "upflag");
2197 RNA_def_property_enum_items(prop, pathup_items);
2199 RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
2200 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2201
2202 prop = RNA_def_property(srna, "use_curve_follow", PROP_BOOLEAN, PROP_NONE);
2203 RNA_def_property_boolean_sdna(prop, nullptr, "followflag", FOLLOWPATH_FOLLOW);
2205 prop, "Follow Curve", "Object will follow the heading and banking of the curve");
2206 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2207
2208 prop = RNA_def_property(srna, "use_fixed_location", PROP_BOOLEAN, PROP_NONE);
2209 RNA_def_property_boolean_sdna(prop, nullptr, "followflag", FOLLOWPATH_STATIC);
2211 prop,
2212 "Fixed Position",
2213 "Object will stay locked to a single point somewhere along the length of the curve "
2214 "regardless of time");
2215 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2216
2217 prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
2218 RNA_def_property_boolean_sdna(prop, nullptr, "followflag", FOLLOWPATH_RADIUS);
2219 RNA_def_property_ui_text(prop, "Curve Radius", "Object is scaled by the curve radius");
2220 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2221
2223}
2224
2226{
2227 StructRNA *srna;
2228 PropertyRNA *prop;
2229
2230 static const EnumPropertyItem volume_items[] = {
2231 {VOLUME_XZ, "VOLUME_XZX", 0, "XZ", ""},
2232 {VOLUME_X, "VOLUME_X", 0, "X", ""},
2233 {VOLUME_Z, "VOLUME_Z", 0, "Z", ""},
2234 {NO_VOLUME, "NO_VOLUME", 0, "None", ""},
2235 {0, nullptr, 0, nullptr, nullptr},
2236 };
2237
2238 static const EnumPropertyItem plane_items[] = {
2239 {PLANE_X, "PLANE_X", 0, "XZ", "Rotate around local X, then Z"},
2240 {PLANE_Z, "PLANE_Z", 0, "ZX", "Rotate around local Z, then X"},
2241 {SWING_Y,
2242 "SWING_Y",
2243 0,
2244 "Swing",
2245 "Use the smallest single axis rotation, similar to Damped Track"},
2246 {0, nullptr, 0, nullptr, nullptr},
2247 };
2248
2249 srna = RNA_def_struct(brna, "StretchToConstraint", "Constraint");
2250 RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretch to meet the target object");
2251 RNA_def_struct_ui_icon(srna, ICON_CON_STRETCHTO);
2252
2254
2255 RNA_def_struct_sdna_from(srna, "bStretchToConstraint", "data");
2256
2258
2260
2261 prop = RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
2262 RNA_def_property_enum_sdna(prop, nullptr, "volmode");
2263 RNA_def_property_enum_items(prop, volume_items);
2265 prop, "Maintain Volume", "Maintain the object's volume as it stretches");
2266 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2267
2268 prop = RNA_def_property(srna, "keep_axis", PROP_ENUM, PROP_NONE);
2269 RNA_def_property_enum_sdna(prop, nullptr, "plane");
2270 RNA_def_property_enum_items(prop, plane_items);
2272 RNA_def_property_ui_text(prop, "Keep Axis", "The rotation type and axis order to use");
2273 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2274
2275 prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_DISTANCE);
2276 RNA_def_property_float_sdna(prop, nullptr, "orglength");
2277 RNA_def_property_range(prop, 0.0f, 1000.0f);
2279 RNA_def_property_ui_text(prop, "Original Length", "Length at rest position");
2280 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2281
2282 prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
2283 RNA_def_property_range(prop, 0.0, 100.0f);
2286 prop, "Volume Variation", "Factor between volume variation and stretching");
2287 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2288
2289 prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
2292 prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
2293 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2294
2295 prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
2298 prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
2299 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2300
2301 prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
2302 RNA_def_property_range(prop, 0.0, 1.0f);
2304 RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
2305 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2306
2307 prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
2308 RNA_def_property_range(prop, 1.0, 100.0f);
2310 RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
2311 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2312
2313 prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
2314 RNA_def_property_range(prop, 0.0, 1.0f);
2316 prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
2317 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2318
2320}
2321
2323{
2324 StructRNA *srna;
2325 PropertyRNA *prop;
2326
2327 static const EnumPropertyItem clamp_items[] = {
2328 {CLAMPTO_AUTO, "CLAMPTO_AUTO", 0, "Auto", ""},
2329 {CLAMPTO_X, "CLAMPTO_X", 0, "X", ""},
2330 {CLAMPTO_Y, "CLAMPTO_Y", 0, "Y", ""},
2331 {CLAMPTO_Z, "CLAMPTO_Z", 0, "Z", ""},
2332 {0, nullptr, 0, nullptr, nullptr},
2333 };
2334
2335 srna = RNA_def_struct(brna, "ClampToConstraint", "Constraint");
2337 srna,
2338 "Clamp To Constraint",
2339 "Constrain an object's location to the nearest point along the target path");
2340 RNA_def_struct_sdna_from(srna, "bClampToConstraint", "data");
2341 RNA_def_struct_ui_icon(srna, ICON_CON_CLAMPTO);
2342
2344
2345 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
2346 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
2347 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Curve_object_poll");
2348 RNA_def_property_ui_text(prop, "Target", "Target Object (Curves only)");
2350 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
2351
2352 prop = RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE);
2353 RNA_def_property_enum_sdna(prop, nullptr, "flag");
2354 RNA_def_property_enum_items(prop, clamp_items);
2355 RNA_def_property_ui_text(prop, "Main Axis", "Main axis of movement");
2356 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2357
2358 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
2359 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", CLAMPTO_CYCLIC);
2361 prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box)");
2362 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2363
2365}
2366
2368{
2369 StructRNA *srna;
2370 PropertyRNA *prop;
2371
2372 static const EnumPropertyItem transform_items[] = {
2373 {TRANS_LOCATION, "LOCATION", 0, "Location", ""},
2374 {TRANS_ROTATION, "ROTATION", 0, "Rotation", ""},
2375 {TRANS_SCALE, "SCALE", 0, "Scale", ""},
2376 {0, nullptr, 0, nullptr, nullptr},
2377 };
2378
2379 static const EnumPropertyItem mix_mode_loc_items[] = {
2380 {TRANS_MIXLOC_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
2381 {TRANS_MIXLOC_ADD, "ADD", 0, "Add", "Add component values together"},
2382 {0, nullptr, 0, nullptr, nullptr},
2383 };
2384
2385 static const EnumPropertyItem mix_mode_rot_items[] = {
2386 {TRANS_MIXROT_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
2387 {TRANS_MIXROT_ADD, "ADD", 0, "Add", "Add component values together"},
2389 "BEFORE",
2390 0,
2391 "Before Original",
2392 "Apply new rotation before original, as if it was on a parent"},
2394 "AFTER",
2395 0,
2396 "After Original",
2397 "Apply new rotation after original, as if it was on a child"},
2398 {0, nullptr, 0, nullptr, nullptr},
2399 };
2400
2401 static const EnumPropertyItem mix_mode_scale_items[] = {
2402 {TRANS_MIXSCALE_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
2403 {TRANS_MIXSCALE_MULTIPLY, "MULTIPLY", 0, "Multiply", "Multiply component values together"},
2404 {0, nullptr, 0, nullptr, nullptr},
2405 };
2406
2407 srna = RNA_def_struct(brna, "TransformConstraint", "Constraint");
2409 srna, "Transformation Constraint", "Map transformations of the target to the object");
2410 RNA_def_struct_sdna_from(srna, "bTransformConstraint", "data");
2411 RNA_def_struct_ui_icon(srna, ICON_CON_TRANSFORM);
2412
2414
2416
2417 prop = RNA_def_property(srna, "map_from", PROP_ENUM, PROP_NONE);
2418 RNA_def_property_enum_sdna(prop, nullptr, "from");
2419 RNA_def_property_enum_items(prop, transform_items);
2420 RNA_def_property_ui_text(prop, "Map From", "The transformation type to use from the target");
2421 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2422
2423 prop = RNA_def_property(srna, "map_to", PROP_ENUM, PROP_NONE);
2424 RNA_def_property_enum_sdna(prop, nullptr, "to");
2425 RNA_def_property_enum_items(prop, transform_items);
2427 prop, "Map To", "The transformation type to affect on the constrained object");
2428 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2429
2430 prop = RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE);
2431 RNA_def_property_enum_sdna(prop, nullptr, "map[0]");
2434 prop, "Map To X From", "The source axis constrained object's X axis uses");
2435 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2436
2437 prop = RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE);
2438 RNA_def_property_enum_sdna(prop, nullptr, "map[1]");
2442 prop, "Map To Y From", "The source axis constrained object's Y axis uses");
2443 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2444
2445 prop = RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE);
2446 RNA_def_property_enum_sdna(prop, nullptr, "map[2]");
2450 prop, "Map To Z From", "The source axis constrained object's Z axis uses");
2451 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2452
2453 prop = RNA_def_property(srna, "use_motion_extrapolate", PROP_BOOLEAN, PROP_NONE);
2454 RNA_def_property_boolean_sdna(prop, nullptr, "expo", CLAMPTO_CYCLIC);
2455 RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges");
2456 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2457
2458 prop = RNA_def_property(srna, "from_rotation_mode", PROP_ENUM, PROP_NONE);
2459 RNA_def_property_enum_sdna(prop, nullptr, "from_rotation_mode");
2461 RNA_def_property_ui_text(prop, "From Mode", "Specify the type of rotation channels to use");
2462 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2463
2464 prop = RNA_def_property(srna, "to_euler_order", PROP_ENUM, PROP_NONE);
2465 RNA_def_property_enum_sdna(prop, nullptr, "to_euler_order");
2467 RNA_def_property_ui_text(prop, "To Order", "Explicitly specify the output euler rotation order");
2468 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2469
2470 /* Loc */
2471 prop = RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
2472 RNA_def_property_float_sdna(prop, nullptr, "from_min[0]");
2473 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2474 RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
2475 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2476
2477 prop = RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
2478 RNA_def_property_float_sdna(prop, nullptr, "from_min[1]");
2479 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2480 RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
2481 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2482
2483 prop = RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
2484 RNA_def_property_float_sdna(prop, nullptr, "from_min[2]");
2485 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2486 RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
2487 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2488
2489 prop = RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
2490 RNA_def_property_float_sdna(prop, nullptr, "from_max[0]");
2491 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2492 RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
2493 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2494
2495 prop = RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
2496 RNA_def_property_float_sdna(prop, nullptr, "from_max[1]");
2497 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2498 RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
2499 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2500
2501 prop = RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
2502 RNA_def_property_float_sdna(prop, nullptr, "from_max[2]");
2503 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2504 RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
2505 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2506
2507 prop = RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
2508 RNA_def_property_float_sdna(prop, nullptr, "to_min[0]");
2509 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2510 RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
2511 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2512
2513 prop = RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
2514 RNA_def_property_float_sdna(prop, nullptr, "to_min[1]");
2515 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2516 RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
2517 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2518
2519 prop = RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
2520 RNA_def_property_float_sdna(prop, nullptr, "to_min[2]");
2521 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2522 RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
2523 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2524
2525 prop = RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
2526 RNA_def_property_float_sdna(prop, nullptr, "to_max[0]");
2527 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2528 RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
2529 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2530
2531 prop = RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
2532 RNA_def_property_float_sdna(prop, nullptr, "to_max[1]");
2533 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2534 RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
2535 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2536
2537 prop = RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
2538 RNA_def_property_float_sdna(prop, nullptr, "to_max[2]");
2539 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2540 RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
2541 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2542
2543 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
2544 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode_loc");
2545 RNA_def_property_enum_items(prop, mix_mode_loc_items);
2547 prop, "Location Mix Mode", "Specify how to combine the new location with original");
2548 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2549
2550 /* Rot */
2551 prop = RNA_def_property(srna, "from_min_x_rot", PROP_FLOAT, PROP_ANGLE);
2552 RNA_def_property_float_sdna(prop, nullptr, "from_min_rot[0]");
2554 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2555 RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
2556 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2557
2558 prop = RNA_def_property(srna, "from_min_y_rot", PROP_FLOAT, PROP_ANGLE);
2559 RNA_def_property_float_sdna(prop, nullptr, "from_min_rot[1]");
2561 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2562 RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
2563 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2564
2565 prop = RNA_def_property(srna, "from_min_z_rot", PROP_FLOAT, PROP_ANGLE);
2566 RNA_def_property_float_sdna(prop, nullptr, "from_min_rot[2]");
2568 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2569 RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
2570 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2571
2572 prop = RNA_def_property(srna, "from_max_x_rot", PROP_FLOAT, PROP_ANGLE);
2573 RNA_def_property_float_sdna(prop, nullptr, "from_max_rot[0]");
2575 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2576 RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
2577 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2578
2579 prop = RNA_def_property(srna, "from_max_y_rot", PROP_FLOAT, PROP_ANGLE);
2580 RNA_def_property_float_sdna(prop, nullptr, "from_max_rot[1]");
2582 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2583 RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
2584 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2585
2586 prop = RNA_def_property(srna, "from_max_z_rot", PROP_FLOAT, PROP_ANGLE);
2587 RNA_def_property_float_sdna(prop, nullptr, "from_max_rot[2]");
2589 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2590 RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
2591 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2592
2593 prop = RNA_def_property(srna, "to_min_x_rot", PROP_FLOAT, PROP_ANGLE);
2594 RNA_def_property_float_sdna(prop, nullptr, "to_min_rot[0]");
2596 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2597 RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
2598 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2599
2600 prop = RNA_def_property(srna, "to_min_y_rot", PROP_FLOAT, PROP_ANGLE);
2601 RNA_def_property_float_sdna(prop, nullptr, "to_min_rot[1]");
2603 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2604 RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
2605 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2606
2607 prop = RNA_def_property(srna, "to_min_z_rot", PROP_FLOAT, PROP_ANGLE);
2608 RNA_def_property_float_sdna(prop, nullptr, "to_min_rot[2]");
2610 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2611 RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
2612 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2613
2614 prop = RNA_def_property(srna, "to_max_x_rot", PROP_FLOAT, PROP_ANGLE);
2615 RNA_def_property_float_sdna(prop, nullptr, "to_max_rot[0]");
2617 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2618 RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
2619 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2620
2621 prop = RNA_def_property(srna, "to_max_y_rot", PROP_FLOAT, PROP_ANGLE);
2622 RNA_def_property_float_sdna(prop, nullptr, "to_max_rot[1]");
2624 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2625 RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
2626 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2627
2628 prop = RNA_def_property(srna, "to_max_z_rot", PROP_FLOAT, PROP_ANGLE);
2629 RNA_def_property_float_sdna(prop, nullptr, "to_max_rot[2]");
2631 prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, RNA_TRANSLATION_PREC_DEFAULT);
2632 RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
2633 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2634
2635 prop = RNA_def_property(srna, "mix_mode_rot", PROP_ENUM, PROP_NONE);
2636 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode_rot");
2637 RNA_def_property_enum_items(prop, mix_mode_rot_items);
2639 prop, "Rotation Mix Mode", "Specify how to combine the new rotation with original");
2640 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2641
2642 /* Scale */
2643 prop = RNA_def_property(srna, "from_min_x_scale", PROP_FLOAT, PROP_NONE);
2644 RNA_def_property_float_sdna(prop, nullptr, "from_min_scale[0]");
2645 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2647 RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
2648 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2649
2650 prop = RNA_def_property(srna, "from_min_y_scale", PROP_FLOAT, PROP_NONE);
2651 RNA_def_property_float_sdna(prop, nullptr, "from_min_scale[1]");
2652 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2654 RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
2655 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2656
2657 prop = RNA_def_property(srna, "from_min_z_scale", PROP_FLOAT, PROP_NONE);
2658 RNA_def_property_float_sdna(prop, nullptr, "from_min_scale[2]");
2659 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2661 RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
2662 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2663
2664 prop = RNA_def_property(srna, "from_max_x_scale", PROP_FLOAT, PROP_NONE);
2665 RNA_def_property_float_sdna(prop, nullptr, "from_max_scale[0]");
2666 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2668 RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
2669 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2670
2671 prop = RNA_def_property(srna, "from_max_y_scale", PROP_FLOAT, PROP_NONE);
2672 RNA_def_property_float_sdna(prop, nullptr, "from_max_scale[1]");
2673 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2675 RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
2676 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2677
2678 prop = RNA_def_property(srna, "from_max_z_scale", PROP_FLOAT, PROP_NONE);
2679 RNA_def_property_float_sdna(prop, nullptr, "from_max_scale[2]");
2680 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2682 RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
2683 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2684
2685 prop = RNA_def_property(srna, "to_min_x_scale", PROP_FLOAT, PROP_NONE);
2686 RNA_def_property_float_sdna(prop, nullptr, "to_min_scale[0]");
2687 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2689 RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
2690 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2691
2692 prop = RNA_def_property(srna, "to_min_y_scale", PROP_FLOAT, PROP_NONE);
2693 RNA_def_property_float_sdna(prop, nullptr, "to_min_scale[1]");
2694 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2696 RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
2697 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2698
2699 prop = RNA_def_property(srna, "to_min_z_scale", PROP_FLOAT, PROP_NONE);
2700 RNA_def_property_float_sdna(prop, nullptr, "to_min_scale[2]");
2701 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2703 RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
2704 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2705
2706 prop = RNA_def_property(srna, "to_max_x_scale", PROP_FLOAT, PROP_NONE);
2707 RNA_def_property_float_sdna(prop, nullptr, "to_max_scale[0]");
2708 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2710 RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
2711 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2712
2713 prop = RNA_def_property(srna, "to_max_y_scale", PROP_FLOAT, PROP_NONE);
2714 RNA_def_property_float_sdna(prop, nullptr, "to_max_scale[1]");
2715 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2717 RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
2718 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2719
2720 prop = RNA_def_property(srna, "to_max_z_scale", PROP_FLOAT, PROP_NONE);
2721 RNA_def_property_float_sdna(prop, nullptr, "to_max_scale[2]");
2722 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
2724 RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
2725 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2726
2727 prop = RNA_def_property(srna, "mix_mode_scale", PROP_ENUM, PROP_NONE);
2728 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode_scale");
2729 RNA_def_property_enum_items(prop, mix_mode_scale_items);
2731 prop, "Scale Mix Mode", "Specify how to combine the new scale with original");
2732 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2733
2735}
2736
2738{
2739 StructRNA *srna;
2740 PropertyRNA *prop;
2741
2742 srna = RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
2744 srna, "Limit Location Constraint", "Limit the location of the constrained object");
2745 RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data");
2746 RNA_def_struct_ui_icon(srna, ICON_CON_LOCLIMIT);
2747
2749
2750 prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
2751 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMIN);
2752 RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
2753 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2754
2755 prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
2756 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMIN);
2757 RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
2758 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2759
2760 prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
2761 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMIN);
2762 RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
2763 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2764
2765 prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
2766 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMAX);
2767 RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
2768 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2769
2770 prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
2771 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMAX);
2772 RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
2773 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2774
2775 prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
2776 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMAX);
2777 RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum 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_DISTANCE);
2781 RNA_def_property_float_sdna(prop, nullptr, "xmin");
2782 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2783 RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
2784 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2785
2786 prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_DISTANCE);
2787 RNA_def_property_float_sdna(prop, nullptr, "ymin");
2788 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2789 RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
2790 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2791
2792 prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_DISTANCE);
2793 RNA_def_property_float_sdna(prop, nullptr, "zmin");
2794 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2795 RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
2796 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2797
2798 prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_DISTANCE);
2799 RNA_def_property_float_sdna(prop, nullptr, "xmax");
2800 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2801 RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
2802 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2803
2804 prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_DISTANCE);
2805 RNA_def_property_float_sdna(prop, nullptr, "ymax");
2806 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2807 RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
2808 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2809
2810 prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_DISTANCE);
2811 RNA_def_property_float_sdna(prop, nullptr, "zmax");
2812 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
2813 RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
2814 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2815
2816 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
2817 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", LIMIT_TRANSFORM);
2819 prop, "Affect Transform", "Transform tools are affected by this constraint as well");
2820 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2821
2823}
2824
2826{
2827 StructRNA *srna;
2828 PropertyRNA *prop;
2829
2830 srna = RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
2832 srna, "Limit Rotation Constraint", "Limit the rotation of the constrained object");
2833 RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data");
2834 RNA_def_struct_ui_icon(srna, ICON_CON_ROTLIMIT);
2835
2837
2838 prop = RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
2839 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XROT);
2840 RNA_def_property_ui_text(prop, "Limit X", "Use the minimum X value");
2841 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2842
2843 prop = RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
2844 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YROT);
2845 RNA_def_property_ui_text(prop, "Limit Y", "Use the minimum Y value");
2846 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2847
2848 prop = RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
2849 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZROT);
2850 RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value");
2851 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2852
2853 prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE);
2854 RNA_def_property_float_sdna(prop, nullptr, "xmin");
2855 RNA_def_property_range(prop, -1000.0, 1000.0f);
2856 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2857 RNA_def_property_ui_text(prop, "Minimum X", "Lower X angle bound");
2858 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2859
2860 prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE);
2861 RNA_def_property_float_sdna(prop, nullptr, "ymin");
2862 RNA_def_property_range(prop, -1000.0, 1000.0f);
2863 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2864 RNA_def_property_ui_text(prop, "Minimum Y", "Lower Y angle bound");
2865 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2866
2867 prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_ANGLE);
2868 RNA_def_property_float_sdna(prop, nullptr, "zmin");
2869 RNA_def_property_range(prop, -1000.0, 1000.0f);
2870 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2871 RNA_def_property_ui_text(prop, "Minimum Z", "Lower Z angle bound");
2872 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2873
2874 prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE);
2875 RNA_def_property_float_sdna(prop, nullptr, "xmax");
2876 RNA_def_property_range(prop, -1000.0, 1000.0f);
2877 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2878 RNA_def_property_ui_text(prop, "Maximum X", "Upper X angle bound");
2879 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2880
2881 prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE);
2882 RNA_def_property_float_sdna(prop, nullptr, "ymax");
2883 RNA_def_property_range(prop, -1000.0, 1000.0f);
2884 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2885 RNA_def_property_ui_text(prop, "Maximum Y", "Upper Y angle bound");
2886 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2887
2888 prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_ANGLE);
2889 RNA_def_property_float_sdna(prop, nullptr, "zmax");
2890 RNA_def_property_range(prop, -1000.0, 1000.0f);
2891 RNA_def_property_ui_range(prop, -2 * M_PI, 2 * M_PI, 10.0f, 1.0f);
2892 RNA_def_property_ui_text(prop, "Maximum Z", "Upper Z angle bound");
2893 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2894
2895 prop = RNA_def_property(srna, "euler_order", PROP_ENUM, PROP_NONE);
2896 RNA_def_property_enum_sdna(prop, nullptr, "euler_order");
2898 RNA_def_property_ui_text(prop, "Euler Order", "Explicitly specify the euler rotation order");
2899 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2900
2901 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
2902 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", LIMIT_TRANSFORM);
2904 prop, "Affect Transform", "Transform tools are affected by this constraint as well");
2905 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2906
2907 prop = RNA_def_property(srna, "use_legacy_behavior", PROP_BOOLEAN, PROP_NONE);
2910 prop,
2911 "Legacy Behavior",
2912 "Use the old semi-broken behavior that does not understand that rotations loop around");
2913 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2914
2916}
2917
2919{
2920 StructRNA *srna;
2921 PropertyRNA *prop;
2922
2923 srna = RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
2925 srna, "Limit Size Constraint", "Limit the scaling of the constrained object");
2926 RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data");
2927 RNA_def_struct_ui_icon(srna, ICON_CON_SIZELIMIT);
2928
2930
2931 prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
2932 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMIN);
2933 RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
2934 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2935
2936 prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
2937 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMIN);
2938 RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
2939 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2940
2941 prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
2942 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMIN);
2943 RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
2944 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2945
2946 prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
2947 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_XMAX);
2948 RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
2949 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2950
2951 prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
2952 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_YMAX);
2953 RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
2954 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2955
2956 prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
2957 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMIT_ZMAX);
2958 RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
2959 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2960
2961 prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
2962 RNA_def_property_float_sdna(prop, nullptr, "xmin");
2963 RNA_def_property_range(prop, -1000.0, 1000.0f);
2964 RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
2965 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2966
2967 prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
2968 RNA_def_property_float_sdna(prop, nullptr, "ymin");
2969 RNA_def_property_range(prop, -1000.0, 1000.0f);
2970 RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
2971 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2972
2973 prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_NONE);
2974 RNA_def_property_float_sdna(prop, nullptr, "zmin");
2975 RNA_def_property_range(prop, -1000.0, 1000.0f);
2976 RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
2977 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2978
2979 prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
2980 RNA_def_property_float_sdna(prop, nullptr, "xmax");
2981 RNA_def_property_range(prop, -1000.0, 1000.0f);
2982 RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
2983 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2984
2985 prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
2986 RNA_def_property_float_sdna(prop, nullptr, "ymax");
2987 RNA_def_property_range(prop, -1000.0, 1000.0f);
2988 RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
2989 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2990
2991 prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_NONE);
2992 RNA_def_property_float_sdna(prop, nullptr, "zmax");
2993 RNA_def_property_range(prop, -1000.0, 1000.0f);
2994 RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
2995 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
2996
2997 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
2998 RNA_def_property_boolean_sdna(prop, nullptr, "flag2", LIMIT_TRANSFORM);
3000 prop, "Affect Transform", "Transform tools are affected by this constraint as well");
3001 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3002
3004}
3005
3007{
3008 StructRNA *srna;
3009 PropertyRNA *prop;
3010
3011 srna = RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
3013 srna, "Limit Distance Constraint", "Limit the distance from target object");
3014
3016
3017 RNA_def_struct_sdna_from(srna, "bDistLimitConstraint", "data");
3018 RNA_def_struct_ui_icon(srna, ICON_CON_DISTLIMIT);
3019
3021
3023
3024 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
3025 RNA_def_property_float_sdna(prop, nullptr, "dist");
3027 RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
3028 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3029
3030 prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
3031 RNA_def_property_enum_sdna(prop, nullptr, "mode");
3034 prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
3035 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3036
3037 prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
3038 RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIMITDIST_TRANSFORM);
3040 prop, "Affect Transform", "Transforms are affected by this constraint as well");
3041 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3042
3044}
3045
3047{
3048 StructRNA *srna;
3049 PropertyRNA *prop;
3050
3051 static const EnumPropertyItem type_items[] = {
3053 "NEAREST_SURFACE",
3054 0,
3055 "Nearest Surface Point",
3056 "Shrink the location to the nearest target surface"},
3058 "PROJECT",
3059 0,
3060 "Project",
3061 "Shrink the location to the nearest target surface along a given axis"},
3063 "NEAREST_VERTEX",
3064 0,
3065 "Nearest Vertex",
3066 "Shrink the location to the nearest target vertex"},
3068 "TARGET_PROJECT",
3069 0,
3070 "Target Normal Project",
3071 "Shrink the location to the nearest target surface "
3072 "along the interpolated vertex normals of the target"},
3073 {0, nullptr, 0, nullptr, nullptr},
3074 };
3075
3076 static const EnumPropertyItem shrink_face_cull_items[] = {
3077 {0, "OFF", 0, "Off", "No culling"},
3079 "FRONT",
3080 0,
3081 "Front",
3082 "No projection when in front of the face"},
3084 "BACK",
3085 0,
3086 "Back",
3087 "No projection when behind the face"},
3088 {0, nullptr, 0, nullptr, nullptr},
3089 };
3090
3091 srna = RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
3093 srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship");
3094 RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
3095 RNA_def_struct_ui_icon(srna, ICON_CON_SHRINKWRAP);
3096
3098
3099 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3100 RNA_def_property_pointer_sdna(prop, nullptr, "target"); /* TODO: mesh type. */
3101 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Mesh_object_poll");
3102 RNA_def_property_ui_text(prop, "Target", "Target Mesh object");
3104 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3105
3106 prop = RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
3107 RNA_def_property_enum_sdna(prop, nullptr, "shrinkType");
3108 RNA_def_property_enum_items(prop, type_items);
3110 prop, "Shrinkwrap Type", "Select type of shrinkwrap algorithm for target position");
3111 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3112
3113 prop = RNA_def_property(srna, "wrap_mode", PROP_ENUM, PROP_NONE);
3114 RNA_def_property_enum_sdna(prop, nullptr, "shrinkMode");
3117 prop, "Snap Mode", "Select how to constrain the object to the target surface");
3118 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3119
3120 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
3121 RNA_def_property_float_sdna(prop, nullptr, "dist");
3122 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3124 RNA_def_property_ui_text(prop, "Distance", "Distance to Target");
3125 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3126
3127 prop = RNA_def_property(srna, "project_axis", PROP_ENUM, PROP_NONE);
3128 RNA_def_property_enum_sdna(prop, nullptr, "projAxis");
3131 RNA_def_property_ui_text(prop, "Project Axis", "Axis constrain to");
3132 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3133
3134 prop = RNA_def_property(srna, "project_axis_space", PROP_ENUM, PROP_NONE);
3135 RNA_def_property_enum_sdna(prop, nullptr, "projAxisSpace");
3138 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Constraint_owner_space_itemf");
3139 RNA_def_property_ui_text(prop, "Axis Space", "Space for the projection axis");
3140
3141 prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_DISTANCE);
3142 RNA_def_property_float_sdna(prop, nullptr, "projLimit");
3143 RNA_def_property_range(prop, 0.0f, FLT_MAX);
3146 prop, "Project Distance", "Limit the distance used for projection (zero disables)");
3147 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3148
3149 prop = RNA_def_property(srna, "use_project_opposite", PROP_BOOLEAN, PROP_NONE);
3152 prop, "Project Opposite", "Project in both specified and opposite directions");
3153 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3154
3155 prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
3156 RNA_def_property_enum_sdna(prop, nullptr, "flag");
3157 RNA_def_property_enum_items(prop, shrink_face_cull_items);
3159 "rna_ShrinkwrapConstraint_face_cull_get",
3160 "rna_ShrinkwrapConstraint_face_cull_set",
3161 nullptr);
3163 prop,
3164 "Face Cull",
3165 "Stop vertices from projecting to a face on the target when facing towards/away");
3166 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3167
3168 prop = RNA_def_property(srna, "use_invert_cull", PROP_BOOLEAN, PROP_NONE);
3171 prop, "Invert Cull", "When projecting in the opposite direction invert the face cull mode");
3172 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3173
3174 prop = RNA_def_property(srna, "use_track_normal", PROP_BOOLEAN, PROP_NONE);
3177 prop, "Align Axis To Normal", "Align the specified axis to the surface normal");
3178 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3179
3180 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
3181 RNA_def_property_enum_sdna(prop, nullptr, "trackAxis");
3183 RNA_def_property_ui_text(prop, "Track Axis", "Axis that is aligned to the normal");
3184 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3185
3187}
3188
3190{
3191 StructRNA *srna;
3192 PropertyRNA *prop;
3193
3194 srna = RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
3196 srna, "Damped Track Constraint", "Point toward target by taking the shortest rotation path");
3197 RNA_def_struct_ui_icon(srna, ICON_CON_TRACKTO);
3198
3200
3201 RNA_def_struct_sdna_from(srna, "bDampTrackConstraint", "data");
3202
3204
3206
3207 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
3208 RNA_def_property_enum_sdna(prop, nullptr, "trackflag");
3211 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
3212 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3213
3215}
3216
3218{
3219 StructRNA *srna;
3220 PropertyRNA *prop;
3221
3222 static const EnumPropertyItem splineik_xz_scale_mode[] = {
3223 {CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes"},
3225 "BONE_ORIGINAL",
3226 0,
3227 "Bone Original",
3228 "Use the original scaling of the bones"},
3230 "INVERSE_PRESERVE",
3231 0,
3232 "Inverse Scale",
3233 "Scale of the X and Z axes is the inverse of the Y-Scale"},
3235 "VOLUME_PRESERVE",
3236 0,
3237 "Volume Preservation",
3238 "Scale of the X and Z axes are adjusted to preserve the volume of the bones"},
3239 {0, nullptr, 0, nullptr, nullptr},
3240 };
3241
3242 static const EnumPropertyItem splineik_y_scale_mode[] = {
3243 {CONSTRAINT_SPLINEIK_YS_NONE, "NONE", 0, "None", "Don't scale in the Y axis"},
3245 "FIT_CURVE",
3246 0,
3247 "Fit Curve",
3248 "Scale the bones to fit the entire length of the curve"},
3250 "BONE_ORIGINAL",
3251 0,
3252 "Bone Original",
3253 "Use the original Y scale of the bone"},
3254 {0, nullptr, 0, nullptr, nullptr},
3255 };
3256
3257 srna = RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
3258 RNA_def_struct_ui_text(srna, "Spline IK Constraint", "Align 'n' bones along a curve");
3259 RNA_def_struct_sdna_from(srna, "bSplineIKConstraint", "data");
3260 RNA_def_struct_ui_icon(srna, ICON_CON_SPLINEIK);
3261
3263
3264 /* target chain */
3265 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3266 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
3267 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, "rna_Curve_object_poll");
3268 RNA_def_property_ui_text(prop, "Target", "Curve that controls this relationship");
3270 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3271
3272 prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
3273 RNA_def_property_int_sdna(prop, nullptr, "chainlen");
3274 /* Changing the IK chain length requires a rebuild of depsgraph relations. This makes it
3275 * unsuitable for animation. */
3277 /* This should be capped at 255 if compatibility with Blender 5.x and earlier is important. */
3278 RNA_def_property_range(prop, 1, 255);
3279 RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain");
3280 /* XXX: this update goes wrong... needs extra flush? */
3281 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3282
3283 /* direct access to bindings */
3284 /* NOTE: only to be used by experienced users */
3285 prop = RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR);
3286 RNA_def_property_array(prop, 32); /* XXX this is the maximum value allowed - why? */
3288 RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length");
3290 "rna_SplineIKConstraint_joint_bindings_get",
3291 "rna_SplineIKConstraint_joint_bindings_set",
3292 nullptr);
3294 prop,
3295 "Joint Bindings",
3296 "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain, "
3297 "as percentages");
3298 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3299
3300 /* settings */
3301 prop = RNA_def_property(srna, "use_chain_offset", PROP_BOOLEAN, PROP_NONE);
3304 prop, "Chain Offset", "Offset the entire chain relative to the root joint");
3305 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3306
3307 prop = RNA_def_property(srna, "use_even_divisions", PROP_BOOLEAN, PROP_NONE);
3310 "Even Divisions",
3311 "Ignore the relative lengths of the bones when fitting to the curve");
3312 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3313
3314 prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
3317 prop,
3318 "Use Curve Radius",
3319 "Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, "
3320 "on top of XZ Scale mode");
3321 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3322
3323 /* xz scaling mode */
3324 prop = RNA_def_property(srna, "xz_scale_mode", PROP_ENUM, PROP_NONE);
3325 RNA_def_property_enum_sdna(prop, nullptr, "xzScaleMode");
3326 RNA_def_property_enum_items(prop, splineik_xz_scale_mode);
3328 prop,
3329 "XZ Scale Mode",
3330 "Method used for determining the scaling of the X and Z axes of the bones");
3331 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3332
3333 /* y scaling mode */
3334 prop = RNA_def_property(srna, "y_scale_mode", PROP_ENUM, PROP_NONE);
3335 RNA_def_property_enum_sdna(prop, nullptr, "yScaleMode");
3336 RNA_def_property_enum_items(prop, splineik_y_scale_mode);
3339 "Y Scale Mode",
3340 "Method used for determining the scaling of the Y axis of the bones, "
3341 "on top of the shape and scaling of the curve itself");
3342 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3343
3344 /* take original scaling of the bone into account in volume preservation */
3345 prop = RNA_def_property(srna, "use_original_scale", PROP_BOOLEAN, PROP_NONE);
3349 prop, "Use Original Scale", "Apply volume preservation over the original scaling");
3350 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3351
3352 /* Volume preservation for "volumetric" scale mode. */
3353 prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
3354 RNA_def_property_range(prop, 0.0, 100.0f);
3357 prop, "Volume Variation", "Factor between volume variation and stretching");
3358 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3359
3360 prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
3363 prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
3364 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3365
3366 prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
3369 prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
3370 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3371
3372 prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
3373 RNA_def_property_range(prop, 0.0, 1.0f);
3375 RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
3376 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3377
3378 prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
3379 RNA_def_property_range(prop, 1.0, 100.0f);
3380 RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
3381 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3382
3383 prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
3384 RNA_def_property_range(prop, 0.0, 1.0f);
3386 prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
3387 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3388
3390}
3391
3393{
3394 StructRNA *srna;
3395 PropertyRNA *prop;
3396
3397 static const EnumPropertyItem pivot_rotAxis_items[] = {
3398 {PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"},
3400 "NX",
3401 0,
3402 "-X Rotation",
3403 "Use the pivot point in the negative rotation range around the X-axis"},
3405 "NY",
3406 0,
3407 "-Y Rotation",
3408 "Use the pivot point in the negative rotation range around the Y-axis"},
3410 "NZ",
3411 0,
3412 "-Z Rotation",
3413 "Use the pivot point in the negative rotation range around the Z-axis"},
3415 "X",
3416 0,
3417 "X Rotation",
3418 "Use the pivot point in the positive rotation range around the X-axis"},
3420 "Y",
3421 0,
3422 "Y Rotation",
3423 "Use the pivot point in the positive rotation range around the Y-axis"},
3425 "Z",
3426 0,
3427 "Z Rotation",
3428 "Use the pivot point in the positive rotation range around the Z-axis"},
3429 {0, nullptr, 0, nullptr, nullptr},
3430 };
3431
3432 srna = RNA_def_struct(brna, "PivotConstraint", "Constraint");
3433 RNA_def_struct_ui_text(srna, "Pivot Constraint", "Rotate around a different point");
3434
3436
3437 RNA_def_struct_sdna_from(srna, "bPivotConstraint", "data");
3438
3439 RNA_def_struct_ui_icon(srna, ICON_CON_PIVOT);
3440
3442
3443 /* target-defined pivot */
3444 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3445 RNA_def_property_pointer_sdna(prop, nullptr, "tar");
3447 prop, "Target", "Target Object, defining the position of the pivot when defined");
3449 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3450
3451 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
3452 RNA_def_property_string_sdna(prop, nullptr, "subtarget");
3453 RNA_def_property_ui_text(prop, "Sub-Target", "");
3454 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3455
3456 /* pivot offset */
3457 prop = RNA_def_property(srna, "use_relative_location", PROP_BOOLEAN, PROP_NONE);
3460 prop,
3461 "Use Relative Offset",
3462 "Offset will be an absolute point in space instead of relative to the target");
3463 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3464
3465 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
3466 RNA_def_property_float_sdna(prop, nullptr, "offset");
3468 "Offset",
3469 "Offset of pivot from target (when set), or from owner's location "
3470 "(when Fixed Position is off), or the absolute pivot point");
3471 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3472
3473 /* rotation-based activation */
3474 prop = RNA_def_property(srna, "rotation_range", PROP_ENUM, PROP_NONE);
3475 RNA_def_property_enum_sdna(prop, nullptr, "rotAxis");
3476 RNA_def_property_enum_items(prop, pivot_rotAxis_items);
3479 prop, "Enabled Rotation Range", "Rotation range on which pivoting should occur");
3480 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3481
3483}
3484
3486{
3487 StructRNA *srna;
3488 PropertyRNA *prop;
3489
3490 static const EnumPropertyItem frame_method_items[] = {
3491 {FOLLOWTRACK_FRAME_STRETCH, "STRETCH", 0, "Stretch", ""},
3492 {FOLLOWTRACK_FRAME_FIT, "FIT", 0, "Fit", ""},
3493 {FOLLOWTRACK_FRAME_CROP, "CROP", 0, "Crop", ""},
3494 {0, nullptr, 0, nullptr, nullptr},
3495 };
3496
3497 srna = RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
3499 srna, "Follow Track Constraint", "Lock motion to the target motion track");
3500 RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
3501 RNA_def_struct_ui_icon(srna, ICON_CON_FOLLOWTRACK);
3502
3504
3505 /* movie clip */
3506 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
3507 RNA_def_property_pointer_sdna(prop, nullptr, "clip");
3508 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
3510 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3511
3512 /* track */
3513 prop = RNA_def_property(srna, "track", PROP_STRING, PROP_NONE);
3514 RNA_def_property_string_sdna(prop, nullptr, "track");
3515 RNA_def_property_ui_text(prop, "Track", "Movie tracking track to follow");
3517 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3518
3519 /* use default clip */
3520 prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
3523 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
3524 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3525
3526 /* use 3d position */
3527 prop = RNA_def_property(srna, "use_3d_position", PROP_BOOLEAN, PROP_NONE);
3529 RNA_def_property_ui_text(prop, "3D Position", "Use 3D position of track to parent to");
3530 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3531
3532 /* object */
3533 prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
3534 RNA_def_property_string_sdna(prop, nullptr, "object");
3536 prop, "Object", "Movie tracking object to follow (if empty, camera object is used)");
3537 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3538
3539 /* camera */
3540 prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
3541 RNA_def_property_pointer_sdna(prop, nullptr, "camera");
3543 prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
3545 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3547 nullptr,
3548 "rna_Constraint_followTrack_camera_set",
3549 nullptr,
3550 "rna_Constraint_cameraObject_poll");
3551
3552 /* depth object */
3553 prop = RNA_def_property(srna, "depth_object", PROP_POINTER, PROP_NONE);
3554 RNA_def_property_pointer_sdna(prop, nullptr, "depth_ob");
3556 prop,
3557 "Depth Object",
3558 "Object used to define depth in camera space by projecting onto surface of this object");
3560 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3562 nullptr,
3563 "rna_Constraint_followTrack_depthObject_set",
3564 nullptr,
3565 "rna_Constraint_followTrack_depthObject_poll");
3566
3567 /* frame method */
3568 prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
3569 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "frame_method");
3570 RNA_def_property_enum_items(prop, frame_method_items);
3571 RNA_def_property_ui_text(prop, "Frame Method", "How the footage fits in the camera frame");
3572 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3573
3574 /* use undistortion */
3575 prop = RNA_def_property(srna, "use_undistorted_position", PROP_BOOLEAN, PROP_NONE);
3577 RNA_def_property_ui_text(prop, "Undistort", "Parent to undistorted position of 2D track");
3578 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3579
3581}
3582
3584{
3585 StructRNA *srna;
3586 PropertyRNA *prop;
3587
3588 srna = RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
3590 srna, "Camera Solver Constraint", "Lock motion to the reconstructed camera movement");
3591 RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data");
3592 RNA_def_struct_ui_icon(srna, ICON_CON_CAMERASOLVER);
3593
3595
3596 /* movie clip */
3597 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
3598 RNA_def_property_pointer_sdna(prop, nullptr, "clip");
3599 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
3601 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3602
3603 /* use default clip */
3604 prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
3607 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
3608 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3609
3611}
3612
3614{
3615 StructRNA *srna;
3616 PropertyRNA *prop;
3617
3618 srna = RNA_def_struct(brna, "ObjectSolverConstraint", "Constraint");
3620 srna, "Object Solver Constraint", "Lock motion to the reconstructed object movement");
3621 RNA_def_struct_sdna_from(srna, "bObjectSolverConstraint", "data");
3622 RNA_def_struct_ui_icon(srna, ICON_CON_OBJECTSOLVER);
3623
3625
3626 /* movie clip */
3627 prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
3628 RNA_def_property_pointer_sdna(prop, nullptr, "clip");
3629 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
3631 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3632
3633 /* use default clip */
3634 prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
3637 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
3638 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3639
3640 prop = RNA_def_property(srna, "set_inverse_pending", PROP_BOOLEAN, PROP_NONE);
3643 prop, "Set Inverse Pending", "Set to true to request recalculation of the inverse matrix");
3644 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3645
3646 /* object */
3647 prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
3648 RNA_def_property_string_sdna(prop, nullptr, "object");
3649 RNA_def_property_ui_text(prop, "Object", "Movie tracking object to follow");
3650 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3651
3652 /* camera */
3653 prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
3654 RNA_def_property_pointer_sdna(prop, nullptr, "camera");
3656 prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
3658 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3660 nullptr,
3661 "rna_Constraint_objectSolver_camera_set",
3662 nullptr,
3663 "rna_Constraint_cameraObject_poll");
3664
3666}
3667
3669{
3670 StructRNA *srna;
3671 PropertyRNA *prop;
3672
3673 srna = RNA_def_struct(brna, "TransformCacheConstraint", "Constraint");
3675 srna, "Transform Cache Constraint", "Look up transformation from an external file");
3676 RNA_def_struct_sdna_from(srna, "bTransformCacheConstraint", "data");
3677 RNA_def_struct_ui_icon(srna, ICON_CON_TRANSFORM_CACHE);
3678
3680
3681 prop = RNA_def_property(srna, "cache_file", PROP_POINTER, PROP_NONE);
3682 RNA_def_property_pointer_sdna(prop, nullptr, "cache_file");
3683 RNA_def_property_struct_type(prop, "CacheFile");
3684 RNA_def_property_ui_text(prop, "Cache File", "");
3686 RNA_def_property_update(prop, 0, "rna_Constraint_dependency_update");
3687
3688 prop = RNA_def_property(srna, "object_path", PROP_STRING, PROP_NONE);
3690 prop,
3691 "Object Path",
3692 "Path to the object in the Alembic archive used to lookup the transform matrix");
3693 RNA_def_property_update(prop, 0, "rna_Constraint_update");
3694
3696}
3697
3699{
3700 StructRNA *srna;
3701 PropertyRNA *prop;
3702
3703 static const EnumPropertyItem domain_items[] = {
3704 {CON_ATTRIBUTE_DOMAIN_POINT, "POINT", 0, "Point"},
3705 {CON_ATTRIBUTE_DOMAIN_EDGE, "EDGE", 0, "Edge"},
3706 {CON_ATTRIBUTE_DOMAIN_FACE, "FACE", 0, "Face"},
3707 {CON_ATTRIBUTE_DOMAIN_FACE_CORNER, "FACE_CORNER", 0, "Face Corner"},
3708 {CON_ATTRIBUTE_DOMAIN_CURVE, "CURVE", 0, "Spline"},
3709 {CON_ATTRIBUTE_DOMAIN_INSTANCE, "INSTANCE", 0, "Instance"},
3710 {0, nullptr, 0, nullptr, nullptr},
3711 };
3712
3713 static const EnumPropertyItem type_items[] = {
3714 {CON_ATTRIBUTE_VECTOR, "VECTOR", 0, "Vector", "Vector data type, affects position"},
3716 "QUATERNION",
3717 0,
3718 "Quaternion",
3719 "Quaternion data type, affects rotation"},
3721 "FLOAT4X4",
3722 0,
3723 "4x4 Matrix",
3724 "4x4 Matrix data type, affects transform"},
3725 {0, nullptr, 0, nullptr, nullptr},
3726 };
3727
3728 static const EnumPropertyItem attribute_mix_mode_items[] = {
3730 "REPLACE",
3731 0,
3732 "Replace",
3733 "Replace the original transformation with the transform from the attribute"},
3736 "BEFORE_FULL",
3737 0,
3738 "Before Original (Full)",
3739 "Apply copied transformation before original, using simple matrix multiplication as if "
3740 "the constraint target is a parent in Full Inherit Scale mode. "
3741 "Will create shear when combining rotation and non-uniform scale."},
3743 "BEFORE_SPLIT",
3744 0,
3745 "Before Original (Split Channels)",
3746 "Apply copied transformation before original, handling location, rotation and scale "
3747 "separately, similar to a sequence of three Copy constraints"},
3750 "AFTER_FULL",
3751 0,
3752 "After Original (Full)",
3753 "Apply copied transformation after original, using simple matrix multiplication as if "
3754 "the constraint target is a child in Full Inherit Scale mode. "
3755 "Will create shear when combining rotation and non-uniform scale."},
3757 "AFTER_SPLIT",
3758 0,
3759 "After Original (Split Channels)",
3760 "Apply copied transformation after original, handling location, rotation and scale "
3761 "separately, similar to a sequence of three Copy constraints"},
3762 {0, nullptr, 0, nullptr, nullptr},
3763 };
3764
3765 srna = RNA_def_struct(brna, "GeometryAttributeConstraint", "Constraint");
3767 "Geometry Attribute Constraint",
3768 "Create a constraint-based relationship with an attribute from geometry");
3769 RNA_def_struct_sdna_from(srna, "bGeometryAttributeConstraint", "data");
3770 RNA_def_struct_ui_icon(srna, ICON_CON_GEOMETRYATTRIBUTE);
3771
3773
3774 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3775 RNA_def_property_pointer_sdna(prop, nullptr, "target");
3776 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, nullptr, nullptr);
3777 RNA_def_property_ui_text(prop, "Target", "Target geometry object");
3779 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3780
3781 prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE);
3782 RNA_def_property_string_sdna(prop, nullptr, "attribute_name");
3784 prop, "Attribute Name", "Name of the attribute to retrieve the transform from");
3786 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3787
3788 prop = RNA_def_property(srna, "domain", PROP_ENUM, PROP_NONE);
3789 RNA_def_property_enum_sdna(prop, nullptr, "domain");
3790 RNA_def_property_enum_items(prop, domain_items);
3791 RNA_def_property_ui_text(prop, "Domain Type", "Attribute domain");
3792 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3793
3794 prop = RNA_def_property(srna, "apply_target_transform", PROP_BOOLEAN, PROP_NONE);
3795 RNA_def_property_boolean_sdna(prop, nullptr, "apply_target_transform", 1);
3797 prop,
3798 "Target Transform",
3799 "Apply the target object's world transform on top of the attribute's transform");
3800 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3801
3802 prop = RNA_def_property(srna, "data_type", PROP_ENUM, PROP_NONE);
3803 RNA_def_property_enum_sdna(prop, nullptr, "data_type");
3804 RNA_def_property_enum_items(prop, type_items);
3805 RNA_def_property_ui_text(prop, "Data Type", "Select data type of attribute");
3806 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3807
3808 prop = RNA_def_property(srna, "sample_index", PROP_INT, PROP_NONE);
3809 RNA_def_property_int_sdna(prop, nullptr, "sample_index");
3811 RNA_def_property_ui_text(prop, "Sample Index", "Sample Index");
3812 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3813
3814 prop = RNA_def_property(srna, "mix_loc", PROP_BOOLEAN, PROP_NONE);
3815 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MIX_LOC);
3816 RNA_def_property_ui_text(prop, "Mix Location", "Mix Location");
3817 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3818
3819 prop = RNA_def_property(srna, "mix_rot", PROP_BOOLEAN, PROP_NONE);
3820 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MIX_ROT);
3821 RNA_def_property_ui_text(prop, "Mix Rotation", "Mix Rotation");
3822 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3823
3824 prop = RNA_def_property(srna, "mix_scl", PROP_BOOLEAN, PROP_NONE);
3825 RNA_def_property_boolean_sdna(prop, nullptr, "flags", MIX_SCALE);
3826 RNA_def_property_ui_text(prop, "Mix Scale", "Mix Scale");
3827 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3828
3829 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
3830 RNA_def_property_enum_sdna(prop, nullptr, "mix_mode");
3831 RNA_def_property_enum_items(prop, attribute_mix_mode_items);
3833 prop, "Mix Mode", "Specify how the copied and existing transformations are combined");
3834 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3835
3837}
3838
3839/* Define the base struct for constraints. */
3840
3842{
3843 StructRNA *srna;
3844 PropertyRNA *prop;
3845
3846 /* data */
3847 srna = RNA_def_struct(brna, "Constraint", nullptr);
3849 srna, "Constraint", "Constraint modifying the transformation of objects and bones");
3850 RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine");
3851 RNA_def_struct_path_func(srna, "rna_Constraint_path");
3852 RNA_def_struct_sdna(srna, "bConstraint");
3853 RNA_def_struct_ui_icon(srna, ICON_CONSTRAINT);
3854
3855 /* strings */
3856 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
3857 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Constraint_name_set");
3858 RNA_def_property_ui_text(prop, "Name", "Constraint name");
3859 RNA_def_struct_name_property(srna, prop);
3861
3862 /* enums */
3863 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
3865 RNA_def_property_enum_sdna(prop, nullptr, "type");
3867 RNA_def_property_ui_text(prop, "Type", "");
3868
3869 prop = RNA_def_boolean(srna,
3870 "is_override_data",
3871 false,
3872 "Override Constraint",
3873 "In a local override object, whether this constraint comes from the "
3874 "linked reference object, or is local to the override");
3877
3879
3880 prop = RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
3881 RNA_def_property_enum_sdna(prop, nullptr, "ownspace");
3883 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Constraint_owner_space_itemf");
3884 RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in");
3885 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3886
3887 prop = RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
3888 RNA_def_property_enum_sdna(prop, nullptr, "tarspace");
3890 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Constraint_target_space_itemf");
3891 RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in");
3892 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3893
3894 prop = RNA_def_property(srna, "space_object", PROP_POINTER, PROP_NONE);
3895 RNA_def_property_pointer_sdna(prop, nullptr, "space_object");
3896 RNA_def_property_ui_text(prop, "Object", "Object for Custom Space");
3899 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3900
3901 prop = RNA_def_property(srna, "space_subtarget", PROP_STRING, PROP_NONE);
3902 RNA_def_property_string_sdna(prop, nullptr, "space_subtarget");
3903 RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
3904 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
3905
3906 /* flags */
3907 prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
3908 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_OFF);
3909 RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint");
3910 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3911 RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
3912
3913 prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
3915 RNA_def_property_ui_text(prop, "Enabled", "Use the results of this constraint");
3916 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3917 RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
3918
3919 prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
3921 RNA_def_property_boolean_sdna(prop, nullptr, "ui_expand_flag", 0);
3922 RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
3923 RNA_def_property_ui_icon(prop, ICON_RIGHTARROW, 1);
3924
3925 /* XXX this is really an internal flag,
3926 * but it may be useful for some tools to be able to access this... */
3927 prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
3930 RNA_def_property_ui_text(prop, "Valid", "Constraint has valid settings and can be evaluated");
3931
3932 /* TODO: setting this to true must ensure that all others in stack are turned off too... */
3933 prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
3934 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CONSTRAINT_ACTIVE);
3935 RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited");
3936
3937 /* values */
3938 prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
3939 RNA_def_property_float_sdna(prop, nullptr, "enforce");
3940 RNA_def_property_range(prop, 0.0f, 1.0f);
3942 prop, "Influence", "Amount of influence constraint will have on the final solution");
3943 RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
3944
3945 /* readonly values */
3946 prop = RNA_def_property(srna, "error_location", PROP_FLOAT, PROP_NONE);
3947 RNA_def_property_float_sdna(prop, nullptr, "lin_error");
3950 prop,
3951 "Lin error",
3952 "Amount of residual error in Blender space unit for constraints that work on position");
3953
3954 prop = RNA_def_property(srna, "error_rotation", PROP_FLOAT, PROP_NONE);
3955 RNA_def_property_float_sdna(prop, nullptr, "rot_error");
3958 prop,
3959 "Rotation error",
3960 "Amount of residual error in radians for constraints that work on orientation");
3961
3963
3964 /* pointers */
3967
3997}
3998
3999} // namespace blender
4000
4001#endif
Functions and classes to work with Actions.
Blender kernel action and pose functionality.
#define G_MAIN
#define DEG2RADF(_deg)
#define M_PI
#define STRNCPY_UTF8(dst, src)
#define BLT_I18NCONTEXT_CONSTRAINT
#define BLT_I18NCONTEXT_ID_MOVIECLIP
#define CON_SHRINKWRAP_PROJECT_CULL_MASK
#define MINAFRAME
#define MAXFRAME
#define RNA_MAX_ARRAY_DIMENSION
Definition RNA_define.hh:29
#define RNA_ENUM_ITEM_SEPR
Definition RNA_types.hh:762
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:272
#define RNA_ENUM_ITEM_HEADING(name, description)
Definition RNA_types.hh:759
#define ND_NLA_ACTCHANGE
Definition WM_types.hh:541
#define NC_ANIMATION
Definition WM_types.hh:401
#define ND_POSE
Definition WM_types.hh:482
#define ND_CONSTRAINT
Definition WM_types.hh:505
#define NA_RENAME
Definition WM_types.hh:638
#define NC_OBJECT
Definition WM_types.hh:392
#define UNUSED_VARS_NDEBUG(...)
#define ELEM(...)
#define BLI_assert_msg(a, msg)
btScalar max
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
Definition btVector3.h:257
static constexpr slot_handle_t unassigned
#define FLT_MAX
#define INT_MAX
decltype(blender::ActionSlot::handle) slot_handle_t
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)
void constraint_dependency_tag_update(Main *bmain, Object *ob, bConstraint *con)
ListBaseT< bConstraint > * constraint_list_from_constraint(Object *ob, bConstraint *con, bPoseChannel **r_pchan)
void constraint_tag_update(Main *bmain, Object *ob, bConstraint *con)
BMesh Iterators.
static void rna_def_constraint_locked_track(BlenderRNA *brna)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
static void rna_def_constrainttarget_bone(BlenderRNA *brna)
void id_lib_extern(ID *id, bool enforce_fix=false)
Definition lib_id.cc:328
static void rna_def_constraint_armature_deform_targets(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_constraint_spline_ik(BlenderRNA *brna)
static void rna_def_constraint_size_limit(BlenderRNA *brna)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
char * STRNCPY(char(&dst)[N], const char *src)
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
static void rna_def_constraint_same_volume(BlenderRNA *brna)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
static const EnumPropertyItem target_space_pchan_items[]
static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
const EnumPropertyItem rna_enum_modifier_shrinkwrap_mode_items[]
const EnumPropertyItem rna_enum_constraint_type_items[]
void BKE_constraint_targets_flush(struct bConstraint *con, ListBaseT< bConstraintTarget > *targets, bool no_copy)
static void rna_def_constraint_object_solver(BlenderRNA *brna)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
@ CONSTRAINT_TYPE_GEOMETRY_ATTRIBUTE
@ CONSTRAINT_TYPE_TRANSFORM_CACHE
@ CON_ATTRIBUTE_MIX_AFTER_SPLIT
@ CON_ATTRIBUTE_MIX_BEFORE_SPLIT
@ CON_ATTRIBUTE_MIX_BEFORE_FULL
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
static void rna_def_constrainttarget(BlenderRNA *brna)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
static void rna_def_constraint_armature_deform(BlenderRNA *brna)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
static void rna_def_constraint_follow_path(BlenderRNA *brna)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
static void rna_def_constraint_damped_track(BlenderRNA *brna)
@ CON_ATTRIBUTE_DOMAIN_FACE_CORNER
@ CON_ATTRIBUTE_DOMAIN_INSTANCE
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
std::string RNA_path_name_to_infix(const StringRefNull string)
Definition rna_path.cc:1419
static void rna_def_constraint_kinematic(BlenderRNA *brna)
@ FUNC_USE_REPORTS
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:980
@ FUNC_USE_MAIN
void RNA_define_lib_overridable(const bool make_overridable)
static void rna_def_constraint_action(BlenderRNA *brna)
@ CONSTRAINT_SPLINEIK_NO_CURVERAD
@ CONSTRAINT_SPLINEIK_USE_BULGE_MAX
@ CONSTRAINT_SPLINEIK_USE_BULGE_MIN
@ CONSTRAINT_SPLINEIK_USE_ORIGINAL_SCALE
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
static const EnumPropertyItem track_axis_items[]
static void rna_def_constraint_rotate_like(BlenderRNA *brna)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
const EnumPropertyItem rna_enum_driver_target_rotation_mode_items[]
void RNA_def_constraint(BlenderRNA *brna)
struct bConstraint * BKE_constraint_find_from_target(struct Object *ob, struct bConstraintTarget *tgt, struct bPoseChannel **r_pchan)
static void rna_def_constraint_follow_track(BlenderRNA *brna)
void RNA_def_property_enum_bitflag_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_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:588
@ PROPOVERRIDE_IGNORE
Definition RNA_types.hh:609
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void BKE_animdata_fix_paths(ID &id, StringRef prefix, StringRef old_infix, StringRef new_infix, bool verify_paths, const DriverMap &driver_map)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
@ CONSTRAINT_SPLINEIK_XZS_ORIGINAL
@ CONSTRAINT_SPLINEIK_XZS_INVERSE
@ CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC
static void rna_def_constraint_childof(BlenderRNA *brna)
void BKE_constraint_unique_name(struct bConstraint *con, ListBaseT< bConstraint > *list)
static void rna_def_constraint_transform(BlenderRNA *brna)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:593
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
static void rna_def_constraint_minmax(BlenderRNA *brna)
@ PROP_BOOLEAN
Definition RNA_types.hh:210
@ PROP_POINTER
Definition RNA_types.hh:215
@ PROP_STRING
Definition RNA_types.hh:213
@ PROP_COLLECTION
Definition RNA_types.hh:216
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
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_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
BMesh const char void * data
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
static void rna_def_constraint_track_to(BlenderRNA *brna)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
static const EnumPropertyItem owner_space_pchan_items[]
const EnumPropertyItem rna_enum_object_axis_items[]
char char size_t BLI_str_escape(char *__restrict dst, StringRef src, size_t dst_maxncpy) ATTR_NONNULL(1)
@ CONSTRAINT_SPLINEIK_YS_FIT_CURVE
@ CONSTRAINT_SPLINEIK_YS_ORIGINAL
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
@ CONSTRAINT_ARMATURE_CUR_LOCATION
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:277
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
int BKE_constraint_targets_get(struct bConstraint *con, ListBaseT< bConstraintTarget > *r_targets)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
static const EnumPropertyItem constraint_distance_items[]
static void rna_def_constraint_clamp_to(BlenderRNA *brna)
@ MOD_SHRINKWRAP_NEAREST_VERTEX
@ MOD_SHRINKWRAP_NEAREST_SURFACE
@ MOD_SHRINKWRAP_TARGET_PROJECT
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
static void rna_def_constraint_location_limit(BlenderRNA *brna)
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
static void rna_def_constraint_transform_like(BlenderRNA *brna)
static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Definition report.cc:191
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
static void rna_def_constraint_size_like(BlenderRNA *brna)
@ CON_SHRINKWRAP_PROJECT_CULL_FRONTFACE
@ CON_SHRINKWRAP_PROJECT_OPPOSITE
@ CON_SHRINKWRAP_PROJECT_INVERT_CULL
@ CON_SHRINKWRAP_PROJECT_CULL_BACKFACE
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
static void rna_def_constraint_headtail_common(StructRNA *srna)
@ PROP_EDITABLE
Definition RNA_types.hh:376
@ PROP_DYNAMIC
Definition RNA_types.hh:498
@ PROP_THICK_WRAP
Definition RNA_types.hh:493
@ PROP_ID_SELF_CHECK
Definition RNA_types.hh:440
@ PROP_NEVER_NULL
Definition RNA_types.hh:447
@ PROP_ANIMATABLE
Definition RNA_types.hh:389
@ PROP_NO_DEG_UPDATE
Definition RNA_types.hh:509
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
static void rna_def_constraint_transform_cache(BlenderRNA *brna)
static void rna_def_constraint_camera_solver(BlenderRNA *brna)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
static const EnumPropertyItem euler_order_items[]
static void rna_def_constraint_geometry_attribute(BlenderRNA *brna)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
static void rna_def_constraint_stretch_to(BlenderRNA *brna)
static void rna_def_constraint_distance_limit(BlenderRNA *brna)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
@ PROP_FACTOR
Definition RNA_types.hh:308
@ PROP_TRANSLATION
Definition RNA_types.hh:318
@ PROP_MATRIX
Definition RNA_types.hh:322
@ PROP_DISTANCE
Definition RNA_types.hh:313
@ PARM_REQUIRED
Definition RNA_types.hh:631
@ PARM_RNAPTR
Definition RNA_types.hh:633
void RNA_def_property_int_default(PropertyRNA *prop, int value)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
void RNA_def_property_array(PropertyRNA *prop, int length)
static void rna_def_constraint_locate_like(BlenderRNA *brna)
const int rna_matrix_dimsize_4x4[]
static void rna_def_constraint_target_common(StructRNA *srna)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
static void rna_def_constraint_pivot(BlenderRNA *brna)
@ CONSTRAINT_OVERRIDE_LIBRARY_LOCAL
const EnumPropertyItem rna_enum_axis_xyz_items[]
#define min(a, b)
Definition sort.cc:38
const NodeType * type
Definition graph/node.h:179
ustring name
Definition graph/node.h:178
eActionConstraint_MixMode mix_mode
ListBaseT< bConstraintTarget > targets
#define N_(msgid)