diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-22 22:40:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-22 22:40:50 +0400 |
commit | 76bea854b6910ed64c94e6b34c531a150ffcb361 (patch) | |
tree | 3b02bdcc02ea682eb5d3037e371b34f2b0b9dd24 | |
parent | ea229638a007bdcf8155fc3f8b8baef96c893f0f (diff) |
code cleanup: replace cos(M_PI / 4) and sin(M_PI / 4) with M_SQRT1_2 define
also some minor style cleanup.
-rw-r--r-- | intern/itasc/Armature.cpp | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 4 | ||||
-rw-r--r-- | source/blender/python/generic/bpy_internal_import.c | 3 |
5 files changed, 12 insertions, 11 deletions
diff --git a/intern/itasc/Armature.cpp b/intern/itasc/Armature.cpp index 1dacb8bc184..78780ed8ba3 100644 --- a/intern/itasc/Armature.cpp +++ b/intern/itasc/Armature.cpp @@ -319,7 +319,7 @@ int Armature::addConstraint(const std::string& segment_name, ConstraintCallback return iConstraint; } } - if (m_finalized) { + if (m_finalized) { if (_freeParam && _param) free(_param); return -1; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 048560f3a83..fa394d4a951 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1688,16 +1688,16 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4]) if (cu->flag & CU_FOLLOW) { #if 0 - float x1, q[4]; + float si, q[4]; vec_to_quat(quat, dir, ob->trackflag, ob->upflag); /* the tilt */ normalize_v3(dir); q[0] = (float)cos(0.5 * vec[3]); - x1 = (float)sin(0.5 * vec[3]); - q[1] = -x1 * dir[0]; - q[2] = -x1 * dir[1]; - q[3] = -x1 * dir[2]; + si = (float)sin(0.5 * vec[3]); + q[1] = -si * dir[0]; + q[2] = -si * dir[1]; + q[3] = -si * dir[2]; mul_qt_qtqt(quat, q, quat); #else quat_apply_track(quat, ob->trackflag, ob->upflag); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index e3a78f526cd..6fbe75fb876 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2873,7 +2873,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) break; case RV3D_VIEW_BACK: - axis_set_view(C, v3d, ar, 0.0, 0.0, -cosf(M_PI / 4.0), -cosf(M_PI / 4.0), + axis_set_view(C, v3d, ar, 0.0, 0.0, -M_SQRT1_2, -M_SQRT1_2, viewnum, nextperspo, align_active); break; @@ -2888,7 +2888,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) break; case RV3D_VIEW_FRONT: - axis_set_view(C, v3d, ar, cosf(M_PI / 4.0), -sinf(M_PI / 4.0), 0.0, 0.0, + axis_set_view(C, v3d, ar, M_SQRT1_2, -M_SQRT1_2, 0.0, 0.0, viewnum, nextperspo, align_active); break; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 3abfda78ec3..f9776855d61 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1125,7 +1125,7 @@ int ED_view3d_lock(RegionView3D *rv3d) break; case RV3D_VIEW_BACK: - QUATSET(rv3d->viewquat, 0.0, 0.0, -cosf(M_PI / 4.0), -cosf(M_PI / 4.0)); + QUATSET(rv3d->viewquat, 0.0, 0.0, -M_SQRT1_2, -M_SQRT1_2); break; case RV3D_VIEW_LEFT: @@ -1137,7 +1137,7 @@ int ED_view3d_lock(RegionView3D *rv3d) break; case RV3D_VIEW_FRONT: - QUATSET(rv3d->viewquat, (float)cos(M_PI / 4.0), -sinf(M_PI / 4.0), 0.0, 0.0); + QUATSET(rv3d->viewquat, M_SQRT1_2, -M_SQRT1_2, 0.0, 0.0); break; case RV3D_VIEW_RIGHT: diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index d4158210cc8..b9ef4b056ad 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -157,7 +157,8 @@ PyObject *bpy_text_import_name(const char *name, int *found) } /* we know this cant be importable, the name is too long for blender! */ - if (namelen >= (MAX_ID_NAME - 2) - 3) return NULL; + if (namelen >= (MAX_ID_NAME - 2) - 3) + return NULL; memcpy(txtname, name, namelen); memcpy(&txtname[namelen], ".py", 4); |