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
path: root/source
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-10-23 17:44:31 +0300
committerAntonioya <blendergit@gmail.com>2018-10-23 17:47:09 +0300
commit3e9405e26dfb02f1aa05c530cce3ca6f9d1c84c7 (patch)
tree7834aa8576e998d4eeeac93d9ef235e90a7f86d4 /source
parentca003d0f5cfc1f2cd511f33e045eac122c8aa4da (diff)
GP: Add new frame scale parameter to Time modifier
This new parameter allows to increase or decrease the animation speed to break animation patterns when reuse data blocks.
Diffstat (limited to 'source')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c7
-rw-r--r--source/blender/makesdna/DNA_gpencil_modifier_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_gpencil_modifier.c6
3 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
index 521a398ee29..c72a20cc0e9 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
@@ -55,6 +55,7 @@ static void initData(GpencilModifierData *md)
TimeGpencilModifierData *gpmd = (TimeGpencilModifierData *)md;
gpmd->layername[0] = '\0';
gpmd->offset = 1;
+ gpmd->frame_scale = 1.0f;
gpmd->flag |= GP_TIME_KEEP_LOOP;
}
@@ -88,6 +89,12 @@ static int remapTime(
}
}
+ /* apply frame scale */
+ cfra *= mmd->frame_scale;
+ if (cfra > efra) {
+ cfra = sfra + (cfra - ((cfra / efra) * efra));
+ }
+
if (mmd->flag & GP_TIME_KEEP_LOOP) {
/* if the sum of the cfra is out scene frame range, recalc */
if (cfra + mmd->offset < sfra) {
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index fd1a4d2a2b7..5d743350827 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -145,6 +145,8 @@ typedef struct TimeGpencilModifierData {
char layername[64]; /* layer name */
int flag; /* flags */
int offset;
+ float frame_scale; /* animation scale */
+ char pad[4];
} TimeGpencilModifierData;
typedef enum eTimeGpencil_Flag {
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index e9ca90e1300..bc0db0ddaea 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -749,6 +749,12 @@ static void rna_def_modifier_gpenciltime(BlenderRNA *brna)
"Number of frames to offset original keyframe number");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ prop = RNA_def_property(srna, "frame_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frame_scale");
+ RNA_def_property_range(prop, 0.001f, 100.0f);
+ RNA_def_property_ui_text(prop, "Frame Scale", "Evaluation time in seconds");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
prop = RNA_def_property(srna, "use_keep_loop", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TIME_KEEP_LOOP);
RNA_def_property_ui_text(prop, "Keep Loop",