From bcf524328ff28acc02d57b70a8e55b10b8460fe5 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Thu, 29 Apr 2021 17:01:12 +0200 Subject: Fix T87297: Gpencil - Disable Frames and Start delay when use Factor After talking with the GP team, we agree in disable these options when the factor is used in Build modifier. --- .../blender/gpencil_modifiers/intern/MOD_gpencilbuild.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'source/blender/gpencil_modifiers') diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c index d7fc08e38f3..d9f0fc9bddd 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c @@ -455,8 +455,10 @@ static void generate_geometry( /* Compute start and end frames for the animation effect * By default, the upper bound is given by the "maximum length" setting */ - float start_frame = gpf->framenum + mmd->start_delay; - float end_frame = start_frame + mmd->length; + float start_frame = is_percentage ? gpf->framenum : gpf->framenum + mmd->start_delay; + /* When use percentage don't need a limit in the upper bound, so use a maximum value for the last + * frame. */ + float end_frame = is_percentage ? start_frame + 9999 : start_frame + mmd->length; if (gpf->next) { /* Use the next frame or upper bound as end frame, whichever is lower/closer */ @@ -547,6 +549,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, &ob_ptr); int mode = RNA_enum_get(ptr, "mode"); + const bool use_percentage = RNA_boolean_get(ptr, "use_percentage"); uiLayoutSetPropSep(layout, true); @@ -558,8 +561,12 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) uiItemS(layout); uiItemR(layout, ptr, "transition", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "start_delay", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "length", 0, IFACE_("Frames"), ICON_NONE); + row = uiLayoutRow(layout, true); + uiLayoutSetActive(row, !use_percentage); + uiItemR(row, ptr, "start_delay", 0, NULL, ICON_NONE); + row = uiLayoutRow(layout, true); + uiLayoutSetActive(row, !use_percentage); + uiItemR(row, ptr, "length", 0, IFACE_("Frames"), ICON_NONE); uiItemS(layout); @@ -567,7 +574,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) uiLayoutSetPropDecorate(row, false); uiItemR(row, ptr, "use_percentage", 0, "", ICON_NONE); sub = uiLayoutRow(row, true); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_percentage")); + uiLayoutSetActive(sub, use_percentage); uiItemR(sub, ptr, "percentage_factor", 0, "", ICON_NONE); uiItemDecoratorR(row, ptr, "percentage_factor", 0); -- cgit v1.2.3