Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2021-04-20 14:46:31 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-04-21 12:02:45 +0300
commit1a6b51e17502a221bc9813301c10cb9b3c4883f7 (patch)
tree3f6b026bbe3a4e797165cbe4d34fdf45b7d9943a /source/blender/modifiers/intern/MOD_ui_common.c
parenta6cd20716e61afe6116aa2e98ef0c3465e142659 (diff)
Curve modifiers: Disable 'Apply on Spline' option if not available
Some curve modifiers (namely Hook, SoftBody and MeshDeform) can only work on pre-tesselated spline points. Before the modifier UI refactor in rB9b099c86123f, users would get the 'Apply on Spline' option, but disabled and with a tip explaining why this cant be changed. After rB9b099c86123f though, this button was always enabled [but disfunctional] leaving the user without an explanation why this has no effect. Now restore this functionality since it is quite important information. Additionally, this button now appears to be ON in these cases which makes more sense from the user perspective (so it does not represent the actual setting on the modifier -- this would internally be switched ON in the modifier calculation anyways though, see 'curve_get_tessellate_point') Differential Revision: https://developer.blender.org/D11029
Diffstat (limited to 'source/blender/modifiers/intern/MOD_ui_common.c')
-rw-r--r--source/blender/modifiers/intern/MOD_ui_common.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c
index fd37ad18b4c..0be5c164089 100644
--- a/source/blender/modifiers/intern/MOD_ui_common.c
+++ b/source/blender/modifiers/intern/MOD_ui_common.c
@@ -344,7 +344,32 @@ static void modifier_panel_header(const bContext *C, Panel *panel)
}
} /* Tessellation point for curve-typed objects. */
else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- if (mti->type != eModifierTypeType_Constructive) {
+ /* Some modifiers can work with pre-tessellated curves only. */
+ if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
+ /* Add button (appearing to be ON) and add tip why this cant be changed. */
+ sub = uiLayoutRow(row, true);
+ uiBlock *block = uiLayoutGetBlock(sub);
+ static int apply_on_spline_always_on_hack = eModifierMode_ApplyOnSpline;
+ 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_on_hack,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ TIP_("Apply on Spline"));
+ UI_but_disable(
+ but, TIP_("This modifier can only deform control points, not the filled curve/surface"));
+ buttons_number++;
+ }
+ else if (mti->type != eModifierTypeType_Constructive) {
/* Constructive modifiers tessellates curve before applying. */
uiItemR(row, ptr, "use_apply_on_spline", 0, "", ICON_NONE);
buttons_number++;