[Bf-blender-cvs] [ffc0db19948] blender-v3.4-release: Fix Curves Smooth modifier appears to be able to act on control points

Philipp Oeser noreply at git.blender.org
Mon Nov 7 12:27:00 CET 2022


Commit: ffc0db199482ecde2f87f3e344475b414bf60e4c
Author: Philipp Oeser
Date:   Fri Nov 4 12:45:38 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBffc0db199482ecde2f87f3e344475b414bf60e4c

Fix Curves Smooth modifier appears to be able to act on control points

This is not the case though, the modifier act explicitly on mesh edges,
if no tesselated mesh is provided, it would simpy early out and do
nothing.

Now always disable the "Apply on Spline" option with a tip that this
modifier can only smooth the tesselated curve (not the underlying curve
control points). Similar to rB1a6b51e17502.

Fixes T102060.

Maniphest Tasks: T102060

Differential Revision: https://developer.blender.org/D16386

===================================================================

M	source/blender/blenkernel/intern/displist.cc
M	source/blender/modifiers/intern/MOD_ui_common.c

===================================================================

diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc
index 2b4bd3eb8f6..f8117a89198 100644
--- a/source/blender/blenkernel/intern/displist.cc
+++ b/source/blender/blenkernel/intern/displist.cc
@@ -532,6 +532,11 @@ static ModifierData *curve_get_tessellate_point(const Scene *scene,
       return pretessellatePoint;
     }
 
+    if (md->type == eModifierType_Smooth) {
+      /* Smooth modifier works with mesh edges explicitly (so needs tesselation, thus cannnot work on control points). */
+      md->mode &= ~eModifierMode_ApplyOnSpline;
+      return pretessellatePoint;
+    }
     if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
       pretessellatePoint = md;
 
diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c
index c027cae8cdb..e882435077a 100644
--- a/source/blender/modifiers/intern/MOD_ui_common.c
+++ b/source/blender/modifiers/intern/MOD_ui_common.c
@@ -326,8 +326,33 @@ static void modifier_panel_header(const bContext *C, Panel *panel)
     }
   } /* Tessellation point for curve-typed objects. */
   else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF, OB_FONT)) {
+    /* Smooth modifier can work with tessellated curves only (works on mesh edges explicitly). */
+    if (md->type == eModifierType_Smooth) {
+      /* Add button (appearing to be OFF) and add tip why this can't be changed. */
+      sub = uiLayoutRow(row, true);
+      uiBlock *block = uiLayoutGetBlock(sub);
+      static int apply_on_spline_always_off_hack = 0;
+      uiBut *but = uiDefIconButBitI(block,
+                                    UI_BTYPE_TOGGLE,
+                                    eModifierMode_ApplyOnSpline,
+                                    0,
+                                    ICON_SURFACE_DATA,
+                                    0,
+                                    0,
+                                    UI_UNIT_X - 2,
+                                    UI_UNIT_Y,
+                                    &apply_on_spline_always_off_hack,
+                                    0.0,
+                                    0.0,
+                                    0.0,
+                                    0.0,
+                                    TIP_("Apply on Spline"));
+      UI_but_disable(
+          but, TIP_("This modifier can only deform filled curve/surface, not the control points"));
+      buttons_number++;
+    }
     /* Some modifiers can work with pre-tessellated curves only. */
-    if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
+    else if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
       /* Add button (appearing to be ON) and add tip why this can't be changed. */
       sub = uiLayoutRow(row, true);
       uiBlock *block = uiLayoutGetBlock(sub);



More information about the Bf-blender-cvs mailing list