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:
authorJoshua Leung <aligorith@gmail.com>2010-02-03 12:05:31 +0300
committerJoshua Leung <aligorith@gmail.com>2010-02-03 12:05:31 +0300
commit53596fc6b8f47d9dec633b1ea5ae56a893d0cf3f (patch)
tree535776eddcc74e9a221b89f572fdb929820d2bf8 /source/blender
parent742ef3b4cc5dabb337e6afe20d6f016106c8bc10 (diff)
Bugfix #20940: Offset always resets to 1 in follow path constraint
Made the 'Offset Factor' setting use a separate variable from the 'Offset' setting in the DNA stuff. While we could get away with this sort of thing in the past, it turns out that with the Datablocks viewer these days, settings sharing an internal var but with different ranges/behaviour doesn't work well anymore, since later instances override earlier ones.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/makesdna/DNA_constraint_types.h12
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c3
3 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 026cc899aad..dd4f518037f 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1206,7 +1206,7 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
}
else {
/* fixed position along curve */
- curvetime= data->offset; // XXX might need a more sensible value
+ curvetime= data->offset_fac;
}
if ( where_on_path(ct->tar, curvetime, vec, dir, NULL, &radius) ) {
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index 163933da12a..09b25f9b453 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -257,11 +257,15 @@ typedef struct bDampTrackConstraint {
/* Follow Path constraints */
typedef struct bFollowPathConstraint {
- Object *tar; /* Must be path object */
- float offset; /* Offset in time on the path (in frame) */
+ Object *tar; /* Must be path object */
+
+ float offset; /* Offset in time on the path (in frames), when NOT using 'fixed position' */
+ float offset_fac; /* Parametric offset factor defining position along path, when using 'fixed position' */
+
int followflag;
- int trackflag;
- int upflag;
+
+ short trackflag;
+ short upflag;
} bFollowPathConstraint;
/* Stretch to constraint */
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 4671dbcd80d..0b20496de9d 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1045,7 +1045,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
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_float_sdna(prop, NULL, "offset_fac");
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");
@@ -1067,7 +1067,6 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
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.");