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