[Bf-blender-cvs] [bcf524328ff] master: Fix T87297: Gpencil - Disable Frames and Start delay when use Factor

Antonio Vazquez noreply at git.blender.org
Thu Apr 29 17:01:43 CEST 2021


Commit: bcf524328ff28acc02d57b70a8e55b10b8460fe5
Author: Antonio Vazquez
Date:   Thu Apr 29 17:01:12 2021 +0200
Branches: master
https://developer.blender.org/rBbcf524328ff28acc02d57b70a8e55b10b8460fe5

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.

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

M	source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c

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

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);



More information about the Bf-blender-cvs mailing list