Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_constraints.c
| Show First 20 Lines • Show All 554 Lines • ▼ Show 20 Lines | static void constraints_rotation_imp(TransInfo *t, | ||||
| float *r_angle) | float *r_angle) | ||||
| { | { | ||||
| BLI_assert(t->con.mode & CON_APPLY); | BLI_assert(t->con.mode & CON_APPLY); | ||||
| int mode = t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2); | int mode = t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2); | ||||
| switch (mode) { | switch (mode) { | ||||
| case CON_AXIS0: | case CON_AXIS0: | ||||
| case (CON_AXIS1 | CON_AXIS2): | case (CON_AXIS1 | CON_AXIS2): | ||||
| negate_v3_v3(r_vec, axismtx[0]); | copy_v3_v3(r_vec, axismtx[0]); | ||||
| break; | break; | ||||
| case CON_AXIS1: | case CON_AXIS1: | ||||
| case (CON_AXIS0 | CON_AXIS2): | case (CON_AXIS0 | CON_AXIS2): | ||||
| negate_v3_v3(r_vec, axismtx[1]); | copy_v3_v3(r_vec, axismtx[1]); | ||||
| break; | break; | ||||
| case CON_AXIS2: | case CON_AXIS2: | ||||
| case (CON_AXIS0 | CON_AXIS1): | case (CON_AXIS0 | CON_AXIS1): | ||||
| negate_v3_v3(r_vec, axismtx[2]); | copy_v3_v3(r_vec, axismtx[2]); | ||||
| break; | break; | ||||
| } | } | ||||
| /* don't flip axis if asked to or if num input */ | /* don't flip axis if asked to or if num input */ | ||||
| if (r_angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) { | if (r_angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) { | ||||
| float view_vector[3]; | float view_vector[3]; | ||||
| view_vector_calc(t, t->center_global, view_vector); | view_vector_calc(t, t->center_global, view_vector); | ||||
| if (dot_v3v3(r_vec, view_vector) > 0.0f) { | if (dot_v3v3(r_vec, view_vector) > 0.0f) { | ||||
| *r_angle = -(*r_angle); | *r_angle = -(*r_angle); | ||||
| ▲ Show 20 Lines • Show All 614 Lines • Show Last 20 Lines | |||||