diff options
author | Martin Poirier <theeth@yahoo.com> | 2004-08-16 05:14:18 +0400 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2004-08-16 05:14:18 +0400 |
commit | f9acfa722d5f5c3ebf3e0f058a1fd70a717cb0e7 (patch) | |
tree | 0932c52153ba37f01a2e1c8930764bbc29685fde | |
parent | 0ce1304e1b941cac30ec9800349fcff4e12b3e72 (diff) |
Renamed get_constraint_target in constraint kernel file to get_constraint_target_matrix since that's what it really does
Moved get_con_target from editconstraint to constraint kernel file and renamed to get_constraint_target
Make scene.c use constraint functions from kernel instead of doing the switch itself (regrouping specific constraint code in one file).
Add LockTrack as an option in the Make Track menu (Ctrl-T)
Adding fun for vortex forces in 3D window, the representation now match the orientation and direction of the force (this is code will need optimisation). I'll probably be slapped for mixing two things in one commit but some function calls needed to be fixed for the new spelling and since this is really isolated code I didn't feel like wasting time getting a fresh copy, doing the changes and then readded this after commiting.
Fixed some warning regarding implicit casts and constants (this last one is a MSVCism where you need to explicitely tell the compiler to use floats with an f. AFAIK, it doesn't affect/bother other compilers).
Removed a useless commented piece of code in readfile (there was an uncommented copy a couple of lines before)
-rw-r--r-- | source/blender/blenkernel/BKE_constraint.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 93 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 78 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 29 | ||||
-rw-r--r-- | source/blender/include/BIF_editconstraint.h | 1 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 2 | ||||
-rw-r--r-- | source/blender/src/drawobject.c | 75 | ||||
-rw-r--r-- | source/blender/src/editconstraint.c | 57 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 64 |
10 files changed, 204 insertions, 203 deletions
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index 273b9d2a0a5..cc2e5498fb4 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -54,10 +54,14 @@ void clear_object_constraint_status (struct Object *ob); void clear_all_constraints(void); void rebuild_all_armature_displists(void); void do_constraint_channels (struct ListBase *conbase, struct ListBase *chanbase, float ctime); -short get_constraint_target (struct bConstraint *con, short ownertype, void *ownerdata, float mat[][4], float size[3], float time); +short get_constraint_target_matrix (struct bConstraint *con, short ownertype, void *ownerdata, float mat[][4], float size[3], float time); struct bConstraintChannel *find_constraint_channel (ListBase *list, const char *name); void free_constraint_channels (ListBase *chanbase); + +/* Gemeric functions */ + char constraint_has_target (struct bConstraint *con); +struct Object *get_constraint_target(struct bConstraint *con); /* Constraint target/owner types */ #define TARGET_OBJECT 1 // string is "" diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index c50e654465e..e590dd1dc24 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -124,10 +124,65 @@ char constraint_has_target (bConstraint *con) { } break; } - // Unknown types or CONSTRAINT_TYPE_NULL or no target + // Unknown types or CONSTRAINT_TYPE_NULL or no target return 0; } +Object *get_constraint_target(bConstraint *con) +{ + /* + * If the target for this constraint is target, return a pointer + * to the name for this constraints subtarget ... NULL otherwise + */ + switch (con->type) { + + case CONSTRAINT_TYPE_ACTION: + { + bActionConstraint *data = con->data; + return data->tar; + } + break; + case CONSTRAINT_TYPE_LOCLIKE: + { + bLocateLikeConstraint *data = con->data; + return data->tar; + } + break; + case CONSTRAINT_TYPE_ROTLIKE: + { + bRotateLikeConstraint *data = con->data; + return data->tar; + } + break; + case CONSTRAINT_TYPE_KINEMATIC: + { + bKinematicConstraint *data = con->data; + return data->tar; + } + break; + case CONSTRAINT_TYPE_TRACKTO: + { + bTrackToConstraint *data = con->data; + return data->tar; + } + break; + case CONSTRAINT_TYPE_LOCKTRACK: + { + bLockTrackConstraint *data = con->data; + return data->tar; + } + break; + case CONSTRAINT_TYPE_FOLLOWPATH: + { + bFollowPathConstraint *data = con->data; + return data->tar; + } + break; + } + + return NULL; +} + void unique_constraint_name (bConstraint *con, ListBase *list){ char tempname[64]; int number; @@ -428,7 +483,7 @@ void rebuild_all_armature_displists(void) { } } -short get_constraint_target (bConstraint *con, short ownertype, void* ownerdata, float mat[][4], float size[3], float ctime) +short get_constraint_target_matrix (bConstraint *con, short ownertype, void* ownerdata, float mat[][4], float size[3], float ctime) { short valid=0; @@ -701,6 +756,14 @@ void relink_constraints (struct ListBase *list) ID_NEW(data->tar); } break; + case CONSTRAINT_TYPE_LOCKTRACK: + { + bLockTrackConstraint *data; + data = con->data; + + ID_NEW(data->tar); + } + break; case CONSTRAINT_TYPE_ACTION: { bActionConstraint *data; @@ -725,6 +788,14 @@ void relink_constraints (struct ListBase *list) ID_NEW(data->tar); } break; + case CONSTRAINT_TYPE_FOLLOWPATH: + { + bFollowPathConstraint *data; + data = con->data; + + ID_NEW(data->tar); + } + break; } } } @@ -812,6 +883,14 @@ void copy_constraints (ListBase *dst, ListBase *src) data = (bTrackToConstraint*) con->data; } break; + case CONSTRAINT_TYPE_LOCKTRACK: + { + bLockTrackConstraint *data; + + con->data = MEM_dupallocN (con->data); + data = (bLockTrackConstraint*) con->data; + } + break; case CONSTRAINT_TYPE_KINEMATIC: { bKinematicConstraint *data; @@ -820,6 +899,14 @@ void copy_constraints (ListBase *dst, ListBase *src) data = (bKinematicConstraint*) con->data; } break; + case CONSTRAINT_TYPE_FOLLOWPATH: + { + bFollowPathConstraint *data; + + con->data = MEM_dupallocN (con->data); + data = (bFollowPathConstraint*) con->data; + } + break; default: con->data = MEM_dupallocN (con->data); break; @@ -1134,7 +1221,7 @@ void evaluate_constraint (bConstraint *constraint, Object *ob, short ownertype, Crossf(totmat[2], totmat[0], totmat[1]); } break; - case TRACK_Y: /* LOCK Y TRACK Z */ + case TRACK_Z: /* LOCK Y TRACK Z */ { /* Projection of Vector on the plane */ Projf(vec2, vec, ob->obmat[1]); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 99a7c577b12..d1f6da37a7c 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1491,7 +1491,7 @@ void solve_constraints (Object *ob, short obtype, void *obdata, float ctime) enf = con->enforce; /* Get the targetmat */ - get_constraint_target(con, obtype, obdata, tmat, size, ctime); + get_constraint_target_matrix(con, obtype, obdata, tmat, size, ctime); Mat4CpyMat4(focusmat, tmat); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 34d6ea65a92..7cf90e92673 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -241,43 +241,8 @@ void sort_baselist(Scene *sce) { bConstraint *con; for (con = base->object->constraints.first; con; con=con->next){ - switch (con->type){ - case CONSTRAINT_TYPE_KINEMATIC: - { - bKinematicConstraint *data=con->data; - if (data->tar) doit++; - } - break; - case CONSTRAINT_TYPE_TRACKTO: - { - bTrackToConstraint *data=con->data; - if (data->tar) doit++; - } - break; - case CONSTRAINT_TYPE_NULL: - break; - case CONSTRAINT_TYPE_ROTLIKE: - { - bRotateLikeConstraint *data=con->data; - if (data->tar) doit++; - - } - break; - case CONSTRAINT_TYPE_LOCLIKE: - { - bLocateLikeConstraint *data=con->data; - if (data->tar) doit++; - } - break; - case CONSTRAINT_TYPE_ACTION: - { - bActionConstraint *data=con->data; - if (data->tar) doit++; - } - break; - default: - break; - } + if (constraint_has_target(con)) + doit++; } } @@ -294,43 +259,8 @@ void sort_baselist(Scene *sce) { bConstraint *con; for (con = base->object->constraints.first; con; con=con->next){ - switch (con->type){ - case CONSTRAINT_TYPE_KINEMATIC: - { - bKinematicConstraint *data=con->data; - if (test->object == data->tar && test->object!=base->object) doit--; - } - break; - case CONSTRAINT_TYPE_TRACKTO: - { - bTrackToConstraint *data=con->data; - if (test->object == data->tar && test->object!=base->object) doit--; - } - break; - case CONSTRAINT_TYPE_NULL: - break; - case CONSTRAINT_TYPE_ROTLIKE: - { - bRotateLikeConstraint *data=con->data; - if (test->object == data->tar && test->object!=base->object) doit--; - - } - break; - case CONSTRAINT_TYPE_LOCLIKE: - { - bLocateLikeConstraint *data=con->data; - if (test->object == data->tar && test->object!=base->object) doit--; - } - break; - case CONSTRAINT_TYPE_ACTION: - { - bActionConstraint *data=con->data; - if (test->object == data->tar && test->object!=base->object) doit--; - } - break; - default: - break; - } + if (test->object == get_constraint_target(con) && test->object!=base->object) + doit--; } } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0a75ef4ff37..55e444bcd4f 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3951,35 +3951,6 @@ static void do_versions(Main *main) } } - /* Change Ob->Track in real TrackTo constraint - - NOT SURE IF PEOPLE WANT THIS SO I DISABLED IT - - if (ob->track){ - bConstraint *con; - bTrackToConstraint *data; - - list = &ob->constraints; - if (list) - { - con = MEM_callocN(sizeof(bConstraint), "constraint"); - strcpy (con->name, "AutoTrack"); - unique_constraint_name(con, list); - con->flag |= CONSTRAINT_EXPAND; - con->enforce=1.0F; - con->type = CONSTRAINT_TYPE_TRACKTO; - data = (bTrackToConstraint *) - new_constraint_data(CONSTRAINT_TYPE_TRACKTO); - - data->tar = ob->track; - data->reserved1 = ob->trackflag; - data->reserved2 = ob->upflag; - con->data= (void*) data; - BLI_addtail(list, con); - } - ob->track = 0; - }*/ - ob = ob->id.next; } diff --git a/source/blender/include/BIF_editconstraint.h b/source/blender/include/BIF_editconstraint.h index 0c7742323c0..8d983fe32e0 100644 --- a/source/blender/include/BIF_editconstraint.h +++ b/source/blender/include/BIF_editconstraint.h @@ -59,7 +59,6 @@ void test_scene_constraints (void); char *get_con_subtarget_name(struct bConstraint *constraint, struct Object *target); -struct Object *get_con_target(struct bConstraint *constraint); #endif diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 1d82fb7adbe..0708fea0b13 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -1249,7 +1249,7 @@ static void object_panel_deflectors(Object *ob) uiDefButS(block, ROW, REDRAWVIEW3D, "Force field", 10,140,200,20, &ob->pd->forcefield, 1.0, PFIELD_FORCE, 0, 0, "Object center attracts or repels particles"); uiDefButS(block, ROW, REDRAWVIEW3D, "Vortex field", 10,120,200,20, &ob->pd->forcefield, 1.0, PFIELD_VORTEX, 0, 0, "Particles swirl around Z-axis of the object"); - uiDefButF(block, NUM, B_DIFF, "Strength: ", 10,100,200,20, &ob->pd->f_strength, -1000, 1000, 1000, 0, "Strength of force field"); + uiDefButF(block, NUM, REDRAWVIEW3D, "Strength: ", 10,100,200,20, &ob->pd->f_strength, -1000, 1000, 1000, 0, "Strength of force field"); uiDefButF(block, NUM, REDRAWVIEW3D, "Fall-off: ", 10,80,200,20, &ob->pd->f_power, 0, 10, 100, 0, "Falloff power (real gravitational fallof = 2)"); /* only meshes collide now */ if(ob->type==OB_MESH) { diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 3518db42112..3bdde7e89fa 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -3083,7 +3083,7 @@ void drawspiral(float *cent, float rad, float tmat[][4], int start) { float vec[3], vx[3], vy[3]; int a, tot=32; - + char inverse=0; /* 32 values of sin function (still same result!) */ static float si[32] = {0.00000000, 0.20129852, @@ -3151,6 +3151,11 @@ void drawspiral(float *cent, float rad, float tmat[][4], int start) 0.97952994, 1.00000000}; + if (start < 0) { + inverse = 1; + start *= -1; + } + VECCOPY(vx, tmat[0]); VECCOPY(vy, tmat[1]); VecMulf(vx, rad); @@ -3158,16 +3163,35 @@ void drawspiral(float *cent, float rad, float tmat[][4], int start) VECCOPY(vec, cent); - for(a=0; a<tot; a++) { - if (a+start>31) - start=-a + 1; - glBegin(GL_LINES); - glVertex3fv(vec); - vec[0]= cent[0] + *(si+a+start) * (vx[0] * (float)a/(float)tot) + *(co+a+start) * (vy[0] * (float)a/(float)tot); - vec[1]= cent[1] + *(si+a+start) * (vx[1] * (float)a/(float)tot) + *(co+a+start) * (vy[1] * (float)a/(float)tot); - vec[2]= cent[2] + *(si+a+start) * (vx[2] * (float)a/(float)tot) + *(co+a+start) * (vy[2] * (float)a/(float)tot); - glVertex3fv(vec); - glEnd(); + if (inverse==0) { + for(a=0; a<tot; a++) { + if (a+start>31) + start=-a + 1; + glBegin(GL_LINES); + glVertex3fv(vec); + vec[0]= cent[0] + *(si+a+start) * (vx[0] * (float)a/(float)tot) + *(co+a+start) * (vy[0] * (float)a/(float)tot); + vec[1]= cent[1] + *(si+a+start) * (vx[1] * (float)a/(float)tot) + *(co+a+start) * (vy[1] * (float)a/(float)tot); + vec[2]= cent[2] + *(si+a+start) * (vx[2] * (float)a/(float)tot) + *(co+a+start) * (vy[2] * (float)a/(float)tot); + glVertex3fv(vec); + glEnd(); + } + } + else { + a=0; + vec[0]= cent[0] + *(si+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[0] * (float)(-a+31)/(float)tot); + vec[1]= cent[1] + *(si+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[1] * (float)(-a+31)/(float)tot); + vec[2]= cent[2] + *(si+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[2] * (float)(-a+31)/(float)tot); + for(a=0; a<tot; a++) { + if (a+start>31) + start=-a + 1; + glBegin(GL_LINES); + glVertex3fv(vec); + vec[0]= cent[0] + *(si+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[0] * (float)(-a+31)/(float)tot); + vec[1]= cent[1] + *(si+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[1] * (float)(-a+31)/(float)tot); + vec[2]= cent[2] + *(si+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(co+a+start) * (vy[2] * (float)(-a+31)/(float)tot); + glVertex3fv(vec); + glEnd(); + } } } @@ -3311,14 +3335,13 @@ static void draw_forcefield(Object *ob) float imat[4][4], tmat[4][4]; float vec[3]= {0.0, 0.0, 0.0}; - mygetmatrix(tmat); - Mat4Invert(imat, tmat); - Normalise(imat[0]); - Normalise(imat[1]); - if (ob->pd->forcefield == PFIELD_FORCE) { float ffall_val; + mygetmatrix(tmat); + Mat4Invert(imat, tmat); + Normalise(imat[0]); + Normalise(imat[1]); if (has_ipo_code(ob->ipo, OB_PD_FFALL)) ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, G.scene->r.cfra); else @@ -3332,16 +3355,28 @@ static void draw_forcefield(Object *ob) drawcircball(vec, 2.0, imat); } else if (ob->pd->forcefield == PFIELD_VORTEX) { - float ffall_val; + float ffall_val, force_val; + Mat4One(imat); if (has_ipo_code(ob->ipo, OB_PD_FFALL)) ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, G.scene->r.cfra); else ffall_val = ob->pd->f_power; + if (has_ipo_code(ob->ipo, OB_PD_FSTR)) + force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, G.scene->r.cfra); + else + force_val = ob->pd->f_strength; + BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7); - drawspiral(vec, 1.0, imat, 0); - drawspiral(vec, 1.0, imat, 15); + if (force_val < 0) { + drawspiral(vec, 1.0, imat, 1); + drawspiral(vec, 1.0, imat, 16); + } + else { + drawspiral(vec, 1.0, imat, -1); + drawspiral(vec, 1.0, imat, -16); + } } } @@ -4028,7 +4063,7 @@ void draw_object(Base *base) for (curcon = list->first; curcon; curcon=curcon->next){ if ((curcon->flag & CONSTRAINT_EXPAND)&&(curcon->type!=CONSTRAINT_TYPE_NULL)&&(constraint_has_target(curcon))){ - get_constraint_target(curcon, TARGET_OBJECT, NULL, tmat, size, bsystem_time(ob, 0, (float)(G.scene->r.cfra), ob->sf)); + get_constraint_target_matrix(curcon, TARGET_OBJECT, NULL, tmat, size, bsystem_time(ob, 0, (float)(G.scene->r.cfra), ob->sf)); setlinestyle(3); glBegin(GL_LINES); glVertex3fv(tmat[3]); diff --git a/source/blender/src/editconstraint.c b/source/blender/src/editconstraint.c index be40b84c403..ff7f34be906 100644 --- a/source/blender/src/editconstraint.c +++ b/source/blender/src/editconstraint.c @@ -841,59 +841,4 @@ char *get_con_subtarget_name(bConstraint *constraint, Object *target) } return NULL; -} - -Object *get_con_target(bConstraint *constraint) -{ - /* - * If the target for this constraint is target, return a pointer - * to the name for this constraints subtarget ... NULL otherwise - */ - switch (constraint->type) { - - case CONSTRAINT_TYPE_ACTION: - { - bActionConstraint *data = constraint->data; - return data->tar; - } - break; - case CONSTRAINT_TYPE_LOCLIKE: - { - bLocateLikeConstraint *data = constraint->data; - return data->tar; - } - break; - case CONSTRAINT_TYPE_ROTLIKE: - { - bRotateLikeConstraint *data = constraint->data; - return data->tar; - } - break; - case CONSTRAINT_TYPE_KINEMATIC: - { - bKinematicConstraint *data = constraint->data; - return data->tar; - } - break; - case CONSTRAINT_TYPE_TRACKTO: - { - bTrackToConstraint *data = constraint->data; - return data->tar; - } - break; - case CONSTRAINT_TYPE_LOCKTRACK: - { - bLockTrackConstraint *data = constraint->data; - return data->tar; - } - break; - case CONSTRAINT_TYPE_FOLLOWPATH: - { - bFollowPathConstraint *data = constraint->data; - return data->tar; - } - break; - } - - return NULL; -} +}
\ No newline at end of file diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 77f046a9a9c..0c2acbef699 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -272,7 +272,7 @@ void make_track(void) } if(BASACT==0) return; - mode= pupmenu("Make Track %t|Constraint %x1|Old Track %x2"); + mode= pupmenu("Make Track %t|TrackTo Constraint %x1|LockTrack Constraint %x2|Old Track %x3"); if (mode == 0){ return; } @@ -307,6 +307,36 @@ void make_track(void) sort_baselist(G.scene); } else if (mode == 2){ + bConstraint *con; + bLockTrackConstraint *data; + + base= FIRSTBASE; + while(base) { + if TESTBASELIB(base) { + if(base!=BASACT) { + con = add_new_constraint(CONSTRAINT_TYPE_LOCKTRACK); + strcpy (con->name, "AutoTrack"); + + data = con->data; + data->tar = BASACT->object; + + /* Lamp and Camera track differently by default */ + if (base->object->type == OB_LAMP || base->object->type == OB_CAMERA) { + data->trackflag = TRACK_nZ; + data->lockflag = LOCK_Y; + } + + add_constraint_to_object(con, base->object); + } + } + base= base->next; + } + + test_scene_constraints(); + allqueue(REDRAWVIEW3D, 0); + sort_baselist(G.scene); + } + else if (mode == 3){ base= FIRSTBASE; while(base) { if TESTBASELIB(base) { @@ -758,7 +788,7 @@ void make_parent(void) add_constraint_to_object(con, base->object); - get_constraint_target(con, TARGET_OBJECT, NULL, cmat, size, G.scene->r.cfra - base->object->sf); + get_constraint_target_matrix(con, TARGET_OBJECT, NULL, cmat, size, G.scene->r.cfra - base->object->sf); VecSubf(vec, base->object->obmat[3], cmat[3]); base->object->loc[0] = vec[0]; @@ -1206,9 +1236,9 @@ void docentre(void) DO_MINMAX(eve->co, min, max); eve= eve->next; } - cent[0]= (min[0]+max[0])/2.0; - cent[1]= (min[1]+max[1])/2.0; - cent[2]= (min[2]+max[2])/2.0; + cent[0]= (min[0]+max[0])/2.0f; + cent[1]= (min[1]+max[1])/2.0f; + cent[2]= (min[2]+max[2])/2.0f; eve= em->verts.first; while(eve) { @@ -1259,9 +1289,9 @@ void docentre(void) DO_MINMAX(mvert->co, min, max); } - cent[0]= (min[0]+max[0])/2.0; - cent[1]= (min[1]+max[1])/2.0; - cent[2]= (min[2]+max[2])/2.0; + cent[0]= (min[0]+max[0])/2.0f; + cent[1]= (min[1]+max[1])/2.0f; + cent[2]= (min[2]+max[2])/2.0f; } mvert= me->mvert; @@ -1346,9 +1376,9 @@ void docentre(void) nu= nu->next; } - cent[0]= (min[0]+max[0])/2.0; - cent[1]= (min[1]+max[1])/2.0; - cent[2]= (min[2]+max[2])/2.0; + cent[0]= (min[0]+max[0])/2.0f; + cent[1]= (min[1]+max[1])/2.0f; + cent[2]= (min[2]+max[2])/2.0f; } nu= nu1; @@ -1391,8 +1421,8 @@ void docentre(void) cu= base->object->data; if(cu->bb==0) return; - cu->xof= -0.5*( cu->bb->vec[4][0] - cu->bb->vec[0][0]); - cu->yof= -0.5 -0.5*( cu->bb->vec[0][1] - cu->bb->vec[2][1]); /* extra 0.5 is the height of above line */ + cu->xof= -0.5f*( cu->bb->vec[4][0] - cu->bb->vec[0][0]); + cu->yof= -0.5f -0.5f*( cu->bb->vec[0][1] - cu->bb->vec[2][1]); /* extra 0.5 is the height of above line */ /* not really ok, do this better once! */ cu->xof /= cu->fsize; @@ -2684,7 +2714,7 @@ static int is_ob_constraint_target(Object *ob, ListBase *conlist) { for (con=conlist->first; con; con=con->next) { - if (get_con_target(con) == ob) + if (get_constraint_target(con) == ob) return 1; } return 0; @@ -2935,7 +2965,7 @@ int is_constraint_target_gonna_move(Object *ob) { bPoseChannel *chan; for (con = ob->constraints.first; con; con=con->next) { - if ( (tarOb = get_con_target(con)) ) { + if ( (tarOb = get_constraint_target(con)) ) { if (tarOb->flag & OB_GONNA_MOVE ) return 1; } @@ -2944,7 +2974,7 @@ int is_constraint_target_gonna_move(Object *ob) { if (ob->pose) { for (chan = ob->pose->chanbase.first; chan; chan=chan->next){ for (con = chan->constraints.first; con; con=con->next) { - if ( (tarOb = get_con_target(con)) ) { + if ( (tarOb = get_constraint_target(con)) ) { if (tarOb->flag & OB_GONNA_MOVE ) return 1; } @@ -4549,7 +4579,7 @@ void transform(int mode) /* figure out which bones need calculating */ figure_bone_nocalc(G.obpose); figure_pose_updating(); - make_trans_bones(mode); + make_trans_bones((char)mode); break; } } |