[Bf-blender-cvs] [9d6a175756c] blender2.8: Merge branch 'master' into blender2.8

Campbell Barton noreply at git.blender.org
Thu Apr 19 12:54:57 CEST 2018


Commit: 9d6a175756c8db989fc95bae47bbd1e77ff07980
Author: Campbell Barton
Date:   Thu Apr 19 12:53:21 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB9d6a175756c8db989fc95bae47bbd1e77ff07980

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/editors/interface/interface_icons.c
index b945965ce6a,ed57412c05c..a33dcfc5ab6
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@@ -874,11 -849,8 +874,11 @@@ void ui_icon_ensure_deferred(const bCon
  			switch (di->type) {
  				case ICON_TYPE_PREVIEW:
  				{
- 					ID *id = (icon->type != 0) ? icon->obj : NULL;
+ 					ID *id = (icon->id_type != 0) ? icon->obj : NULL;
  					PreviewImage *prv = id ? BKE_previewimg_id_ensure(id) : icon->obj;
 +					/* Using jobs for screen previews crashes due to offscreen rendering.
 +					 * XXX would be nicer if PreviewImage could store if it supports jobs */
 +					const bool use_jobs = !id || (GS(id->name) != ID_SCR);
  
  					if (prv) {
  						const int size = big ? ICON_SIZE_PREVIEW : ICON_SIZE_ICON;
@@@ -1232,12 -1119,12 +1232,12 @@@ static void icon_draw_size
  #endif
  		if (!iimg->rect) return;  /* something has gone wrong! */
  
 -		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 +		glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
  		icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, is_preview);
 -		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 +		glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
  	}
  	else if (di->type == ICON_TYPE_PREVIEW) {
- 		PreviewImage *pi = (icon->type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) : icon->obj;
+ 		PreviewImage *pi = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) : icon->obj;
  
  		if (pi) {
  			/* no create icon on this level in code */
diff --cc source/blender/modifiers/intern/MOD_particleinstance.c
index 99433ae3725,f0b80cda447..d7cb7fd8d94
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@@ -50,10 -52,9 +52,8 @@@
  #include "BKE_particle.h"
  #include "BKE_pointcache.h"
  
 -#include "depsgraph_private.h"
  #include "DEG_depsgraph_build.h"
  
- #include "MOD_modifiertypes.h"
- 
  static void initData(ModifierData *md)
  {
  	ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *) md;
@@@ -154,16 -177,48 +162,48 @@@ static bool particle_skip(ParticleInsta
  	}
  
  	if (pa) {
- 		if (pa->alive == PARS_UNBORN && (pimd->flag & eParticleInstanceFlag_Unborn) == 0) return 1;
- 		if (pa->alive == PARS_ALIVE && (pimd->flag & eParticleInstanceFlag_Alive) == 0) return 1;
- 		if (pa->alive == PARS_DEAD && (pimd->flag & eParticleInstanceFlag_Dead) == 0) return 1;
+ 		if (pa->alive == PARS_UNBORN && (pimd->flag & eParticleInstanceFlag_Unborn) == 0) return true;
+ 		if (pa->alive == PARS_ALIVE && (pimd->flag & eParticleInstanceFlag_Alive) == 0) return true;
+ 		if (pa->alive == PARS_DEAD && (pimd->flag & eParticleInstanceFlag_Dead) == 0) return true;
  	}
  
- 	return 0;
+ 	if (pimd->particle_amount == 1.0f) {
+ 		/* Early output, all particles are to be instanced. */
+ 		return false;
+ 	}
+ 
+ 	/* Randomly skip particles based on desired amount of visible particles. */
+ 
+ 	totpart = psys->totpart + psys->totchild;
+ 
+ 	/* TODO make randomization optional? */
+ 	randp = (int)(psys_frand(psys, 3578 + p) * totpart) % totpart;
+ 
+ 	minp = (int)(totpart * pimd->particle_offset) % (totpart+1);
+ 	maxp = (int)(totpart * (pimd->particle_offset + pimd->particle_amount)) % (totpart+1);
+ 
+ 	if (maxp > minp) {
+ 		return randp < minp || randp >= maxp;
+ 	}
+ 	else if (maxp < minp) {
+ 		return randp < minp && randp >= maxp;
+ 	}
+ 	else {
+ 		return true;
+ 	}
+ 
+ 	return false;
+ }
+ 
+ static void store_float_in_vcol(MLoopCol *vcol, float float_value)
+ {
+ 	const uchar value = FTOCHAR(float_value);
+ 	vcol->r = vcol->g = vcol->b = value;
+ 	vcol->a = 1.0f;
  }
  
 -static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 -                                  DerivedMesh *derivedData,
 +static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
 +                                  Object *ob, DerivedMesh *derivedData,
                                    ModifierApplyFlag UNUSED(flag))
  {
  	DerivedMesh *dm = derivedData, *result;
@@@ -197,18 -256,17 +241,18 @@@
  		return derivedData;
  	}
  
- 	if (pimd->flag & eParticleInstanceFlag_Parents)
- 		totpart += psys->totpart;
- 	if (pimd->flag & eParticleInstanceFlag_Children) {
- 		if (totpart == 0)
- 			first_particle = psys->totpart;
- 		totpart += psys->totchild;
- 	}
+ 	part_start = use_parents ? 0 : psys->totpart;
+ 
+ 	part_end = 0;
+ 	if (use_parents)
+ 		part_end += psys->totpart;
+ 	if (use_children)
+ 		part_end += psys->totchild;
  
- 	if (totpart == 0)
+ 	if (part_end == 0)
  		return derivedData;
  
 +	sim.depsgraph = depsgraph;
  	sim.scene = md->scene;
  	sim.ob = pimd->ob;
  	sim.psys = psys;
@@@ -437,9 -554,10 +540,9 @@@ ModifierTypeInfo modifierType_ParticleI
  	/* applyModifier */     applyModifier,
  	/* applyModifierEM */   NULL,
  	/* initData */          initData,
- 	/* requiredDataMask */  NULL,
+ 	/* requiredDataMask */  requiredDataMask,
  	/* freeData */          NULL,
  	/* isDisabled */        isDisabled,
 -	/* updateDepgraph */    updateDepgraph,
  	/* updateDepsgraph */   updateDepsgraph,
  	/* dependsOnTime */     NULL,
  	/* dependsOnNormals */  NULL,



More information about the Bf-blender-cvs mailing list