Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_constraint.c')
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c336
1 files changed, 230 insertions, 106 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 8200a21f4ac..b630e61a680 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -33,41 +33,66 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "ED_object.h"
#include "WM_types.h"
EnumPropertyItem constraint_type_items[] ={
{CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", 0, "Child Of", ""},
{CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", 0, "Transformation", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", 0, "Copy Location", ""},
{CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", 0, "Copy Rotation", ""},
{CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", 0, "Copy Scale", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", 0, "Limit Location", ""},
{CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", 0, "Limit Rotation", ""},
{CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", 0, "Limit Scale", ""},
{CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", 0, "Limit Distance", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", 0, "Track To", ""},
{CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", 0, "Locked Track", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_MINMAX, "FLOOR", 0, "Floor", ""},
{CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", 0, "Shrinkwrap", ""},
{CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", 0, "Follow Path", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", 0, "Clamp To", ""},
{CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO", 0, "Stretch To", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_KINEMATIC, "IK", 0, "IK", ""},
{CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", 0, "Rigid Body Joint", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_ACTION, "ACTION", 0, "Action", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_PYTHON, "SCRIPT", 0, "Script", ""},
-
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_TYPE_NULL, "NULL", 0, "Null", ""},
{0, NULL, 0, NULL, NULL}};
+EnumPropertyItem space_pchan_items[] = {
+ {0, "WORLD", 0, "World Space", ""},
+ {2, "POSE", 0, "Pose Space", ""},
+ {3, "LOCAL_WITH_PARENT", 0, "Local With Parent", ""},
+ {1, "LOCAL", 0, "Local Space", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem space_object_items[] = {
+ {0, "WORLD", 0, "World Space", ""},
+ {1, "LOCAL", 0, "Local (Without Parent) Space", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem constraint_ik_type_items[] ={
+ {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
+ {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
+ {0, NULL, 0, NULL, NULL},
+};
+
+static EnumPropertyItem constraint_distance_items[] = {
+ {LIMITDIST_INSIDE, "LIMITDIST_INSIDE", 0, "Inside", ""},
+ {LIMITDIST_OUTSIDE, "LIMITDIST_OUTSIDE", 0, "Outside", ""},
+ {LIMITDIST_ONSURFACE, "LIMITDIST_ONSURFACE", 0, "On Surface", ""},
+ {0, NULL, 0, NULL, NULL}
+};
#ifdef RNA_RUNTIME
@@ -78,7 +103,7 @@ EnumPropertyItem constraint_type_items[] ={
#include "ED_object.h"
-StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
+static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
{
bConstraint *con= (bConstraint*)ptr->data;
@@ -130,30 +155,31 @@ StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
static char *rna_Constraint_path(PointerRNA *ptr)
{
- return BLI_sprintfN("constraints[%s]", ((bConstraint*)ptr->data)->name);
+ Object *ob= ptr->id.data;
+ bConstraint *con= ptr->data;
+ bPoseChannel *pchan= get_active_posechannel(ob);
+ ListBase *actlist= get_active_constraints(ob);
+ short inList = 0;
+
+ /* check if constraint is in the given list */
+ if (actlist)
+ inList= (BLI_findindex(actlist, con) != -1);
+
+ /* if constraint is in the list, the list is for the active bone... */
+ if ((inList) && (actlist != &ob->constraints) && (pchan))
+ return BLI_sprintfN("pose.pose_channels[\"%s\"].constraints[\"%s\"]", pchan->name, con->name);
+ else
+ return BLI_sprintfN("constraints[\"%s\"]", con->name);
}
static void rna_Constraint_update(bContext *C, PointerRNA *ptr)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ptr->id.data;
-
- if(ob->pose) update_pose_constraint_flags(ob->pose);
-
- object_test_constraints(ob);
-
- if(ob->type==OB_ARMATURE) DAG_object_flush_update(scene, ob, OB_RECALC_DATA|OB_RECALC_OB);
- else DAG_object_flush_update(scene, ob, OB_RECALC_OB);
+ ED_object_constraint_update(ptr->id.data);
}
static void rna_Constraint_dependency_update(bContext *C, PointerRNA *ptr)
{
- Object *ob= ptr->id.data;
-
- rna_Constraint_update(C, ptr);
-
- if(ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels
- DAG_scene_sort(CTX_data_scene(C));
+ ED_object_constraint_dependency_update(CTX_data_scene(C), ptr->id.data);
}
static void rna_Constraint_influence_update(bContext *C, PointerRNA *ptr)
@@ -166,22 +192,42 @@ static void rna_Constraint_influence_update(bContext *C, PointerRNA *ptr)
rna_Constraint_update(C, ptr);
}
-static EnumPropertyItem space_pchan_items[] = {
- {0, "WORLD", 0, "World Space", ""},
- {2, "POSE", 0, "Pose Space", ""},
- {3, "LOCAL_WITH_PARENT", 0, "Local With Parent", ""},
- {1, "LOCAL", 0, "Local Space", ""},
- {0, NULL, 0, NULL, NULL}};
-
-static EnumPropertyItem space_object_items[] = {
- {0, "WORLD", 0, "World Space", ""},
- {1, "LOCAL", 0, "Local (Without Parent) Space", ""},
- {0, NULL, 0, NULL, NULL}};
+static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value)
+{
+ bConstraint *con = ptr->data;
+ bKinematicConstraint *ikdata = con->data;
+
+ if (ikdata->type != value) {
+ // the type of IK constraint has changed, set suitable default values
+ // in case constraints reuse same fields incompatible
+ switch (value) {
+ case CONSTRAINT_IK_COPYPOSE:
+ break;
+ case CONSTRAINT_IK_DISTANCE:
+ break;
+ }
+ ikdata->type = value;
+ }
+}
-static EnumPropertyItem *rna_Constraint_owner_space_itemf(PointerRNA *ptr)
+static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *C, PointerRNA *ptr, int *free)
{
Object *ob= (Object*)ptr->id.data;
bConstraint *con= (bConstraint*)ptr->data;
+
+ if(C==NULL) {
+ EnumPropertyItem *item= NULL;
+ int totitem= 0;
+
+ /* needed for doc generation */
+ RNA_enum_items_add(&item, &totitem, space_object_items);
+ RNA_enum_items_add(&item, &totitem, space_pchan_items);
+ RNA_enum_item_end(&item, &totitem);
+
+ *free= 1;
+
+ return item;
+ }
if(BLI_findindex(&ob->constraints, con) == -1)
return space_pchan_items;
@@ -189,13 +235,27 @@ static EnumPropertyItem *rna_Constraint_owner_space_itemf(PointerRNA *ptr)
return space_object_items;
}
-static EnumPropertyItem *rna_Constraint_target_space_itemf(PointerRNA *ptr)
+static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *C, PointerRNA *ptr, int *free)
{
bConstraint *con= (bConstraint*)ptr->data;
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
+ if(C==NULL) {
+ EnumPropertyItem *item= NULL;
+ int totitem= 0;
+
+ /* needed for doc generation */
+ RNA_enum_items_add(&item, &totitem, space_object_items);
+ RNA_enum_items_add(&item, &totitem, space_pchan_items);
+ RNA_enum_item_end(&item, &totitem);
+
+ *free= 1;
+
+ return item;
+ }
+
if(cti && cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
@@ -213,6 +273,22 @@ static EnumPropertyItem *rna_Constraint_target_space_itemf(PointerRNA *ptr)
return space_object_items;
}
+static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float *max)
+{
+ bConstraint *con= (bConstraint*)ptr->data;
+ bActionConstraint *acon = (bActionConstraint *)con->data;
+
+ /* 0, 1, 2 = magic numbers for rotX, rotY, rotZ */
+ if (ELEM3(acon->type, 0, 1, 2)) {
+ *min= -90.f;
+ *max= 90.f;
+ } else {
+ *min= -1000.f;
+ *max= 1000.f;
+ }
+}
+
+
#else
static void rna_def_constrainttarget(BlenderRNA *brna)
@@ -375,7 +451,7 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
- prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE); // XXX - todo, convert to rad
RNA_def_property_float_sdna(prop, NULL, "poleangle");
RNA_def_property_range(prop, 0.0, 180.f);
RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset.");
@@ -400,21 +476,40 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
prop= RNA_def_property(srna, "tail", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_TIP);
RNA_def_property_ui_text(prop, "Use Tail", "Include bone's tail as last element in chain.");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop= RNA_def_property(srna, "rotation", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_ROT);
RNA_def_property_ui_text(prop, "Rotation", "Chain follows rotation of target.");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop= RNA_def_property(srna, "targetless", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_AUTO);
RNA_def_property_ui_text(prop, "Targetless", "Use targetless IK.");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop= RNA_def_property(srna, "stretch", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_STRETCH);
RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop= RNA_def_property(srna, "ik_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Constraint_ik_type_set", NULL);
+ RNA_def_property_enum_items(prop, constraint_ik_type_items);
+ RNA_def_property_ui_text(prop, "IK Type", "");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop= RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, constraint_distance_items);
+ RNA_def_property_ui_text(prop, "Limit Mode", "Distances in relation to sphere of influence to allow.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dist");
+ RNA_def_property_range(prop, 0.0, 100.f);
+ RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
@@ -535,10 +630,8 @@ static void rna_def_constraint_locate_like(BlenderRNA *brna)
srna= RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copies the location of the target.");
- RNA_def_struct_sdna(srna, "bConstraint");
-
- prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_PERCENTAGE);
- RNA_def_property_float_sdna(prop, NULL, "headtail");
+ prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -637,7 +730,7 @@ static void rna_def_constraint_minmax(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_range(prop, 0.0, 100.f);
RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object center.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -691,15 +784,15 @@ static void rna_def_constraint_action(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem transform_channel_items[] = {
- {00, "ROTATION_X", 0, "Rotation X", ""},
- {01, "ROTATION_Y", 0, "Rotation Y", ""},
- {02, "ROTATION_Z", 0, "Rotation Z", ""},
- {10, "SIZE_X", 0, "Scale X", ""},
- {11, "SIZE_Y", 0, "Scale Y", ""},
- {12, "SIZE_Z", 0, "Scale Z", ""},
{20, "LOCATION_X", 0, "Location X", ""},
{21, "LOCATION_Y", 0, "Location Y", ""},
{22, "LOCATION_Z", 0, "Location Z", ""},
+ {00, "ROTATION_X", 0, "Rotation X", ""},
+ {01, "ROTATION_Y", 0, "Rotation Y", ""},
+ {02, "ROTATION_Z", 0, "Rotation Z", ""},
+ {10, "SCALE_X", 0, "Scale X", ""},
+ {11, "SCALE_Y", 0, "Scale Y", ""},
+ {12, "SCALE_Z", 0, "Scale Z", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "ActionConstraint", "Constraint");
@@ -729,29 +822,31 @@ static void rna_def_constraint_action(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "start");
- RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "end_frame", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "end_frame", PROP_INT, PROP_TIME);
RNA_def_property_int_sdna(prop, NULL, "end");
- RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "maximum", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "max");
- RNA_def_property_range(prop, 0.0, 1000.f);
+ RNA_def_property_range(prop, -1000.f, 1000.f);
RNA_def_property_ui_text(prop, "Maximum", "Maximum value for target channel range.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
prop= RNA_def_property(srna, "minimum", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "min");
- RNA_def_property_range(prop, 0.0, 1000.f);
+ RNA_def_property_range(prop, -1000.f, 1000.f);
RNA_def_property_ui_text(prop, "Minimum", "Minimum value for target channel range.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
}
static void rna_def_constraint_locked_track(BlenderRNA *brna)
@@ -832,10 +927,16 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
- prop= RNA_def_property(srna, "offset", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, -300000.0, 300000.f);
+ prop= RNA_def_property(srna, "offset", PROP_INT, PROP_TIME);
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
RNA_def_property_ui_text(prop, "Offset", "Offset from the position corresponding to the time frame.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop= RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "offset"); // XXX we might be better with another var or some hackery?
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Offset Factor", "Percentage value defining target position along length of bone.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "forward", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "trackflag");
@@ -849,10 +950,21 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "curve_follow", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "followflag", 1);
+ prop= RNA_def_property(srna, "use_curve_follow", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_FOLLOW);
RNA_def_property_ui_text(prop, "Follow Curve", "Object will follow the heading and banking of the curve.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+
+ // TODO: do we need to do some special trickery to get offset sane for this?
+ prop= RNA_def_property(srna, "use_fixed_position", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_STATIC);
+ 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.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop= RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_RADIUS);
+ RNA_def_property_ui_text(prop, "Curve Radius", "Objects scale by the curve radius.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_stretch_to(BlenderRNA *brna)
@@ -881,6 +993,11 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Target", "Target Object");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "subtarget");
+ RNA_def_property_ui_text(prop, "Sub-Target", "");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop= RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "volmode");
@@ -894,7 +1011,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Keep Axis", "Axis to maintain during stretch.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "original_length", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "original_length", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "orglength");
RNA_def_property_range(prop, 0.0, 100.f);
RNA_def_property_ui_text(prop, "Original Length", "Length at rest position.");
@@ -939,37 +1056,37 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Pivot Type", "");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "pivX");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Pivot X", "Offset pivot on X.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "pivY");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Pivot Y", "Offset pivot on Y.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "pivZ");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Pivot Z", "Offset pivot on Z.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
RNA_def_property_float_sdna(prop, NULL, "axX");
RNA_def_property_range(prop, -360.0, 360.f);
RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis in degrees.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
RNA_def_property_float_sdna(prop, NULL, "axY");
RNA_def_property_range(prop, -360.0, 360.f);
RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis in degrees.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
RNA_def_property_float_sdna(prop, NULL, "axZ");
RNA_def_property_range(prop, -360.0, 360.f);
RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees.");
@@ -1091,73 +1208,73 @@ static void rna_def_constraint_transform(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_min[1]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_min[2]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_max[0]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_max[1]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_max[2]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_min[0]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_min[1]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_min[2]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_max[0]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_max[1]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "to_max[2]");
RNA_def_property_range(prop, 0.0, 1000.f);
RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion.");
@@ -1203,37 +1320,37 @@ static void rna_def_constraint_location_limit(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "xmin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "ymin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "zmin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "xmax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "ymax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "zmax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow.");
@@ -1269,37 +1386,37 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "minimum_x", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "xmin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "minimum_y", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "ymin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "minimum_z", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "zmin");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "maximum_x", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "xmax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "maximum_y", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "ymax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "maximum_z", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "zmax");
RNA_def_property_range(prop, -1000.0, 1000.f);
RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow.");
@@ -1397,12 +1514,6 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem distance_items[] = {
- {LIMITDIST_INSIDE, "LIMITDIST_INSIDE", 0, "Inside", ""},
- {LIMITDIST_OUTSIDE, "LIMITDIST_OUTSIDE", 0, "Outside", ""},
- {LIMITDIST_ONSURFACE, "LIMITDIST_ONSURFACE", 0, "On Surface", ""},
- {0, NULL, 0, NULL, NULL}};
-
srna= RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limits the distance from target object.");
RNA_def_struct_sdna_from(srna, "bDistLimitConstraint", "data");
@@ -1418,7 +1529,7 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Sub-Target", "");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
- prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "dist");
RNA_def_property_range(prop, 0.0, 100.f);
RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere.");
@@ -1426,7 +1537,7 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna)
prop= RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, distance_items);
+ RNA_def_property_enum_items(prop, constraint_distance_items);
RNA_def_property_ui_text(prop, "Limit Mode", "Distances in relation to sphere of influence to allow.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
@@ -1458,7 +1569,7 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Selects type of shrinkwrap algorithm for target position");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "dist");
RNA_def_property_range(prop, 0.0, 100.f);
RNA_def_property_ui_text(prop, "Distance", "Distance to Target.");
@@ -1507,11 +1618,13 @@ void RNA_def_constraint(BlenderRNA *brna)
prop= RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "ownspace");
+ RNA_def_property_enum_items(prop, space_pchan_items);
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf");
RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in.");
prop= RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "tarspace");
+ RNA_def_property_enum_items(prop, space_pchan_items);
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_target_space_itemf");
RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in.");
@@ -1537,12 +1650,23 @@ void RNA_def_constraint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Proxy Local", "Constraint was added in this proxy instance (i.e. did not belong to source Armature).");
/* values */
- prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_PERCENTAGE);
+ prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "enforce");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Influence", "Amount of influence constraint will have on the final solution.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_influence_update");
-
+
+ /* readonly values */
+ prop= RNA_def_property(srna, "lin_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "lin_error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Lin error", "Amount of residual error in Blender space unit for constraints that work on position.");
+
+ prop= RNA_def_property(srna, "rot_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rot_error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Rot error", "Amount of residual error in radiant for constraints that work on orientation.");
+
/* pointers */
rna_def_constrainttarget(brna);