Revision: 38287
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38287
Author:   jhk
Date:     2011-07-10 17:30:31 +0000 (Sun, 10 Jul 2011)
Log Message:
-----------
Fix for [#27289] Hair: Render Option - Object does not point objects to end of 
"hair path"
* Objects are now always rotated in the directions of the hair paths
* Secondary fix: particle size wasn't updated for hair particles, so 
dupliobject size couldn't be change after the hair was edited

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/particle.c
    trunk/blender/source/blender/blenkernel/intern/particle_system.c

Modified: trunk/blender/source/blender/blenkernel/intern/particle.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle.c   2011-07-10 
17:26:15 UTC (rev 38286)
+++ trunk/blender/source/blender/blenkernel/intern/particle.c   2011-07-10 
17:30:31 UTC (rev 38287)
@@ -4372,59 +4372,46 @@
        Object *ob = sim->ob;
        ParticleSystem *psys = sim->psys;
        ParticleSystemModifierData *psmd = sim->psmd;
-       float loc[3], nor[3], vec[3], side[3], len, obrotmat[4][4], qmat[4][4];
-       float xvec[3] = {-1.0, 0.0, 0.0}, q[4], nmat[3][3];
+       float loc[3], nor[3], vec[3], side[3], len;
+       float xvec[3] = {-1.0, 0.0, 0.0}, nmat[3][3];
 
        sub_v3_v3v3(vec, (cache+cache->steps)->co, cache->co);
        len= normalize_v3(vec);
 
-       if(psys->part->rotmode) {
-               if(pa == NULL)
-                       pa= psys->particles+cpa->pa[0];
+       if(pa == NULL && psys->part->childflat != PART_CHILD_FACES)
+               pa = psys->particles + cpa->pa[0];
 
-               vec_to_quat( q,xvec, ob->trackflag, ob->upflag);
-               quat_to_mat4( obrotmat,q);
-               obrotmat[3][3]= 1.0f;
-
-               quat_to_mat4( qmat,pa->state.rot);
-               mul_m4_m4m4(mat, obrotmat, qmat);
-       }
-       else {
-               if(pa == NULL && psys->part->childflat != PART_CHILD_FACES)
-                       pa = psys->particles + cpa->pa[0];
-
-               if(pa)
-                       
psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
-               else
-                       
psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
+       if(pa)
+               
psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
+       else
+               
psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
                
-               copy_m3_m4(nmat, ob->imat);
-               transpose_m3(nmat);
-               mul_m3_v3(nmat, nor);
+       copy_m3_m4(nmat, ob->imat);
+       transpose_m3(nmat);
+       mul_m3_v3(nmat, nor);
 
-               /* make sure that we get a proper side vector */
-               if(fabs(dot_v3v3(nor,vec))>0.999999) {
-                       if(fabs(dot_v3v3(nor,xvec))>0.999999) {
-                               nor[0] = 0.0f;
-                               nor[1] = 1.0f;
-                               nor[2] = 0.0f;
-                       }
-                       else {
-                               nor[0] = 1.0f;
-                               nor[1] = 0.0f;
-                               nor[2] = 0.0f;
-                       }
+       /* make sure that we get a proper side vector */
+       if(fabs(dot_v3v3(nor,vec))>0.999999) {
+               if(fabs(dot_v3v3(nor,xvec))>0.999999) {
+                       nor[0] = 0.0f;
+                       nor[1] = 1.0f;
+                       nor[2] = 0.0f;
                }
-               cross_v3_v3v3(side, nor, vec);
-               normalize_v3(side);
-               cross_v3_v3v3(nor, vec, side);
-
-               unit_m4(mat);
-               VECCOPY(mat[0], vec);
-               VECCOPY(mat[1], side);
-               VECCOPY(mat[2], nor);
+               else {
+                       nor[0] = 1.0f;
+                       nor[1] = 0.0f;
+                       nor[2] = 0.0f;
+               }
        }
+       cross_v3_v3v3(side, nor, vec);
+       normalize_v3(side);
+       cross_v3_v3v3(nor, vec, side);
 
+       unit_m4(mat);
+       VECCOPY(mat[0], vec);
+       VECCOPY(mat[1], side);
+       VECCOPY(mat[2], nor);
+
        *scale= len;
 }
 

Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c    
2011-07-10 17:26:15 UTC (rev 38286)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c    
2011-07-10 17:30:31 UTC (rev 38287)
@@ -3510,11 +3510,15 @@
 static void hair_step(ParticleSimulationData *sim, float cfra)
 {
        ParticleSystem *psys = sim->psys;
-/*     ParticleSettings *part = psys->part; */
+       ParticleSettings *part = psys->part;
        PARTICLE_P;
        float disp = (float)psys_get_current_display_percentage(psys)/100.0f;
 
        LOOP_PARTICLES {
+               pa->size = part->size;
+               if(part->randsize > 0.0f)
+                       pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
+
                if(PSYS_FRAND(p) > disp)
                        pa->flag |= PARS_NO_DISP;
                else

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to