forked from bartvdbraak/blender
bugfix [#24995] Object rotation seems to be applied incorrectly
- Object actuator rotation was being scaled by: (1/0.02)*2*PI/360 == 0.872, since revision 2. - Remove scaling and use do_versions to adjust existing files.
This commit is contained in:
parent
5c8dfc1d51
commit
4dceafc928
@ -11155,24 +11155,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* put compatibility code here until next subversion bump */
|
/* put compatibility code here until next subversion bump */
|
||||||
{
|
if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 1)) {
|
||||||
Brush *br;
|
Brush *br;
|
||||||
|
ParticleSettings *part;
|
||||||
|
bScreen *sc;
|
||||||
|
Object *ob;
|
||||||
|
|
||||||
for(br= main->brush.first; br; br= br->id.next) {
|
for(br= main->brush.first; br; br= br->id.next) {
|
||||||
if(br->ob_mode==0)
|
if(br->ob_mode==0)
|
||||||
br->ob_mode= OB_MODE_ALL_PAINT;
|
br->ob_mode= OB_MODE_ALL_PAINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
{
|
|
||||||
ParticleSettings *part;
|
|
||||||
for(part = main->particle.first; part; part = part->id.next) {
|
for(part = main->particle.first; part; part = part->id.next) {
|
||||||
if(part->boids)
|
if(part->boids)
|
||||||
part->boids->pitch = 1.0f;
|
part->boids->pitch = 1.0f;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
bScreen *sc;
|
|
||||||
for (sc= main->screen.first; sc; sc= sc->id.next) {
|
for (sc= main->screen.first; sc; sc= sc->id.next) {
|
||||||
ScrArea *sa;
|
ScrArea *sa;
|
||||||
for (sa= sc->areabase.first; sa; sa= sa->next) {
|
for (sa= sc->areabase.first; sa; sa= sa->next) {
|
||||||
@ -11198,8 +11196,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* fix rotation actuators for objects so they use real angles (radians)
|
||||||
|
* since before blender went opensource this strange scalar was used: (1 / 0.02) * 2 * math.pi/360 */
|
||||||
|
for(ob= main->object.first; ob; ob= ob->id.next) {
|
||||||
|
bActuator *act= ob->actuators.first;
|
||||||
|
while(act) {
|
||||||
|
if (act->type==ACT_OBJECT) {
|
||||||
|
/* multiply velocity with 50 in old files */
|
||||||
|
bObjectActuator *oa= act->data;
|
||||||
|
mul_v3_fl(oa->drot, 0.8726646259971648f);
|
||||||
|
}
|
||||||
|
act= act->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
|
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
|
||||||
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
|
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ typedef struct bObjectActuator {
|
|||||||
short damping;
|
short damping;
|
||||||
float forceloc[3], forcerot[3];
|
float forceloc[3], forcerot[3];
|
||||||
float pad[3], pad1[3];
|
float pad[3], pad1[3];
|
||||||
float dloc[3], drot[3];
|
float dloc[3], drot[3]; /* angle in radians */
|
||||||
float linearvelocity[3], angularvelocity[3];
|
float linearvelocity[3], angularvelocity[3];
|
||||||
struct Object *reference;
|
struct Object *reference;
|
||||||
} bObjectActuator;
|
} bObjectActuator;
|
||||||
|
@ -32,8 +32,6 @@
|
|||||||
#pragma warning (disable : 4786)
|
#pragma warning (disable : 4786)
|
||||||
#endif //WIN32
|
#endif //WIN32
|
||||||
|
|
||||||
#define BLENDER_HACK_DTIME 0.02
|
|
||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
#include "KX_BlenderSceneConverter.h"
|
#include "KX_BlenderSceneConverter.h"
|
||||||
@ -151,13 +149,6 @@ void BL_ConvertActuators(char* maggiename,
|
|||||||
KX_BLENDERTRUNC(obact->angularvelocity[2]));
|
KX_BLENDERTRUNC(obact->angularvelocity[2]));
|
||||||
short damping = obact->damping;
|
short damping = obact->damping;
|
||||||
|
|
||||||
drotvec /= BLENDER_HACK_DTIME;
|
|
||||||
//drotvec /= BLENDER_HACK_DTIME;
|
|
||||||
drotvec *= MT_2_PI/360.0;
|
|
||||||
//dlocvec /= BLENDER_HACK_DTIME;
|
|
||||||
//linvelvec /= BLENDER_HACK_DTIME;
|
|
||||||
//angvelvec /= BLENDER_HACK_DTIME;
|
|
||||||
|
|
||||||
/* Blender uses a bit vector internally for the local-flags. In */
|
/* Blender uses a bit vector internally for the local-flags. In */
|
||||||
/* KX, we have four bools. The compiler should be smart enough */
|
/* KX, we have four bools. The compiler should be smart enough */
|
||||||
/* to do the right thing. We need to explicitly convert here! */
|
/* to do the right thing. We need to explicitly convert here! */
|
||||||
|
Loading…
Reference in New Issue
Block a user