Blender  V2.59
rna_constraint.c
Go to the documentation of this file.
00001 /*
00002  * $Id: rna_constraint.c 39246 2011-08-10 07:49:18Z campbellbarton $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * Contributor(s): Blender Foundation (2008), Joshua Leung, Roland Hess
00021  *
00022  * ***** END GPL LICENSE BLOCK *****
00023  */
00024 
00030 #include <stdlib.h>
00031 
00032 #include "RNA_define.h"
00033 
00034 #include "rna_internal.h"
00035 
00036 #include "BLI_math.h"
00037 
00038 #include "DNA_action_types.h"
00039 #include "DNA_constraint_types.h"
00040 #include "DNA_modifier_types.h"
00041 #include "DNA_object_types.h"
00042 #include "DNA_scene_types.h"
00043 
00044 #include "ED_object.h"
00045 #include "WM_types.h"
00046 
00047 EnumPropertyItem constraint_type_items[] ={
00048         {0, "", 0, "Transform", ""},
00049         {CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", ICON_CONSTRAINT_DATA, "Copy Location", ""},
00050         {CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", ICON_CONSTRAINT_DATA, "Copy Rotation", ""},
00051         {CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", ICON_CONSTRAINT_DATA, "Copy Scale", ""},
00052         {CONSTRAINT_TYPE_TRANSLIKE, "COPY_TRANSFORMS", ICON_CONSTRAINT_DATA, "Copy Transforms", ""},
00053         {CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", ICON_CONSTRAINT_DATA, "Limit Distance", ""},
00054         {CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", ICON_CONSTRAINT_DATA, "Limit Location", ""},
00055         {CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", ICON_CONSTRAINT_DATA, "Limit Rotation", ""},
00056         {CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", ICON_CONSTRAINT_DATA, "Limit Scale", ""},
00057         {CONSTRAINT_TYPE_SAMEVOL, "MAINTAIN_VOLUME", ICON_CONSTRAINT_DATA, "Maintain Volume", ""},
00058         {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", ICON_CONSTRAINT_DATA, "Transformation", ""},
00059         {0, "", 0, "Tracking", ""},
00060         {CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", ICON_CONSTRAINT_DATA, "Clamp To", ""},
00061         {CONSTRAINT_TYPE_DAMPTRACK, "DAMPED_TRACK", ICON_CONSTRAINT_DATA, "Damped Track", "Tracking by taking the shortest path"},
00062         {CONSTRAINT_TYPE_KINEMATIC, "IK", ICON_CONSTRAINT_DATA, "Inverse Kinematics", ""},
00063         {CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", ICON_CONSTRAINT_DATA, "Locked Track", "Tracking along a single axis"},
00064         {CONSTRAINT_TYPE_SPLINEIK, "SPLINE_IK", ICON_CONSTRAINT_DATA, "Spline IK", ""},
00065         {CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO",ICON_CONSTRAINT_DATA, "Stretch To", ""},
00066         {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To", "Legacy tracking constraint prone to twisting artifacts"},
00067         {0, "", 0, "Relationship", ""},
00068         {CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT_DATA, "Action", ""},
00069         {CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", ICON_CONSTRAINT_DATA, "Child Of", ""},
00070         {CONSTRAINT_TYPE_MINMAX, "FLOOR", ICON_CONSTRAINT_DATA, "Floor", ""},
00071         {CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", ICON_CONSTRAINT_DATA, "Follow Path", ""},
00072         {CONSTRAINT_TYPE_PIVOT, "PIVOT", ICON_CONSTRAINT_DATA, "Pivot", ""},
00073         {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", ICON_CONSTRAINT_DATA, "Rigid Body Joint", ""},
00074         {CONSTRAINT_TYPE_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script", ""},
00075         {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT_DATA, "Shrinkwrap", ""},
00076         {0, NULL, 0, NULL, NULL}};
00077 
00078 static EnumPropertyItem target_space_pchan_items[] = {
00079         {0, "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world coordinate system"},
00080         {2, "POSE", 0, "Pose Space", "The transformation of the target is only evaluated in the Pose Space, the target armature object transformation is ignored"},
00081         {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"},
00082         {1, "LOCAL", 0, "Local Space", "The transformation of the target is evaluated relative to its local coordinate system"},
00083         {0, NULL, 0, NULL, NULL}};
00084 
00085 static EnumPropertyItem owner_space_pchan_items[] = {
00086         {0, "WORLD", 0, "World Space", "The constraint is applied relative to the world coordinate system"},
00087         {2, "POSE", 0, "Pose Space", "The constraint is applied in Pose Space, the object transformation is ignored"},
00088         {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"},
00089         {1, "LOCAL", 0, "Local Space", "The constraint is applied relative to the local coordinate sytem of the object"},
00090         {0, NULL, 0, NULL, NULL}};
00091 
00092 #ifdef RNA_RUNTIME
00093 
00094 static EnumPropertyItem space_object_items[] = {
00095         {0, "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world coordinate system"},
00096         {1, "LOCAL", 0, "Local Space", "The transformation of the target is evaluated relative to its local coordinate system"},
00097         {0, NULL, 0, NULL, NULL}};
00098 
00099 #include "BKE_animsys.h"
00100 #include "BKE_action.h"
00101 #include "BKE_constraint.h"
00102 #include "BKE_context.h"
00103 #include "BKE_depsgraph.h"
00104 
00105 
00106 static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
00107 {
00108         bConstraint *con= (bConstraint*)ptr->data;
00109 
00110         switch(con->type) {
00111                 case CONSTRAINT_TYPE_CHILDOF:
00112                         return &RNA_ChildOfConstraint;
00113                 case CONSTRAINT_TYPE_TRACKTO:
00114                         return &RNA_TrackToConstraint;
00115                 case CONSTRAINT_TYPE_KINEMATIC:
00116                         return &RNA_KinematicConstraint;
00117                 case CONSTRAINT_TYPE_FOLLOWPATH:
00118                         return &RNA_FollowPathConstraint;
00119                 case CONSTRAINT_TYPE_ROTLIKE:
00120                         return &RNA_CopyRotationConstraint;
00121                 case CONSTRAINT_TYPE_LOCLIKE:
00122                         return &RNA_CopyLocationConstraint;
00123                 case CONSTRAINT_TYPE_SIZELIKE:
00124                         return &RNA_CopyScaleConstraint;
00125                 case CONSTRAINT_TYPE_SAMEVOL:
00126                         return &RNA_MaintainVolumeConstraint;
00127                 case CONSTRAINT_TYPE_PYTHON:
00128                         return &RNA_PythonConstraint;
00129                 case CONSTRAINT_TYPE_ACTION:
00130                         return &RNA_ActionConstraint;
00131                 case CONSTRAINT_TYPE_LOCKTRACK:
00132                         return &RNA_LockedTrackConstraint;
00133                 case CONSTRAINT_TYPE_STRETCHTO:
00134                         return &RNA_StretchToConstraint;
00135                 case CONSTRAINT_TYPE_MINMAX:
00136                         return &RNA_FloorConstraint;
00137                 case CONSTRAINT_TYPE_RIGIDBODYJOINT:
00138                         return &RNA_RigidBodyJointConstraint;
00139                 case CONSTRAINT_TYPE_CLAMPTO:
00140                         return &RNA_ClampToConstraint;                  
00141                 case CONSTRAINT_TYPE_TRANSFORM:
00142                         return &RNA_TransformConstraint;
00143                 case CONSTRAINT_TYPE_ROTLIMIT:
00144                         return &RNA_LimitRotationConstraint;
00145                 case CONSTRAINT_TYPE_LOCLIMIT:
00146                         return &RNA_LimitLocationConstraint;
00147                 case CONSTRAINT_TYPE_SIZELIMIT:
00148                         return &RNA_LimitScaleConstraint;
00149                 case CONSTRAINT_TYPE_DISTLIMIT:
00150                         return &RNA_LimitDistanceConstraint;
00151                 case CONSTRAINT_TYPE_SHRINKWRAP:
00152                         return &RNA_ShrinkwrapConstraint;
00153                 case CONSTRAINT_TYPE_DAMPTRACK:
00154                         return &RNA_DampedTrackConstraint;
00155                 case CONSTRAINT_TYPE_SPLINEIK:
00156                         return &RNA_SplineIKConstraint;
00157                 case CONSTRAINT_TYPE_TRANSLIKE:
00158                         return &RNA_CopyTransformsConstraint;
00159                 case CONSTRAINT_TYPE_PIVOT:
00160                         return &RNA_PivotConstraint;
00161                 default:
00162                         return &RNA_UnknownType;
00163         }
00164 }
00165 
00166 static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
00167 {
00168         bConstraint *con= ptr->data;
00169         char oldname[sizeof(con->name)];
00170         
00171         /* make a copy of the old name first */
00172         BLI_strncpy(oldname, con->name, sizeof(con->name));
00173         
00174         /* copy the new name into the name slot */
00175         BLI_strncpy(con->name, value, sizeof(con->name));
00176         
00177         /* make sure name is unique */
00178         if (ptr->id.data) {
00179                 Object *ob= ptr->id.data;
00180                 ListBase *list = get_constraint_lb(ob, con, NULL);
00181                 
00182                 /* if we have the list, check for unique name, otherwise give up */
00183                 if (list)
00184                         unique_constraint_name(con, list); 
00185         }
00186         
00187         /* fix all the animation data which may link to this */
00188         BKE_all_animdata_fix_paths_rename("constraints", oldname, con->name);
00189 }
00190 
00191 static char *rna_Constraint_path(PointerRNA *ptr)
00192 {
00193         Object *ob= ptr->id.data;
00194         bConstraint *con= ptr->data;
00195         bPoseChannel *pchan;
00196         ListBase *lb = get_constraint_lb(ob, con, &pchan);
00197 
00198         if(lb == NULL)
00199                 printf("rna_Constraint_path: internal error, constraint '%s' not found in object '%s'\n", con->name, ob->id.name);
00200 
00201         if(pchan) {
00202                 return BLI_sprintfN("pose.bones[\"%s\"].constraints[\"%s\"]", pchan->name, con->name);
00203         }
00204         
00205         return BLI_sprintfN("constraints[\"%s\"]", con->name);
00206 }
00207 
00208 static void rna_Constraint_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
00209 {
00210         ED_object_constraint_update(ptr->id.data);
00211 }
00212 
00213 static void rna_Constraint_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00214 {
00215         ED_object_constraint_dependency_update(bmain, scene, ptr->id.data);
00216 }
00217 
00218 static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
00219 {
00220         Object *ob= ptr->id.data;
00221 
00222         if(ob->pose)
00223                 ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
00224         
00225         rna_Constraint_update(bmain, scene, ptr);
00226 }
00227 
00228 static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value)
00229 {
00230         bConstraint *con = ptr->data;
00231         bKinematicConstraint *ikdata = con->data;
00232 
00233         if (ikdata->type != value) {
00234                 // the type of IK constraint has changed, set suitable default values
00235                 // in case constraints reuse same fields incompatible
00236                 switch (value) {
00237                 case CONSTRAINT_IK_COPYPOSE:
00238                         break;
00239                 case CONSTRAINT_IK_DISTANCE:
00240                         break;
00241                 }
00242                 ikdata->type = value;
00243         }
00244 }
00245 
00246 static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
00247 {
00248         Object *ob= (Object*)ptr->id.data;
00249         bConstraint *con= (bConstraint*)ptr->data;
00250         
00251         if(BLI_findindex(&ob->constraints, con) == -1)
00252                 return owner_space_pchan_items;
00253         else /* object */
00254                 return space_object_items;
00255 }
00256 
00257 static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
00258 {
00259         bConstraint *con= (bConstraint*)ptr->data;
00260         bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
00261         ListBase targets = {NULL, NULL};
00262         bConstraintTarget *ct;
00263         
00264         if(cti && cti->get_constraint_targets) {
00265                 cti->get_constraint_targets(con, &targets);
00266                 
00267                 for(ct=targets.first; ct; ct= ct->next)
00268                         if(ct->tar && ct->tar->type == OB_ARMATURE)
00269                                 break;
00270                 
00271                 if(cti->flush_constraint_targets)
00272                         cti->flush_constraint_targets(con, &targets, 1);
00273 
00274                 if(ct)
00275                         return target_space_pchan_items;
00276         }
00277 
00278         return space_object_items;
00279 }
00280 
00281 static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float *max)
00282 {
00283         bConstraint *con= (bConstraint*)ptr->data;
00284         bActionConstraint *acon = (bActionConstraint *)con->data;
00285 
00286         /* 0, 1, 2 = magic numbers for rotX, rotY, rotZ */
00287         if (ELEM3(acon->type, 0, 1, 2)) {
00288                 *min= -90.f;
00289                 *max= 90.f;
00290         } else {
00291                 *min= -1000.f;
00292                 *max= 1000.f;
00293         }
00294 }
00295 
00296 static int rna_SplineIKConstraint_joint_bindings_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
00297 {
00298         bConstraint *con= (bConstraint*)ptr->data;
00299         bSplineIKConstraint *ikData= (bSplineIKConstraint *)con->data;
00300 
00301         if (ikData)
00302                 length[0]= ikData->numpoints;
00303         else
00304                 length[0]= 256; /* for raw_access, untested */
00305 
00306         return length[0];
00307 }
00308 
00309 static void rna_SplineIKConstraint_joint_bindings_get(PointerRNA *ptr, float *values)
00310 {
00311         bConstraint *con= (bConstraint*)ptr->data;
00312         bSplineIKConstraint *ikData= (bSplineIKConstraint *)con->data;
00313         
00314         memcpy(values, ikData->points, ikData->numpoints * sizeof(float));
00315 }
00316 
00317 static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const float *values)
00318 {
00319         bConstraint *con= (bConstraint*)ptr->data;
00320         bSplineIKConstraint *ikData= (bSplineIKConstraint *)con->data;
00321         
00322         memcpy(ikData->points, values, ikData->numpoints * sizeof(float));
00323 }
00324 
00325 #else
00326 
00327 EnumPropertyItem constraint_distance_items[] = {
00328         {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"},
00329         {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"},
00330         {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"},
00331         {0, NULL, 0, NULL, NULL}
00332 };
00333 
00334 
00335 static void rna_def_constrainttarget(BlenderRNA *brna)
00336 {
00337         StructRNA *srna;
00338         PropertyRNA *prop;
00339 
00340         srna= RNA_def_struct(brna, "ConstraintTarget", NULL);
00341         RNA_def_struct_ui_text(srna, "Constraint Target", "Target object for multi-target constraints");
00342         RNA_def_struct_sdna(srna, "bConstraintTarget");
00343 
00344         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
00345         RNA_def_property_pointer_sdna(prop, NULL, "tar");
00346         RNA_def_property_ui_text(prop, "Target", "Target Object");
00347         RNA_def_property_flag(prop, PROP_EDITABLE);
00348         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00349 
00350         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
00351         RNA_def_property_string_sdna(prop, NULL, "subtarget");
00352         RNA_def_property_ui_text(prop, "Sub-Target", "");
00353         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00354 
00355         // space, flag and type still to do 
00356 }
00357 
00358 static void rna_def_constraint_childof(BlenderRNA *brna)
00359 {
00360         static int rna_matrix_dimsize_4x4[]= {4, 4};
00361         StructRNA *srna;
00362         PropertyRNA *prop;
00363 
00364         srna= RNA_def_struct(brna, "ChildOfConstraint", "Constraint"); 
00365         RNA_def_struct_ui_text(srna, "Child Of Constraint", "Creates constraint-based parent-child relationship"); 
00366         RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data"); 
00367 
00368         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
00369         RNA_def_property_pointer_sdna(prop, NULL, "tar");
00370         RNA_def_property_ui_text(prop, "Target", "Target Object");
00371         RNA_def_property_flag(prop, PROP_EDITABLE);
00372         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00373 
00374         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
00375         RNA_def_property_string_sdna(prop, NULL, "subtarget");
00376         RNA_def_property_ui_text(prop, "Sub-Target", "");
00377         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00378 
00379         prop= RNA_def_property(srna, "use_location_x", PROP_BOOLEAN, PROP_NONE);
00380         RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCX);
00381         RNA_def_property_ui_text(prop, "Location X", "Use X Location of Parent");
00382         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00383 
00384         prop= RNA_def_property(srna, "use_location_y", PROP_BOOLEAN, PROP_NONE);
00385         RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCY);
00386         RNA_def_property_ui_text(prop, "Location Y", "Use Y Location of Parent");
00387         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00388 
00389         prop= RNA_def_property(srna, "use_location_z", PROP_BOOLEAN, PROP_NONE);
00390         RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCZ);
00391         RNA_def_property_ui_text(prop, "Location Z", "Use Z Location of Parent");
00392         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00393 
00394         prop= RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
00395         RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTX);
00396         RNA_def_property_ui_text(prop, "Rotation X", "Use X Rotation of Parent");
00397         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00398 
00399         prop= RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
00400         RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTY);
00401         RNA_def_property_ui_text(prop, "Rotation Y", "Use Y Rotation of Parent");
00402         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00403 
00404         prop= RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
00405         RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTZ);
00406         RNA_def_property_ui_text(prop, "Rotation Z", "Use Z Rotation of Parent");
00407         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00408 
00409         prop= RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
00410         RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEX);
00411         RNA_def_property_ui_text(prop, "Scale X", "Use X Scale of Parent");
00412         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00413 
00414         prop= RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
00415         RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEY);
00416         RNA_def_property_ui_text(prop, "Scale Y", "Use Y Scale of Parent");
00417         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00418 
00419         prop= RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
00420         RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEZ);
00421         RNA_def_property_ui_text(prop, "Scale Z", "Use Z Scale of Parent");
00422         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00423         
00424         prop= RNA_def_property(srna, "inverse_matrix", PROP_FLOAT, PROP_MATRIX);
00425         RNA_def_property_float_sdna(prop, NULL, "invmat");
00426         RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
00427         RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
00428         RNA_def_property_ui_text(prop, "Inverse Matrix", "Transformation matrix to apply before");
00429         
00430 }
00431 
00432 static void rna_def_constraint_python(BlenderRNA *brna)
00433 {
00434         StructRNA *srna;
00435         PropertyRNA *prop;
00436 
00437         srna= RNA_def_struct(brna, "PythonConstraint", "Constraint");
00438         RNA_def_struct_ui_text(srna, "Python Constraint", "Uses Python script for constraint evaluation");
00439         RNA_def_struct_sdna_from(srna, "bPythonConstraint", "data");
00440 
00441         prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
00442         RNA_def_property_collection_sdna(prop, NULL, "targets", NULL);
00443         RNA_def_property_struct_type(prop, "ConstraintTarget");
00444         RNA_def_property_ui_text(prop, "Targets", "Target Objects");
00445 
00446         prop= RNA_def_property(srna, "target_count", PROP_INT, PROP_NONE);
00447         RNA_def_property_int_sdna(prop, NULL, "tarnum");
00448         RNA_def_property_ui_text(prop, "Number of Targets", "Usually only 1-3 are needed");
00449         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00450 
00451         prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
00452         RNA_def_property_ui_text(prop, "Script", "The text object that contains the Python script");
00453         RNA_def_property_flag(prop, PROP_EDITABLE);
00454         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00455 
00456         prop= RNA_def_property(srna, "use_targets", PROP_BOOLEAN, PROP_NONE);
00457         RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_USETARGETS);
00458         RNA_def_property_ui_text(prop, "Use Targets", "Use the targets indicated in the constraint panel");
00459         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00460 
00461         prop= RNA_def_property(srna, "has_script_error", PROP_BOOLEAN, PROP_NONE);
00462         RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_SCRIPTERROR);
00463         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
00464         RNA_def_property_ui_text(prop, "Script Error", "The linked Python script has thrown an error");
00465 }
00466 
00467 static void rna_def_constraint_kinematic(BlenderRNA *brna)
00468 {
00469         StructRNA *srna;
00470         PropertyRNA *prop;
00471 
00472         static EnumPropertyItem constraint_ik_axisref_items[] ={
00473                 {0, "BONE", 0, "Bone", ""},
00474                 {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""},
00475                 {0, NULL, 0, NULL, NULL},
00476         };
00477 
00478         static EnumPropertyItem constraint_ik_type_items[] ={
00479                 {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
00480                 {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
00481                 {0, NULL, 0, NULL, NULL},
00482         };
00483 
00484         srna= RNA_def_struct(brna, "KinematicConstraint", "Constraint");
00485         RNA_def_struct_ui_text(srna, "Kinematic Constraint", "Inverse Kinematics");
00486         RNA_def_struct_sdna_from(srna, "bKinematicConstraint", "data");
00487 
00488         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
00489         RNA_def_property_pointer_sdna(prop, NULL, "tar");
00490         RNA_def_property_ui_text(prop, "Target", "Target Object");
00491         RNA_def_property_flag(prop, PROP_EDITABLE);
00492         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00493 
00494         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
00495         RNA_def_property_string_sdna(prop, NULL, "subtarget");
00496         RNA_def_property_ui_text(prop, "Sub-Target", "");
00497         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00498 
00499         prop= RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
00500         RNA_def_property_range(prop, 1, 10000);
00501         RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving iterations");
00502         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00503 
00504         prop= RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE);
00505         RNA_def_property_pointer_sdna(prop, NULL, "poletar");
00506         RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation");
00507         RNA_def_property_flag(prop, PROP_EDITABLE);
00508         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00509 
00510         prop= RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE);
00511         RNA_def_property_string_sdna(prop, NULL, "polesubtarget");
00512         RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
00513         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00514 
00515         prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE);
00516         RNA_def_property_float_sdna(prop, NULL, "poleangle");
00517         RNA_def_property_range(prop, -M_PI, M_PI);
00518         RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset");
00519         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00520 
00521         prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
00522         RNA_def_property_range(prop, 0.01, 1.f);
00523         RNA_def_property_ui_text(prop, "Weight", "For Tree-IK: Weight of position control for this target");
00524 
00525         prop= RNA_def_property(srna, "orient_weight", PROP_FLOAT, PROP_NONE);
00526         RNA_def_property_float_sdna(prop, NULL, "orientweight");
00527         RNA_def_property_range(prop, 0.01, 1.f);
00528         RNA_def_property_ui_text(prop, "Orientation Weight", "For Tree-IK: Weight of orientation control for this target");
00529         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00530 
00531         prop= RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
00532         RNA_def_property_int_sdna(prop, NULL, "rootbone");
00533         RNA_def_property_range(prop, 0, 255);
00534         RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the IK effect - 0 uses all bones");
00535         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00536 
00537         prop= RNA_def_property(srna, "use_tail", PROP_BOOLEAN, PROP_NONE);
00538         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_TIP);
00539         RNA_def_property_ui_text(prop, "Use Tail", "Include bone's tail as last element in chain");
00540         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00541 
00542         prop= RNA_def_property(srna, "reference_axis", PROP_ENUM, PROP_NONE);
00543         RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
00544         RNA_def_property_enum_items(prop, constraint_ik_axisref_items);
00545         RNA_def_property_ui_text(prop, "Axis Reference", "Constraint axis Lock options relative to Bone or Target reference");
00546         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00547 
00548         prop= RNA_def_property(srna, "use_location", PROP_BOOLEAN, PROP_NONE);
00549         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_POS);
00550         RNA_def_property_ui_text(prop, "Position", "Chain follows position of target");
00551         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00552 
00553         prop= RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
00554         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_X);
00555         RNA_def_property_ui_text(prop, "Lock X Pos", "Constraint position along X axis");
00556         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
00557 
00558         prop= RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
00559         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Y);
00560         RNA_def_property_ui_text(prop, "Lock Y Pos", "Constraint position along Y axis");
00561         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
00562 
00563         prop= RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
00564         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Z);
00565         RNA_def_property_ui_text(prop, "Lock Z Pos", "Constraint position along Z axis");
00566         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
00567 
00568         prop= RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
00569         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_ROT);
00570         RNA_def_property_ui_text(prop, "Rotation", "Chain follows rotation of target");
00571         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00572 
00573         prop= RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
00574         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_X);
00575         RNA_def_property_ui_text(prop, "Lock X Rot", "Constraint rotation along X axis");
00576         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
00577 
00578         prop= RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
00579         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Y);
00580         RNA_def_property_ui_text(prop, "Lock Y Rot", "Constraint rotation along Y axis");
00581         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
00582 
00583         prop= RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
00584         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Z);
00585         RNA_def_property_ui_text(prop, "Lock Z Rot", "Constraint rotation along Z axis");
00586         RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
00587 
00588         prop= RNA_def_property(srna, "use_target", PROP_BOOLEAN, PROP_NONE);
00589         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_AUTO);
00590         RNA_def_property_ui_text(prop, "Target", "Disable for targetless IK");
00591         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00592 
00593         prop= RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
00594         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_STRETCH);
00595         RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching");
00596         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00597 
00598         prop= RNA_def_property(srna, "ik_type", PROP_ENUM, PROP_NONE);
00599         RNA_def_property_enum_sdna(prop, NULL, "type");
00600         RNA_def_property_enum_funcs(prop, NULL, "rna_Constraint_ik_type_set", NULL);
00601         RNA_def_property_enum_items(prop, constraint_ik_type_items);
00602         RNA_def_property_ui_text(prop, "IK Type", "");
00603         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00604 
00605         prop= RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
00606         RNA_def_property_enum_sdna(prop, NULL, "mode");
00607         RNA_def_property_enum_items(prop, constraint_distance_items);
00608         RNA_def_property_ui_text(prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
00609         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00610 
00611         prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
00612         RNA_def_property_float_sdna(prop, NULL, "dist");
00613         RNA_def_property_range(prop, 0.0, 100.f);
00614         RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
00615         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00616 }
00617 
00618 static void rna_def_constraint_track_to(BlenderRNA *brna)
00619 {
00620         StructRNA *srna;
00621         PropertyRNA *prop;
00622 
00623         static EnumPropertyItem track_items[] = {
00624                 {TRACK_X, "TRACK_X", 0, "X", ""},
00625                 {TRACK_Y, "TRACK_Y", 0, "Y", ""},
00626                 {TRACK_Z, "TRACK_Z", 0, "Z", ""},
00627                 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
00628                 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
00629                 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
00630                 {0, NULL, 0, NULL, NULL}};
00631 
00632         static EnumPropertyItem up_items[] = {
00633                 {TRACK_X, "UP_X", 0, "X", ""},
00634                 {TRACK_Y, "UP_Y", 0, "Y", ""},
00635                 {TRACK_Z, "UP_Z", 0, "Z", ""},
00636                 {0, NULL, 0, NULL, NULL}};
00637 
00638         srna= RNA_def_struct(brna, "TrackToConstraint", "Constraint");
00639         RNA_def_struct_ui_text(srna, "Track To Constraint", "Aims the constrained object toward the target");
00640 
00641         prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
00642         RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
00643         RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
00644         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00645 
00646         RNA_def_struct_sdna_from(srna, "bTrackToConstraint", "data");
00647 
00648         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
00649         RNA_def_property_pointer_sdna(prop, NULL, "tar");
00650         RNA_def_property_ui_text(prop, "Target", "Target Object");
00651         RNA_def_property_flag(prop, PROP_EDITABLE);
00652         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00653 
00654         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
00655         RNA_def_property_string_sdna(prop, NULL, "subtarget");
00656         RNA_def_property_ui_text(prop, "Sub-Target", "");
00657         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00658 
00659         prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
00660         RNA_def_property_enum_sdna(prop, NULL, "reserved1");
00661         RNA_def_property_enum_items(prop, track_items);
00662         RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
00663         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00664 
00665         prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
00666         RNA_def_property_enum_sdna(prop, NULL, "reserved2");
00667         RNA_def_property_enum_items(prop, up_items);
00668         RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
00669         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00670 
00671         prop= RNA_def_property(srna, "use_target_z", PROP_BOOLEAN, PROP_NONE);
00672         RNA_def_property_boolean_sdna(prop, NULL, "flags", TARGET_Z_UP);
00673         RNA_def_property_ui_text(prop, "Target Z", "Target's Z axis, not World Z axis, will constraint the Up direction");
00674         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00675 }
00676 
00677 static void rna_def_constraint_locate_like(BlenderRNA *brna)
00678 {
00679         StructRNA *srna;
00680         PropertyRNA *prop;
00681 
00682         srna= RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
00683         RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copies the location of the target");
00684 
00685         prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
00686         RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
00687         RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
00688         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00689 
00690         RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data");
00691 
00692         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
00693         RNA_def_property_pointer_sdna(prop, NULL, "tar");
00694         RNA_def_property_flag(prop, PROP_EDITABLE);
00695         RNA_def_property_ui_text(prop, "Target", "Target Object");
00696         RNA_def_property_flag(prop, PROP_EDITABLE);
00697         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00698 
00699         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
00700         RNA_def_property_string_sdna(prop, NULL, "subtarget");
00701         RNA_def_property_ui_text(prop, "Sub-Target", "");
00702         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00703 
00704         prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
00705         RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X);
00706         RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X location");
00707         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00708 
00709         prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
00710         RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y);
00711         RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y location");
00712         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00713 
00714         prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
00715         RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z);
00716         RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z location");
00717         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00718 
00719         prop= RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
00720         RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X_INVERT);
00721         RNA_def_property_ui_text(prop, "Invert X", "Invert the X location");
00722         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00723 
00724         prop= RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
00725         RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y_INVERT);
00726         RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location");
00727         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00728 
00729         prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
00730         RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z_INVERT);
00731         RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location");
00732         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00733 
00734         prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
00735         RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_OFFSET);
00736         RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location");
00737         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00738 }
00739 
00740 static void rna_def_constraint_rotate_like(BlenderRNA *brna)
00741 {
00742         StructRNA *srna;
00743         PropertyRNA *prop;
00744 
00745         srna= RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
00746         RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copies the rotation of the target");
00747         RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data");
00748 
00749         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
00750         RNA_def_property_pointer_sdna(prop, NULL, "tar");
00751         RNA_def_property_ui_text(prop, "Target", "Target Object");
00752         RNA_def_property_flag(prop, PROP_EDITABLE);
00753         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00754 
00755         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
00756         RNA_def_property_string_sdna(prop, NULL, "subtarget");
00757         RNA_def_property_ui_text(prop, "Sub-Target", "");
00758         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00759 
00760         prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
00761         RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X);
00762         RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X rotation");
00763         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00764 
00765         prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
00766         RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y);
00767         RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y rotation");
00768         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00769 
00770         prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
00771         RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z);
00772         RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z rotation");
00773         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00774 
00775         prop= RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
00776         RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X_INVERT);
00777         RNA_def_property_ui_text(prop, "Invert X", "Invert the X rotation");
00778         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00779 
00780         prop= RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
00781         RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y_INVERT);
00782         RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y rotation");
00783         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00784 
00785         prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
00786         RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z_INVERT);
00787         RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z rotation");
00788         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00789 
00790         prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
00791         RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_OFFSET);
00792         RNA_def_property_ui_text(prop, "Offset", "Add original rotation into copied rotation");
00793         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00794 }
00795 
00796 static void rna_def_constraint_size_like(BlenderRNA *brna)
00797 {
00798         StructRNA *srna;
00799         PropertyRNA *prop;
00800 
00801         srna= RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
00802         RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copies the scale of the target");
00803         RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
00804 
00805         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
00806         RNA_def_property_pointer_sdna(prop, NULL, "tar");
00807         RNA_def_property_flag(prop, PROP_EDITABLE);
00808         RNA_def_property_ui_text(prop, "Target", "Target Object");
00809         RNA_def_property_flag(prop, PROP_EDITABLE);
00810         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00811 
00812         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
00813         RNA_def_property_string_sdna(prop, NULL, "subtarget");
00814         RNA_def_property_ui_text(prop, "Sub-Target", "");
00815         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00816 
00817         prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
00818         RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_X);
00819         RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X scale");
00820         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00821 
00822         prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
00823         RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Y);
00824         RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y scale");
00825         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00826 
00827         prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
00828         RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Z);
00829         RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale");
00830         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00831 
00832         prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
00833         RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_OFFSET);
00834         RNA_def_property_ui_text(prop, "Offset", "Add original scale into copied scale");
00835         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00836 }
00837 
00838 static void rna_def_constraint_same_volume(BlenderRNA *brna)
00839 {
00840         StructRNA *srna;
00841         PropertyRNA *prop;
00842 
00843         static EnumPropertyItem volume_items[] = {
00844         {SAMEVOL_X, "SAMEVOL_X", 0, "X", ""},
00845         {SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""},
00846         {SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""},
00847         {0, NULL, 0, NULL, NULL}};
00848 
00849         srna= RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
00850         RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", "Maintains a constant volume along a single scaling axis");
00851         RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
00852 
00853         prop= RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
00854         RNA_def_property_enum_sdna(prop, NULL, "flag");
00855         RNA_def_property_enum_items(prop, volume_items);
00856         RNA_def_property_ui_text(prop, "Free Axis", "The free scaling axis of the object");
00857         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00858 
00859         prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_DISTANCE);
00860         RNA_def_property_range(prop, 0.001, 100.f);
00861         RNA_def_property_ui_text(prop, "Volume", "Volume of the bone at rest");
00862         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00863 
00864 }
00865 
00866 static void rna_def_constraint_transform_like(BlenderRNA *brna)
00867 {
00868         StructRNA *srna;
00869         PropertyRNA *prop;
00870 
00871         srna= RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
00872         RNA_def_struct_ui_text(srna, "Copy Transforms Constraint", "Copies all the transforms of the target");
00873         
00874         prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
00875         RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
00876         RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
00877         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00878 
00879         RNA_def_struct_sdna_from(srna, "bTransLikeConstraint", "data");
00880 
00881         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
00882         RNA_def_property_pointer_sdna(prop, NULL, "tar");
00883         RNA_def_property_ui_text(prop, "Target", "Target Object");
00884         RNA_def_property_flag(prop, PROP_EDITABLE);
00885         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00886 
00887         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
00888         RNA_def_property_string_sdna(prop, NULL, "subtarget");
00889         RNA_def_property_ui_text(prop, "Sub-Target", "");
00890         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00891 }
00892 
00893 static void rna_def_constraint_minmax(BlenderRNA *brna)
00894 {
00895         StructRNA *srna;
00896         PropertyRNA *prop;
00897 
00898         static EnumPropertyItem minmax_items[] = {
00899                 {TRACK_X, "FLOOR_X", 0, "X", ""},
00900                 {TRACK_Y, "FLOOR_Y", 0, "Y", ""},
00901                 {TRACK_Z, "FLOOR_Z", 0, "Z", ""},
00902                 {TRACK_nX, "FLOOR_NEGATIVE_X", 0, "-X", ""},
00903                 {TRACK_nY, "FLOOR_NEGATIVE_Y", 0, "-Y", ""},
00904                 {TRACK_nZ, "FLOOR_NEGATIVE_Z", 0, "-Z", ""},
00905                 {0, NULL, 0, NULL, NULL}};
00906 
00907         srna= RNA_def_struct(brna, "FloorConstraint", "Constraint");
00908         RNA_def_struct_ui_text(srna, "Floor Constraint", "Uses the target object for location limitation");
00909         RNA_def_struct_sdna_from(srna, "bMinMaxConstraint","data");
00910 
00911         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
00912         RNA_def_property_pointer_sdna(prop, NULL, "tar");
00913         RNA_def_property_ui_text(prop, "Target", "Target Object");
00914         RNA_def_property_flag(prop, PROP_EDITABLE);
00915         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00916 
00917         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
00918         RNA_def_property_string_sdna(prop, NULL, "subtarget");
00919         RNA_def_property_ui_text(prop, "Sub-Target", "");
00920         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00921 
00922         prop= RNA_def_property(srna, "floor_location", PROP_ENUM, PROP_NONE);
00923         RNA_def_property_enum_sdna(prop, NULL, "minmaxflag");
00924         RNA_def_property_enum_items(prop, minmax_items);
00925         RNA_def_property_ui_text(prop, "Floor Location", "Location of target that object will not pass through");
00926         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00927 
00928         prop= RNA_def_property(srna, "use_sticky", PROP_BOOLEAN, PROP_NONE);
00929         RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_STICKY);
00930         RNA_def_property_ui_text(prop, "Sticky", "Immobilize object while constrained");
00931         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00932 
00933         prop= RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
00934         RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_USEROT);
00935         RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor");
00936         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00937 
00938         prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
00939         RNA_def_property_range(prop, 0.0, 100.f);
00940         RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object origin");
00941         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00942 }
00943 
00944 static void rna_def_constraint_action(BlenderRNA *brna)
00945 {
00946         StructRNA *srna;
00947         PropertyRNA *prop;
00948 
00949         static EnumPropertyItem transform_channel_items[] = {
00950                 {20, "LOCATION_X", 0, "Location X", ""},
00951                 {21, "LOCATION_Y", 0, "Location Y", ""},
00952                 {22, "LOCATION_Z", 0, "Location Z", ""},
00953                 {00, "ROTATION_X", 0, "Rotation X", ""},
00954                 {01, "ROTATION_Y", 0, "Rotation Y", ""},
00955                 {02, "ROTATION_Z", 0, "Rotation Z", ""},
00956                 {10, "SCALE_X", 0, "Scale X", ""},
00957                 {11, "SCALE_Y", 0, "Scale Y", ""},
00958                 {12, "SCALE_Z", 0, "Scale Z", ""},
00959                 {0, NULL, 0, NULL, NULL}};
00960 
00961         srna= RNA_def_struct(brna, "ActionConstraint", "Constraint");
00962         RNA_def_struct_ui_text(srna, "Action Constraint", "Map an action to the transform axes of a bone");
00963         RNA_def_struct_sdna_from(srna, "bActionConstraint", "data");
00964 
00965         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
00966         RNA_def_property_pointer_sdna(prop, NULL, "tar");
00967         RNA_def_property_ui_text(prop, "Target", "Target Object");
00968         RNA_def_property_flag(prop, PROP_EDITABLE);
00969         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00970 
00971         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
00972         RNA_def_property_string_sdna(prop, NULL, "subtarget");
00973         RNA_def_property_ui_text(prop, "Sub-Target", "");
00974         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
00975 
00976         prop= RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE);
00977         RNA_def_property_enum_sdna(prop, NULL, "type");
00978         RNA_def_property_enum_items(prop, transform_channel_items);
00979         RNA_def_property_ui_text(prop, "Transform Channel", "Transformation channel from the target that is used to key the Action");
00980         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00981 
00982         prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
00983         RNA_def_property_pointer_sdna(prop, NULL, "act");
00984         RNA_def_property_ui_text(prop, "Action", "The constraining action");
00985         RNA_def_property_flag(prop, PROP_EDITABLE);
00986         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00987 
00988         prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
00989         RNA_def_property_int_sdna(prop, NULL, "start");
00990         RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
00991         RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use");
00992         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00993 
00994         prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
00995         RNA_def_property_int_sdna(prop, NULL, "end");
00996         RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
00997         RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use");
00998         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
00999 
01000         prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
01001         RNA_def_property_float_sdna(prop, NULL, "max");
01002         RNA_def_property_range(prop, -1000.f, 1000.f);
01003         RNA_def_property_ui_text(prop, "Maximum", "Maximum value for target channel range");
01004         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01005         RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
01006 
01007         prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
01008         RNA_def_property_float_sdna(prop, NULL, "min");
01009         RNA_def_property_range(prop, -1000.f, 1000.f);
01010         RNA_def_property_ui_text(prop, "Minimum", "Minimum value for target channel range");
01011         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01012         RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
01013 }
01014 
01015 static void rna_def_constraint_locked_track(BlenderRNA *brna)
01016 {
01017         StructRNA *srna;
01018         PropertyRNA *prop;
01019 
01020         static EnumPropertyItem locktrack_items[] = {
01021                 {TRACK_X, "TRACK_X", 0, "X", ""},
01022                 {TRACK_Y, "TRACK_Y", 0, "Y", ""},
01023                 {TRACK_Z, "TRACK_Z", 0, "Z", ""},
01024                 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
01025                 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
01026                 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
01027                 {0, NULL, 0, NULL, NULL}};
01028 
01029         static EnumPropertyItem lock_items[] = {
01030                 {TRACK_X, "LOCK_X", 0, "X", ""},
01031                 {TRACK_Y, "LOCK_Y", 0, "Y", ""},
01032                 {TRACK_Z, "LOCK_Z", 0, "Z", ""},
01033                 {0, NULL, 0, NULL, NULL}};
01034 
01035         srna= RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
01036         RNA_def_struct_ui_text(srna, "Locked Track Constraint", "Points toward the target along the track axis, while locking the other axis");
01037         RNA_def_struct_sdna_from(srna, "bLockTrackConstraint", "data");
01038 
01039         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
01040         RNA_def_property_pointer_sdna(prop, NULL, "tar");
01041         RNA_def_property_ui_text(prop, "Target", "Target Object");
01042         RNA_def_property_flag(prop, PROP_EDITABLE);
01043         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01044 
01045         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
01046         RNA_def_property_string_sdna(prop, NULL, "subtarget");
01047         RNA_def_property_ui_text(prop, "Sub-Target", "");
01048         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01049 
01050         prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
01051         RNA_def_property_enum_sdna(prop, NULL, "trackflag");
01052         RNA_def_property_enum_items(prop, locktrack_items);
01053         RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
01054         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01055 
01056         prop= RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
01057         RNA_def_property_enum_sdna(prop, NULL, "lockflag");
01058         RNA_def_property_enum_items(prop, lock_items);
01059         RNA_def_property_ui_text(prop, "Locked Axis", "Axis that points upward");
01060         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01061 }
01062 
01063 static void rna_def_constraint_follow_path(BlenderRNA *brna)
01064 {
01065         StructRNA *srna;
01066         PropertyRNA *prop;
01067 
01068         static EnumPropertyItem forwardpath_items[] = {
01069                 {TRACK_X, "FORWARD_X", 0, "X", ""},
01070                 {TRACK_Y, "FORWARD_Y", 0, "Y", ""},
01071                 {TRACK_Z, "FORWARD_Z", 0, "Z", ""},
01072                 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
01073                 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
01074                 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
01075                 {0, NULL, 0, NULL, NULL}};
01076 
01077         static EnumPropertyItem pathup_items[] = {
01078                 {TRACK_X, "UP_X", 0, "X", ""},
01079                 {TRACK_Y, "UP_Y", 0, "Y", ""},
01080                 {TRACK_Z, "UP_Z", 0, "Z", ""},
01081                 {0, NULL, 0, NULL, NULL}};
01082 
01083         srna= RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
01084         RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Locks motion to the target path");
01085         RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data");
01086 
01087         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
01088         RNA_def_property_pointer_sdna(prop, NULL, "tar");
01089         RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
01090         RNA_def_property_ui_text(prop, "Target", "Target Object");
01091         RNA_def_property_flag(prop, PROP_EDITABLE);
01092         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01093 
01094         prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TIME);
01095         RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
01096         RNA_def_property_ui_text(prop, "Offset", "Offset from the position corresponding to the time frame");
01097         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01098         
01099         prop= RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR);
01100         RNA_def_property_float_sdna(prop, NULL, "offset_fac");
01101         RNA_def_property_range(prop, 0.0f, 1.0f);
01102         RNA_def_property_ui_text(prop, "Offset Factor", "Percentage value defining target position along length of bone");
01103         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01104 
01105         prop= RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
01106         RNA_def_property_enum_sdna(prop, NULL, "trackflag");
01107         RNA_def_property_enum_items(prop, forwardpath_items);
01108         RNA_def_property_ui_text(prop, "Forward Axis", "Axis that points forward along the path");
01109         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01110 
01111         prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
01112         RNA_def_property_enum_sdna(prop, NULL, "upflag");
01113         RNA_def_property_enum_items(prop, pathup_items);
01114         RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
01115         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01116 
01117         prop= RNA_def_property(srna, "use_curve_follow", PROP_BOOLEAN, PROP_NONE);
01118         RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_FOLLOW);
01119         RNA_def_property_ui_text(prop, "Follow Curve", "Object will follow the heading and banking of the curve");
01120         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01121         
01122         prop= RNA_def_property(srna, "use_fixed_location", PROP_BOOLEAN, PROP_NONE);
01123         RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_STATIC);
01124         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");
01125         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01126 
01127         prop= RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
01128         RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_RADIUS);
01129         RNA_def_property_ui_text(prop, "Curve Radius", "Objects scale by the curve radius");
01130         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01131 }
01132 
01133 static void rna_def_constraint_stretch_to(BlenderRNA *brna)
01134 {
01135         StructRNA *srna;
01136         PropertyRNA *prop;
01137 
01138         static EnumPropertyItem volume_items[] = {
01139                 {VOLUME_XZ, "VOLUME_XZX", 0, "XZ", ""},
01140                 {VOLUME_X, "VOLUME_X", 0, "X", ""},
01141                 {VOLUME_Z, "VOLUME_Z", 0, "Z", ""},
01142                 {NO_VOLUME, "NO_VOLUME", 0, "None", ""},
01143                 {0, NULL, 0, NULL, NULL}};
01144 
01145         static EnumPropertyItem plane_items[] = {
01146                 {PLANE_X, "PLANE_X", 0, "X", "Keep X Axis"},
01147                 {PLANE_Z, "PLANE_Z", 0, "Z", "Keep Z Axis"},
01148                 {0, NULL, 0, NULL, NULL}};
01149 
01150         srna= RNA_def_struct(brna, "StretchToConstraint", "Constraint");
01151         RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretches to meet the target object");
01152 
01153         prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
01154         RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
01155         RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
01156         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01157 
01158         RNA_def_struct_sdna_from(srna, "bStretchToConstraint", "data");
01159 
01160         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
01161         RNA_def_property_pointer_sdna(prop, NULL, "tar");
01162         RNA_def_property_ui_text(prop, "Target", "Target Object");
01163         RNA_def_property_flag(prop, PROP_EDITABLE);
01164         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01165         
01166         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
01167         RNA_def_property_string_sdna(prop, NULL, "subtarget");
01168         RNA_def_property_ui_text(prop, "Sub-Target", "");
01169         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01170 
01171         prop= RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
01172         RNA_def_property_enum_sdna(prop, NULL, "volmode");
01173         RNA_def_property_enum_items(prop, volume_items);
01174         RNA_def_property_ui_text(prop, "Maintain Volume", "Maintain the object's volume as it stretches");
01175         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01176 
01177         prop= RNA_def_property(srna, "keep_axis", PROP_ENUM, PROP_NONE);
01178         RNA_def_property_enum_sdna(prop, NULL, "plane");
01179         RNA_def_property_enum_items(prop, plane_items);
01180         RNA_def_property_ui_text(prop, "Keep Axis", "Axis to maintain during stretch");
01181         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01182 
01183         prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_DISTANCE);
01184         RNA_def_property_float_sdna(prop, NULL, "orglength");
01185         RNA_def_property_range(prop, 0.0, 100.f);
01186         RNA_def_property_ui_text(prop, "Original Length", "Length at rest position");
01187         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01188 
01189         prop= RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
01190         RNA_def_property_range(prop, 0.0, 100.f);
01191         RNA_def_property_ui_text(prop, "Volume Variation", "Factor between volume variation and stretching");
01192         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01193 }
01194 
01195 static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
01196 {
01197         StructRNA *srna;
01198         PropertyRNA *prop;
01199 
01200         static EnumPropertyItem pivot_items[] = {
01201                 {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allows rotations around all axes"},
01202                 {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Works in one plane, allows rotations around one axis only"},
01203                 {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", "Allows rotations around all axes with limits for the cone and twist axes"},
01204                 {CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF", "No constraints by default, limits can be set individually"},
01205                 {0, NULL, 0, NULL, NULL}};
01206 
01207         srna= RNA_def_struct(brna, "RigidBodyJointConstraint", "Constraint");
01208         RNA_def_struct_ui_text(srna, "Rigid Body Joint Constraint", "For use with the Game Engine");
01209         RNA_def_struct_sdna_from(srna, "bRigidBodyJointConstraint", "data");
01210 
01211         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
01212         RNA_def_property_pointer_sdna(prop, NULL, "tar");
01213         RNA_def_property_ui_text(prop, "Target", "Target Object");
01214         RNA_def_property_flag(prop, PROP_EDITABLE);
01215         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01216 
01217         prop= RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
01218         RNA_def_property_ui_text(prop, "Child Object", "Child object");
01219         RNA_def_property_flag(prop, PROP_EDITABLE);
01220         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01221 
01222         prop= RNA_def_property(srna, "pivot_type", PROP_ENUM, PROP_NONE);
01223         RNA_def_property_enum_sdna(prop, NULL, "type");
01224         RNA_def_property_enum_items(prop, pivot_items);
01225         RNA_def_property_ui_text(prop, "Pivot Type", "");
01226         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01227 
01228         prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_DISTANCE);
01229         RNA_def_property_float_sdna(prop, NULL, "pivX");
01230         RNA_def_property_range(prop, -1000.0, 1000.f);
01231         RNA_def_property_ui_text(prop, "Pivot X", "Offset pivot on X");
01232         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01233 
01234         prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_DISTANCE);
01235         RNA_def_property_float_sdna(prop, NULL, "pivY");
01236         RNA_def_property_range(prop, -1000.0, 1000.f);
01237         RNA_def_property_ui_text(prop, "Pivot Y", "Offset pivot on Y");
01238         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01239 
01240         prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_DISTANCE);
01241         RNA_def_property_float_sdna(prop, NULL, "pivZ");
01242         RNA_def_property_range(prop, -1000.0, 1000.f);
01243         RNA_def_property_ui_text(prop, "Pivot Z", "Offset pivot on Z");
01244         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01245 
01246         prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE);
01247         RNA_def_property_float_sdna(prop, NULL, "axX");
01248         RNA_def_property_range(prop, -M_PI*2, M_PI*2);
01249         RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis in degrees");
01250         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01251 
01252         prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE);
01253         RNA_def_property_float_sdna(prop, NULL, "axY");
01254         RNA_def_property_range(prop, -M_PI*2, M_PI*2);
01255         RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis in degrees");
01256         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01257 
01258         prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE);
01259         RNA_def_property_float_sdna(prop, NULL, "axZ");
01260         RNA_def_property_range(prop, -M_PI*2, M_PI*2);
01261         RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees");
01262         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01263 
01264         prop= RNA_def_property(srna, "use_linked_collision", PROP_BOOLEAN, PROP_NONE);
01265         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE_LINKED_COLLISION);
01266         RNA_def_property_ui_text(prop, "Disable Linked Collision", "Disable collision between linked bodies");
01267         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01268 
01269         prop= RNA_def_property(srna, "show_pivot", PROP_BOOLEAN, PROP_NONE);
01270         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DRAW_PIVOT);
01271         RNA_def_property_ui_text(prop, "Draw Pivot", "Display the pivot point and rotation in 3D view");
01272         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01273         
01274         
01275         /* Limits */
01276         /* Limit Min/Max */
01277         prop= RNA_def_property(srna, "limit_min_x", PROP_FLOAT, PROP_NONE);
01278         RNA_def_property_float_sdna(prop, NULL, "minLimit[0]");
01279         RNA_def_property_ui_text(prop, "Minimum Limit X", "");
01280 
01281         prop= RNA_def_property(srna, "limit_min_y", PROP_FLOAT, PROP_NONE);
01282         RNA_def_property_float_sdna(prop, NULL, "minLimit[1]");
01283         RNA_def_property_ui_text(prop, "Minimum Limit Y", "");
01284 
01285         prop= RNA_def_property(srna, "limit_min_z", PROP_FLOAT, PROP_NONE);
01286         RNA_def_property_float_sdna(prop, NULL, "minLimit[2]");
01287         RNA_def_property_ui_text(prop, "Minimum Limit Z", "");
01288 
01289         prop= RNA_def_property(srna, "limit_max_x", PROP_FLOAT, PROP_NONE);
01290         RNA_def_property_float_sdna(prop, NULL, "maxLimit[0]");
01291         RNA_def_property_ui_text(prop, "Maximum Limit X", "");
01292 
01293         prop= RNA_def_property(srna, "limit_max_y", PROP_FLOAT, PROP_NONE);
01294         RNA_def_property_float_sdna(prop, NULL, "maxLimit[1]");
01295         RNA_def_property_ui_text(prop, "Maximum Limit Y", "");
01296 
01297         prop= RNA_def_property(srna, "limit_max_z", PROP_FLOAT, PROP_NONE);
01298         RNA_def_property_float_sdna(prop, NULL, "maxLimit[2]");
01299         RNA_def_property_ui_text(prop, "Maximum Limit Z", "");
01300 
01301         /* Limit Min/Max for angle */
01302         prop= RNA_def_property(srna, "limit_angle_min_x", PROP_FLOAT, PROP_ANGLE);
01303         RNA_def_property_float_sdna(prop, NULL, "minLimit[3]");
01304         RNA_def_property_range(prop, -M_PI*2, M_PI*2);
01305         RNA_def_property_ui_text(prop, "Minimum Angular Limit X", "");
01306 
01307         prop= RNA_def_property(srna, "limit_angle_min_y", PROP_FLOAT, PROP_ANGLE);
01308         RNA_def_property_float_sdna(prop, NULL, "minLimit[4]");
01309         RNA_def_property_range(prop, -M_PI*2, M_PI*2);
01310         RNA_def_property_ui_text(prop, "Minimum Angular Limit Y", "");
01311 
01312         prop= RNA_def_property(srna, "limit_angle_min_z", PROP_FLOAT, PROP_ANGLE);
01313         RNA_def_property_float_sdna(prop, NULL, "minLimit[5]");
01314         RNA_def_property_range(prop, -M_PI*2, M_PI*2);
01315         RNA_def_property_ui_text(prop, "Minimum Angular Limit Z", "");
01316 
01317         prop= RNA_def_property(srna, "limit_angle_max_x", PROP_FLOAT, PROP_ANGLE);
01318         RNA_def_property_float_sdna(prop, NULL, "maxLimit[3]");
01319         RNA_def_property_range(prop, -M_PI*2, M_PI*2);
01320         RNA_def_property_ui_text(prop, "Maximum Angular Limit X", "");
01321         
01322         prop= RNA_def_property(srna, "limit_angle_max_y", PROP_FLOAT, PROP_ANGLE);
01323         RNA_def_property_float_sdna(prop, NULL, "maxLimit[4]");
01324         RNA_def_property_range(prop, -M_PI*2, M_PI*2);
01325         RNA_def_property_ui_text(prop, "Maximum Angular Limit Y", "");
01326 
01327         prop= RNA_def_property(srna, "limit_angle_max_z", PROP_FLOAT, PROP_ANGLE);
01328         RNA_def_property_float_sdna(prop, NULL, "maxLimit[5]");
01329         RNA_def_property_range(prop, -M_PI*2, M_PI*2);
01330         RNA_def_property_ui_text(prop, "Maximum Angular Limit Z", "");
01331 
01332         /* Limit Booleans */
01333         prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
01334         RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
01335         RNA_def_property_ui_text(prop, "Limit X", "Use minimum/maximum x limit");
01336         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01337         
01338         prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
01339         RNA_def_property_boolean_sdna(prop, NULL, "flag", 2);
01340         RNA_def_property_ui_text(prop, "Limit Y", "Use minimum/maximum y limit");
01341         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01342         
01343         prop= RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
01344         RNA_def_property_boolean_sdna(prop, NULL, "flag", 4);
01345         RNA_def_property_ui_text(prop, "Limit Z", "Use minimum/maximum z limit");
01346         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01347 
01348         prop= RNA_def_property(srna, "use_angular_limit_x", PROP_BOOLEAN, PROP_NONE);
01349         RNA_def_property_boolean_sdna(prop, NULL, "flag", 8);
01350         RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum x angular limit");
01351         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01352         
01353         prop= RNA_def_property(srna, "use_angular_limit_y", PROP_BOOLEAN, PROP_NONE);
01354         RNA_def_property_boolean_sdna(prop, NULL, "flag", 16);
01355         RNA_def_property_ui_text(prop, "Angular Y Limit", "Use minimum/maximum y angular limit");
01356         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01357         
01358         prop= RNA_def_property(srna, "use_angular_limit_z", PROP_BOOLEAN, PROP_NONE);
01359         RNA_def_property_boolean_sdna(prop, NULL, "flag", 32);
01360         RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum z angular limit");
01361         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01362 }
01363 
01364 static void rna_def_constraint_clamp_to(BlenderRNA *brna)
01365 {
01366         StructRNA *srna;
01367         PropertyRNA *prop;
01368 
01369         static EnumPropertyItem clamp_items[] = {
01370                 {CLAMPTO_AUTO, "CLAMPTO_AUTO", 0, "Auto", ""},
01371                 {CLAMPTO_X, "CLAMPTO_X", 0, "X", ""},
01372                 {CLAMPTO_Y, "CLAMPTO_Y", 0, "Y", ""},
01373                 {CLAMPTO_Z, "CLAMPTO_Z", 0, "Z", ""},
01374                 {0, NULL, 0, NULL, NULL}};
01375 
01376         srna= RNA_def_struct(brna, "ClampToConstraint", "Constraint");
01377         RNA_def_struct_ui_text(srna, "Clamp To Constraint", "Constrains an object's location to the nearest point along the target path");
01378         RNA_def_struct_sdna_from(srna, "bClampToConstraint", "data");
01379 
01380         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
01381         RNA_def_property_pointer_sdna(prop, NULL, "tar"); // TODO: curve only for set function!
01382         RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
01383         RNA_def_property_ui_text(prop, "Target", "Target Object");
01384         RNA_def_property_flag(prop, PROP_EDITABLE);
01385         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01386 
01387         prop= RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE);
01388         RNA_def_property_enum_sdna(prop, NULL, "flag");
01389         RNA_def_property_enum_items(prop, clamp_items);
01390         RNA_def_property_ui_text(prop, "Main Axis", "Main axis of movement");
01391         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01392 
01393         prop= RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
01394         RNA_def_property_boolean_sdna(prop, NULL, "flag2", CLAMPTO_CYCLIC);
01395         RNA_def_property_ui_text(prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box");
01396         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01397 }
01398 
01399 static void rna_def_constraint_transform(BlenderRNA *brna)
01400 {
01401         StructRNA *srna;
01402         PropertyRNA *prop;
01403 
01404         static EnumPropertyItem transform_items[] = {
01405                 {0, "LOCATION", 0, "Loc", ""},
01406                 {1, "ROTATION", 0, "Rot", ""},
01407                 {2, "SCALE", 0, "Scale", ""},
01408                 {0, NULL, 0, NULL, NULL}};
01409 
01410         static EnumPropertyItem axis_map_items[] = {
01411                 {0, "X", 0, "X", ""},
01412                 {1, "Y", 0, "Y", ""},
01413                 {2, "Z", 0, "Z", ""},
01414                 {0, NULL, 0, NULL, NULL}};
01415 
01416         srna= RNA_def_struct(brna, "TransformConstraint", "Constraint");
01417         RNA_def_struct_ui_text(srna, "Transformation Constraint", "Maps transformations of the target to the object");
01418         RNA_def_struct_sdna_from(srna, "bTransformConstraint", "data");
01419 
01420         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
01421         RNA_def_property_pointer_sdna(prop, NULL, "tar");
01422         RNA_def_property_ui_text(prop, "Target", "Target Object");
01423         RNA_def_property_flag(prop, PROP_EDITABLE);
01424         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01425 
01426         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
01427         RNA_def_property_string_sdna(prop, NULL, "subtarget");
01428         RNA_def_property_ui_text(prop, "Sub-Target", "");
01429         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01430 
01431         prop= RNA_def_property(srna, "map_from", PROP_ENUM, PROP_NONE);
01432         RNA_def_property_enum_sdna(prop, NULL, "from");
01433         RNA_def_property_enum_items(prop, transform_items);
01434         RNA_def_property_ui_text(prop, "Map From", "The transformation type to use from the target");
01435         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01436 
01437         prop= RNA_def_property(srna, "map_to", PROP_ENUM, PROP_NONE);
01438         RNA_def_property_enum_sdna(prop, NULL, "to");
01439         RNA_def_property_enum_items(prop, transform_items);
01440         RNA_def_property_ui_text(prop, "Map To", "The transformation type to affect of the constrained object");
01441         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01442 
01443         prop= RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE);
01444         RNA_def_property_enum_sdna(prop, NULL, "map[0]");
01445         RNA_def_property_enum_items(prop, axis_map_items);
01446         RNA_def_property_ui_text(prop, "Map To X From", "The source axis constrained object's X axis uses");
01447         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01448 
01449         prop= RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE);
01450         RNA_def_property_enum_sdna(prop, NULL, "map[1]");
01451         RNA_def_property_enum_items(prop, axis_map_items);
01452         RNA_def_property_ui_text(prop, "Map To Y From", "The source axis constrained object's Y axis uses");
01453         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01454 
01455         prop= RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE);
01456         RNA_def_property_enum_sdna(prop, NULL, "map[2]");
01457         RNA_def_property_enum_items(prop, axis_map_items);
01458         RNA_def_property_ui_text(prop, "Map To Z From", "The source axis constrained object's Z axis uses");
01459         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01460 
01461         prop= RNA_def_property(srna, "use_motion_extrapolate", PROP_BOOLEAN, PROP_NONE);
01462         RNA_def_property_boolean_sdna(prop, NULL, "expo", CLAMPTO_CYCLIC);
01463         RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges");
01464         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01465 
01466         prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
01467         RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
01468         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01469         RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
01470         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01471 
01472         prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
01473         RNA_def_property_float_sdna(prop, NULL, "from_min[1]");
01474         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01475         RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
01476         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01477 
01478         prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
01479         RNA_def_property_float_sdna(prop, NULL, "from_min[2]");
01480         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01481         RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
01482         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01483 
01484         prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
01485         RNA_def_property_float_sdna(prop, NULL, "from_max[0]");
01486         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01487         RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
01488         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01489 
01490         prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
01491         RNA_def_property_float_sdna(prop, NULL, "from_max[1]");
01492         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01493         RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
01494         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01495 
01496         prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
01497         RNA_def_property_float_sdna(prop, NULL, "from_max[2]");
01498         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01499         RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
01500         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01501 
01502         prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
01503         RNA_def_property_float_sdna(prop, NULL, "to_min[0]");
01504         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01505         RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
01506         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01507 
01508         prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
01509         RNA_def_property_float_sdna(prop, NULL, "to_min[1]");
01510         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01511         RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
01512         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01513 
01514         prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
01515         RNA_def_property_float_sdna(prop, NULL, "to_min[2]");
01516         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01517         RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
01518         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01519 
01520         prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
01521         RNA_def_property_float_sdna(prop, NULL, "to_max[0]");
01522         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01523         RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
01524         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01525 
01526         prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
01527         RNA_def_property_float_sdna(prop, NULL, "to_max[1]");
01528         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01529         RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
01530         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01531 
01532         prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
01533         RNA_def_property_float_sdna(prop, NULL, "to_max[2]");
01534         RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
01535         RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
01536         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01537 }
01538 
01539 static void rna_def_constraint_location_limit(BlenderRNA *brna)
01540 {
01541         StructRNA *srna;
01542         PropertyRNA *prop;
01543 
01544         srna= RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
01545         RNA_def_struct_ui_text(srna, "Limit Location Constraint", "Limits the location of the constrained object");
01546         RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data");
01547 
01548         prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
01549         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
01550         RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
01551         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01552 
01553         prop= RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
01554         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
01555         RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
01556         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01557 
01558         prop= RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
01559         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
01560         RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
01561         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01562 
01563         prop= RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
01564         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
01565         RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
01566         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01567 
01568         prop= RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
01569         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
01570         RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
01571         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01572 
01573         prop= RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
01574         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
01575         RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
01576         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01577 
01578         prop= RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_DISTANCE);
01579         RNA_def_property_float_sdna(prop, NULL, "xmin");
01580         RNA_def_property_range(prop, -1000.0, 1000.f);
01581         RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
01582         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01583 
01584         prop= RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_DISTANCE);
01585         RNA_def_property_float_sdna(prop, NULL, "ymin");
01586         RNA_def_property_range(prop, -1000.0, 1000.f);
01587         RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
01588         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01589 
01590         prop= RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_DISTANCE);
01591         RNA_def_property_float_sdna(prop, NULL, "zmin");
01592         RNA_def_property_range(prop, -1000.0, 1000.f);
01593         RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
01594         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01595 
01596         prop= RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_DISTANCE);
01597         RNA_def_property_float_sdna(prop, NULL, "xmax");
01598         RNA_def_property_range(prop, -1000.0, 1000.f);
01599         RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
01600         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01601 
01602         prop= RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_DISTANCE);
01603         RNA_def_property_float_sdna(prop, NULL, "ymax");
01604         RNA_def_property_range(prop, -1000.0, 1000.f);
01605         RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
01606         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01607 
01608         prop= RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_DISTANCE);
01609         RNA_def_property_float_sdna(prop, NULL, "zmax");
01610         RNA_def_property_range(prop, -1000.0, 1000.f);
01611         RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
01612         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01613 
01614         prop= RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
01615         RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
01616         RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
01617         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01618 }
01619 
01620 static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
01621 {
01622         StructRNA *srna;
01623         PropertyRNA *prop;
01624 
01625         srna= RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
01626         RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limits the rotation of the constrained object");
01627         RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data");
01628 
01629         prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
01630         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XROT);
01631         RNA_def_property_ui_text(prop, "Limit X", "Use the minimum X value");
01632         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01633 
01634         prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
01635         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YROT);
01636         RNA_def_property_ui_text(prop, "Limit Y", "Use the minimum Y value");
01637         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01638 
01639         prop= RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
01640         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZROT);
01641         RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value");
01642         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01643 
01644         prop= RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE);
01645         RNA_def_property_float_sdna(prop, NULL, "xmin");
01646         RNA_def_property_range(prop, -1000.0, 1000.f);
01647         RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
01648         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01649 
01650         prop= RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE);
01651         RNA_def_property_float_sdna(prop, NULL, "ymin");
01652         RNA_def_property_range(prop, -1000.0, 1000.f);
01653         RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
01654         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01655 
01656         prop= RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_ANGLE);
01657         RNA_def_property_float_sdna(prop, NULL, "zmin");
01658         RNA_def_property_range(prop, -1000.0, 1000.f);
01659         RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
01660         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01661 
01662         prop= RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE);
01663         RNA_def_property_float_sdna(prop, NULL, "xmax");
01664         RNA_def_property_range(prop, -1000.0, 1000.f);
01665         RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
01666         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01667 
01668         prop= RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE);
01669         RNA_def_property_float_sdna(prop, NULL, "ymax");
01670         RNA_def_property_range(prop, -1000.0, 1000.f);
01671         RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
01672         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01673 
01674         prop= RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_ANGLE);
01675         RNA_def_property_float_sdna(prop, NULL, "zmax");
01676         RNA_def_property_range(prop, -1000.0, 1000.f);
01677         RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
01678         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01679 
01680         prop= RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
01681         RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
01682         RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
01683         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01684 }
01685 
01686 static void rna_def_constraint_size_limit(BlenderRNA *brna)
01687 {
01688         StructRNA *srna;
01689         PropertyRNA *prop;
01690 
01691         srna= RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
01692         RNA_def_struct_ui_text(srna, "Limit Size Constraint", "Limits the scaling of the constrained object");
01693         RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data");
01694 
01695         prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
01696         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
01697         RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
01698         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01699 
01700         prop= RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
01701         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
01702         RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
01703         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01704 
01705         prop= RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
01706         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
01707         RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
01708         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01709 
01710         prop= RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
01711         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
01712         RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
01713         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01714 
01715         prop= RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
01716         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
01717         RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
01718         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01719 
01720         prop= RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
01721         RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
01722         RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
01723         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01724 
01725         prop= RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
01726         RNA_def_property_float_sdna(prop, NULL, "xmin");
01727         RNA_def_property_range(prop, -1000.0, 1000.f);
01728         RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
01729         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01730 
01731         prop= RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
01732         RNA_def_property_float_sdna(prop, NULL, "ymin");
01733         RNA_def_property_range(prop, -1000.0, 1000.f);
01734         RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
01735         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01736 
01737         prop= RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_NONE);
01738         RNA_def_property_float_sdna(prop, NULL, "zmin");
01739         RNA_def_property_range(prop, -1000.0, 1000.f);
01740         RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
01741         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01742 
01743         prop= RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
01744         RNA_def_property_float_sdna(prop, NULL, "xmax");
01745         RNA_def_property_range(prop, -1000.0, 1000.f);
01746         RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
01747         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01748 
01749         prop= RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
01750         RNA_def_property_float_sdna(prop, NULL, "ymax");
01751         RNA_def_property_range(prop, -1000.0, 1000.f);
01752         RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
01753         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01754 
01755         prop= RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_NONE);
01756         RNA_def_property_float_sdna(prop, NULL, "zmax");
01757         RNA_def_property_range(prop, -1000.0, 1000.f);
01758         RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
01759         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01760 
01761         prop= RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
01762         RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
01763         RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
01764         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01765 }
01766 
01767 static void rna_def_constraint_distance_limit(BlenderRNA *brna)
01768 {
01769         StructRNA *srna;
01770         PropertyRNA *prop;
01771 
01772         srna= RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
01773         RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limits the distance from target object");
01774         RNA_def_struct_sdna_from(srna, "bDistLimitConstraint", "data");
01775 
01776         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
01777         RNA_def_property_pointer_sdna(prop, NULL, "tar");
01778         RNA_def_property_ui_text(prop, "Target", "Target Object");
01779         RNA_def_property_flag(prop, PROP_EDITABLE);
01780         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01781 
01782         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
01783         RNA_def_property_string_sdna(prop, NULL, "subtarget");
01784         RNA_def_property_ui_text(prop, "Sub-Target", "");
01785         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01786 
01787         prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
01788         RNA_def_property_float_sdna(prop, NULL, "dist");
01789         RNA_def_property_range(prop, 0.0, 100.f);
01790         RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
01791         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01792 
01793         prop= RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
01794         RNA_def_property_enum_sdna(prop, NULL, "mode");
01795         RNA_def_property_enum_items(prop, constraint_distance_items);
01796         RNA_def_property_ui_text(prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
01797         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01798 }
01799 
01800 static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
01801 {
01802         StructRNA *srna;
01803         PropertyRNA *prop;
01804         
01805         static EnumPropertyItem type_items[] = {
01806                 {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrinks the location to the nearest target surface"},
01807                 {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrinks the location to the nearest target surface along a given axis"},
01808                 {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrinks the location to the nearest target vertex"},
01809                 {0, NULL, 0, NULL, NULL}};
01810         
01811         srna= RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint"); 
01812         RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Creates constraint-based shrinkwrap relationship"); 
01813         RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
01814         
01815         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
01816         RNA_def_property_pointer_sdna(prop, NULL, "target"); /* TODO, mesh type */
01817         RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
01818         RNA_def_property_ui_text(prop, "Target", "Target Object");
01819         RNA_def_property_flag(prop, PROP_EDITABLE);
01820         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01821         
01822         prop= RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
01823         RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
01824         RNA_def_property_enum_items(prop, type_items);
01825         RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Selects type of shrinkwrap algorithm for target position");
01826         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01827         
01828         prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
01829         RNA_def_property_float_sdna(prop, NULL, "dist");
01830         RNA_def_property_range(prop, 0.0, 100.f);
01831         RNA_def_property_ui_text(prop, "Distance", "Distance to Target");
01832         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01833         
01834         prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
01835         RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS);
01836         RNA_def_property_ui_text(prop, "Axis X", "Projection over X Axis");
01837         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01838         
01839         prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
01840         RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS);
01841         RNA_def_property_ui_text(prop, "Axis Y", "Projection over Y Axis");
01842         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01843         
01844         prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
01845         RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS);
01846         RNA_def_property_ui_text(prop, "Axis Z", "Projection over Z Axis");
01847         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01848 }
01849 
01850 static void rna_def_constraint_damped_track(BlenderRNA *brna)
01851 {
01852         StructRNA *srna;
01853         PropertyRNA *prop;
01854 
01855         static EnumPropertyItem damptrack_items[] = {
01856                 {TRACK_X, "TRACK_X", 0, "X", ""},
01857                 {TRACK_Y, "TRACK_Y", 0, "Y", ""},
01858                 {TRACK_Z, "TRACK_Z", 0, "Z", ""},
01859                 {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
01860                 {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
01861                 {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
01862                 {0, NULL, 0, NULL, NULL}};
01863 
01864         srna= RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
01865         RNA_def_struct_ui_text(srna, "Damped Track Constraint", "Points toward target by taking the shortest rotation path");
01866         RNA_def_struct_sdna_from(srna, "bDampTrackConstraint", "data");
01867 
01868         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
01869         RNA_def_property_pointer_sdna(prop, NULL, "tar");
01870         RNA_def_property_ui_text(prop, "Target", "Target Object");
01871         RNA_def_property_flag(prop, PROP_EDITABLE);
01872         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01873 
01874         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
01875         RNA_def_property_string_sdna(prop, NULL, "subtarget");
01876         RNA_def_property_ui_text(prop, "Sub-Target", "");
01877         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01878 
01879         prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
01880         RNA_def_property_enum_sdna(prop, NULL, "trackflag");
01881         RNA_def_property_enum_items(prop, damptrack_items);
01882         RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
01883         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01884 }
01885 
01886 static void rna_def_constraint_spline_ik(BlenderRNA *brna)
01887 {
01888         StructRNA *srna;
01889         PropertyRNA *prop;
01890         
01891         static EnumPropertyItem splineik_xz_scale_mode[] = {
01892                 {CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes (Default)"},
01893                 {CONSTRAINT_SPLINEIK_XZS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original", "Use the original scaling of the bones"},
01894                 {CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC, "VOLUME_PRESERVE", 0, "Volume Preservation", "Scale of the X and Z axes is the inverse of the Y-Scale"},
01895                 {0, NULL, 0, NULL, NULL}};
01896 
01897         srna= RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
01898         RNA_def_struct_ui_text(srna, "Spline IK Constraint", "Align 'n' bones along a curve");
01899         RNA_def_struct_sdna_from(srna, "bSplineIKConstraint", "data");
01900         
01901         /* target chain */
01902         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
01903         RNA_def_property_pointer_sdna(prop, NULL, "tar");
01904         RNA_def_property_ui_text(prop, "Target", "Curve that controls this relationship");
01905         RNA_def_property_flag(prop, PROP_EDITABLE);
01906         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01907         
01908         prop= RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
01909         RNA_def_property_int_sdna(prop, NULL, "chainlen");
01910         RNA_def_property_range(prop, 1, 255); // TODO: this should really check the max length of the chain the constraint is attached to
01911         RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain");
01912         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01913         
01914         /* direct access to bindings */
01915         // NOTE: only to be used by experienced users
01916         prop= RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR);
01917         RNA_def_property_array(prop, 32); // XXX this is the maximum value allowed
01918         RNA_def_property_flag(prop, PROP_DYNAMIC);
01919         RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length");
01920         RNA_def_property_float_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get", "rna_SplineIKConstraint_joint_bindings_set", NULL);
01921         RNA_def_property_ui_text(prop, "Joint Bindings", "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain as percentages");
01922         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01923         
01924         /* settings */
01925         prop= RNA_def_property(srna, "use_chain_offset", PROP_BOOLEAN, PROP_NONE);
01926         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_ROOT);
01927         RNA_def_property_ui_text(prop, "Chain Offset", "Offset the entire chain relative to the root joint");
01928         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01929         
01930         prop= RNA_def_property(srna, "use_even_divisions", PROP_BOOLEAN, PROP_NONE);
01931         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_EVENSPLITS);
01932         RNA_def_property_ui_text(prop, "Even Divisions", "Ignore the relative lengths of the bones when fitting to the curve");
01933         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01934         
01935         prop= RNA_def_property(srna, "use_y_stretch", PROP_BOOLEAN, PROP_NONE);
01936         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_SCALE_LIMITED);
01937         RNA_def_property_ui_text(prop, "Y Stretch", "Stretch the Y axis of the bones to fit the curve");
01938         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01939         
01940         prop= RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
01941         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_CURVERAD);
01942         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");
01943         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01944         
01945         prop= RNA_def_property(srna, "xz_scale_mode", PROP_ENUM, PROP_NONE);
01946         RNA_def_property_enum_sdna(prop, NULL, "xzScaleMode");
01947         RNA_def_property_enum_items(prop, splineik_xz_scale_mode);
01948         RNA_def_property_ui_text(prop, "XZ Scale Mode", "Method used for determining the scaling of the X and Z axes of the bones");
01949         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01950 }
01951 
01952 static void rna_def_constraint_pivot(BlenderRNA *brna)
01953 {
01954         StructRNA *srna;
01955         PropertyRNA *prop;
01956 
01957         static EnumPropertyItem pivot_rotAxis_items[] = {
01958                 {PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"},
01959                 {PIVOTCON_AXIS_X_NEG, "NX", 0, "-X Rot", "Use the pivot point in the negative rotation range around the X-axis"},
01960                 {PIVOTCON_AXIS_Y_NEG, "NY", 0, "-Y Rot", "Use the pivot point in the negative rotation range around the Y-axis"},
01961                 {PIVOTCON_AXIS_Z_NEG, "NZ", 0, "-Z Rot", "Use the pivot point in the negative rotation range around the Z-axis"},
01962                 {PIVOTCON_AXIS_X, "X", 0, "X Rot", "Use the pivot point in the positive rotation range around the X-axis"},
01963                 {PIVOTCON_AXIS_Y, "Y", 0, "Y Rot", "Use the pivot point in the positive rotation range around the Y-axis"},
01964                 {PIVOTCON_AXIS_Z, "Z", 0, "Z Rot", "Use the pivot point in the positive rotation range around the Z-axis"},
01965                 {0, NULL, 0, NULL, NULL}};
01966 
01967         srna= RNA_def_struct(brna, "PivotConstraint", "Constraint");
01968         RNA_def_struct_ui_text(srna, "Pivot Constraint", "Rotate around a different point");
01969         
01970         prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
01971         RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
01972         RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
01973         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01974         
01975         RNA_def_struct_sdna_from(srna, "bPivotConstraint", "data");
01976         
01977         /* target-defined pivot */
01978         prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
01979         RNA_def_property_pointer_sdna(prop, NULL, "tar");
01980         RNA_def_property_ui_text(prop, "Target", "Target Object, defining the position of the pivot when defined");
01981         RNA_def_property_flag(prop, PROP_EDITABLE);
01982         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01983         
01984         prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
01985         RNA_def_property_string_sdna(prop, NULL, "subtarget");
01986         RNA_def_property_ui_text(prop, "Sub-Target", "");
01987         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
01988         
01989         /* pivot offset */
01990         prop= RNA_def_property(srna, "use_relative_location", PROP_BOOLEAN, PROP_NONE);
01991         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PIVOTCON_FLAG_OFFSET_ABS);
01992         RNA_def_property_ui_text(prop, "Use Relative Offset", "Offset will be an absolute point in space instead of relative to the target");
01993         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01994         
01995         prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_XYZ);
01996         RNA_def_property_float_sdna(prop, NULL, "offset");
01997         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");
01998         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
01999         
02000         /* rotation-based activation */
02001         prop= RNA_def_property(srna, "rotation_range", PROP_ENUM, PROP_NONE);
02002         RNA_def_property_enum_sdna(prop, NULL, "rotAxis");
02003         RNA_def_property_enum_items(prop, pivot_rotAxis_items);
02004         RNA_def_property_ui_text(prop, "Enabled Rotation Range", "Rotation range on which pivoting should occur");
02005         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
02006 }
02007 
02008 /* base struct for constraints */
02009 void RNA_def_constraint(BlenderRNA *brna)
02010 {
02011         StructRNA *srna;
02012         PropertyRNA *prop;
02013         
02014         /* data */
02015         srna= RNA_def_struct(brna, "Constraint", NULL );
02016         RNA_def_struct_ui_text(srna, "Constraint", "Constraint modifying the transformation of objects and bones");
02017         RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine");
02018         RNA_def_struct_path_func(srna, "rna_Constraint_path");
02019         RNA_def_struct_sdna(srna, "bConstraint");
02020         
02021         /* strings */
02022         prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
02023         RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Constraint_name_set");
02024         RNA_def_property_ui_text(prop, "Name", "Constraint name");
02025         RNA_def_struct_name_property(srna, prop);
02026         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT|NA_RENAME, NULL);
02027         
02028         /* enums */
02029         prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
02030         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02031         RNA_def_property_enum_sdna(prop, NULL, "type");
02032         RNA_def_property_enum_items(prop, constraint_type_items);
02033         RNA_def_property_ui_text(prop, "Type", "");
02034 
02035         prop= RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
02036         RNA_def_property_enum_sdna(prop, NULL, "ownspace");
02037         RNA_def_property_enum_items(prop, owner_space_pchan_items);
02038         RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf");
02039         RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in");
02040 
02041         prop= RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
02042         RNA_def_property_enum_sdna(prop, NULL, "tarspace");
02043         RNA_def_property_enum_items(prop, target_space_pchan_items);
02044         RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_target_space_itemf");
02045         RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in");
02046 
02047         /* flags */
02048         prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
02049         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OFF);
02050         RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint");
02051         
02052         prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
02053         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_EXPAND);
02054         RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
02055         RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
02056 
02057                 // XXX this is really an internal flag, but it may be useful for some tools to be able to access this...
02058         prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
02059         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02060         RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE);
02061         RNA_def_property_ui_text(prop, "Valid", "Constraint has valid settings and can be evaluated");
02062         
02063                 // TODO: setting this to true must ensure that all others in stack are turned off too...
02064         prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
02065         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ACTIVE);
02066         RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited ");
02067         
02068         prop= RNA_def_property(srna, "is_proxy_local", PROP_BOOLEAN, PROP_NONE);
02069         RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_PROXY_LOCAL);
02070         RNA_def_property_ui_text(prop, "Proxy Local", "Constraint was added in this proxy instance (i.e. did not belong to source Armature)");
02071         
02072         /* values */
02073         prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
02074         RNA_def_property_float_sdna(prop, NULL, "enforce");
02075         RNA_def_property_range(prop, 0.0f, 1.0f);
02076         RNA_def_property_ui_text(prop, "Influence", "Amount of influence constraint will have on the final solution");
02077         RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_influence_update");
02078 
02079         /* readonly values */
02080         prop= RNA_def_property(srna, "error_location", PROP_FLOAT, PROP_NONE);
02081         RNA_def_property_float_sdna(prop, NULL, "lin_error");
02082         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02083         RNA_def_property_ui_text(prop, "Lin error", "Amount of residual error in Blender space unit for constraints that work on position");
02084 
02085         prop= RNA_def_property(srna, "error_rotation", PROP_FLOAT, PROP_NONE);
02086         RNA_def_property_float_sdna(prop, NULL, "rot_error");
02087         RNA_def_property_clear_flag(prop, PROP_EDITABLE);
02088         RNA_def_property_ui_text(prop, "Rot error", "Amount of residual error in radiant for constraints that work on orientation");
02089 
02090         /* pointers */
02091         rna_def_constrainttarget(brna);
02092 
02093         rna_def_constraint_childof(brna);
02094         rna_def_constraint_python(brna);
02095         rna_def_constraint_stretch_to(brna);
02096         rna_def_constraint_follow_path(brna);
02097         rna_def_constraint_locked_track(brna);
02098         rna_def_constraint_action(brna);
02099         rna_def_constraint_size_like(brna);
02100         rna_def_constraint_same_volume(brna);
02101         rna_def_constraint_locate_like(brna);
02102         rna_def_constraint_rotate_like(brna);
02103         rna_def_constraint_transform_like(brna);
02104         rna_def_constraint_minmax(brna);
02105         rna_def_constraint_track_to(brna);
02106         rna_def_constraint_kinematic(brna);
02107         rna_def_constraint_rigid_body_joint(brna);
02108         rna_def_constraint_clamp_to(brna);
02109         rna_def_constraint_distance_limit(brna);
02110         rna_def_constraint_size_limit(brna);
02111         rna_def_constraint_rotation_limit(brna);
02112         rna_def_constraint_location_limit(brna);
02113         rna_def_constraint_transform(brna);
02114         rna_def_constraint_shrinkwrap(brna);
02115         rna_def_constraint_damped_track(brna);
02116         rna_def_constraint_spline_ik(brna);
02117         rna_def_constraint_pivot(brna);
02118 }
02119 
02120 #endif
02121