diff options
author | Jacques Lucke <jacques@blender.org> | 2021-06-14 13:44:13 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-06-14 13:44:13 +0300 |
commit | dddcf1e9bbf4a6d1f4ff03eaf0cb7e9228b18ec5 (patch) | |
tree | c20defa7efd54c933d20a296abefe567909bb6c0 /source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c | |
parent | 3b162b7c185d089e93d892169a458d552196b7b6 (diff) | |
parent | c9dc55301cd7903b7ef7c045d337ada29aa809a1 (diff) |
Merge branch 'master' into temp-compact-node-prototypetemp-compact-node-prototype
Diffstat (limited to 'source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c index 87d677a5c8a..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,16 +561,22 @@ 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); row = uiLayoutRowWithHeading(layout, true, IFACE_("Use Factor")); + 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); /* Check for incompatible time modifier. */ Object *ob = ob_ptr.data; |