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>2019-03-30 19:06:49 +0300
committerAntonioya <blendergit@gmail.com>2019-03-30 19:06:49 +0300
commit03bd024c077d549cdef1ac686a557c742545cba8 (patch)
tree2ee005840b0e058ee4e47e050a4e88cefd3a0a15 /source
parent4b6a4b5bc25bce10367dffadf7718e373f81f299 (diff)
GPencil: Uses same random seed for render in Noise modifier
As the random seed was calculated in the copy data, the render could be a little different. Now, the data is saved in the original data.
Diffstat (limited to 'source')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
index 9bfbe20343e..97ac6fa56cd 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
@@ -101,11 +101,16 @@ static void deformStroke(
const int def_nr = defgroup_name_index(ob, mmd->vgname);
const float unit_v3[3] = { 1.0f, 1.0f, 1.0f };
- /* Random generator, only init once. */
- if (mmd->rng == NULL) {
+ Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+ GpencilModifierData *md_eval = BKE_gpencil_modifiers_findByName(object_eval, md->name);
+ NoiseGpencilModifierData *mmd_eval = (NoiseGpencilModifierData *)md_eval;
+
+ /* Random generator, only init once. (it uses eval to get same value in render) */
+ if (mmd_eval->rng == NULL) {
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
rng_seed ^= POINTER_AS_UINT(mmd);
- mmd->rng = BLI_rng_new(rng_seed);
+ mmd_eval->rng = BLI_rng_new(rng_seed);
+ mmd->rng = mmd_eval->rng;
}
if (!is_stroke_affected_by_modifier(