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
diff options
context:
space:
mode:
authorBassam Kurdali <bassam@urchn.org>2014-02-10 06:23:01 +0400
committerJoshua Leung <aligorith@gmail.com>2014-02-10 07:21:12 +0400
commit5cf987cff8276625735c789f18c9f77c507b70b0 (patch)
treef36aaf8424ffa3c64773918ae4e10bb2f017509f
parent3432f34d059381546df8b202263a243f0656df38 (diff)
Patch T38282/D295: Add a time offset to the FCurve Noise Modifier
FCurve Noise Modifer now has an extra float property which offsets the noise in time. This is useful for creating follow through in procedurally animated noise. For example, if you've used a noise modifier on a parent bone to add additional movement, a quick and easy way to add overlapping motion is to create copies of that modifier on its children, and then offset the time those curves play at. See this in action at: http://youtu.be/Ph6fk_z_k3k Reviewed By: Joshua Leung
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c3
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c1
-rw-r--r--source/blender/makesdna/DNA_anim_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c5
4 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 6c98808f087..bcbc5571077 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -785,6 +785,7 @@ static void fcm_noise_new_data(void *mdata)
data->size = 1.0f;
data->strength = 1.0f;
data->phase = 1.0f;
+ data->offset = 0.0f;
data->depth = 0;
data->modification = FCM_NOISE_MODIF_REPLACE;
}
@@ -798,7 +799,7 @@ static void fcm_noise_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cvalu
* - 0.1 is passed as the 'z' value, otherwise evaluation fails for size = phase = 1
* with evaltime being an integer (which happens when evaluating on frame by frame basis)
*/
- noise = BLI_turbulence(data->size, evaltime, data->phase, 0.1f, data->depth);
+ noise = BLI_turbulence(data->size, evaltime - data->offset, data->phase, 0.1f, data->depth);
/* combine the noise with existing motion data */
switch (data->modification) {
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 5ceca478b47..75ea133176c 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -320,6 +320,7 @@ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short
col = uiLayoutColumn(split, FALSE);
uiItemR(col, &ptr, "scale", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE);
+ uiItemR(col, &ptr, "offset", 0, NULL, ICON_NONE);
/* col 2 */
col = uiLayoutColumn(split, FALSE);
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 6f5c9254a38..8c04c41650d 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -228,7 +228,7 @@ typedef struct FMod_Noise {
float size;
float strength;
float phase;
- float pad;
+ float offset;
short depth;
short modification;
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 071309d340f..3f7a00d33b4 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -1174,6 +1174,11 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "phase");
RNA_def_property_ui_text(prop, "Phase", "A random seed for the noise effect");
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(prop, "Offset", "Time offset for the noise effect");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "depth");