diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-07-07 18:39:45 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-09-26 16:52:58 +0300 |
commit | 3378782eeeb55a6ed64dba479e37f8b98fab63b1 (patch) | |
tree | 1ae6e8fd713d4c7b22a05a4024f2f7dbc09efe2b /source/blender/blenloader | |
parent | 310f1b057926d6250adf11db6621f2606b61827f (diff) |
Implement additional modes for Shrinkwrap to a surface.
In addition to the original map to surface and Keep Above Surface,
add modes that only affect vertices that are inside or outside
the object. This is inspired by the Limit Distance constraint,
and can be useful for crude collision detection in rigs.
The inside/outside test works based on face normals and may not be
completely reliable near 90 degree or sharper angles in the target.
Reviewers: campbellbarton, mont29
Differential Revision: https://developer.blender.org/D3717
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 6b74e4f2239..4ec283c35ca 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -2074,4 +2074,20 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + { + if (!DNA_struct_elem_find(fd->filesdna, "ShrinkwrapModifierData", "char", "shrinkMode")) { + for (Object *ob = bmain->object.first; ob; ob = ob->id.next) { + for (ModifierData *md = ob->modifiers.first; md; md = md->next) { + if (md->type == eModifierType_Shrinkwrap) { + ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*)md; + if (smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE) { + smd->shrinkMode = MOD_SHRINKWRAP_ABOVE_SURFACE; + smd->shrinkOpts &= ~MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE; + } + } + } + } + } + } } |