Bugfixes for frame number boost:

- Found several places, where people explicitly casted the frame number
  to short.
- Fixed the crash in BPY_interface by adding an empty line (to make it
  recompile everywhere, make clean doesn't help...)

  For the build system maintainers:

  Problem was: The change in makesdna changed the position of the
  scriptlink structure. BPY_interface.c somehow didn't get recompiled
  (not even after a make clean!!!) which triggered crashes on adding
  scriptlinks.
This commit is contained in:
2006-05-07 08:23:51 +00:00
parent 53e777aae1
commit 390380e97b
7 changed files with 15 additions and 14 deletions

View File

@@ -475,7 +475,7 @@ void pdDoEffectors(ListBase *lb, float *opco, float *force, float *speed, float
float *obloc; float *obloc;
float distance, force_val, ffall_val; float distance, force_val, ffall_val;
float guidecollect[3], guidedist= 0.0f; float guidecollect[3], guidedist= 0.0f;
short cur_frame; int cur_frame;
guidecollect[0]= guidecollect[1]= guidecollect[2]=0.0f; guidecollect[0]= guidecollect[1]= guidecollect[2]=0.0f;
@@ -501,7 +501,7 @@ void pdDoEffectors(ListBase *lb, float *opco, float *force, float *speed, float
/* Need to set r.cfra for paths (investigate, ton) (uses ob->ctime now, ton) */ /* Need to set r.cfra for paths (investigate, ton) (uses ob->ctime now, ton) */
if(ob->ctime!=cur_time) { if(ob->ctime!=cur_time) {
cur_frame = G.scene->r.cfra; cur_frame = G.scene->r.cfra;
G.scene->r.cfra = (short)cur_time; G.scene->r.cfra = (int)cur_time;
where_is_object_time(ob, cur_time); where_is_object_time(ob, cur_time);
G.scene->r.cfra = cur_frame; G.scene->r.cfra = cur_frame;
} }
@@ -702,7 +702,7 @@ static int pdDoDeflection(RNG *rng, float opco[3], float npco[3], float opno[3],
int a, deflected=0, deflected_now=0; int a, deflected=0, deflected_now=0;
float t,t2, min_t; float t,t2, min_t;
float mat[3][3], obloc[3]; float mat[3][3], obloc[3];
short cur_frame; int cur_frame;
float time_before, time_after; float time_before, time_after;
float force_mag_norm; float force_mag_norm;
int d_object=0, d_face=0, ds_object=0, ds_face=0; int d_object=0, d_face=0, ds_object=0, ds_face=0;
@@ -734,7 +734,7 @@ static int pdDoDeflection(RNG *rng, float opco[3], float npco[3], float opno[3],
else { else {
/*Find out where the object is at this time*/ /*Find out where the object is at this time*/
cur_frame = G.scene->r.cfra; cur_frame = G.scene->r.cfra;
G.scene->r.cfra = (short)cur_time; G.scene->r.cfra = (int)cur_time;
where_is_object_time(ob, cur_time); where_is_object_time(ob, cur_time);
G.scene->r.cfra = cur_frame; G.scene->r.cfra = cur_frame;

View File

@@ -1325,6 +1325,7 @@ void BPY_do_pyscript( ID * id, short event )
} }
} }
/* SPACE HANDLERS */ /* SPACE HANDLERS */
/* These are special script links that can be assigned to ScrArea's to /* These are special script links that can be assigned to ScrArea's to

View File

@@ -752,7 +752,7 @@ static PyObject *Lattice_insertKey( BPy_Lattice * self, PyObject * args )
if( frame > 0 ) { if( frame > 0 ) {
frame = EXPP_ClampInt( frame, 1, MAXFRAME ); frame = EXPP_ClampInt( frame, 1, MAXFRAME );
oldfra = G.scene->r.cfra; oldfra = G.scene->r.cfra;
G.scene->r.cfra = (short)frame; G.scene->r.cfra = (int)frame;
} }
// else just use current frame, then // else just use current frame, then
// return (EXPP_ReturnPyObjError (PyExc_RuntimeError, // return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
@@ -763,7 +763,7 @@ static PyObject *Lattice_insertKey( BPy_Lattice * self, PyObject * args )
allspace(REMAKEIPO, 0); allspace(REMAKEIPO, 0);
if( frame > 0 ) if( frame > 0 )
G.scene->r.cfra = (short)oldfra; G.scene->r.cfra = (int)oldfra;
Py_INCREF( Py_None ); Py_INCREF( Py_None );
return Py_None; return Py_None;

View File

@@ -1248,7 +1248,7 @@ static PyObject *NMesh_insertKey( PyObject * self, PyObject * args )
if( fra > 0 ) { if( fra > 0 ) {
fra = EXPP_ClampInt( fra, 1, NMESH_FRAME_MAX ); fra = EXPP_ClampInt( fra, 1, NMESH_FRAME_MAX );
oldfra = G.scene->r.cfra; oldfra = G.scene->r.cfra;
G.scene->r.cfra = (short)fra; G.scene->r.cfra = (int)fra;
} }
if( !mesh ) if( !mesh )
@@ -1259,7 +1259,7 @@ static PyObject *NMesh_insertKey( PyObject * self, PyObject * args )
allspace(REMAKEIPO, 0); allspace(REMAKEIPO, 0);
if( fra > 0 ) if( fra > 0 )
G.scene->r.cfra = (short)oldfra; G.scene->r.cfra = (int)oldfra;
return EXPP_incr_ret( Py_None ); return EXPP_incr_ret( Py_None );
} }

View File

@@ -463,7 +463,7 @@ static PyObject *PoseBone_insertKey(BPy_PoseBone *self, PyObject *args)
//set the frame we want insertion on //set the frame we want insertion on
oldframe = G.scene->r.cfra; oldframe = G.scene->r.cfra;
G.scene->r.cfra = (short)frame; G.scene->r.cfra = frame;
//add the action channel if it's not there //add the action channel if it's not there
verify_action_channel(((BPy_Object*)parent_object)->object->action, verify_action_channel(((BPy_Object*)parent_object)->object->action,
@@ -498,7 +498,7 @@ static PyObject *PoseBone_insertKey(BPy_PoseBone *self, PyObject *args)
} }
//flip the frame back //flip the frame back
G.scene->r.cfra = (short)oldframe; G.scene->r.cfra = oldframe;
//update the IPOs //update the IPOs
remake_action_ipos (((BPy_Object*)parent_object)->object->action); remake_action_ipos (((BPy_Object*)parent_object)->object->action);

View File

@@ -4642,7 +4642,7 @@ void move_to_frame(void)
cfra+= ob->sf/G.scene->r.framelen; cfra+= ob->sf/G.scene->r.framelen;
} }
} }
CFRA= (short)floor(cfra+0.5); CFRA= (int)floor(cfra+0.5);
if(CFRA < 1) CFRA= 1; if(CFRA < 1) CFRA= 1;
update_for_newframe(); update_for_newframe();

View File

@@ -2340,7 +2340,7 @@ static void createTransObject(TransInfo *t)
popfirst(&elems); // bring back pushed listbase popfirst(&elems); // bring back pushed listbase
if(elems.first) { if(elems.first) {
float cfraont; int cfraont;
int ipoflag; int ipoflag;
base->flag |= BA_DO_IPO+BA_WAS_SEL; base->flag |= BA_DO_IPO+BA_WAS_SEL;
@@ -2356,7 +2356,7 @@ static void createTransObject(TransInfo *t)
for(ik= elems.first; ik; ik= ik->next) { for(ik= elems.first; ik; ik= ik->next) {
/* weak... this doesn't correct for floating values, giving small errors */ /* weak... this doesn't correct for floating values, giving small errors */
CFRA= (short)(ik->val/G.scene->r.framelen); CFRA= (int)(ik->val/G.scene->r.framelen);
do_ob_ipo(ob); do_ob_ipo(ob);
ObjectToTransData(td, ob); // does where_is_object() ObjectToTransData(td, ob); // does where_is_object()
@@ -2376,7 +2376,7 @@ static void createTransObject(TransInfo *t)
poplast(ob->loc); poplast(ob->loc);
set_no_parent_ipo(0); set_no_parent_ipo(0);
CFRA= (short)cfraont; CFRA= cfraont;
ob->ipoflag= ipoflag; ob->ipoflag= ipoflag;
where_is_object(ob); // restore where_is_object(ob); // restore