Fix T52498: Deleting force field doesn't remove "Surface" from modifier stack.
authorBastien Montagne <montagne29@wanadoo.fr>
Sun, 27 Aug 2017 10:20:21 +0000 (12:20 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Sun, 27 Aug 2017 10:20:21 +0000 (12:20 +0200)
Logic in `ED_object_check_force_modifiers` was inconsistent between add
and remove modifier cases.

Should be safe enough for 2.79.

source/blender/editors/object/object_edit.c

index 34554db131887236cbe9f7457922abb4ed1840e5..4a96a2e220090c669aa0507fc3e4c6b18d51df87 100644 (file)
@@ -1158,13 +1158,16 @@ void ED_object_check_force_modifiers(Main *bmain, Scene *scene, Object *object)
 
        /* add/remove modifier as needed */
        if (!md) {
-               if (pd && (pd->shape == PFIELD_SHAPE_SURFACE) && ELEM(pd->forcefield, PFIELD_GUIDE, PFIELD_TEXTURE) == 0)
-                       if (ELEM(object->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE))
+               if (pd && (pd->shape == PFIELD_SHAPE_SURFACE) && !ELEM(pd->forcefield, 0, PFIELD_GUIDE, PFIELD_TEXTURE)) {
+                       if (ELEM(object->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE)) {
                                ED_object_modifier_add(NULL, bmain, scene, object, NULL, eModifierType_Surface);
+                       }
+               }
        }
        else {
-               if (!pd || pd->shape != PFIELD_SHAPE_SURFACE || pd->forcefield != PFIELD_FORCE)
+               if (!pd || (pd->shape != PFIELD_SHAPE_SURFACE) || ELEM(pd->forcefield, 0, PFIELD_GUIDE, PFIELD_TEXTURE)) {
                        ED_object_modifier_remove(NULL, bmain, object, md);
+               }
        }
 }