code cleanup: Ctrl+Click extrude - replace inline axis/angle to matrix conversion with a call to axis_angle_to_mat3()
This commit is contained in:
@@ -805,29 +805,23 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent
|
|||||||
/* calculate rotation */
|
/* calculate rotation */
|
||||||
unit_m3(mat);
|
unit_m3(mat);
|
||||||
if (done) {
|
if (done) {
|
||||||
float dot;
|
float angle;
|
||||||
|
|
||||||
copy_v3_v3(vec, min);
|
normalize_v3_v3(vec, min);
|
||||||
normalize_v3(vec);
|
|
||||||
dot = dot_v3v3(vec, nor);
|
|
||||||
|
|
||||||
if (fabsf(dot) < 0.999f) {
|
angle = angle_normalized_v3v3(vec, nor);
|
||||||
float cross[3], si, q1[4];
|
|
||||||
|
|
||||||
cross_v3_v3v3(cross, nor, vec);
|
if (angle != 0.0f) {
|
||||||
normalize_v3(cross);
|
float axis[3];
|
||||||
dot = 0.5f * saacos(dot);
|
|
||||||
|
cross_v3_v3v3(axis, nor, vec);
|
||||||
|
|
||||||
/* halve the rotation if its applied twice */
|
/* halve the rotation if its applied twice */
|
||||||
if (rot_src) dot *= 0.5f;
|
if (rot_src) {
|
||||||
|
angle *= 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
si = sinf(dot);
|
axis_angle_to_mat3(mat, axis, angle);
|
||||||
q1[0] = cosf(dot);
|
|
||||||
q1[1] = cross[0] * si;
|
|
||||||
q1[2] = cross[1] * si;
|
|
||||||
q1[3] = cross[2] * si;
|
|
||||||
normalize_qt(q1);
|
|
||||||
quat_to_mat3(mat, q1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -103,7 +103,8 @@ void ED_sculpt_force_update(bContext *C)
|
|||||||
|
|
||||||
/* Sculpt mode handles multires differently from regular meshes, but only if
|
/* Sculpt mode handles multires differently from regular meshes, but only if
|
||||||
* it's the last modifier on the stack and it is not on the first level */
|
* it's the last modifier on the stack and it is not on the first level */
|
||||||
struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob){
|
struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
|
||||||
|
{
|
||||||
Mesh *me = (Mesh *)ob->data;
|
Mesh *me = (Mesh *)ob->data;
|
||||||
ModifierData *md;
|
ModifierData *md;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user