diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-13 07:56:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-13 07:56:51 +0300 |
commit | 59c6487e9314dd43003af1a018fc092b041e7e10 (patch) | |
tree | de8cc7dd06b875d174cb79cad7558874c8bffa5e /source/blender/editors/transform/transform_orientations.c | |
parent | 7a56d31af3523081e33a67d7aea11314c37c7104 (diff) | |
parent | b99d064e9142b2e9d790731f4c4c6c107ca43696 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/transform/transform_orientations.c')
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index aeea8930ccb..19df46455d7 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -192,14 +192,14 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, int type; type = getTransformOrientation(C, normal, plane); - + switch (type) { case ORIENTATION_VERT: if (createSpaceNormal(mat, normal) == 0) { BKE_reports_prepend(reports, "Cannot use vertex with zero-length normal"); return NULL; } - + if (name[0] == 0) { name = "Vertex"; } @@ -209,7 +209,7 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, BKE_reports_prepend(reports, "Cannot use zero-length edge"); return NULL; } - + if (name[0] == 0) { name = "Edge"; } @@ -219,7 +219,7 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, BKE_reports_prepend(reports, "Cannot use zero-area face"); return NULL; } - + if (name[0] == 0) { name = "Face"; } @@ -234,7 +234,7 @@ static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, bool createSpaceNormal(float mat[3][3], const float normal[3]) { float tangent[3] = {0.0f, 0.0f, 1.0f}; - + copy_v3_v3(mat[2], normal); if (normalize_v3(mat[2]) == 0.0f) { return false; /* error return */ @@ -250,7 +250,7 @@ bool createSpaceNormal(float mat[3][3], const float normal[3]) cross_v3_v3v3(mat[1], mat[2], mat[0]); normalize_m3(mat); - + return true; } @@ -276,13 +276,13 @@ bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const floa if (normalize_v3(mat[0]) == 0.0f) { return false; /* error return */ } - + cross_v3_v3v3(mat[1], mat[2], mat[0]); normalize_v3(mat[1]); /* final matrix must be normalized, do inline */ // normalize_m3(mat); - + return true; } @@ -406,7 +406,7 @@ static int count_bone_select(bArmature *arm, ListBase *lb, const bool do_it) Bone *bone; bool do_next; int total = 0; - + for (bone = lb->first; bone; bone = bone->next) { bone->flag &= ~BONE_TRANSFORM; do_next = do_it; @@ -423,7 +423,7 @@ static int count_bone_select(bArmature *arm, ListBase *lb, const bool do_it) } total += count_bone_select(arm, &bone->childbase, do_next); } - + return total; } @@ -454,7 +454,7 @@ void initTransformOrientation(bContext *C, TransInfo *t) ATTR_FALLTHROUGH; /* we define 'normal' as 'local' in Object mode */ case V3D_MANIP_LOCAL: BLI_strncpy(t->spacename, IFACE_("local"), sizeof(t->spacename)); - + if (ob) { copy_m3_m4(t->spacemtx, ob->obmat); normalize_m3(t->spacemtx); @@ -462,9 +462,9 @@ void initTransformOrientation(bContext *C, TransInfo *t) else { unit_m3(t->spacemtx); } - + break; - + case V3D_MANIP_VIEW: if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) @@ -595,10 +595,10 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 if (obedit) { float imat[3][3], mat[3][3]; - + /* we need the transpose of the inverse for a normal... */ copy_m3_m4(imat, ob->obmat); - + invert_m3_m3(mat, imat); transpose_m3(mat); @@ -608,12 +608,12 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 BMEditMesh *em = BKE_editmesh_from_object(ob); BMEditSelection ese; float vec[3] = {0, 0, 0}; - + /* USE LAST SELECTED WITH ACTIVE */ if (activeOnly && BM_select_history_active_get(em->bm, &ese)) { BM_editselection_normal(&ese, normal); BM_editselection_plane(&ese, plane); - + switch (ese.htype) { case BM_VERT: result = ORIENTATION_VERT; @@ -638,7 +638,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 add_v3_v3(plane, vec); } } - + result = ORIENTATION_FACE; } else if (em->bm->totvertsel == 3) { @@ -699,7 +699,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 else if (em->bm->totedgesel == 1 || em->bm->totvertsel == 2) { BMVert *v_pair[2] = {NULL, NULL}; BMEdge *eed = NULL; - + if (em->bm->totedgesel == 1) { if (bm_mesh_edges_select_get_n(em->bm, &eed, 1) == 1) { v_pair[0] = eed->v1; @@ -929,7 +929,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 } } } - + if (!is_zero_v3(normal)) { result = ORIENTATION_FACE; } @@ -939,7 +939,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 MetaElem *ml; bool ok = false; float tmat[3][3]; - + if (activeOnly && (ml = mb->lastelem)) { quat_to_mat3(tmat, ml->quat); add_v3_v3(normal, tmat[2]); @@ -987,7 +987,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 } } } - + if (ok) { if (!is_zero_v3(plane)) { result = ORIENTATION_EDGE; @@ -1044,12 +1044,12 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 if (ok) { /* we need the transpose of the inverse for a normal... */ copy_m3_m4(imat, ob->obmat); - + invert_m3_m3(mat, imat); transpose_m3(mat); mul_m3_v3(mat, normal); mul_m3_v3(mat, plane); - + result = ORIENTATION_EDGE; } } @@ -1073,14 +1073,14 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 } } } - + if (ob) { copy_v3_v3(normal, ob->obmat[2]); copy_v3_v3(plane, ob->obmat[1]); } result = ORIENTATION_NORMAL; } - + return result; } |