diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-02-03 23:04:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-02-03 23:16:20 +0300 |
commit | c69458985cdb0cc1b388b81f61e5091c73461003 (patch) | |
tree | a6da9bba98ca516553b2c0af8c9755c72331e257 /source/blender/blenloader | |
parent | a66a54c06d414a7d70b8ad13f683b6f5e1874e68 (diff) |
Hook Modifier: add falloff & radius options
- Add falloff types & curves (matching warp-modifier)
- Add uniform scale option,
important when adding hooks to non-uniform scaled objects,
especially for use with lattice objects which can't avoid uneven scaling.
This uses relative transformation set when the hook is assigned,
when measuring the distances.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 5 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_270.c | 14 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 4 |
3 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9daa6931282..7bfe6f0397b 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4840,6 +4840,11 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { BLI_endian_switch_int32_array(hmd->indexar, hmd->totindex); } + + hmd->curfalloff = newdataadr(fd, hmd->curfalloff); + if (hmd->curfalloff) { + direct_link_curvemapping(fd, hmd->curfalloff); + } } else if (md->type == eModifierType_ParticleSystem) { ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 6f33cab203e..a6320ed597b 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -519,6 +519,20 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } + if (!DNA_struct_elem_find(fd->filesdna, "HookModifierData", "char", "flag")) { + Object *ob; + + for (ob = main->object.first; ob; ob = ob->id.next) { + ModifierData *md; + for (md = ob->modifiers.first; md; md = md->next) { + if (md->type == eModifierType_Hook) { + HookModifierData *hmd = (HookModifierData *)md; + hmd->falloff_type = eHook_Falloff_InvSquare; + } + } + } + } + if (!MAIN_VERSION_ATLEAST(main, 273, 3)) { ParticleSettings *part; for (part = main->particle.first; part; part = part->id.next) { diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 1de2b6b267a..3eeb30ac5d0 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1485,6 +1485,10 @@ static void write_modifiers(WriteData *wd, ListBase *modbase) if (md->type==eModifierType_Hook) { HookModifierData *hmd = (HookModifierData*) md; + if (hmd->curfalloff) { + write_curvemapping(wd, hmd->curfalloff); + } + writedata(wd, DATA, sizeof(int)*hmd->totindex, hmd->indexar); } else if (md->type==eModifierType_Cloth) { |