From 9e7012995249281b041d55607e7e7408857aa8c4 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Fri, 12 Jun 2020 21:33:38 +0300 Subject: Cloth: allow forces to act parallel to cloth. Currently all force effectors can only act on cloth when the force is perpendicular to the surface. This makes sense for wind, but not for other forces; and the user may want even wind to have some friction. This changes effector code to output two force vectors - although you of course can pass the same pointer for both. The force is split between the two outputs based on a new per-effector setting. Differential Revision: https://developer.blender.org/D8017 --- source/blender/blenloader/intern/versioning_280.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 6211c58d7d4..0648264466d 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -5075,6 +5075,23 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) * \note Keep this message at the bottom of the function. */ { + /* Set the cloth wind factor to 1 for old forces. */ + if (!DNA_struct_elem_find(fd->filesdna, "PartDeflect", "float", "f_wind_factor")) { + LISTBASE_FOREACH (Object *, ob, &bmain->objects) { + if (ob->pd) { + ob->pd->f_wind_factor = 1.0f; + } + } + LISTBASE_FOREACH (ParticleSettings *, part, &bmain->particles) { + if (part->pd) { + part->pd->f_wind_factor = 1.0f; + } + if (part->pd2) { + part->pd2->f_wind_factor = 1.0f; + } + } + } + /* Keep this block, even when empty. */ } } -- cgit v1.2.3