bugfix for puff brush, it wasnt working if the object had any transformation.
some dna comments too.
This commit is contained in:
@@ -2844,6 +2844,8 @@ static void brush_puff(PEData *data, int point_index)
|
||||
PTCacheEditPoint *point = edit->points + point_index;
|
||||
KEY_K;
|
||||
float mat[4][4], imat[4][4];
|
||||
float obmat[4][4], obimat[4][4];
|
||||
|
||||
float lastco[3], rootco[3] = {0.0f, 0.0f, 0.0f}, co[3], nor[3], kco[3], dco[3], fac=0.0f, length=0.0f;
|
||||
|
||||
if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
|
||||
@@ -2855,17 +2857,23 @@ static void brush_puff(PEData *data, int point_index)
|
||||
unit_m4(imat);
|
||||
}
|
||||
|
||||
copy_m4_m4(obmat, data->ob->obmat);
|
||||
invert_m4_m4(obimat, obmat);
|
||||
|
||||
LOOP_KEYS {
|
||||
if(k==0) {
|
||||
/* find root coordinate and normal on emitter */
|
||||
VECCOPY(co, key->co);
|
||||
mul_m4_v3(mat, co);
|
||||
mul_v3_m4v3(kco, obimat, co); /* use 'kco' as the object space version of worldspace 'co' */
|
||||
|
||||
point_index= BLI_kdtree_find_nearest(edit->emitter_field, co, NULL, NULL);
|
||||
point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL);
|
||||
if(point_index == -1) return;
|
||||
|
||||
VECCOPY(rootco, co);
|
||||
copy_v3_v3(nor, &edit->emitter_cosnos[point_index*6+3]);
|
||||
mul_mat3_m4_v3(obmat, nor); /* normal into worldspace */
|
||||
|
||||
normalize_v3(nor);
|
||||
length= 0.0f;
|
||||
|
||||
@@ -3913,7 +3921,8 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* mesh may have changed since last entering editmode.
|
||||
* note, this may have run before if the edit data was just created, so could avoid this and speed up a little */
|
||||
recalc_emitter_field(ob, edit->psys);
|
||||
if(edit)
|
||||
recalc_emitter_field(ob, edit->psys);
|
||||
|
||||
toggle_particle_cursor(C, 1);
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_PARTICLE, NULL);
|
||||
|
||||
@@ -135,15 +135,15 @@ typedef struct Object {
|
||||
|
||||
/* rot en drot have to be together! (transform('r' en 's')) */
|
||||
float loc[3], dloc[3], orig[3];
|
||||
float size[3], dsize[3];
|
||||
float size[3], dsize[3]; /* scale and delta scale */
|
||||
float rot[3], drot[3]; /* euler rotation */
|
||||
float quat[4], dquat[4]; /* quaternion rotation */
|
||||
float rotAxis[3], drotAxis[3]; /* axis angle rotation - axis part */
|
||||
float rotAngle, drotAngle; /* axis angle rotation - angle part */
|
||||
float obmat[4][4];
|
||||
float obmat[4][4]; /* final worldspace matrix with constraints & animsys applied */
|
||||
float parentinv[4][4]; /* inverse result of parent, so that object doesn't 'stick' to parent */
|
||||
float constinv[4][4]; /* inverse result of constraints. doesn't include effect of parent or object local transform */
|
||||
float imat[4][4]; /* for during render, old game engine, temporally: ipokeys of transform */
|
||||
float imat[4][4]; /* inverse matrix of 'obmat' for during render, old game engine, temporally: ipokeys of transform */
|
||||
|
||||
unsigned int lay; /* copy of Base */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user