[Bf-blender-cvs] [7f1eddb5ab2] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object

Antonio Vazquez noreply at git.blender.org
Wed Jun 20 16:00:25 CEST 2018


Commit: 7f1eddb5ab2855293ece5702fa26e1caa8bc8905
Author: Antonio Vazquez
Date:   Wed Jun 20 14:30:08 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB7f1eddb5ab2855293ece5702fa26e1caa8bc8905

Merge branch 'blender2.8' into greasepencil-object

 Conflicts:
	source/blender/blenlib/BLI_rand.h
	source/blender/blenlib/intern/rand.c
	source/blender/makesrna/intern/rna_gpencil.c

===================================================================



===================================================================

diff --cc source/blender/blenlib/BLI_rand.h
index 71801478504,612151b7ea2..f7dea562393
--- a/source/blender/blenlib/BLI_rand.h
+++ b/source/blender/blenlib/BLI_rand.h
@@@ -64,13 -64,6 +64,9 @@@ void        BLI_rng_shuffle_array(struc
  /** Note that skipping is as slow as generating n numbers! */
  void        BLI_rng_skip(struct RNG *rng, int n) ATTR_NONNULL(1);
  
- /** Return a pseudo-random number N where 0.0f<=N<1.0f */
- /* !!!!! NOTE: DO NOT USE IT IN NEW CODE !!!!! */
- float   BLI_frand(void) ATTR_WARN_UNUSED_RESULT;
- 
 +/* fill an array with random numbers */
 +void    BLI_array_frand(float *ar, int count, unsigned int seed);
 +
  /** Return a pseudo-random (hash) float from an integer value */
  float	BLI_hash_frand(unsigned int seed) ATTR_WARN_UNUSED_RESULT;
  
diff --cc source/blender/blenlib/intern/rand.c
index 7c87b895907,9e56ce6b2cf..8613a0ea6dd
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@@ -265,38 -265,6 +265,18 @@@ void BLI_rng_skip(RNG *rng, int n
  
  /***/
  
- /* initialize with some non-zero seed */
- static RNG theBLI_rng = {611330372042337130};
- 
- static void ensure_rng_thread_safe(void)
- {
- 	/* TODO(sergey): Ideally we will get rid of all rng functions which
- 	 * are using global generator. But for until then we need some way to
- 	 * catch "bad" calls at runtime.
- 	 *
- 	 * NOTE: Lots of areas are not ported, so we keep check disabled for now.
- 	 */
- 	// BLI_assert(BLI_thread_is_main());
- }
- 
- float BLI_frand(void)
- {
- 	ensure_rng_thread_safe();
- 	return BLI_rng_get_float(&theBLI_rng);
- }
- 
 +/* fill an array with random numbers */
 +void BLI_array_frand(float *ar, int count, unsigned int seed)
 +{
 +	RNG rng;
 +
 +	BLI_rng_srandom(&rng, seed);
 +
 +	for (int i = 0; i < count; i++) {
 +		ar[i] = BLI_rng_get_float(&rng);
 +	}
 +}
 +
  float BLI_hash_frand(unsigned int seed)
  {
  	RNG rng;



More information about the Bf-blender-cvs mailing list