diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-12-07 07:24:02 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-12-07 07:24:02 +0300 |
commit | ab02e9140e6c8b1d8c9169b18fa5025a1fb54377 (patch) | |
tree | d4a6fbb81c1b729a71a965738a5543e52e377926 /source/blender/blenloader | |
parent | 90715580b93d633aa01e1c0e12b057301658cc59 (diff) |
== NLA - Scale Setting for Strips ==
NLA-Strips now have a new setting: Scale.
It determines how much the action-range is scaled for each repeat, instead of the scaling being implicitly determined based on repeats + strip-length.
One of the instant benefits of this, is that when increasing the number of repeats, the strip length increases by the right amount. Thus, increasing the number of repeats retains a constant speed.
Hopefully we can prevent weirdly scaled actions this way. (i.e. 0.00001 frames long action * 10000 or so)
Todo:
- Transform code needs to be able to set the scale setting (it doesn't yet)
- Add a new option to "apply scaling", to fix up problems with old files that have really bad scaling. Situations when this is needed could get indicated in the interface too... (red background for "Scale" field?)
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 43bddc275b7..f6b0c4cb4dc 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7187,11 +7187,36 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 10)) { Object *ob; - + /* dupliface scale */ for(ob= main->object.first; ob; ob= ob->id.next) ob->dupfacesca = 1.0f; } + + if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 11)) { + Object *ob; + bActionStrip *strip; + + /* nla-strips - scale */ + for (ob= main->object.first; ob; ob= ob->id.next) { + for (strip= ob->nlastrips.first; strip; strip= strip->next) { + float length, actlength, repeat; + + if (strip->flag & ACTSTRIP_USESTRIDE) + repeat= 1.0f; + else + repeat= strip->repeat; + + length = strip->end-strip->start; + if (length == 0.0f) length= 1.0f; + actlength = strip->actend-strip->actstart; + + // right calculation? + strip->scale = actlength / (length * repeat); + if (strip->scale == 0.0f) strip->scale= 1.0f; + } + } + } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ |