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
This commit is contained in:
parent
3432f34d05
commit
5cf987cff8
Notes:
blender-bot
2023-02-14 11:19:17 +01:00
Referenced by issue #38282, Need delay option for noise modifier
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -228,7 +228,7 @@ typedef struct FMod_Noise {
|
|||
float size;
|
||||
float strength;
|
||||
float phase;
|
||||
float pad;
|
||||
float offset;
|
||||
|
||||
short depth;
|
||||
short modification;
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue