- Bugfix to make dupli particles for hair respect render amount.
- Allow Random and Even distribution settings to be set after hair is made editable, since they also affect children.
This commit is contained in:
parent
76cc0a4c57
commit
f62477fe27
|
@ -34,6 +34,8 @@
|
|||
#ifndef BKE_ANIM_H
|
||||
#define BKE_ANIM_H
|
||||
|
||||
#define MAX_DUPLI_RECUR 4
|
||||
|
||||
struct Path;
|
||||
struct Object;
|
||||
struct PartEff;
|
||||
|
|
|
@ -75,8 +75,6 @@
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#define MAX_DUPLI_RECUR 4
|
||||
|
||||
static void object_duplilist_recursive(ID *id, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level);
|
||||
|
||||
void free_path(Path *path)
|
||||
|
|
|
@ -4090,6 +4090,39 @@ static int allow_render_dupli_instance(Render *re, DupliObject *dob, Object *obd
|
|||
!(re->r.mode & R_RADIO));
|
||||
}
|
||||
|
||||
static void dupli_render_particle_set(Render *re, Object *ob, int level, int enable)
|
||||
{
|
||||
/* ugly function, but we need to set particle systems to their render
|
||||
* settings before calling object_duplilist, to get render level duplis */
|
||||
Group *group;
|
||||
GroupObject *go;
|
||||
ParticleSystem *psys;
|
||||
|
||||
if(level >= MAX_DUPLI_RECUR)
|
||||
return;
|
||||
|
||||
if(ob->transflag & OB_DUPLIPARTS) {
|
||||
DerivedMesh *dm;
|
||||
|
||||
for(psys=ob->particlesystem.first; psys; psys=psys->next)
|
||||
if(enable)
|
||||
psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy);
|
||||
else
|
||||
psys_render_restore(ob, psys);
|
||||
|
||||
if(enable) {
|
||||
dm = mesh_create_derived_render(ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
|
||||
dm->release(dm);
|
||||
}
|
||||
}
|
||||
|
||||
if(ob->dup_group==NULL) return;
|
||||
group= ob->dup_group;
|
||||
|
||||
for(go= group->gobject.first; go; go= go->next)
|
||||
dupli_render_particle_set(re, go->ob, level+1, enable);
|
||||
}
|
||||
|
||||
static void database_init_objects(Render *re, unsigned int lay, int nolamps, int onlyselected, Object *actob, int only_verts)
|
||||
{
|
||||
Base *base;
|
||||
|
@ -4125,7 +4158,10 @@ static void database_init_objects(Render *re, unsigned int lay, int nolamps, int
|
|||
DupliObject *dob;
|
||||
ListBase *lb;
|
||||
|
||||
dupli_render_particle_set(re, ob, 0, 1);
|
||||
lb= object_duplilist(sce, ob);
|
||||
dupli_render_particle_set(re, ob, 0, 0);
|
||||
|
||||
for(dob= lb->first; dob; dob= dob->next) {
|
||||
Object *obd= dob->ob;
|
||||
|
||||
|
|
|
@ -4280,7 +4280,7 @@ static void object_panel_particle_system(Object *ob)
|
|||
short butx=0, buty=160, butw=150, buth=20;
|
||||
char str[30];
|
||||
static short partact;
|
||||
short totpart;
|
||||
short totpart, lock;
|
||||
|
||||
block= uiNewBlock(&curarea->uiblocks, "object_panel_particle_system", UI_EMBOSS, UI_HELV, curarea->win);
|
||||
if(uiNewPanel(curarea, block, "Particle System", "Particle", 0, 0, 318, 204)==0) return;
|
||||
|
@ -4340,9 +4340,9 @@ static void object_panel_particle_system(Object *ob)
|
|||
uiBlockEndAlign(block);
|
||||
}
|
||||
|
||||
if(psys->flag & PSYS_EDITED || psys->flag & PSYS_PROTECT_CACHE) {
|
||||
lock= (psys->flag & PSYS_EDITED || psys->flag & PSYS_PROTECT_CACHE);
|
||||
if(lock)
|
||||
uiSetButLock(1, "Hair is edited or cache is protected!");
|
||||
}
|
||||
|
||||
uiDefButS(block, MENU, B_PARTTYPE, "Type%t|Hair%x2|Reactor%x1|Emitter%x0", 210,buty,100,buth, &part->type, 14.0, 0.0, 0, 0, "Type of particle system");
|
||||
|
||||
|
@ -4388,15 +4388,20 @@ static void object_panel_particle_system(Object *ob)
|
|||
|
||||
uiDefBut(block, LABEL, 0, "Emit From:", butx,buty,butw,buth, NULL, 0.0, 0, 0, 0, "");
|
||||
uiBlockBeginAlign(block);
|
||||
|
||||
if(lock) uiClearButLock();
|
||||
uiDefButBitI(block, TOG, PART_TRAND, B_PART_DISTR, "Random", butx,(buty-=buth),butw/2,buth, &part->flag, 0, 0, 0, 0, "Emit in random order of elements");
|
||||
|
||||
if(lock) uiSetButLock(1, "Hair is edited or cache is protected!");
|
||||
|
||||
if(part->type==PART_REACTOR)
|
||||
uiDefButS(block, MENU, B_PART_DISTR, "Particle %x3|Volume %x2|Faces %x1|Verts %x0", butx+butw/2,buty,butw/2,buth, &part->from, 14.0, 0.0, 0, 0, "Where to emit particles from");
|
||||
else
|
||||
uiDefButS(block, MENU, B_PART_DISTR, "Volume %x2|Faces %x1|Verts%x0", butx+butw/2,buty,butw/2,buth, &part->from, 14.0, 0.0, 0, 0, "Where to emit particles from");
|
||||
|
||||
if(ELEM(part->from,PART_FROM_FACE,PART_FROM_VOLUME)) {
|
||||
if(lock) uiClearButLock();
|
||||
uiDefButBitI(block, TOG, PART_EDISTR, B_PART_DISTR, "Even",butx,(buty-=buth),butw/2,buth, &part->flag, 0, 0, 0, 0, "Use even distribution from faces based on face areas or edge lengths");
|
||||
if(lock) uiSetButLock(1, "Hair is edited or cache is protected!");
|
||||
uiDefButS(block, MENU, B_PART_DISTR, "Distribution %t|Grid%x2|Random%x1|Jittered%x0", butx+butw/2,buty,butw/2,buth, &part->distr, 14.0, 0.0, 0, 0, "How to distribute particles on selected element");
|
||||
if(part->distr==PART_DISTR_JIT) {
|
||||
uiDefButF(block, NUM, B_PART_DISTR, "Amount:", butx,(buty-=buth),butw,buth, &part->jitfac, 0, 2.0, 1, 1, "Amount of jitter applied to the sampling");
|
||||
|
|
Loading…
Reference in New Issue