Fix T59389: Solidify Modifier does not work with 'beveled' Curve objects.
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 27 Dec 2018 14:01:48 +0000 (15:01 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 27 Dec 2018 14:03:06 +0000 (15:03 +0100)
Curve modifier eval code was actually doing nothing to ensure we passed
mesh with valid normals when required by the modifier.

This is a bit basic, rough code, but think it should cover all cases,
time will say...

source/blender/blenkernel/intern/displist.c

index c985de9..c5dadb1 100644 (file)
@@ -965,6 +965,19 @@ static void curve_calc_modifiers_post(
                if (!modifier_isEnabled(scene, md, required_mode))
                        continue;
 
+               /* If we need normals, no choice, have to convert to mesh now. */
+               if (mti->dependsOnNormals != NULL && mti->dependsOnNormals(md) && modified == NULL) {
+                       if (vertCos != NULL) {
+                               displist_apply_allverts(dispbase, vertCos);
+                       }
+
+                       if (ELEM(ob->type, OB_CURVE, OB_FONT) && (cu->flag & CU_DEFORM_FILL)) {
+                               curve_to_filledpoly(cu, nurb, dispbase);
+                       }
+
+                       modified = BKE_mesh_new_nomain_from_curve_displist(ob, dispbase);
+               }
+
                if (mti->type == eModifierTypeType_OnlyDeform ||
                    (mti->type == eModifierTypeType_DeformOrConstruct && !modified))
                {
@@ -972,6 +985,9 @@ static void curve_calc_modifiers_post(
                                if (!vertCos) {
                                        vertCos = BKE_mesh_vertexCos_get(modified, &totvert);
                                }
+                               if (mti->dependsOnNormals != NULL && mti->dependsOnNormals(md)) {
+                                       BKE_mesh_ensure_normals(modified);
+                               }
                                mti->deformVerts(md, &mectx_deform, modified, vertCos, totvert);
                        }
                        else {
@@ -1021,6 +1037,9 @@ static void curve_calc_modifiers_post(
                                vertCos = NULL;
                        }
 
+                       if (mti->dependsOnNormals != NULL && mti->dependsOnNormals(md)) {
+                               BKE_mesh_ensure_normals(modified);
+                       }
                        mesh_applied = mti->applyModifier(md, &mectx_apply, modified);
 
                        if (mesh_applied) {