diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 23 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 6 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_constraint_types.h | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_constraint.c | 16 |
4 files changed, 42 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 0f7767a1808..dfbcc51a93c 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1178,17 +1178,26 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr makeDispListCurveTypes(cob->scene, ct->tar, 0); if (cu->path && cu->path->data) { - curvetime= bsystem_time(cob->scene, ct->tar, (float)ctime, 0.0) - data->offset; - -#if 0 // XXX old animation system - if (calc_ipo_spec(cu->ipo, CU_SPEED, &curvetime)==0) { - curvetime /= cu->pathlen; + if ((data->followflag & FOLLOWPATH_STATIC) == 0) { + /* animated position along curve depending on time */ + curvetime= bsystem_time(cob->scene, ct->tar, ctime, 0.0) - data->offset; + + /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated, + * but this will only work if it actually is animated... + * + * we firstly calculate the modulus of cu->ctime/cu->pathlen to clamp ctime within the 0.0 to 1.0 times pathlen + * range, then divide this (the modulus) by pathlen to get a value between 0.0 and 1.0 + */ + curvetime= fmod(cu->ctime, cu->pathlen) / cu->pathlen; CLAMP(curvetime, 0.0, 1.0); } -#endif // XXX old animation system + else { + /* fixed position along curve */ + curvetime= data->offset; // XXX might need a more sensible value + } if ( where_on_path(ct->tar, curvetime, vec, dir) ) { - if (data->followflag) { + if (data->followflag & FOLLOWPATH_FOLLOW) { vectoquat(dir, (short) data->trackflag, (short) data->upflag, quat); Normalize(dir); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index db97657a2ee..618e587d674 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9596,6 +9596,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 2)) { Scene *sce; + Object *ob; for(sce = main->scene.first; sce; sce = sce->id.next) { if(fd->fileflags & G_FILE_ENABLE_ALL_FRAMES) @@ -9628,6 +9629,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce->gm.flag |= GAME_DISPLAY_LISTS; } + + for(ob = main->object.first; ob; ob = ob->id.next) { + if(ob->flag & 8192) // OB_POSEMODE = 8192 + ob->mode |= OB_MODE_POSE; + } } /* put 2.50 compatibility code here until next subversion bump */ diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 6fab633b192..a92dc836197 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -64,7 +64,8 @@ typedef struct bConstraint { float enforce; /* Amount of influence exherted by constraint (0.0-1.0) */ float headtail; /* Point along subtarget bone where the actual target is. 0=head (default for all), 1=tail*/ int pad; - struct Ipo *ipo; /* local influence ipo or driver */ + + struct Ipo *ipo; /* local influence ipo or driver */ // XXX depreceated for 2.5... old animation system hack } bConstraint; @@ -449,6 +450,10 @@ typedef enum B_CONSTRAINTCHANNEL_FLAG { #define TRACK_nY 0x04 #define TRACK_nZ 0x05 +/* FollowPath flags */ +#define FOLLOWPATH_FOLLOW 0x01 +#define FOLLOWPATH_STATIC 0x02 + /* bTrackToConstraint->flags */ #define TARGET_Z_UP 0x01 diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index c09a71f752a..83f3042d8ee 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -871,9 +871,15 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "offset", PROP_INT, PROP_TIME); - RNA_def_property_range(prop, -300000.0, 300000.f); + 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_percentage", PROP_FLOAT, PROP_PERCENTAGE); + 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 Percentage", "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"); @@ -888,9 +894,15 @@ 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, "curve_follow", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "followflag", 1); + 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, "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"); } static void rna_def_constraint_stretch_to(BlenderRNA *brna) |