- Fixed flipped orientation of getViewViewvector(), was opposite in ortho

versus perspective.
  Note for Martin; still an issue with defining what positive/negative
  rotation is in perspective... needs more math here!
- Added Transform Widgets for PoseMode
- made adding bones in EditMode setting G.moving, so it doesn't draw other
  selected objects nor Widgets

Warning in commit of Martin yesterday: Trackball and initTrackball were
declared static, whilst also in transform.h. Quez; why are these functions
exported in the .h file?
This commit is contained in:
2005-03-20 09:45:54 +00:00
parent 836d576730
commit c2140d28c1
5 changed files with 50 additions and 8 deletions

View File

@@ -1584,6 +1584,7 @@ static void add_bone_input (Object *ob)
cursLoc= give_cursor();
VECCOPY (curs,cursLoc);
G.moving= G_TRANSFORM_EDIT;
while (addbones>0){
afbreek=0;
@@ -1741,6 +1742,7 @@ static void add_bone_input (Object *ob)
} /* End of bone adding loop*/
countall();
G.moving= 0;
}

View File

@@ -292,7 +292,8 @@ static void createTransTexspace(void)
/* ********************* pose mode ************* */
/* callback, make sure it's identical structured as next one */
static void count_bone_select(ListBase *lb, int *counter)
/* also used to count for manipulator */
void count_bone_select(ListBase *lb, int *counter)
{
Bone *bone;
@@ -309,7 +310,7 @@ static void count_bone_select(ListBase *lb, int *counter)
}
}
/* callback */
/* recursive */
static void add_pose_transdata(ListBase *lb, Object *ob, TransData **tdp)
{
Bone *bone;
@@ -2389,7 +2390,7 @@ int Rotation(TransInfo *t, short mval[2])
/* ************************** TRACKBALL *************************** */
static void initTrackball(TransInfo *t)
void initTrackball(TransInfo *t)
{
t->idx_max = 1;
t->num.idx_max = 1;
@@ -2430,7 +2431,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
}
}
static int Trackball(TransInfo *t, short mval[2])
int Trackball(TransInfo *t, short mval[2])
{
char str[50];
float axis1[3], axis2[3];

View File

@@ -192,5 +192,10 @@ int Tilt(TransInfo *t, short mval[2]);
void initTrackball(TransInfo *t);
int Trackball(TransInfo *t, short mval[2]);
/* exported from transform.c */
struct ListBase;
void count_bone_select(struct ListBase *lb, int *counter);
#endif

View File

@@ -132,7 +132,7 @@ void getViewVector(float coord[3], float vec[3]) {
Mat4MulVec4fl(G.vd->viewinv, p2);
VecSubf(vec, p2, p1);
VecSubf(vec, p1, p2);
}
else {
VECCOPY(vec, G.vd->viewinv[2]);

View File

@@ -57,6 +57,7 @@
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
#include "BKE_armature.h"
#include "BKE_global.h"
#include "BKE_lattice.h"
#include "BKE_object.h"
@@ -121,6 +122,28 @@ static void calc_tw_center(float *co)
VecAddf(twcent, twcent, co);
}
/* callback */
static void stats_pose(ListBase *lb)
{
Bone *bone;
float vec[3];
for(bone= lb->first; bone; bone= bone->next) {
if (bone->flag & BONE_SELECTED) {
/* We don't let IK children get "grabbed" */
/* ALERT! abusive global Trans here */
if ( (Trans.mode!=TFM_TRANSLATION) || (bone->flag & BONE_IK_TOPARENT)==0 ) {
get_bone_root_pos (bone, vec, 1);
calc_tw_center(vec);
return; // see above function
}
}
stats_pose(&bone->childbase);
}
}
/* centroid, boundbox, of selection */
/* returns total items selected */
@@ -248,7 +271,19 @@ static int calc_manipulator(ScrArea *sa)
}
}
else if(G.obpose) {
;
bArmature *arm= G.obpose->data;
/* count total */
count_bone_select(&arm->bonebase, &totsel);
if(totsel) {
/* recursive get stats */
stats_pose(&arm->bonebase);
VecMulf(G.scene->twcent, 1.0f/(float)totsel); // centroid!
Mat4MulVecfl(G.obpose->obmat, G.scene->twcent);
Mat4MulVecfl(G.obpose->obmat, G.scene->twmin);
Mat4MulVecfl(G.obpose->obmat, G.scene->twmax);
}
}
else if(G.f & (G_FACESELECT + G_VERTEXPAINT + G_TEXTUREPAINT +G_WEIGHTPAINT)) {
;
@@ -439,10 +474,9 @@ static void draw_manipulator_rotate(float mat[][4])
Mat3CpyMat4(smat, mat);
Mat3Inv(imat, smat);
getViewVector(mat[3], offset);
VecMulf(offset, -1.0f);
Mat3MulVecfl(imat, offset);
Normalise(offset); // matrix space is such that 1.0 = size of sphere
BIF_ThemeColor(TH_TRANSFORM);
glBegin(GL_LINES);