remove unused code & some redundant NULL checks.

This commit is contained in:
Campbell Barton
2013-07-27 16:39:00 +00:00
parent aaa284f505
commit 52e54d3c01
2 changed files with 5 additions and 68 deletions

View File

@@ -420,7 +420,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
/* note; this sets state, so we can use wmOrtho and friends */
wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
UI_SetTheme(sa ? sa->spacetype : 0, ar->type ? ar->type->regionid : 0);
UI_SetTheme(sa ? sa->spacetype : 0, at->regionid);
/* optional header info instead? */
if (ar->headerstr) {

View File

@@ -202,7 +202,7 @@ void view3d_smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera
}
/* skip smooth viewing for render engine draw */
if (C && U.smooth_viewtx && v3d->drawtype != OB_RENDER) {
if (U.smooth_viewtx && v3d->drawtype != OB_RENDER) {
bool changed = false; /* zero means no difference */
if (oldcamera != camera)
@@ -753,7 +753,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect)
glGetFloatv(GL_PROJECTION_MATRIX, (float *)rv3d->winmat);
}
static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short smooth)
static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob)
{
float bmat[4][4];
float tmat[3][3];
@@ -766,36 +766,7 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
/* view quat calculation, needed for add object */
copy_m3_m4(tmat, rv3d->viewmat);
if (smooth) {
float new_quat[4];
if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
/* were from a camera view */
float orig_ofs[3];
float orig_dist = rv3d->dist;
float orig_lens = v3d->lens;
copy_v3_v3(orig_ofs, rv3d->ofs);
/* Switch from camera view */
mat3_to_quat(new_quat, tmat);
rv3d->persp = RV3D_PERSP;
rv3d->dist = 0.0;
ED_view3d_from_object(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
view3d_smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); /* XXX */
rv3d->persp = RV3D_CAMOB; /* just to be polite, not needed */
}
else {
mat3_to_quat(new_quat, tmat);
view3d_smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); /* XXX */
}
}
else {
mat3_to_quat(rv3d->viewquat, tmat);
}
mat3_to_quat(rv3d->viewquat, tmat);
}
#define QUATSET(a, b, c, d, e) { a[0] = b; a[1] = c; a[2] = d; a[3] = e; } (void)0
@@ -839,7 +810,7 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
if (rv3d->persp == RV3D_CAMOB) { /* obs/camera */
if (v3d->camera) {
BKE_object_where_is_calc(scene, v3d->camera);
obmat_to_viewmat(v3d, rv3d, v3d->camera, 0);
obmat_to_viewmat(rv3d, v3d->camera);
}
else {
quat_to_mat4(rv3d->viewmat, rv3d->viewquat);
@@ -1562,40 +1533,6 @@ void VIEW3D_OT_game_start(wmOperatorType *ot)
/* ************************************** */
static void UNUSED_FUNCTION(view3d_align_axis_to_vector)(View3D *v3d, RegionView3D *rv3d, int axisidx, float vec[3])
{
float alignaxis[3] = {0.0, 0.0, 0.0};
float norm[3], axis[3], angle, new_quat[4];
if (axisidx > 0) alignaxis[axisidx - 1] = 1.0;
else alignaxis[-axisidx - 1] = -1.0;
normalize_v3_v3(norm, vec);
angle = (float)acos(dot_v3v3(alignaxis, norm));
cross_v3_v3v3(axis, alignaxis, norm);
axis_angle_to_quat(new_quat, axis, -angle);
rv3d->view = RV3D_VIEW_USER;
if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
/* switch out of camera view */
float orig_ofs[3];
float orig_dist = rv3d->dist;
float orig_lens = v3d->lens;
copy_v3_v3(orig_ofs, rv3d->ofs);
rv3d->persp = RV3D_PERSP;
rv3d->dist = 0.0;
ED_view3d_from_object(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
view3d_smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); /* XXX */
}
else {
if (rv3d->persp == RV3D_CAMOB) rv3d->persp = RV3D_PERSP; /* switch out of camera mode */
view3d_smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); /* XXX */
}
}
float ED_view3d_pixel_size(RegionView3D *rv3d, const float co[3])
{
return mul_project_m4_v3_zfac(rv3d->persmat, co) * rv3d->pixsize * U.pixelsize;