Merge with trunk/2.5 at r25563
Most likely will not compile for others, I'd appreciate any build errors and missing files reports (I can never seem to get everything committed and all the build systems working without help). Porting over the sculpt/multires tools was a breeze, thanks goes to brecht for a design that didn't exclude ngons and was easy to port. Note that I've not tested externally-backed multires file support yet. Also, I still need to write version patch code for some cases. Some notes: * Like trunk, topological changes don't update multires right, so e.g. subdivide will duplicate multires data on the new faces, instead of subdividing it. * If you set the debug value (ctrl-alt-d) to 1 it'll turn on my experiments in speeding up sculpting on higher-res multires meshes (but note it makes partial redraw not completely accurate). * There's a bug where you have to go through editmode to get out of sculpt mode, not sure if I inherited or created this myself.
This commit is contained in:
@@ -791,7 +791,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
|
||||
totface= dm->getNumTessFaces(dm);
|
||||
totorigface= me->totface;
|
||||
|
||||
if(totface == 0 || totorigface == 0 || origindex == NULL)
|
||||
if(totface == 0 || totorigface == 0)
|
||||
return tot;
|
||||
|
||||
facearea= MEM_callocN(sizeof(float)*totorigface, "SimplifyFaceArea");
|
||||
@@ -808,14 +808,14 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
|
||||
|
||||
/* compute number of children per original face */
|
||||
for(a=0; a<tot; a++) {
|
||||
b= origindex[ctx->index[a]];
|
||||
b= (origindex)? origindex[ctx->index[a]]: ctx->index[a];
|
||||
if(b != -1)
|
||||
elems[b].totchild++;
|
||||
}
|
||||
|
||||
/* compute areas and centers of original faces */
|
||||
for(mf=mface, a=0; a<totface; a++, mf++) {
|
||||
b= origindex[a];
|
||||
b= (origindex)? origindex[a]: a;
|
||||
|
||||
if(b != -1) {
|
||||
VECCOPY(co1, mvert[mf->v1].co);
|
||||
@@ -911,7 +911,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
|
||||
|
||||
skipped= 0;
|
||||
for(a=0, newtot=0; a<tot; a++) {
|
||||
b= origindex[ctx->index[a]];
|
||||
b= (origindex)? origindex[ctx->index[a]]: ctx->index[a];
|
||||
if(b != -1) {
|
||||
if(elems[b].curchild++ < ceil(elems[b].lambda*elems[b].totchild)) {
|
||||
ctx->index[newtot]= ctx->index[a];
|
||||
@@ -944,7 +944,7 @@ int psys_render_simplify_params(ParticleSystem *psys, ChildParticle *cpa, float
|
||||
if(!data->dosimplify)
|
||||
return 0;
|
||||
|
||||
b= data->origindex[cpa->num];
|
||||
b= (data->origindex)? data->origindex[cpa->num]: cpa->num;
|
||||
if(b == -1)
|
||||
return 0;
|
||||
|
||||
@@ -2333,6 +2333,7 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
|
||||
ctx->totparent= totparent;
|
||||
ctx->parent_pass= 0;
|
||||
ctx->cfra= cfra;
|
||||
ctx->editupdate= editupdate;
|
||||
|
||||
psys->lattice = psys_get_lattice(&ctx->sim);
|
||||
|
||||
@@ -2444,7 +2445,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
|
||||
mul_m4_v3(ob->obmat,cpa_1st);
|
||||
}
|
||||
|
||||
pa = psys->particles + cpa->parent;
|
||||
pa = psys->particles + cpa->pa[0];
|
||||
|
||||
psys_mat_hair_to_global(ob, ctx->sim.psmd->dm, psys->part->from, pa, hairmat);
|
||||
|
||||
@@ -2616,6 +2617,9 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
|
||||
get_strand_normal(ctx->ma, ornor, cur_length, (state-1)->vel);
|
||||
}
|
||||
|
||||
if(k == ctx->steps)
|
||||
VECSUB(state->vel,state->co,(state-1)->co);
|
||||
|
||||
/* check if path needs to be cut before actual end of data points */
|
||||
if(k){
|
||||
VECSUB(dvec,state->co,(state-1)->co);
|
||||
@@ -3269,14 +3273,14 @@ void psys_mat_hair_to_global(Object *ob, DerivedMesh *dm, short from, ParticleDa
|
||||
/************************************************/
|
||||
/* ParticleSettings handling */
|
||||
/************************************************/
|
||||
void object_add_particle_system(Scene *scene, Object *ob)
|
||||
ModifierData *object_add_particle_system(Scene *scene, Object *ob, char *name)
|
||||
{
|
||||
ParticleSystem *psys;
|
||||
ModifierData *md;
|
||||
ParticleSystemModifierData *psmd;
|
||||
|
||||
if(!ob || ob->type != OB_MESH)
|
||||
return;
|
||||
return NULL;
|
||||
|
||||
psys = ob->particlesystem.first;
|
||||
for(; psys; psys=psys->next)
|
||||
@@ -3294,7 +3298,11 @@ void object_add_particle_system(Scene *scene, Object *ob)
|
||||
strcpy(psys->name, "ParticleSystem");
|
||||
|
||||
md= modifier_new(eModifierType_ParticleSystem);
|
||||
sprintf(md->name, "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
|
||||
|
||||
if(name) BLI_strncpy(md->name, name, sizeof(md->name));
|
||||
else sprintf(md->name, "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
|
||||
modifier_unique_name(&ob->modifiers, md);
|
||||
|
||||
psmd= (ParticleSystemModifierData*) md;
|
||||
psmd->psys=psys;
|
||||
BLI_addtail(&ob->modifiers, md);
|
||||
@@ -3305,6 +3313,8 @@ void object_add_particle_system(Scene *scene, Object *ob)
|
||||
|
||||
DAG_scene_sort(scene);
|
||||
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
||||
|
||||
return md;
|
||||
}
|
||||
void object_remove_particle_system(Scene *scene, Object *ob)
|
||||
{
|
||||
@@ -4060,7 +4070,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
|
||||
else{
|
||||
if(cpa){
|
||||
ParticleKey *key1;
|
||||
float t = (cfra - pa->time + pa->loop * pa->lifetime) / pa->lifetime;
|
||||
float t = (cfra - pa->time) / pa->lifetime;
|
||||
|
||||
key1=&pa->state;
|
||||
offset_child(cpa, key1, state, part->childflat, part->childrad);
|
||||
|
||||
Reference in New Issue
Block a user