Revision: 26571
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26571
Author:   aligorith
Date:     2010-02-03 10:05:31 +0100 (Wed, 03 Feb 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/constraint.c
    trunk/blender/source/blender/makesdna/DNA_constraint_types.h
    trunk/blender/source/blender/makesrna/intern/rna_constraint.c

Modified: trunk/blender/source/blender/blenkernel/intern/constraint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/constraint.c 2010-02-03 
06:30:16 UTC (rev 26570)
+++ trunk/blender/source/blender/blenkernel/intern/constraint.c 2010-02-03 
09:05:31 UTC (rev 26571)
@@ -1206,7 +1206,7 @@
                        }
                        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) ) {

Modified: trunk/blender/source/blender/makesdna/DNA_constraint_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_constraint_types.h        
2010-02-03 06:30:16 UTC (rev 26570)
+++ trunk/blender/source/blender/makesdna/DNA_constraint_types.h        
2010-02-03 09:05:31 UTC (rev 26571)
@@ -257,11 +257,15 @@
 
 /* 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 */

Modified: trunk/blender/source/blender/makesrna/intern/rna_constraint.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_constraint.c       
2010-02-03 06:30:16 UTC (rev 26570)
+++ trunk/blender/source/blender/makesrna/intern/rna_constraint.c       
2010-02-03 09:05:31 UTC (rev 26571)
@@ -1045,7 +1045,7 @@
        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 @@
        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.");


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to