diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-11-07 00:31:14 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-11-07 00:31:14 +0300 |
commit | 0b027b40971a48efa7486568922f8ed9afc53d75 (patch) | |
tree | 993eb823de30ccb6af74e3391fb5e285686cd4ef /source/blender/editors | |
parent | 5c3a365ac49dda3caf17985abb66fd2299920fcd (diff) |
Make orientation matrix access function public.
Fix bug in previous code: passing 3x3 matrix to a function expecting a 4x4 (warnings are for something)
Diffstat (limited to 'source/blender/editors')
4 files changed, 12 insertions, 18 deletions
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index e07cbff429a..0f17599daae 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -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); diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index f6f8d3e4aa2..bba3ae44ebc 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -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]); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index dd94fef4059..0f4848d9120 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -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 */ diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 8b4023a3352..0cb2515828d 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -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); } } |