synched with trunk at revision 37212

This commit is contained in:
Nick Samarin
2011-06-05 18:51:00 +00:00
574 changed files with 23225 additions and 21017 deletions

View File

@@ -867,11 +867,32 @@ Lamp *copy_lamp(Lamp *la)
lan->curfalloff = curvemapping_copy(la->curfalloff);
#if 0 // XXX old animation system
id_us_plus((ID *)lan->ipo);
#endif // XXX old animation system
if(la->preview)
lan->preview = BKE_previewimg_copy(la->preview);
return lan;
}
if (la->preview) lan->preview = BKE_previewimg_copy(la->preview);
Lamp *localize_lamp(Lamp *la)
{
Lamp *lan;
int a;
lan= copy_libblock(la);
BLI_remlink(&G.main->lamp, lan);
for(a=0; a<MAX_MTEX; a++) {
if(lan->mtex[a]) {
lan->mtex[a]= MEM_mallocN(sizeof(MTex), "localize_lamp");
memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
/* free lamp decrements */
id_us_plus((ID *)lan->mtex[a]->tex);
}
}
lan->curfalloff = curvemapping_copy(la->curfalloff);
lan->preview= NULL;
return lan;
}
@@ -1628,12 +1649,6 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
/* there is also a timing calculation in drawobject() */
static int no_speed_curve= 0;
void disable_speed_curve(int val)
{
no_speed_curve= val;
}
// XXX THIS CRUFT NEEDS SERIOUS RECODING ASAP!
/* ob can be NULL */
@@ -1671,21 +1686,20 @@ void object_rot_to_mat3(Object *ob, float mat[][3])
{
float rmat[3][3], dmat[3][3];
/* initialise the delta-rotation matrix, which will get (pre)multiplied
/* 'dmat' is the delta-rotation matrix, which will get (pre)multiplied
* with the rotation matrix to yield the appropriate rotation
*/
unit_m3(dmat);
/* rotations may either be quats, eulers (with various rotation orders), or axis-angle */
if (ob->rotmode > 0) {
/* euler rotations (will cause gimble lock, but this can be alleviated a bit with rotation orders) */
eulO_to_mat3( rmat,ob->rot, ob->rotmode);
eulO_to_mat3( dmat,ob->drot, ob->rotmode);
eulO_to_mat3(rmat, ob->rot, ob->rotmode);
eulO_to_mat3(dmat, ob->drot, ob->rotmode);
}
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
/* axis-angle - not really that great for 3D-changing orientations */
axis_angle_to_mat3( rmat,ob->rotAxis, ob->rotAngle);
axis_angle_to_mat3( dmat,ob->drotAxis, ob->drotAngle);
axis_angle_to_mat3(rmat, ob->rotAxis, ob->rotAngle);
axis_angle_to_mat3(dmat, ob->drotAxis, ob->drotAngle);
}
else {
/* quats are normalised before use to eliminate scaling issues */
@@ -1720,9 +1734,22 @@ void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat)
ob->rotAngle -= ob->drotAngle;
break;
default: /* euler */
if(use_compat) mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, mat);
else mat3_to_eulO(ob->rot, ob->rotmode, mat);
sub_v3_v3(ob->rot, ob->drot);
{
float quat[4];
float dquat[4];
float tmat[3][3];
/* without drot we could apply 'mat' directly */
mat3_to_quat(quat, mat);
eulO_to_quat(dquat, ob->drot, ob->rotmode);
invert_qt(dquat);
mul_qt_qtqt(quat, dquat, quat);
quat_to_mat3(tmat, quat);
/* end drot correction */
if(use_compat) mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, tmat);
else mat3_to_eulO(ob->rot, ob->rotmode, tmat);
}
}
}
@@ -1738,7 +1765,7 @@ void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const
mul_m4_m4m4(rmat, mat, imat); /* get the parent relative matrix */
object_apply_mat4(ob, rmat, use_compat, FALSE);
/* same as below, use rmat rather then mat */
/* same as below, use rmat rather than mat */
mat4_to_loc_rot_size(ob->loc, rot, ob->size, rmat);
object_mat3_to_rot(ob, rot, use_compat);
}
@@ -1914,9 +1941,10 @@ static void give_parvert(Object *par, int nr, float *vec)
if(dm) {
MVert *mvert= dm->getVertArray(dm);
int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX);
int i, count = 0, vindex, numVerts = dm->getNumVerts(dm);
int i, vindex, numVerts = dm->getNumVerts(dm);
/* get the average of all verts with (original index == nr) */
count= 0;
for(i = 0; i < numVerts; i++) {
vindex= (index)? index[i]: i;
@@ -3010,9 +3038,14 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int
if(newkey || from_mix==FALSE) {
kb= add_keyblock(key, name);
/* create from lattice */
latt_to_key(lt, kb);
if (!newkey) {
KeyBlock *basekb= (KeyBlock *)key->block.first;
kb->data= MEM_dupallocN(basekb->data);
kb->totelem= basekb->totelem;
}
else {
latt_to_key(lt, kb);
}
}
else {
/* copy from current values */
@@ -3048,7 +3081,10 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
KeyBlock *basekb= (KeyBlock *)key->block.first;
kb->data= MEM_dupallocN(basekb->data);
kb->totelem= basekb->totelem;
} else curve_to_key(cu, kb, lb);
}
else {
curve_to_key(cu, kb, lb);
}
}
else {
/* copy from current values */