Make orientation matrix access function public.

Fix bug in previous code: passing 3x3 matrix to a function expecting a 4x4 (warnings are for something)
This commit is contained in:
2009-11-06 21:31:14 +00:00
parent 5c3a365ac4
commit 0b027b4097
4 changed files with 12 additions and 18 deletions

View File

@@ -122,6 +122,8 @@ int BIF_menuselectTransformOrientation(void);
void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
void BIF_selectTransformOrientationValue(struct bContext *C, int orientation);
void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[][3], int activeOnly);
struct EnumPropertyItem *BIF_enumTransformOrientation(struct bContext *C);
char * BIF_menustringTransformOrientation(const struct bContext *C, char *title); /* the returned value was allocated and needs to be freed after use */
int BIF_countTransformOrientation(const struct bContext *C);

View File

@@ -698,8 +698,6 @@ void applyTransformOrientation(const struct bContext *C, float mat[3][3], char *
int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3], int activeOnly);
/* also used in view3d_edit.c, todo - move outside of transform */
void getTransformOrientationMatrix(const struct bContext *C, float twmat[][4], int use_active);
int createSpaceNormal(float mat[3][3], float normal[3]);
int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3]);

View File

@@ -496,7 +496,9 @@ int calc_manipulator_stats(const bContext *C)
}
case V3D_MANIP_NORMAL:
if(obedit || ob->mode & OB_MODE_POSE) {
getTransformOrientationMatrix(C, rv3d->twmat, (v3d->around == V3D_ACTIVE));
float mat[3][3];
ED_getTransformOrientationMatrix(C, mat, (v3d->around == V3D_ACTIVE));
Mat4CpyMat3(rv3d->twmat, mat);
break;
}
/* no break we define 'normal' as 'local' in Object mode */

View File

@@ -515,9 +515,6 @@ void initTransformOrientation(bContext *C, TransInfo *t)
View3D *v3d = CTX_wm_view3d(C);
Object *ob = CTX_data_active_object(C);
Object *obedit = CTX_data_active_object(C);
float normal[3]={0.0, 0.0, 0.0};
float plane[3]={0.0, 0.0, 0.0};
switch(t->current_orientation) {
case V3D_MANIP_GLOBAL:
@@ -532,7 +529,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
case V3D_MANIP_NORMAL:
if(obedit || (ob && ob->mode & OB_MODE_POSE)) {
strcpy(t->spacename, "normal");
getTransformOrientationMatrix(C, t->spacemtx, (v3d->around == V3D_ACTIVE));
ED_getTransformOrientationMatrix(C, t->spacemtx, (v3d->around == V3D_ACTIVE));
break;
}
/* no break we define 'normal' as 'local' in Object mode */
@@ -927,12 +924,11 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
return result;
}
void getTransformOrientationMatrix(const bContext *C, float twmat[][4], int activeOnly)
void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[][3], int activeOnly)
{
float normal[3]={0.0, 0.0, 0.0};
float plane[3]={0.0, 0.0, 0.0};
float mat[3][3];
int type;
type = getTransformOrientation(C, normal, plane, activeOnly);
@@ -940,25 +936,25 @@ void getTransformOrientationMatrix(const bContext *C, float twmat[][4], int acti
switch (type)
{
case ORIENTATION_NORMAL:
if (createSpaceNormalTangent(mat, normal, plane) == 0)
if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0)
{
type = ORIENTATION_NONE;
}
break;
case ORIENTATION_VERT:
if (createSpaceNormal(mat, normal) == 0)
if (createSpaceNormal(orientation_mat, normal) == 0)
{
type = ORIENTATION_NONE;
}
break;
case ORIENTATION_EDGE:
if (createSpaceNormalTangent(mat, normal, plane) == 0)
if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0)
{
type = ORIENTATION_NONE;
}
break;
case ORIENTATION_FACE:
if (createSpaceNormalTangent(mat, normal, plane) == 0)
if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0)
{
type = ORIENTATION_NONE;
}
@@ -967,10 +963,6 @@ void getTransformOrientationMatrix(const bContext *C, float twmat[][4], int acti
if (type == ORIENTATION_NONE)
{
Mat4One(twmat);
}
else
{
Mat4CpyMat3(twmat, mat);
Mat3One(orientation_mat);
}
}