fix [#29111] Wrong application of delta scale

apply delta scale as a multiplier & do-versions on existing files.

- bumps subversion to 2.60.6
This commit is contained in:
Campbell Barton 2011-11-29 21:13:37 +00:00
parent 5763e6ce85
commit 6403858ad9
5 changed files with 37 additions and 14 deletions

@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 260
#define BLENDER_SUBVERSION 5
#define BLENDER_SUBVERSION 6
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0

@ -774,6 +774,7 @@ Object *add_only_object(int type, const char *name)
ob->col[3]= 1.0;
ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
ob->dsize[0]= ob->dsize[1]= ob->dsize[2]= 1.0;
/* objects should default to having Euler XYZ rotations,
* but rotations default to quaternions
@ -1441,7 +1442,7 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
void object_scale_to_mat3(Object *ob, float mat[][3])
{
float vec[3];
add_v3_v3v3(vec, ob->size, ob->dsize);
mul_v3_v3v3(vec, ob->size, ob->dsize);
size_to_mat3( mat,vec);
}
@ -1603,7 +1604,11 @@ void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const
}
sub_v3_v3(ob->loc, ob->dloc);
sub_v3_v3(ob->size, ob->dsize);
if (ob->dsize[0] != 0.0f) ob->size[0] /= ob->dsize[0];
if (ob->dsize[1] != 0.0f) ob->size[1] /= ob->dsize[1];
if (ob->dsize[2] != 0.0f) ob->size[2] /= ob->dsize[2];
/* object_mat3_to_rot handles delta rotations */
}

@ -11967,7 +11967,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
/* put compatibility code here until next subversion bump */
if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 3)) {
Object *ob;
@ -11984,8 +11983,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
/* put compatibility code here until next subversion bump */
if (main->versionfile < 256) {
bScreen *sc;
ScrArea *sa;
@ -12604,16 +12601,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
/* put compatibility code here until next subversion bump */
if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 6))
{
Scene *sce;
MovieClip *clip;
bScreen *sc;
for(sce = main->scene.first; sce; sce = sce->id.next) {
if (sce->r.im_format.depth == 0) {
do_versions_image_settings_2_60(sce);
}
do_versions_image_settings_2_60(sce);
}
for (clip= main->movieclip.first; clip; clip= clip->id.next) {
@ -12640,6 +12635,29 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
{
Object *ob;
for (ob= main->object.first; ob; ob= ob->id.next) {
/* convert delta addition into delta scale */
int i;
for (i= 0; i < 3; i++) {
if ( (ob->dsize[i] == 0.0f) || /* simple case, user never touched dsize */
(ob->size[i] == 0.0f)) /* cant scale the dsize to give a non zero result, so fallback to 1.0f */
{
ob->dsize[i]= 1.0f;
}
else {
ob->size[i]= (ob->size[i] + ob->dsize[i]) / ob->size[i];
}
}
}
}
}
/* put compatibility code here until next subversion bump */
{
/* nothing! */
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */

@ -188,15 +188,15 @@ static void object_clear_scale(Object *ob)
{
/* clear scale factors which are not locked */
if ((ob->protectflag & OB_LOCK_SCALEX)==0) {
ob->dsize[0]= 0.0f;
ob->dsize[0]= 1.0f;
ob->size[0]= 1.0f;
}
if ((ob->protectflag & OB_LOCK_SCALEY)==0) {
ob->dsize[1]= 0.0f;
ob->dsize[1]= 1.0f;
ob->size[1]= 1.0f;
}
if ((ob->protectflag & OB_LOCK_SCALEZ)==0) {
ob->dsize[2]= 0.0f;
ob->dsize[2]= 1.0f;
ob->size[2]= 1.0f;
}
}

@ -2391,7 +2391,7 @@ static void do_displacement(Render *re, ObjectRen *obr, float mat[][4], float im
/* Object Size with parenting */
obt=obr->ob;
while(obt){
add_v3_v3v3(temp, obt->size, obt->dsize);
mul_v3_v3v3(temp, obt->size, obt->dsize);
scale[0]*=temp[0]; scale[1]*=temp[1]; scale[2]*=temp[2];
obt=obt->parent;
}