2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Blender Foundation (2008), Joshua Leung, Roland Hess
20 * ***** END GPL LICENSE BLOCK *****
23 /** \file blender/makesrna/intern/rna_constraint.c
30 #include "RNA_define.h"
32 #include "rna_internal.h"
36 #include "DNA_action_types.h"
37 #include "DNA_constraint_types.h"
38 #include "DNA_modifier_types.h"
39 #include "DNA_object_types.h"
40 #include "DNA_scene_types.h"
42 #include "ED_object.h"
45 EnumPropertyItem constraint_type_items[] ={
46 {0, "", 0, "Motion Tracking", ""},
47 {CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT_DATA, "Camera Solver", ""},
48 {CONSTRAINT_TYPE_OBJECTSOLVER, "OBJECT_SOLVER", ICON_CONSTRAINT_DATA, "Object Solver", ""},
49 {CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT_DATA, "Follow Track", ""},
50 {0, "", 0, "Transform", ""},
51 {CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", ICON_CONSTRAINT_DATA, "Copy Location", ""},
52 {CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", ICON_CONSTRAINT_DATA, "Copy Rotation", ""},
53 {CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", ICON_CONSTRAINT_DATA, "Copy Scale", ""},
54 {CONSTRAINT_TYPE_TRANSLIKE, "COPY_TRANSFORMS", ICON_CONSTRAINT_DATA, "Copy Transforms", ""},
55 {CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", ICON_CONSTRAINT_DATA, "Limit Distance", ""},
56 {CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", ICON_CONSTRAINT_DATA, "Limit Location", ""},
57 {CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", ICON_CONSTRAINT_DATA, "Limit Rotation", ""},
58 {CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", ICON_CONSTRAINT_DATA, "Limit Scale", ""},
59 {CONSTRAINT_TYPE_SAMEVOL, "MAINTAIN_VOLUME", ICON_CONSTRAINT_DATA, "Maintain Volume", ""},
60 {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", ICON_CONSTRAINT_DATA, "Transformation", ""},
61 {0, "", 0, "Tracking", ""},
62 {CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", ICON_CONSTRAINT_DATA, "Clamp To", ""},
63 {CONSTRAINT_TYPE_DAMPTRACK, "DAMPED_TRACK", ICON_CONSTRAINT_DATA, "Damped Track", "Tracking by taking the shortest path"},
64 {CONSTRAINT_TYPE_KINEMATIC, "IK", ICON_CONSTRAINT_DATA, "Inverse Kinematics", ""},
65 {CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", ICON_CONSTRAINT_DATA, "Locked Track", "Tracking along a single axis"},
66 {CONSTRAINT_TYPE_SPLINEIK, "SPLINE_IK", ICON_CONSTRAINT_DATA, "Spline IK", ""},
67 {CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO",ICON_CONSTRAINT_DATA, "Stretch To", ""},
68 {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To", "Legacy tracking constraint prone to twisting artifacts"},
69 {0, "", 0, "Relationship", ""},
70 {CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT_DATA, "Action", ""},
71 {CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", ICON_CONSTRAINT_DATA, "Child Of", ""},
72 {CONSTRAINT_TYPE_MINMAX, "FLOOR", ICON_CONSTRAINT_DATA, "Floor", ""},
73 {CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", ICON_CONSTRAINT_DATA, "Follow Path", ""},
74 {CONSTRAINT_TYPE_PIVOT, "PIVOT", ICON_CONSTRAINT_DATA, "Pivot", ""},
75 {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", ICON_CONSTRAINT_DATA, "Rigid Body Joint", ""},
76 {CONSTRAINT_TYPE_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script", ""},
77 {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT_DATA, "Shrinkwrap", ""},
78 {0, NULL, 0, NULL, NULL}};
80 static EnumPropertyItem target_space_pchan_items[] = {
81 {0, "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world coordinate system"},
82 {2, "POSE", 0, "Pose Space", "The transformation of the target is only evaluated in the Pose Space, the target armature object transformation is ignored"},
83 {3, "LOCAL_WITH_PARENT", 0, "Local With Parent", "The transformation of the target bone is evaluated relative its local coordinate system, with the parent transformation added"},
84 {1, "LOCAL", 0, "Local Space", "The transformation of the target is evaluated relative to its local coordinate system"},
85 {0, NULL, 0, NULL, NULL}};
87 static EnumPropertyItem owner_space_pchan_items[] = {
88 {0, "WORLD", 0, "World Space", "The constraint is applied relative to the world coordinate system"},
89 {2, "POSE", 0, "Pose Space", "The constraint is applied in Pose Space, the object transformation is ignored"},
90 {3, "LOCAL_WITH_PARENT", 0, "Local With Parent", "The constraint is applied relative to the local coordinate system of the object, with the parent transformation added"},
91 {1, "LOCAL", 0, "Local Space", "The constraint is applied relative to the local coordinate sytem of the object"},
92 {0, NULL, 0, NULL, NULL}};
96 static EnumPropertyItem space_object_items[] = {
97 {0, "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world coordinate system"},
98 {1, "LOCAL", 0, "Local Space", "The transformation of the target is evaluated relative to its local coordinate system"},
99 {0, NULL, 0, NULL, NULL}};
101 #include "BKE_animsys.h"
102 #include "BKE_action.h"
103 #include "BKE_constraint.h"
104 #include "BKE_context.h"
105 #include "BKE_depsgraph.h"
108 static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
110 bConstraint *con= (bConstraint*)ptr->data;
113 case CONSTRAINT_TYPE_CHILDOF:
114 return &RNA_ChildOfConstraint;
115 case CONSTRAINT_TYPE_TRACKTO:
116 return &RNA_TrackToConstraint;
117 case CONSTRAINT_TYPE_KINEMATIC:
118 return &RNA_KinematicConstraint;
119 case CONSTRAINT_TYPE_FOLLOWPATH:
120 return &RNA_FollowPathConstraint;
121 case CONSTRAINT_TYPE_ROTLIKE:
122 return &RNA_CopyRotationConstraint;
123 case CONSTRAINT_TYPE_LOCLIKE:
124 return &RNA_CopyLocationConstraint;
125 case CONSTRAINT_TYPE_SIZELIKE:
126 return &RNA_CopyScaleConstraint;
127 case CONSTRAINT_TYPE_SAMEVOL:
128 return &RNA_MaintainVolumeConstraint;
129 case CONSTRAINT_TYPE_PYTHON:
130 return &RNA_PythonConstraint;
131 case CONSTRAINT_TYPE_ACTION:
132 return &RNA_ActionConstraint;
133 case CONSTRAINT_TYPE_LOCKTRACK:
134 return &RNA_LockedTrackConstraint;
135 case CONSTRAINT_TYPE_STRETCHTO:
136 return &RNA_StretchToConstraint;
137 case CONSTRAINT_TYPE_MINMAX:
138 return &RNA_FloorConstraint;
139 case CONSTRAINT_TYPE_RIGIDBODYJOINT:
140 return &RNA_RigidBodyJointConstraint;
141 case CONSTRAINT_TYPE_CLAMPTO:
142 return &RNA_ClampToConstraint;
143 case CONSTRAINT_TYPE_TRANSFORM:
144 return &RNA_TransformConstraint;
145 case CONSTRAINT_TYPE_ROTLIMIT:
146 return &RNA_LimitRotationConstraint;
147 case CONSTRAINT_TYPE_LOCLIMIT:
148 return &RNA_LimitLocationConstraint;
149 case CONSTRAINT_TYPE_SIZELIMIT:
150 return &RNA_LimitScaleConstraint;
151 case CONSTRAINT_TYPE_DISTLIMIT:
152 return &RNA_LimitDistanceConstraint;
153 case CONSTRAINT_TYPE_SHRINKWRAP:
154 return &RNA_ShrinkwrapConstraint;
155 case CONSTRAINT_TYPE_DAMPTRACK:
156 return &RNA_DampedTrackConstraint;
157 case CONSTRAINT_TYPE_SPLINEIK:
158 return &RNA_SplineIKConstraint;
159 case CONSTRAINT_TYPE_TRANSLIKE:
160 return &RNA_CopyTransformsConstraint;
161 case CONSTRAINT_TYPE_PIVOT:
162 return &RNA_PivotConstraint;
163 case CONSTRAINT_TYPE_FOLLOWTRACK:
164 return &RNA_FollowTrackConstraint;
165 case CONSTRAINT_TYPE_CAMERASOLVER:
166 return &RNA_CameraSolverConstraint;
167 case CONSTRAINT_TYPE_OBJECTSOLVER:
168 return &RNA_ObjectSolverConstraint;
170 return &RNA_UnknownType;
174 static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
176 bConstraint *con= ptr->data;
177 char oldname[sizeof(con->name)];
179 /* make a copy of the old name first */
180 BLI_strncpy(oldname, con->name, sizeof(con->name));
182 /* copy the new name into the name slot */
183 BLI_strncpy_utf8(con->name, value, sizeof(con->name));
185 /* make sure name is unique */
187 Object *ob= ptr->id.data;
188 ListBase *list = get_constraint_lb(ob, con, NULL);
190 /* if we have the list, check for unique name, otherwise give up */
192 unique_constraint_name(con, list);
195 /* fix all the animation data which may link to this */
196 BKE_all_animdata_fix_paths_rename("constraints", oldname, con->name);
199 static char *rna_Constraint_path(PointerRNA *ptr)
201 Object *ob= ptr->id.data;
202 bConstraint *con= ptr->data;
204 ListBase *lb = get_constraint_lb(ob, con, &pchan);
207 printf("rna_Constraint_path: internal error, constraint '%s' not found in object '%s'\n", con->name, ob->id.name);
210 return BLI_sprintfN("pose.bones[\"%s\"].constraints[\"%s\"]", pchan->name, con->name);
213 return BLI_sprintfN("constraints[\"%s\"]", con->name);
216 static void rna_Constraint_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
218 ED_object_constraint_update(ptr->id.data);
221 static void rna_Constraint_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
223 ED_object_constraint_dependency_update(bmain, scene, ptr->id.data);
226 static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
228 Object *ob= ptr->id.data;
231 ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
233 rna_Constraint_update(bmain, scene, ptr);
236 static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value)
238 bConstraint *con = ptr->data;
239 bKinematicConstraint *ikdata = con->data;
241 if (ikdata->type != value) {
242 // the type of IK constraint has changed, set suitable default values
243 // in case constraints reuse same fields incompatible
245 case CONSTRAINT_IK_COPYPOSE:
247 case CONSTRAINT_IK_DISTANCE:
250 ikdata->type = value;
254 static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
256 Object *ob= (Object*)ptr->id.data;
257 bConstraint *con= (bConstraint*)ptr->data;
259 if(BLI_findindex(&ob->constraints, con) == -1)
260 return owner_space_pchan_items;
262 return space_object_items;
265 static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
267 bConstraint *con= (bConstraint*)ptr->data;
268 bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
269 ListBase targets = {NULL, NULL};
270 bConstraintTarget *ct;
272 if(cti && cti->get_constraint_targets) {
273 cti->get_constraint_targets(con, &targets);
275 for(ct=targets.first; ct; ct= ct->next)
276 if(ct->tar && ct->tar->type == OB_ARMATURE)
279 if(cti->flush_constraint_targets)
280 cti->flush_constraint_targets(con, &targets, 1);
283 return target_space_pchan_items;
286 return space_object_items;
289 static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float *max)
291 bConstraint *con= (bConstraint*)ptr->data;
292 bActionConstraint *acon = (bActionConstraint *)con->data;
294 /* 0, 1, 2 = magic numbers for rotX, rotY, rotZ */
295 if (ELEM3(acon->type, 0, 1, 2)) {
304 static int rna_SplineIKConstraint_joint_bindings_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
306 bConstraint *con= (bConstraint*)ptr->data;
307 bSplineIKConstraint *ikData= (bSplineIKConstraint *)con->data;
310 length[0]= ikData->numpoints;
312 length[0]= 256; /* for raw_access, untested */
317 static void rna_SplineIKConstraint_joint_bindings_get(PointerRNA *ptr, float *values)
319 bConstraint *con= (bConstraint*)ptr->data;
320 bSplineIKConstraint *ikData= (bSplineIKConstraint *)con->data;
322 memcpy(values, ikData->points, ikData->numpoints * sizeof(float));
325 static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const float *values)
327 bConstraint *con= (bConstraint*)ptr->data;
328 bSplineIKConstraint *ikData= (bSplineIKConstraint *)con->data;
330 memcpy(ikData->points, values, ikData->numpoints * sizeof(float));
333 static int rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value)
335 Object *ob= (Object*)value.data;
338 if (ob->type == OB_CAMERA && ob != (Object*)ptr->id.data) {
346 static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr, PointerRNA value)
348 bConstraint *con= (bConstraint*)ptr->data;
349 bFollowTrackConstraint *data= (bFollowTrackConstraint*)con->data;
350 Object *ob= (Object*)value.data;
353 if (ob->type == OB_CAMERA && ob != (Object*)ptr->id.data) {
361 static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr, PointerRNA value)
363 bConstraint *con= (bConstraint*)ptr->data;
364 bObjectSolverConstraint *data= (bObjectSolverConstraint*)con->data;
365 Object *ob= (Object*)value.data;
368 if (ob->type == OB_CAMERA && ob != (Object*)ptr->id.data) {
378 EnumPropertyItem constraint_distance_items[] = {
379 {LIMITDIST_INSIDE, "LIMITDIST_INSIDE", 0, "Inside", "The object is constrained inside a virtual sphere around the target object, with a radius defined by the limit distance"},
380 {LIMITDIST_OUTSIDE, "LIMITDIST_OUTSIDE", 0, "Outside", "The object is constrained outside a virtual sphere around the target object, with a radius defined by the limit distance"},
381 {LIMITDIST_ONSURFACE, "LIMITDIST_ONSURFACE", 0, "On Surface", "The object is constrained on the surface of a virtual sphere around the target object, with a radius defined by the limit distance"},
382 {0, NULL, 0, NULL, NULL}
386 static void rna_def_constrainttarget(BlenderRNA *brna)
391 srna= RNA_def_struct(brna, "ConstraintTarget", NULL);
392 RNA_def_struct_ui_text(srna, "Constraint Target", "Target object for multi-target constraints");
393 RNA_def_struct_sdna(srna, "bConstraintTarget");
395 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
396 RNA_def_property_pointer_sdna(prop, NULL, "tar");
397 RNA_def_property_ui_text(prop, "Target", "Target Object");
398 RNA_def_property_flag(prop, PROP_EDITABLE);
399 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
401 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
402 RNA_def_property_string_sdna(prop, NULL, "subtarget");
403 RNA_def_property_ui_text(prop, "Sub-Target", "");
404 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
406 // space, flag and type still to do
409 static void rna_def_constraint_childof(BlenderRNA *brna)
411 static int rna_matrix_dimsize_4x4[]= {4, 4};
415 srna= RNA_def_struct(brna, "ChildOfConstraint", "Constraint");
416 RNA_def_struct_ui_text(srna, "Child Of Constraint", "Create constraint-based parent-child relationship");
417 RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data");
419 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
420 RNA_def_property_pointer_sdna(prop, NULL, "tar");
421 RNA_def_property_ui_text(prop, "Target", "Target Object");
422 RNA_def_property_flag(prop, PROP_EDITABLE);
423 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
425 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
426 RNA_def_property_string_sdna(prop, NULL, "subtarget");
427 RNA_def_property_ui_text(prop, "Sub-Target", "");
428 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
430 prop= RNA_def_property(srna, "use_location_x", PROP_BOOLEAN, PROP_NONE);
431 RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCX);
432 RNA_def_property_ui_text(prop, "Location X", "Use X Location of Parent");
433 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
435 prop= RNA_def_property(srna, "use_location_y", PROP_BOOLEAN, PROP_NONE);
436 RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCY);
437 RNA_def_property_ui_text(prop, "Location Y", "Use Y Location of Parent");
438 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
440 prop= RNA_def_property(srna, "use_location_z", PROP_BOOLEAN, PROP_NONE);
441 RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCZ);
442 RNA_def_property_ui_text(prop, "Location Z", "Use Z Location of Parent");
443 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
445 prop= RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
446 RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTX);
447 RNA_def_property_ui_text(prop, "Rotation X", "Use X Rotation of Parent");
448 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
450 prop= RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
451 RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTY);
452 RNA_def_property_ui_text(prop, "Rotation Y", "Use Y Rotation of Parent");
453 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
455 prop= RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
456 RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTZ);
457 RNA_def_property_ui_text(prop, "Rotation Z", "Use Z Rotation of Parent");
458 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
460 prop= RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
461 RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEX);
462 RNA_def_property_ui_text(prop, "Scale X", "Use X Scale of Parent");
463 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
465 prop= RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
466 RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEY);
467 RNA_def_property_ui_text(prop, "Scale Y", "Use Y Scale of Parent");
468 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
470 prop= RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
471 RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEZ);
472 RNA_def_property_ui_text(prop, "Scale Z", "Use Z Scale of Parent");
473 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
475 prop= RNA_def_property(srna, "inverse_matrix", PROP_FLOAT, PROP_MATRIX);
476 RNA_def_property_float_sdna(prop, NULL, "invmat");
477 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
478 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
479 RNA_def_property_ui_text(prop, "Inverse Matrix", "Transformation matrix to apply before");
483 static void rna_def_constraint_python(BlenderRNA *brna)
488 srna= RNA_def_struct(brna, "PythonConstraint", "Constraint");
489 RNA_def_struct_ui_text(srna, "Python Constraint", "Use Python script for constraint evaluation");
490 RNA_def_struct_sdna_from(srna, "bPythonConstraint", "data");
492 prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
493 RNA_def_property_collection_sdna(prop, NULL, "targets", NULL);
494 RNA_def_property_struct_type(prop, "ConstraintTarget");
495 RNA_def_property_ui_text(prop, "Targets", "Target Objects");
497 prop= RNA_def_property(srna, "target_count", PROP_INT, PROP_NONE);
498 RNA_def_property_int_sdna(prop, NULL, "tarnum");
499 RNA_def_property_ui_text(prop, "Number of Targets", "Usually only 1-3 are needed");
500 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
502 prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
503 RNA_def_property_ui_text(prop, "Script", "The text object that contains the Python script");
504 RNA_def_property_flag(prop, PROP_EDITABLE);
505 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
507 prop= RNA_def_property(srna, "use_targets", PROP_BOOLEAN, PROP_NONE);
508 RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_USETARGETS);
509 RNA_def_property_ui_text(prop, "Use Targets", "Use the targets indicated in the constraint panel");
510 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
512 prop= RNA_def_property(srna, "has_script_error", PROP_BOOLEAN, PROP_NONE);
513 RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_SCRIPTERROR);
514 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
515 RNA_def_property_ui_text(prop, "Script Error", "The linked Python script has thrown an error");
518 static void rna_def_constraint_kinematic(BlenderRNA *brna)
523 static EnumPropertyItem constraint_ik_axisref_items[] ={
524 {0, "BONE", 0, "Bone", ""},
525 {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""},
526 {0, NULL, 0, NULL, NULL},
529 static EnumPropertyItem constraint_ik_type_items[] ={
530 {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
531 {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
532 {0, NULL, 0, NULL, NULL},
535 srna= RNA_def_struct(brna, "KinematicConstraint", "Constraint");
536 RNA_def_struct_ui_text(srna, "Kinematic Constraint", "Inverse Kinematics");
537 RNA_def_struct_sdna_from(srna, "bKinematicConstraint", "data");
539 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
540 RNA_def_property_pointer_sdna(prop, NULL, "tar");
541 RNA_def_property_ui_text(prop, "Target", "Target Object");
542 RNA_def_property_flag(prop, PROP_EDITABLE);
543 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
545 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
546 RNA_def_property_string_sdna(prop, NULL, "subtarget");
547 RNA_def_property_ui_text(prop, "Sub-Target", "");
548 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
550 prop= RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
551 RNA_def_property_range(prop, 1, 10000);
552 RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving iterations");
553 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
555 prop= RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE);
556 RNA_def_property_pointer_sdna(prop, NULL, "poletar");
557 RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation");
558 RNA_def_property_flag(prop, PROP_EDITABLE);
559 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
561 prop= RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE);
562 RNA_def_property_string_sdna(prop, NULL, "polesubtarget");
563 RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
564 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
566 prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE);
567 RNA_def_property_float_sdna(prop, NULL, "poleangle");
568 RNA_def_property_range(prop, -M_PI, M_PI);
569 RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset");
570 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
572 prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
573 RNA_def_property_range(prop, 0.01, 1.f);
574 RNA_def_property_ui_text(prop, "Weight", "For Tree-IK: Weight of position control for this target");
576 prop= RNA_def_property(srna, "orient_weight", PROP_FLOAT, PROP_NONE);
577 RNA_def_property_float_sdna(prop, NULL, "orientweight");
578 RNA_def_property_range(prop, 0.01, 1.f);
579 RNA_def_property_ui_text(prop, "Orientation Weight", "For Tree-IK: Weight of orientation control for this target");
580 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
582 prop= RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
583 RNA_def_property_int_sdna(prop, NULL, "rootbone");
584 RNA_def_property_range(prop, 0, 255);
585 RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the IK effect - 0 uses all bones");
586 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
588 prop= RNA_def_property(srna, "use_tail", PROP_BOOLEAN, PROP_NONE);
589 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_TIP);
590 RNA_def_property_ui_text(prop, "Use Tail", "Include bone's tail as last element in chain");
591 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
593 prop= RNA_def_property(srna, "reference_axis", PROP_ENUM, PROP_NONE);
594 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
595 RNA_def_property_enum_items(prop, constraint_ik_axisref_items);
596 RNA_def_property_ui_text(prop, "Axis Reference", "Constraint axis Lock options relative to Bone or Target reference");
597 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
599 prop= RNA_def_property(srna, "use_location", PROP_BOOLEAN, PROP_NONE);
600 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_POS);
601 RNA_def_property_ui_text(prop, "Position", "Chain follows position of target");
602 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
604 prop= RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
605 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_X);
606 RNA_def_property_ui_text(prop, "Lock X Pos", "Constraint position along X axis");
607 RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
609 prop= RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
610 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Y);
611 RNA_def_property_ui_text(prop, "Lock Y Pos", "Constraint position along Y axis");
612 RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
614 prop= RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
615 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Z);
616 RNA_def_property_ui_text(prop, "Lock Z Pos", "Constraint position along Z axis");
617 RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
619 prop= RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
620 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_ROT);
621 RNA_def_property_ui_text(prop, "Rotation", "Chain follows rotation of target");
622 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
624 prop= RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
625 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_X);
626 RNA_def_property_ui_text(prop, "Lock X Rot", "Constraint rotation along X axis");
627 RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
629 prop= RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
630 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Y);
631 RNA_def_property_ui_text(prop, "Lock Y Rot", "Constraint rotation along Y axis");
632 RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
634 prop= RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
635 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Z);
636 RNA_def_property_ui_text(prop, "Lock Z Rot", "Constraint rotation along Z axis");
637 RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
639 prop= RNA_def_property(srna, "use_target", PROP_BOOLEAN, PROP_NONE);
640 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_AUTO);
641 RNA_def_property_ui_text(prop, "Target", "Disable for targetless IK");
642 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
644 prop= RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
645 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_STRETCH);
646 RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching");
647 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
649 prop= RNA_def_property(srna, "ik_type", PROP_ENUM, PROP_NONE);
650 RNA_def_property_enum_sdna(prop, NULL, "type");
651 RNA_def_property_enum_funcs(prop, NULL, "rna_Constraint_ik_type_set", NULL);
652 RNA_def_property_enum_items(prop, constraint_ik_type_items);
653 RNA_def_property_ui_text(prop, "IK Type", "");
654 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
656 prop= RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
657 RNA_def_property_enum_sdna(prop, NULL, "mode");
658 RNA_def_property_enum_items(prop, constraint_distance_items);
659 RNA_def_property_ui_text(prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
660 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
662 prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
663 RNA_def_property_float_sdna(prop, NULL, "dist");
664 RNA_def_property_range(prop, 0.0, 100.f);
665 RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
666 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
669 static void rna_def_constraint_track_to(BlenderRNA *brna)
674 static EnumPropertyItem track_items[] = {
675 {TRACK_X, "TRACK_X", 0, "X", ""},
676 {TRACK_Y, "TRACK_Y", 0, "Y", ""},
677 {TRACK_Z, "TRACK_Z", 0, "Z", ""},
678 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
679 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
680 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
681 {0, NULL, 0, NULL, NULL}};
683 static EnumPropertyItem up_items[] = {
684 {TRACK_X, "UP_X", 0, "X", ""},
685 {TRACK_Y, "UP_Y", 0, "Y", ""},
686 {TRACK_Z, "UP_Z", 0, "Z", ""},
687 {0, NULL, 0, NULL, NULL}};
689 srna= RNA_def_struct(brna, "TrackToConstraint", "Constraint");
690 RNA_def_struct_ui_text(srna, "Track To Constraint", "Aim the constrained object toward the target");
692 prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
693 RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
694 RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
695 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
697 RNA_def_struct_sdna_from(srna, "bTrackToConstraint", "data");
699 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
700 RNA_def_property_pointer_sdna(prop, NULL, "tar");
701 RNA_def_property_ui_text(prop, "Target", "Target Object");
702 RNA_def_property_flag(prop, PROP_EDITABLE);
703 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
705 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
706 RNA_def_property_string_sdna(prop, NULL, "subtarget");
707 RNA_def_property_ui_text(prop, "Sub-Target", "");
708 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
710 prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
711 RNA_def_property_enum_sdna(prop, NULL, "reserved1");
712 RNA_def_property_enum_items(prop, track_items);
713 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
714 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
716 prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
717 RNA_def_property_enum_sdna(prop, NULL, "reserved2");
718 RNA_def_property_enum_items(prop, up_items);
719 RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
720 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
722 prop= RNA_def_property(srna, "use_target_z", PROP_BOOLEAN, PROP_NONE);
723 RNA_def_property_boolean_sdna(prop, NULL, "flags", TARGET_Z_UP);
724 RNA_def_property_ui_text(prop, "Target Z", "Target's Z axis, not World Z axis, will constraint the Up direction");
725 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
728 static void rna_def_constraint_locate_like(BlenderRNA *brna)
733 srna= RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
734 RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copy the location of the target");
736 prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
737 RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
738 RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
739 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
741 RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data");
743 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
744 RNA_def_property_pointer_sdna(prop, NULL, "tar");
745 RNA_def_property_flag(prop, PROP_EDITABLE);
746 RNA_def_property_ui_text(prop, "Target", "Target Object");
747 RNA_def_property_flag(prop, PROP_EDITABLE);
748 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
750 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
751 RNA_def_property_string_sdna(prop, NULL, "subtarget");
752 RNA_def_property_ui_text(prop, "Sub-Target", "");
753 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
755 prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
756 RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X);
757 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X location");
758 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
760 prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
761 RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y);
762 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y location");
763 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
765 prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
766 RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z);
767 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z location");
768 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
770 prop= RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
771 RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X_INVERT);
772 RNA_def_property_ui_text(prop, "Invert X", "Invert the X location");
773 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
775 prop= RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
776 RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y_INVERT);
777 RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location");
778 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
780 prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
781 RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z_INVERT);
782 RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location");
783 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
785 prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
786 RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_OFFSET);
787 RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location");
788 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
791 static void rna_def_constraint_rotate_like(BlenderRNA *brna)
796 srna= RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
797 RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copy the rotation of the target");
798 RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data");
800 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
801 RNA_def_property_pointer_sdna(prop, NULL, "tar");
802 RNA_def_property_ui_text(prop, "Target", "Target Object");
803 RNA_def_property_flag(prop, PROP_EDITABLE);
804 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
806 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
807 RNA_def_property_string_sdna(prop, NULL, "subtarget");
808 RNA_def_property_ui_text(prop, "Sub-Target", "");
809 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
811 prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
812 RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X);
813 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X rotation");
814 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
816 prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
817 RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y);
818 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y rotation");
819 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
821 prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
822 RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z);
823 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z rotation");
824 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
826 prop= RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
827 RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X_INVERT);
828 RNA_def_property_ui_text(prop, "Invert X", "Invert the X rotation");
829 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
831 prop= RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
832 RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y_INVERT);
833 RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y rotation");
834 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
836 prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
837 RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z_INVERT);
838 RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z rotation");
839 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
841 prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
842 RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_OFFSET);
843 RNA_def_property_ui_text(prop, "Offset", "Add original rotation into copied rotation");
844 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
847 static void rna_def_constraint_size_like(BlenderRNA *brna)
852 srna= RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
853 RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copy the scale of the target");
854 RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
856 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
857 RNA_def_property_pointer_sdna(prop, NULL, "tar");
858 RNA_def_property_flag(prop, PROP_EDITABLE);
859 RNA_def_property_ui_text(prop, "Target", "Target Object");
860 RNA_def_property_flag(prop, PROP_EDITABLE);
861 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
863 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
864 RNA_def_property_string_sdna(prop, NULL, "subtarget");
865 RNA_def_property_ui_text(prop, "Sub-Target", "");
866 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
868 prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
869 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_X);
870 RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X scale");
871 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
873 prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
874 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Y);
875 RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y scale");
876 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
878 prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
879 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Z);
880 RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale");
881 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
883 prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
884 RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_OFFSET);
885 RNA_def_property_ui_text(prop, "Offset", "Add original scale into copied scale");
886 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
889 static void rna_def_constraint_same_volume(BlenderRNA *brna)
894 static EnumPropertyItem volume_items[] = {
895 {SAMEVOL_X, "SAMEVOL_X", 0, "X", ""},
896 {SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""},
897 {SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""},
898 {0, NULL, 0, NULL, NULL}};
900 srna= RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
901 RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", "Maintain a constant volume along a single scaling axis");
902 RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
904 prop= RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
905 RNA_def_property_enum_sdna(prop, NULL, "flag");
906 RNA_def_property_enum_items(prop, volume_items);
907 RNA_def_property_ui_text(prop, "Free Axis", "The free scaling axis of the object");
908 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
910 prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_DISTANCE);
911 RNA_def_property_range(prop, 0.001, 100.f);
912 RNA_def_property_ui_text(prop, "Volume", "Volume of the bone at rest");
913 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
917 static void rna_def_constraint_transform_like(BlenderRNA *brna)
922 srna= RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
923 RNA_def_struct_ui_text(srna, "Copy Transforms Constraint", "Copy all the transforms of the target");
925 prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
926 RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
927 RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
928 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
930 RNA_def_struct_sdna_from(srna, "bTransLikeConstraint", "data");
932 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
933 RNA_def_property_pointer_sdna(prop, NULL, "tar");
934 RNA_def_property_ui_text(prop, "Target", "Target Object");
935 RNA_def_property_flag(prop, PROP_EDITABLE);
936 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
938 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
939 RNA_def_property_string_sdna(prop, NULL, "subtarget");
940 RNA_def_property_ui_text(prop, "Sub-Target", "");
941 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
944 static void rna_def_constraint_minmax(BlenderRNA *brna)
949 static EnumPropertyItem minmax_items[] = {
950 {TRACK_X, "FLOOR_X", 0, "X", ""},
951 {TRACK_Y, "FLOOR_Y", 0, "Y", ""},
952 {TRACK_Z, "FLOOR_Z", 0, "Z", ""},
953 {TRACK_nX, "FLOOR_NEGATIVE_X", 0, "-X", ""},
954 {TRACK_nY, "FLOOR_NEGATIVE_Y", 0, "-Y", ""},
955 {TRACK_nZ, "FLOOR_NEGATIVE_Z", 0, "-Z", ""},
956 {0, NULL, 0, NULL, NULL}};
958 srna= RNA_def_struct(brna, "FloorConstraint", "Constraint");
959 RNA_def_struct_ui_text(srna, "Floor Constraint", "Use the target object for location limitation");
960 RNA_def_struct_sdna_from(srna, "bMinMaxConstraint","data");
962 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
963 RNA_def_property_pointer_sdna(prop, NULL, "tar");
964 RNA_def_property_ui_text(prop, "Target", "Target Object");
965 RNA_def_property_flag(prop, PROP_EDITABLE);
966 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
968 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
969 RNA_def_property_string_sdna(prop, NULL, "subtarget");
970 RNA_def_property_ui_text(prop, "Sub-Target", "");
971 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
973 prop= RNA_def_property(srna, "floor_location", PROP_ENUM, PROP_NONE);
974 RNA_def_property_enum_sdna(prop, NULL, "minmaxflag");
975 RNA_def_property_enum_items(prop, minmax_items);
976 RNA_def_property_ui_text(prop, "Floor Location", "Location of target that object will not pass through");
977 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
979 prop= RNA_def_property(srna, "use_sticky", PROP_BOOLEAN, PROP_NONE);
980 RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_STICKY);
981 RNA_def_property_ui_text(prop, "Sticky", "Immobilize object while constrained");
982 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
984 prop= RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
985 RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_USEROT);
986 RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor");
987 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
989 prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
990 RNA_def_property_range(prop, 0.0, 100.f);
991 RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object origin");
992 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
995 static void rna_def_constraint_action(BlenderRNA *brna)
1000 static EnumPropertyItem transform_channel_items[] = {
1001 {20, "LOCATION_X", 0, "Location X", ""},
1002 {21, "LOCATION_Y", 0, "Location Y", ""},
1003 {22, "LOCATION_Z", 0, "Location Z", ""},
1004 {00, "ROTATION_X", 0, "Rotation X", ""},
1005 {01, "ROTATION_Y", 0, "Rotation Y", ""},
1006 {02, "ROTATION_Z", 0, "Rotation Z", ""},
1007 {10, "SCALE_X", 0, "Scale X", ""},
1008 {11, "SCALE_Y", 0, "Scale Y", ""},
1009 {12, "SCALE_Z", 0, "Scale Z", ""},
1010 {0, NULL, 0, NULL, NULL}};
1012 srna= RNA_def_struct(brna, "ActionConstraint", "Constraint");
1013 RNA_def_struct_ui_text(srna, "Action Constraint", "Map an action to the transform axes of a bone");
1014 RNA_def_struct_sdna_from(srna, "bActionConstraint", "data");
1016 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1017 RNA_def_property_pointer_sdna(prop, NULL, "tar");
1018 RNA_def_property_ui_text(prop, "Target", "Target Object");
1019 RNA_def_property_flag(prop, PROP_EDITABLE);
1020 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1022 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1023 RNA_def_property_string_sdna(prop, NULL, "subtarget");
1024 RNA_def_property_ui_text(prop, "Sub-Target", "");
1025 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1027 prop= RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE);
1028 RNA_def_property_enum_sdna(prop, NULL, "type");
1029 RNA_def_property_enum_items(prop, transform_channel_items);
1030 RNA_def_property_ui_text(prop, "Transform Channel", "Transformation channel from the target that is used to key the Action");
1031 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1033 prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
1034 RNA_def_property_pointer_sdna(prop, NULL, "act");
1035 RNA_def_property_ui_text(prop, "Action", "The constraining action");
1036 RNA_def_property_flag(prop, PROP_EDITABLE);
1037 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1039 prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
1040 RNA_def_property_int_sdna(prop, NULL, "start");
1041 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
1042 RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use");
1043 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1045 prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
1046 RNA_def_property_int_sdna(prop, NULL, "end");
1047 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
1048 RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use");
1049 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1051 prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
1052 RNA_def_property_float_sdna(prop, NULL, "max");
1053 RNA_def_property_range(prop, -1000.f, 1000.f);
1054 RNA_def_property_ui_text(prop, "Maximum", "Maximum value for target channel range");
1055 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1056 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
1058 prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
1059 RNA_def_property_float_sdna(prop, NULL, "min");
1060 RNA_def_property_range(prop, -1000.f, 1000.f);
1061 RNA_def_property_ui_text(prop, "Minimum", "Minimum value for target channel range");
1062 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1063 RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
1066 static void rna_def_constraint_locked_track(BlenderRNA *brna)
1071 static EnumPropertyItem locktrack_items[] = {
1072 {TRACK_X, "TRACK_X", 0, "X", ""},
1073 {TRACK_Y, "TRACK_Y", 0, "Y", ""},
1074 {TRACK_Z, "TRACK_Z", 0, "Z", ""},
1075 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
1076 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
1077 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
1078 {0, NULL, 0, NULL, NULL}};
1080 static EnumPropertyItem lock_items[] = {
1081 {TRACK_X, "LOCK_X", 0, "X", ""},
1082 {TRACK_Y, "LOCK_Y", 0, "Y", ""},
1083 {TRACK_Z, "LOCK_Z", 0, "Z", ""},
1084 {0, NULL, 0, NULL, NULL}};
1086 srna= RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
1087 RNA_def_struct_ui_text(srna, "Locked Track Constraint", "Point toward the target along the track axis, while locking the other axis");
1089 prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
1090 RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
1091 RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
1092 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1094 RNA_def_struct_sdna_from(srna, "bLockTrackConstraint", "data");
1096 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1097 RNA_def_property_pointer_sdna(prop, NULL, "tar");
1098 RNA_def_property_ui_text(prop, "Target", "Target Object");
1099 RNA_def_property_flag(prop, PROP_EDITABLE);
1100 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1102 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1103 RNA_def_property_string_sdna(prop, NULL, "subtarget");
1104 RNA_def_property_ui_text(prop, "Sub-Target", "");
1105 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1107 prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
1108 RNA_def_property_enum_sdna(prop, NULL, "trackflag");
1109 RNA_def_property_enum_items(prop, locktrack_items);
1110 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
1111 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1113 prop= RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
1114 RNA_def_property_enum_sdna(prop, NULL, "lockflag");
1115 RNA_def_property_enum_items(prop, lock_items);
1116 RNA_def_property_ui_text(prop, "Locked Axis", "Axis that points upward");
1117 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1120 static void rna_def_constraint_follow_path(BlenderRNA *brna)
1125 static EnumPropertyItem forwardpath_items[] = {
1126 {TRACK_X, "FORWARD_X", 0, "X", ""},
1127 {TRACK_Y, "FORWARD_Y", 0, "Y", ""},
1128 {TRACK_Z, "FORWARD_Z", 0, "Z", ""},
1129 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
1130 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
1131 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
1132 {0, NULL, 0, NULL, NULL}};
1134 static EnumPropertyItem pathup_items[] = {
1135 {TRACK_X, "UP_X", 0, "X", ""},
1136 {TRACK_Y, "UP_Y", 0, "Y", ""},
1137 {TRACK_Z, "UP_Z", 0, "Z", ""},
1138 {0, NULL, 0, NULL, NULL}};
1140 srna= RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
1141 RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Lock motion to the target path");
1142 RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data");
1144 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1145 RNA_def_property_pointer_sdna(prop, NULL, "tar");
1146 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
1147 RNA_def_property_ui_text(prop, "Target", "Target Object");
1148 RNA_def_property_flag(prop, PROP_EDITABLE);
1149 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1151 prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TIME);
1152 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
1153 RNA_def_property_ui_text(prop, "Offset", "Offset from the position corresponding to the time frame");
1154 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1156 prop= RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR);
1157 RNA_def_property_float_sdna(prop, NULL, "offset_fac");
1158 RNA_def_property_range(prop, 0.0f, 1.0f);
1159 RNA_def_property_ui_text(prop, "Offset Factor", "Percentage value defining target position along length of bone");
1160 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1162 prop= RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
1163 RNA_def_property_enum_sdna(prop, NULL, "trackflag");
1164 RNA_def_property_enum_items(prop, forwardpath_items);
1165 RNA_def_property_ui_text(prop, "Forward Axis", "Axis that points forward along the path");
1166 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1168 prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
1169 RNA_def_property_enum_sdna(prop, NULL, "upflag");
1170 RNA_def_property_enum_items(prop, pathup_items);
1171 RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
1172 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1174 prop= RNA_def_property(srna, "use_curve_follow", PROP_BOOLEAN, PROP_NONE);
1175 RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_FOLLOW);
1176 RNA_def_property_ui_text(prop, "Follow Curve", "Object will follow the heading and banking of the curve");
1177 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1179 prop= RNA_def_property(srna, "use_fixed_location", PROP_BOOLEAN, PROP_NONE);
1180 RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_STATIC);
1181 RNA_def_property_ui_text(prop, "Fixed Position", "Object will stay locked to a single point somewhere along the length of the curve regardless of time");
1182 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1184 prop= RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
1185 RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_RADIUS);
1186 RNA_def_property_ui_text(prop, "Curve Radius", "Object is scaled by the curve radius");
1187 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1190 static void rna_def_constraint_stretch_to(BlenderRNA *brna)
1195 static EnumPropertyItem volume_items[] = {
1196 {VOLUME_XZ, "VOLUME_XZX", 0, "XZ", ""},
1197 {VOLUME_X, "VOLUME_X", 0, "X", ""},
1198 {VOLUME_Z, "VOLUME_Z", 0, "Z", ""},
1199 {NO_VOLUME, "NO_VOLUME", 0, "None", ""},
1200 {0, NULL, 0, NULL, NULL}};
1202 static EnumPropertyItem plane_items[] = {
1203 {PLANE_X, "PLANE_X", 0, "X", "Keep X Axis"},
1204 {PLANE_Z, "PLANE_Z", 0, "Z", "Keep Z Axis"},
1205 {0, NULL, 0, NULL, NULL}};
1207 srna= RNA_def_struct(brna, "StretchToConstraint", "Constraint");
1208 RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretch to meet the target object");
1210 prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
1211 RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
1212 RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
1213 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1215 RNA_def_struct_sdna_from(srna, "bStretchToConstraint", "data");
1217 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1218 RNA_def_property_pointer_sdna(prop, NULL, "tar");
1219 RNA_def_property_ui_text(prop, "Target", "Target Object");
1220 RNA_def_property_flag(prop, PROP_EDITABLE);
1221 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1223 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1224 RNA_def_property_string_sdna(prop, NULL, "subtarget");
1225 RNA_def_property_ui_text(prop, "Sub-Target", "");
1226 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1228 prop= RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
1229 RNA_def_property_enum_sdna(prop, NULL, "volmode");
1230 RNA_def_property_enum_items(prop, volume_items);
1231 RNA_def_property_ui_text(prop, "Maintain Volume", "Maintain the object's volume as it stretches");
1232 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1234 prop= RNA_def_property(srna, "keep_axis", PROP_ENUM, PROP_NONE);
1235 RNA_def_property_enum_sdna(prop, NULL, "plane");
1236 RNA_def_property_enum_items(prop, plane_items);
1237 RNA_def_property_ui_text(prop, "Keep Axis", "Axis to maintain during stretch");
1238 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1240 prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_DISTANCE);
1241 RNA_def_property_float_sdna(prop, NULL, "orglength");
1242 RNA_def_property_range(prop, 0.0, 100.f);
1243 RNA_def_property_ui_text(prop, "Original Length", "Length at rest position");
1244 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1246 prop= RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
1247 RNA_def_property_range(prop, 0.0, 100.f);
1248 RNA_def_property_ui_text(prop, "Volume Variation", "Factor between volume variation and stretching");
1249 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1252 static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
1257 static EnumPropertyItem pivot_items[] = {
1258 {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allow rotations around all axes"},
1259 {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Work in one plane, allow rotations around one axis only"},
1260 {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", "Allow rotations around all axes with limits for the cone and twist axes"},
1261 {CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF", "No constraints by default, limits can be set individually"},
1262 {0, NULL, 0, NULL, NULL}};
1264 srna= RNA_def_struct(brna, "RigidBodyJointConstraint", "Constraint");
1265 RNA_def_struct_ui_text(srna, "Rigid Body Joint Constraint", "For use with the Game Engine");
1266 RNA_def_struct_sdna_from(srna, "bRigidBodyJointConstraint", "data");
1268 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1269 RNA_def_property_pointer_sdna(prop, NULL, "tar");
1270 RNA_def_property_ui_text(prop, "Target", "Target Object");
1271 RNA_def_property_flag(prop, PROP_EDITABLE);
1272 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1274 prop= RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
1275 RNA_def_property_ui_text(prop, "Child Object", "Child object");
1276 RNA_def_property_flag(prop, PROP_EDITABLE);
1277 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1279 prop= RNA_def_property(srna, "pivot_type", PROP_ENUM, PROP_NONE);
1280 RNA_def_property_enum_sdna(prop, NULL, "type");
1281 RNA_def_property_enum_items(prop, pivot_items);
1282 RNA_def_property_ui_text(prop, "Pivot Type", "");
1283 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1285 prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_DISTANCE);
1286 RNA_def_property_float_sdna(prop, NULL, "pivX");
1287 RNA_def_property_range(prop, -1000.0, 1000.f);
1288 RNA_def_property_ui_text(prop, "Pivot X", "Offset pivot on X");
1289 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1291 prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_DISTANCE);
1292 RNA_def_property_float_sdna(prop, NULL, "pivY");
1293 RNA_def_property_range(prop, -1000.0, 1000.f);
1294 RNA_def_property_ui_text(prop, "Pivot Y", "Offset pivot on Y");
1295 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1297 prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_DISTANCE);
1298 RNA_def_property_float_sdna(prop, NULL, "pivZ");
1299 RNA_def_property_range(prop, -1000.0, 1000.f);
1300 RNA_def_property_ui_text(prop, "Pivot Z", "Offset pivot on Z");
1301 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1303 prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE);
1304 RNA_def_property_float_sdna(prop, NULL, "axX");
1305 RNA_def_property_range(prop, -M_PI*2, M_PI*2);
1306 RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis in degrees");
1307 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1309 prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE);
1310 RNA_def_property_float_sdna(prop, NULL, "axY");
1311 RNA_def_property_range(prop, -M_PI*2, M_PI*2);
1312 RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis in degrees");
1313 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1315 prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE);
1316 RNA_def_property_float_sdna(prop, NULL, "axZ");
1317 RNA_def_property_range(prop, -M_PI*2, M_PI*2);
1318 RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees");
1319 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1321 prop= RNA_def_property(srna, "use_linked_collision", PROP_BOOLEAN, PROP_NONE);
1322 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE_LINKED_COLLISION);
1323 RNA_def_property_ui_text(prop, "Disable Linked Collision", "Disable collision between linked bodies");
1324 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1326 prop= RNA_def_property(srna, "show_pivot", PROP_BOOLEAN, PROP_NONE);
1327 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DRAW_PIVOT);
1328 RNA_def_property_ui_text(prop, "Draw Pivot", "Display the pivot point and rotation in 3D view");
1329 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1334 prop= RNA_def_property(srna, "limit_min_x", PROP_FLOAT, PROP_NONE);
1335 RNA_def_property_float_sdna(prop, NULL, "minLimit[0]");
1336 RNA_def_property_ui_text(prop, "Minimum Limit X", "");
1338 prop= RNA_def_property(srna, "limit_min_y", PROP_FLOAT, PROP_NONE);
1339 RNA_def_property_float_sdna(prop, NULL, "minLimit[1]");
1340 RNA_def_property_ui_text(prop, "Minimum Limit Y", "");
1342 prop= RNA_def_property(srna, "limit_min_z", PROP_FLOAT, PROP_NONE);
1343 RNA_def_property_float_sdna(prop, NULL, "minLimit[2]");
1344 RNA_def_property_ui_text(prop, "Minimum Limit Z", "");
1346 prop= RNA_def_property(srna, "limit_max_x", PROP_FLOAT, PROP_NONE);
1347 RNA_def_property_float_sdna(prop, NULL, "maxLimit[0]");
1348 RNA_def_property_ui_text(prop, "Maximum Limit X", "");
1350 prop= RNA_def_property(srna, "limit_max_y", PROP_FLOAT, PROP_NONE);
1351 RNA_def_property_float_sdna(prop, NULL, "maxLimit[1]");
1352 RNA_def_property_ui_text(prop, "Maximum Limit Y", "");
1354 prop= RNA_def_property(srna, "limit_max_z", PROP_FLOAT, PROP_NONE);
1355 RNA_def_property_float_sdna(prop, NULL, "maxLimit[2]");
1356 RNA_def_property_ui_text(prop, "Maximum Limit Z", "");
1358 /* Limit Min/Max for angle */
1359 prop= RNA_def_property(srna, "limit_angle_min_x", PROP_FLOAT, PROP_ANGLE);
1360 RNA_def_property_float_sdna(prop, NULL, "minLimit[3]");
1361 RNA_def_property_range(prop, -M_PI*2, M_PI*2);
1362 RNA_def_property_ui_text(prop, "Minimum Angular Limit X", "");
1364 prop= RNA_def_property(srna, "limit_angle_min_y", PROP_FLOAT, PROP_ANGLE);
1365 RNA_def_property_float_sdna(prop, NULL, "minLimit[4]");
1366 RNA_def_property_range(prop, -M_PI*2, M_PI*2);
1367 RNA_def_property_ui_text(prop, "Minimum Angular Limit Y", "");
1369 prop= RNA_def_property(srna, "limit_angle_min_z", PROP_FLOAT, PROP_ANGLE);
1370 RNA_def_property_float_sdna(prop, NULL, "minLimit[5]");
1371 RNA_def_property_range(prop, -M_PI*2, M_PI*2);
1372 RNA_def_property_ui_text(prop, "Minimum Angular Limit Z", "");
1374 prop= RNA_def_property(srna, "limit_angle_max_x", PROP_FLOAT, PROP_ANGLE);
1375 RNA_def_property_float_sdna(prop, NULL, "maxLimit[3]");
1376 RNA_def_property_range(prop, -M_PI*2, M_PI*2);
1377 RNA_def_property_ui_text(prop, "Maximum Angular Limit X", "");
1379 prop= RNA_def_property(srna, "limit_angle_max_y", PROP_FLOAT, PROP_ANGLE);
1380 RNA_def_property_float_sdna(prop, NULL, "maxLimit[4]");
1381 RNA_def_property_range(prop, -M_PI*2, M_PI*2);
1382 RNA_def_property_ui_text(prop, "Maximum Angular Limit Y", "");
1384 prop= RNA_def_property(srna, "limit_angle_max_z", PROP_FLOAT, PROP_ANGLE);
1385 RNA_def_property_float_sdna(prop, NULL, "maxLimit[5]");
1386 RNA_def_property_range(prop, -M_PI*2, M_PI*2);
1387 RNA_def_property_ui_text(prop, "Maximum Angular Limit Z", "");
1389 /* Limit Booleans */
1390 prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
1391 RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
1392 RNA_def_property_ui_text(prop, "Limit X", "Use minimum/maximum X limit");
1393 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1395 prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
1396 RNA_def_property_boolean_sdna(prop, NULL, "flag", 2);
1397 RNA_def_property_ui_text(prop, "Limit Y", "Use minimum/maximum y limit");
1398 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1400 prop= RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
1401 RNA_def_property_boolean_sdna(prop, NULL, "flag", 4);
1402 RNA_def_property_ui_text(prop, "Limit Z", "Use minimum/maximum z limit");
1403 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1405 prop= RNA_def_property(srna, "use_angular_limit_x", PROP_BOOLEAN, PROP_NONE);
1406 RNA_def_property_boolean_sdna(prop, NULL, "flag", 8);
1407 RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum X angular limit");
1408 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1410 prop= RNA_def_property(srna, "use_angular_limit_y", PROP_BOOLEAN, PROP_NONE);
1411 RNA_def_property_boolean_sdna(prop, NULL, "flag", 16);
1412 RNA_def_property_ui_text(prop, "Angular Y Limit", "Use minimum/maximum Y angular limit");
1413 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1415 prop= RNA_def_property(srna, "use_angular_limit_z", PROP_BOOLEAN, PROP_NONE);
1416 RNA_def_property_boolean_sdna(prop, NULL, "flag", 32);
1417 RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum Z angular limit");
1418 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1421 static void rna_def_constraint_clamp_to(BlenderRNA *brna)
1426 static EnumPropertyItem clamp_items[] = {
1427 {CLAMPTO_AUTO, "CLAMPTO_AUTO", 0, "Auto", ""},
1428 {CLAMPTO_X, "CLAMPTO_X", 0, "X", ""},
1429 {CLAMPTO_Y, "CLAMPTO_Y", 0, "Y", ""},
1430 {CLAMPTO_Z, "CLAMPTO_Z", 0, "Z", ""},
1431 {0, NULL, 0, NULL, NULL}};
1433 srna= RNA_def_struct(brna, "ClampToConstraint", "Constraint");
1434 RNA_def_struct_ui_text(srna, "Clamp To Constraint", "Constrains an object's location to the nearest point along the target path");
1435 RNA_def_struct_sdna_from(srna, "bClampToConstraint", "data");
1437 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1438 RNA_def_property_pointer_sdna(prop, NULL, "tar");
1439 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
1440 RNA_def_property_ui_text(prop, "Target", "Target Object");
1441 RNA_def_property_flag(prop, PROP_EDITABLE);
1442 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1444 prop= RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE);
1445 RNA_def_property_enum_sdna(prop, NULL, "flag");
1446 RNA_def_property_enum_items(prop, clamp_items);
1447 RNA_def_property_ui_text(prop, "Main Axis", "Main axis of movement");
1448 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1450 prop= RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
1451 RNA_def_property_boolean_sdna(prop, NULL, "flag2", CLAMPTO_CYCLIC);
1452 RNA_def_property_ui_text(prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box)");
1453 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1456 static void rna_def_constraint_transform(BlenderRNA *brna)
1461 static EnumPropertyItem transform_items[] = {
1462 {0, "LOCATION", 0, "Loc", ""},
1463 {1, "ROTATION", 0, "Rot", ""},
1464 {2, "SCALE", 0, "Scale", ""},
1465 {0, NULL, 0, NULL, NULL}};
1467 static EnumPropertyItem axis_map_items[] = {
1468 {0, "X", 0, "X", ""},
1469 {1, "Y", 0, "Y", ""},
1470 {2, "Z", 0, "Z", ""},
1471 {0, NULL, 0, NULL, NULL}};
1473 srna= RNA_def_struct(brna, "TransformConstraint", "Constraint");
1474 RNA_def_struct_ui_text(srna, "Transformation Constraint", "Maps transformations of the target to the object");
1475 RNA_def_struct_sdna_from(srna, "bTransformConstraint", "data");
1477 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1478 RNA_def_property_pointer_sdna(prop, NULL, "tar");
1479 RNA_def_property_ui_text(prop, "Target", "Target Object");
1480 RNA_def_property_flag(prop, PROP_EDITABLE);
1481 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1483 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1484 RNA_def_property_string_sdna(prop, NULL, "subtarget");
1485 RNA_def_property_ui_text(prop, "Sub-Target", "");
1486 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1488 prop= RNA_def_property(srna, "map_from", PROP_ENUM, PROP_NONE);
1489 RNA_def_property_enum_sdna(prop, NULL, "from");
1490 RNA_def_property_enum_items(prop, transform_items);
1491 RNA_def_property_ui_text(prop, "Map From", "The transformation type to use from the target");
1492 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1494 prop= RNA_def_property(srna, "map_to", PROP_ENUM, PROP_NONE);
1495 RNA_def_property_enum_sdna(prop, NULL, "to");
1496 RNA_def_property_enum_items(prop, transform_items);
1497 RNA_def_property_ui_text(prop, "Map To", "The transformation type to affect of the constrained object");
1498 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1500 prop= RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE);
1501 RNA_def_property_enum_sdna(prop, NULL, "map[0]");
1502 RNA_def_property_enum_items(prop, axis_map_items);
1503 RNA_def_property_ui_text(prop, "Map To X From", "The source axis constrained object's X axis uses");
1504 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1506 prop= RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE);
1507 RNA_def_property_enum_sdna(prop, NULL, "map[1]");
1508 RNA_def_property_enum_items(prop, axis_map_items);
1509 RNA_def_property_ui_text(prop, "Map To Y From", "The source axis constrained object's Y axis uses");
1510 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1512 prop= RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE);
1513 RNA_def_property_enum_sdna(prop, NULL, "map[2]");
1514 RNA_def_property_enum_items(prop, axis_map_items);
1515 RNA_def_property_ui_text(prop, "Map To Z From", "The source axis constrained object's Z axis uses");
1516 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1518 prop= RNA_def_property(srna, "use_motion_extrapolate", PROP_BOOLEAN, PROP_NONE);
1519 RNA_def_property_boolean_sdna(prop, NULL, "expo", CLAMPTO_CYCLIC);
1520 RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges");
1521 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1523 prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
1524 RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
1525 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1526 RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
1527 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1529 prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
1530 RNA_def_property_float_sdna(prop, NULL, "from_min[1]");
1531 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1532 RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
1533 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1535 prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
1536 RNA_def_property_float_sdna(prop, NULL, "from_min[2]");
1537 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1538 RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
1539 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1541 prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
1542 RNA_def_property_float_sdna(prop, NULL, "from_max[0]");
1543 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1544 RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
1545 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1547 prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
1548 RNA_def_property_float_sdna(prop, NULL, "from_max[1]");
1549 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1550 RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
1551 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1553 prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
1554 RNA_def_property_float_sdna(prop, NULL, "from_max[2]");
1555 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1556 RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
1557 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1559 prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
1560 RNA_def_property_float_sdna(prop, NULL, "to_min[0]");
1561 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1562 RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
1563 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1565 prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
1566 RNA_def_property_float_sdna(prop, NULL, "to_min[1]");
1567 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1568 RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
1569 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1571 prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
1572 RNA_def_property_float_sdna(prop, NULL, "to_min[2]");
1573 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1574 RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
1575 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1577 prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
1578 RNA_def_property_float_sdna(prop, NULL, "to_max[0]");
1579 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1580 RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
1581 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1583 prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
1584 RNA_def_property_float_sdna(prop, NULL, "to_max[1]");
1585 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1586 RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
1587 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1589 prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
1590 RNA_def_property_float_sdna(prop, NULL, "to_max[2]");
1591 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
1592 RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
1593 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1596 static void rna_def_constraint_location_limit(BlenderRNA *brna)
1601 srna= RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
1602 RNA_def_struct_ui_text(srna, "Limit Location Constraint", "Limit the location of the constrained object");
1603 RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data");
1605 prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
1606 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
1607 RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
1608 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1610 prop= RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
1611 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
1612 RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
1613 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1615 prop= RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
1616 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
1617 RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
1618 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1620 prop= RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
1621 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
1622 RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
1623 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1625 prop= RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
1626 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
1627 RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
1628 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1630 prop= RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
1631 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
1632 RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
1633 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1635 prop= RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_DISTANCE);
1636 RNA_def_property_float_sdna(prop, NULL, "xmin");
1637 RNA_def_property_range(prop, -1000.0, 1000.f);
1638 RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
1639 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1641 prop= RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_DISTANCE);
1642 RNA_def_property_float_sdna(prop, NULL, "ymin");
1643 RNA_def_property_range(prop, -1000.0, 1000.f);
1644 RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
1645 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1647 prop= RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_DISTANCE);
1648 RNA_def_property_float_sdna(prop, NULL, "zmin");
1649 RNA_def_property_range(prop, -1000.0, 1000.f);
1650 RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
1651 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1653 prop= RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_DISTANCE);
1654 RNA_def_property_float_sdna(prop, NULL, "xmax");
1655 RNA_def_property_range(prop, -1000.0, 1000.f);
1656 RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
1657 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1659 prop= RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_DISTANCE);
1660 RNA_def_property_float_sdna(prop, NULL, "ymax");
1661 RNA_def_property_range(prop, -1000.0, 1000.f);
1662 RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
1663 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1665 prop= RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_DISTANCE);
1666 RNA_def_property_float_sdna(prop, NULL, "zmax");
1667 RNA_def_property_range(prop, -1000.0, 1000.f);
1668 RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
1669 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1671 prop= RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
1672 RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
1673 RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
1674 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1677 static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
1682 srna= RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
1683 RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limit the rotation of the constrained object");
1684 RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data");
1686 prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
1687 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XROT);
1688 RNA_def_property_ui_text(prop, "Limit X", "Use the minimum X value");
1689 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1691 prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
1692 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YROT);
1693 RNA_def_property_ui_text(prop, "Limit Y", "Use the minimum Y value");
1694 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1696 prop= RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
1697 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZROT);
1698 RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value");
1699 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1701 prop= RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE);
1702 RNA_def_property_float_sdna(prop, NULL, "xmin");
1703 RNA_def_property_range(prop, -1000.0, 1000.f);
1704 RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
1705 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1707 prop= RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE);
1708 RNA_def_property_float_sdna(prop, NULL, "ymin");
1709 RNA_def_property_range(prop, -1000.0, 1000.f);
1710 RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
1711 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1713 prop= RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_ANGLE);
1714 RNA_def_property_float_sdna(prop, NULL, "zmin");
1715 RNA_def_property_range(prop, -1000.0, 1000.f);
1716 RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
1717 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1719 prop= RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE);
1720 RNA_def_property_float_sdna(prop, NULL, "xmax");
1721 RNA_def_property_range(prop, -1000.0, 1000.f);
1722 RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
1723 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1725 prop= RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE);
1726 RNA_def_property_float_sdna(prop, NULL, "ymax");
1727 RNA_def_property_range(prop, -1000.0, 1000.f);
1728 RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
1729 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1731 prop= RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_ANGLE);
1732 RNA_def_property_float_sdna(prop, NULL, "zmax");
1733 RNA_def_property_range(prop, -1000.0, 1000.f);
1734 RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
1735 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1737 prop= RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
1738 RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
1739 RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
1740 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1743 static void rna_def_constraint_size_limit(BlenderRNA *brna)
1748 srna= RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
1749 RNA_def_struct_ui_text(srna, "Limit Size Constraint", "Limit the scaling of the constrained object");
1750 RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data");
1752 prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
1753 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
1754 RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
1755 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1757 prop= RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
1758 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
1759 RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
1760 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1762 prop= RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
1763 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
1764 RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
1765 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1767 prop= RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
1768 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
1769 RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
1770 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1772 prop= RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
1773 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
1774 RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
1775 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1777 prop= RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
1778 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
1779 RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
1780 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1782 prop= RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
1783 RNA_def_property_float_sdna(prop, NULL, "xmin");
1784 RNA_def_property_range(prop, -1000.0, 1000.f);
1785 RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
1786 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1788 prop= RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
1789 RNA_def_property_float_sdna(prop, NULL, "ymin");
1790 RNA_def_property_range(prop, -1000.0, 1000.f);
1791 RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
1792 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1794 prop= RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_NONE);
1795 RNA_def_property_float_sdna(prop, NULL, "zmin");
1796 RNA_def_property_range(prop, -1000.0, 1000.f);
1797 RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
1798 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1800 prop= RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
1801 RNA_def_property_float_sdna(prop, NULL, "xmax");
1802 RNA_def_property_range(prop, -1000.0, 1000.f);
1803 RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
1804 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1806 prop= RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
1807 RNA_def_property_float_sdna(prop, NULL, "ymax");
1808 RNA_def_property_range(prop, -1000.0, 1000.f);
1809 RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
1810 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1812 prop= RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_NONE);
1813 RNA_def_property_float_sdna(prop, NULL, "zmax");
1814 RNA_def_property_range(prop, -1000.0, 1000.f);
1815 RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
1816 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1818 prop= RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
1819 RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
1820 RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
1821 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1824 static void rna_def_constraint_distance_limit(BlenderRNA *brna)
1829 srna= RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
1830 RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limit the distance from target object");
1832 prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
1833 RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
1834 RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
1835 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1837 RNA_def_struct_sdna_from(srna, "bDistLimitConstraint", "data");
1839 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1840 RNA_def_property_pointer_sdna(prop, NULL, "tar");
1841 RNA_def_property_ui_text(prop, "Target", "Target Object");
1842 RNA_def_property_flag(prop, PROP_EDITABLE);
1843 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1845 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1846 RNA_def_property_string_sdna(prop, NULL, "subtarget");
1847 RNA_def_property_ui_text(prop, "Sub-Target", "");
1848 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1850 prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
1851 RNA_def_property_float_sdna(prop, NULL, "dist");
1852 RNA_def_property_range(prop, 0.0, 100.f);
1853 RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
1854 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1856 prop= RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
1857 RNA_def_property_enum_sdna(prop, NULL, "mode");
1858 RNA_def_property_enum_items(prop, constraint_distance_items);
1859 RNA_def_property_ui_text(prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
1860 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1862 prop= RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
1863 RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMITDIST_TRANSFORM);
1864 RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
1865 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1868 static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
1873 static EnumPropertyItem type_items[] = {
1874 {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrink the location to the nearest target surface"},
1875 {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrink the location to the nearest target surface along a given axis"},
1876 {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrink the location to the nearest target vertex"},
1877 {0, NULL, 0, NULL, NULL}};
1879 srna= RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
1880 RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship");
1881 RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
1883 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1884 RNA_def_property_pointer_sdna(prop, NULL, "target"); /* TODO, mesh type */
1885 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
1886 RNA_def_property_ui_text(prop, "Target", "Target Object");
1887 RNA_def_property_flag(prop, PROP_EDITABLE);
1888 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1890 prop= RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
1891 RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
1892 RNA_def_property_enum_items(prop, type_items);
1893 RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Select type of shrinkwrap algorithm for target position");
1894 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1896 prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
1897 RNA_def_property_float_sdna(prop, NULL, "dist");
1898 RNA_def_property_range(prop, 0.0, 100.f);
1899 RNA_def_property_ui_text(prop, "Distance", "Distance to Target");
1900 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1902 prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1903 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS);
1904 RNA_def_property_ui_text(prop, "Axis X", "Projection over X Axis");
1905 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1907 prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1908 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS);
1909 RNA_def_property_ui_text(prop, "Axis Y", "Projection over Y Axis");
1910 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1912 prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1913 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS);
1914 RNA_def_property_ui_text(prop, "Axis Z", "Projection over Z Axis");
1915 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1918 static void rna_def_constraint_damped_track(BlenderRNA *brna)
1923 static EnumPropertyItem damptrack_items[] = {
1924 {TRACK_X, "TRACK_X", 0, "X", ""},
1925 {TRACK_Y, "TRACK_Y", 0, "Y", ""},
1926 {TRACK_Z, "TRACK_Z", 0, "Z", ""},
1927 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
1928 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
1929 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
1930 {0, NULL, 0, NULL, NULL}};
1932 srna= RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
1933 RNA_def_struct_ui_text(srna, "Damped Track Constraint", "Point toward target by taking the shortest rotation path");
1935 prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
1936 RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
1937 RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
1938 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1940 RNA_def_struct_sdna_from(srna, "bDampTrackConstraint", "data");
1942 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1943 RNA_def_property_pointer_sdna(prop, NULL, "tar");
1944 RNA_def_property_ui_text(prop, "Target", "Target Object");
1945 RNA_def_property_flag(prop, PROP_EDITABLE);
1946 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1948 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1949 RNA_def_property_string_sdna(prop, NULL, "subtarget");
1950 RNA_def_property_ui_text(prop, "Sub-Target", "");
1951 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1953 prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
1954 RNA_def_property_enum_sdna(prop, NULL, "trackflag");
1955 RNA_def_property_enum_items(prop, damptrack_items);
1956 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
1957 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1960 static void rna_def_constraint_spline_ik(BlenderRNA *brna)
1965 static EnumPropertyItem splineik_xz_scale_mode[] = {
1966 {CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes (Default)"},
1967 {CONSTRAINT_SPLINEIK_XZS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original", "Use the original scaling of the bones"},
1968 {CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC, "VOLUME_PRESERVE", 0, "Volume Preservation", "Scale of the X and Z axes is the inverse of the Y-Scale"},
1969 {0, NULL, 0, NULL, NULL}};
1971 srna= RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
1972 RNA_def_struct_ui_text(srna, "Spline IK Constraint", "Align 'n' bones along a curve");
1973 RNA_def_struct_sdna_from(srna, "bSplineIKConstraint", "data");
1976 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
1977 RNA_def_property_pointer_sdna(prop, NULL, "tar");
1978 RNA_def_property_ui_text(prop, "Target", "Curve that controls this relationship");
1979 RNA_def_property_flag(prop, PROP_EDITABLE);
1980 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1982 prop= RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
1983 RNA_def_property_int_sdna(prop, NULL, "chainlen");
1984 RNA_def_property_range(prop, 1, 255); // TODO: this should really check the max length of the chain the constraint is attached to
1985 RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain");
1986 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
1988 /* direct access to bindings */
1989 // NOTE: only to be used by experienced users
1990 prop= RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR);
1991 RNA_def_property_array(prop, 32); // XXX this is the maximum value allowed
1992 RNA_def_property_flag(prop, PROP_DYNAMIC);
1993 RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length");
1994 RNA_def_property_float_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get", "rna_SplineIKConstraint_joint_bindings_set", NULL);
1995 RNA_def_property_ui_text(prop, "Joint Bindings", "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain as percentages");
1996 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
1999 prop= RNA_def_property(srna, "use_chain_offset", PROP_BOOLEAN, PROP_NONE);
2000 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_ROOT);
2001 RNA_def_property_ui_text(prop, "Chain Offset", "Offset the entire chain relative to the root joint");
2002 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2004 prop= RNA_def_property(srna, "use_even_divisions", PROP_BOOLEAN, PROP_NONE);
2005 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_EVENSPLITS);
2006 RNA_def_property_ui_text(prop, "Even Divisions", "Ignore the relative lengths of the bones when fitting to the curve");
2007 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2009 prop= RNA_def_property(srna, "use_y_stretch", PROP_BOOLEAN, PROP_NONE);
2010 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_SCALE_LIMITED);
2011 RNA_def_property_ui_text(prop, "Y Stretch", "Stretch the Y axis of the bones to fit the curve");
2012 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2014 prop= RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
2015 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_CURVERAD);
2016 RNA_def_property_ui_text(prop, "Use Curve Radius", "Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, on top of XZ Scale mode");
2017 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2019 prop= RNA_def_property(srna, "xz_scale_mode", PROP_ENUM, PROP_NONE);
2020 RNA_def_property_enum_sdna(prop, NULL, "xzScaleMode");
2021 RNA_def_property_enum_items(prop, splineik_xz_scale_mode);
2022 RNA_def_property_ui_text(prop, "XZ Scale Mode", "Method used for determining the scaling of the X and Z axes of the bones");
2023 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2026 static void rna_def_constraint_pivot(BlenderRNA *brna)
2031 static EnumPropertyItem pivot_rotAxis_items[] = {
2032 {PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"},
2033 {PIVOTCON_AXIS_X_NEG, "NX", 0, "-X Rot", "Use the pivot point in the negative rotation range around the X-axis"},
2034 {PIVOTCON_AXIS_Y_NEG, "NY", 0, "-Y Rot", "Use the pivot point in the negative rotation range around the Y-axis"},
2035 {PIVOTCON_AXIS_Z_NEG, "NZ", 0, "-Z Rot", "Use the pivot point in the negative rotation range around the Z-axis"},
2036 {PIVOTCON_AXIS_X, "X", 0, "X Rot", "Use the pivot point in the positive rotation range around the X-axis"},
2037 {PIVOTCON_AXIS_Y, "Y", 0, "Y Rot", "Use the pivot point in the positive rotation range around the Y-axis"},
2038 {PIVOTCON_AXIS_Z, "Z", 0, "Z Rot", "Use the pivot point in the positive rotation range around the Z-axis"},
2039 {0, NULL, 0, NULL, NULL}};
2041 srna= RNA_def_struct(brna, "PivotConstraint", "Constraint");
2042 RNA_def_struct_ui_text(srna, "Pivot Constraint", "Rotate around a different point");
2044 prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
2045 RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
2046 RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
2047 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2049 RNA_def_struct_sdna_from(srna, "bPivotConstraint", "data");
2051 /* target-defined pivot */
2052 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
2053 RNA_def_property_pointer_sdna(prop, NULL, "tar");
2054 RNA_def_property_ui_text(prop, "Target", "Target Object, defining the position of the pivot when defined");
2055 RNA_def_property_flag(prop, PROP_EDITABLE);
2056 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
2058 prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
2059 RNA_def_property_string_sdna(prop, NULL, "subtarget");
2060 RNA_def_property_ui_text(prop, "Sub-Target", "");
2061 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
2064 prop= RNA_def_property(srna, "use_relative_location", PROP_BOOLEAN, PROP_NONE);
2065 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PIVOTCON_FLAG_OFFSET_ABS);
2066 RNA_def_property_ui_text(prop, "Use Relative Offset", "Offset will be an absolute point in space instead of relative to the target");
2067 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2069 prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_XYZ);
2070 RNA_def_property_float_sdna(prop, NULL, "offset");
2071 RNA_def_property_ui_text(prop, "Offset", "Offset of pivot from target (when set), or from owner's location (when Fixed Position is off), or the absolute pivot point");
2072 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2074 /* rotation-based activation */
2075 prop= RNA_def_property(srna, "rotation_range", PROP_ENUM, PROP_NONE);
2076 RNA_def_property_enum_sdna(prop, NULL, "rotAxis");
2077 RNA_def_property_enum_items(prop, pivot_rotAxis_items);
2078 RNA_def_property_ui_text(prop, "Enabled Rotation Range", "Rotation range on which pivoting should occur");
2079 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2082 static void rna_def_constraint_follow_track(BlenderRNA *brna)
2087 srna= RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
2088 RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Lock motion to the target motion track");
2089 RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
2092 prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
2093 RNA_def_property_pointer_sdna(prop, NULL, "clip");
2094 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
2095 RNA_def_property_flag(prop, PROP_EDITABLE);
2096 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
2099 prop= RNA_def_property(srna, "track", PROP_STRING, PROP_NONE);
2100 RNA_def_property_string_sdna(prop, NULL, "track");
2101 RNA_def_property_ui_text(prop, "Track", "Movie tracking track to follow");
2102 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
2104 /* use default clip */
2105 prop= RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
2106 RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_ACTIVECLIP);
2107 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
2108 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2110 /* use 3d position */
2111 prop= RNA_def_property(srna, "use_3d_position", PROP_BOOLEAN, PROP_NONE);
2112 RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_USE_3D_POSITION);
2113 RNA_def_property_ui_text(prop, "3D Position", "Use 3D position of track to parent to");
2114 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2117 prop= RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
2118 RNA_def_property_string_sdna(prop, NULL, "object");
2119 RNA_def_property_ui_text(prop, "Object", "Movie tracking object to follow (if empty, camera object is used)");
2120 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
2123 prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
2124 RNA_def_property_pointer_sdna(prop, NULL, "camera");
2125 RNA_def_property_ui_text(prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
2126 RNA_def_property_flag(prop, PROP_EDITABLE);
2127 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
2128 RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_followTrack_camera_set", NULL, "rna_Constraint_cameraObject_poll");
2131 static void rna_def_constraint_camera_solver(BlenderRNA *brna)
2136 srna= RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
2137 RNA_def_struct_ui_text(srna, "Camera Solver Constraint", "Lock motion to the reconstructed camera movement");
2138 RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data");
2141 prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
2142 RNA_def_property_pointer_sdna(prop, NULL, "clip");
2143 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
2144 RNA_def_property_flag(prop, PROP_EDITABLE);
2145 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
2147 /* use default clip */
2148 prop= RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
2149 RNA_def_property_boolean_sdna(prop, NULL, "flag", CAMERASOLVER_ACTIVECLIP);
2150 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
2151 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2154 static void rna_def_constraint_object_solver(BlenderRNA *brna)
2159 srna= RNA_def_struct(brna, "ObjectSolverConstraint", "Constraint");
2160 RNA_def_struct_ui_text(srna, "Object Solver Constraint", "Lock motion to the reconstructed object movement");
2161 RNA_def_struct_sdna_from(srna, "bObjectSolverConstraint", "data");
2164 prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
2165 RNA_def_property_pointer_sdna(prop, NULL, "clip");
2166 RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
2167 RNA_def_property_flag(prop, PROP_EDITABLE);
2168 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
2170 /* use default clip */
2171 prop= RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
2172 RNA_def_property_boolean_sdna(prop, NULL, "flag", CAMERASOLVER_ACTIVECLIP);
2173 RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
2174 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
2177 prop= RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
2178 RNA_def_property_string_sdna(prop, NULL, "object");
2179 RNA_def_property_ui_text(prop, "Object", "Movie tracking object to follow");
2180 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
2183 prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
2184 RNA_def_property_pointer_sdna(prop, NULL, "camera");
2185 RNA_def_property_ui_text(prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
2186 RNA_def_property_flag(prop, PROP_EDITABLE);
2187 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
2188 RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_objectSolver_camera_set", NULL, "rna_Constraint_cameraObject_poll");
2191 /* base struct for constraints */
2192 void RNA_def_constraint(BlenderRNA *brna)
2198 srna= RNA_def_struct(brna, "Constraint", NULL );
2199 RNA_def_struct_ui_text(srna, "Constraint", "Constraint modifying the transformation of objects and bones");
2200 RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine");
2201 RNA_def_struct_path_func(srna, "rna_Constraint_path");
2202 RNA_def_struct_sdna(srna, "bConstraint");
2205 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2206 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Constraint_name_set");
2207 RNA_def_property_ui_text(prop, "Name", "Constraint name");
2208 RNA_def_struct_name_property(srna, prop);
2209 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT|NA_RENAME, NULL);
2212 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2213 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2214 RNA_def_property_enum_sdna(prop, NULL, "type");
2215 RNA_def_property_enum_items(prop, constraint_type_items);
2216 RNA_def_property_ui_text(prop, "Type", "");
2218 prop= RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
2219 RNA_def_property_enum_sdna(prop, NULL, "ownspace");
2220 RNA_def_property_enum_items(prop, owner_space_pchan_items);
2221 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf");
2222 RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in");
2224 prop= RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
2225 RNA_def_property_enum_sdna(prop, NULL, "tarspace");
2226 RNA_def_property_enum_items(prop, target_space_pchan_items);
2227 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_target_space_itemf");
2228 RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in");
2231 prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
2232 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OFF);
2233 RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint");
2235 prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
2236 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_EXPAND);
2237 RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
2238 RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
2240 // XXX this is really an internal flag, but it may be useful for some tools to be able to access this...
2241 prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
2242 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2243 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE);
2244 RNA_def_property_ui_text(prop, "Valid", "Constraint has valid settings and can be evaluated");
2246 // TODO: setting this to true must ensure that all others in stack are turned off too...
2247 prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
2248 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ACTIVE);
2249 RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited ");
2251 prop= RNA_def_property(srna, "is_proxy_local", PROP_BOOLEAN, PROP_NONE);
2252 RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_PROXY_LOCAL);
2253 RNA_def_property_ui_text(prop, "Proxy Local", "Constraint was added in this proxy instance (i.e. did not belong to source Armature)");
2256 prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
2257 RNA_def_property_float_sdna(prop, NULL, "enforce");
2258 RNA_def_property_range(prop, 0.0f, 1.0f);
2259 RNA_def_property_ui_text(prop, "Influence", "Amount of influence constraint will have on the final solution");
2260 RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_influence_update");
2262 /* readonly values */
2263 prop= RNA_def_property(srna, "error_location", PROP_FLOAT, PROP_NONE);
2264 RNA_def_property_float_sdna(prop, NULL, "lin_error");
2265 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2266 RNA_def_property_ui_text(prop, "Lin error", "Amount of residual error in Blender space unit for constraints that work on position");
2268 prop= RNA_def_property(srna, "error_rotation", PROP_FLOAT, PROP_NONE);
2269 RNA_def_property_float_sdna(prop, NULL, "rot_error");
2270 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2271 RNA_def_property_ui_text(prop, "Rot error", "Amount of residual error in radiant for constraints that work on orientation");
2274 rna_def_constrainttarget(brna);
2276 rna_def_constraint_childof(brna);
2277 rna_def_constraint_python(brna);
2278 rna_def_constraint_stretch_to(brna);
2279 rna_def_constraint_follow_path(brna);
2280 rna_def_constraint_locked_track(brna);
2281 rna_def_constraint_action(brna);
2282 rna_def_constraint_size_like(brna);
2283 rna_def_constraint_same_volume(brna);
2284 rna_def_constraint_locate_like(brna);
2285 rna_def_constraint_rotate_like(brna);
2286 rna_def_constraint_transform_like(brna);
2287 rna_def_constraint_minmax(brna);
2288 rna_def_constraint_track_to(brna);
2289 rna_def_constraint_kinematic(brna);
2290 rna_def_constraint_rigid_body_joint(brna);
2291 rna_def_constraint_clamp_to(brna);
2292 rna_def_constraint_distance_limit(brna);
2293 rna_def_constraint_size_limit(brna);
2294 rna_def_constraint_rotation_limit(brna);
2295 rna_def_constraint_location_limit(brna);
2296 rna_def_constraint_transform(brna);
2297 rna_def_constraint_shrinkwrap(brna);
2298 rna_def_constraint_damped_track(brna);
2299 rna_def_constraint_spline_ik(brna);
2300 rna_def_constraint_pivot(brna);
2301 rna_def_constraint_follow_track(brna);
2302 rna_def_constraint_camera_solver(brna);
2303 rna_def_constraint_object_solver(brna);