GPencil: New Percentage parameter in Build modifier
Add a factor to determine the percentage affected. This parameter is used to hide part of the stroke and to have a full control of how the points are displayed and not linked to current scene frame. {F8526502} {F8526511} Reviewed By: mendio, pepeland Differential Revision: https://developer.blender.org/D7682
This commit is contained in:
parent
e82d8c60f0
commit
a1593fa05b
|
@ -2182,6 +2182,11 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
|
|||
sub.prop(md, "frame_start", text="Start")
|
||||
sub.prop(md, "frame_end", text="End")
|
||||
|
||||
col.prop(md, "use_percentage")
|
||||
sub = col.column(align=True)
|
||||
sub.active = md.use_percentage
|
||||
sub.prop(md, "percentage_factor")
|
||||
|
||||
layout.label(text="Influence Filters:")
|
||||
|
||||
split = layout.split(factor=0.25)
|
||||
|
|
|
@ -406,6 +406,7 @@ static void generate_geometry(GpencilModifierData *md,
|
|||
{
|
||||
BuildGpencilModifierData *mmd = (BuildGpencilModifierData *)md;
|
||||
const bool reverse = (mmd->transition != GP_BUILD_TRANSITION_GROW);
|
||||
const bool is_percentage = (mmd->flag & GP_BUILD_PERCENTAGE);
|
||||
|
||||
const float ctime = DEG_get_ctime(depsgraph);
|
||||
|
||||
|
@ -500,7 +501,8 @@ static void generate_geometry(GpencilModifierData *md,
|
|||
}
|
||||
|
||||
/* Determine how far along we are between the keyframes */
|
||||
float fac = (ctime - start_frame) / (end_frame - start_frame);
|
||||
float fac = is_percentage ? mmd->percentage_fac :
|
||||
(ctime - start_frame) / (end_frame - start_frame);
|
||||
|
||||
/* Time management mode */
|
||||
switch (mmd->mode) {
|
||||
|
|
|
@ -370,6 +370,9 @@ typedef struct BuildGpencilModifierData {
|
|||
* For the "Concurrent" mode, when should "shorter" strips start/end.
|
||||
*/
|
||||
short time_alignment;
|
||||
/** Factor of the stroke (used instead of frame evaluation. */
|
||||
float percentage_fac;
|
||||
char _pad[4];
|
||||
} BuildGpencilModifierData;
|
||||
|
||||
typedef enum eBuildGpencil_Mode {
|
||||
|
@ -405,6 +408,9 @@ typedef enum eBuildGpencil_Flag {
|
|||
/* Restrict modifier to only operating between the nominated frames */
|
||||
GP_BUILD_RESTRICT_TIME = (1 << 2),
|
||||
GP_BUILD_INVERT_LAYERPASS = (1 << 3),
|
||||
|
||||
/* Use a percentage instead of frame number to evaluate strokes. */
|
||||
GP_BUILD_PERCENTAGE = (1 << 4),
|
||||
} eBuildGpencil_Flag;
|
||||
|
||||
typedef struct LatticeGpencilModifierData {
|
||||
|
|
|
@ -1671,6 +1671,20 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
|
|||
prop, "Restrict Frame Range", "Only modify strokes during the specified frame range");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
/* Use percentage */
|
||||
prop = RNA_def_property(srna, "use_percentage", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_PERCENTAGE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Restrict Visible Points", "Use a percentage factor to determine the visible points");
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
/* Percentage factor. */
|
||||
prop = RNA_def_property(srna, "percentage_factor", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "percentage_fac");
|
||||
RNA_def_property_ui_text(prop, "Factor", "Defines how much of the stroke is visible");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "start_frame");
|
||||
RNA_def_property_ui_text(
|
||||
|
|
Loading…
Reference in New Issue