diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 17 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 4 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_manipulator.c | 29 |
5 files changed, 38 insertions, 34 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 8d7edf1b044..2ccba2e35f0 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -742,8 +742,8 @@ typedef struct uiSearchboxData { uiFontStyle fstyle; uiSearchItems items; int active; /* index in items array */ - int noback; /* when menu opened with enough space for this */ - int preview; /* draw thumbnail previews, rather than list */ + bool noback; /* when menu opened with enough space for this */ + bool preview; /* draw thumbnail previews, rather than list */ int prv_rows, prv_cols; } uiSearchboxData; @@ -1023,7 +1023,7 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) /* pixel space */ wmOrtho2(-0.01f, ar->winx - 0.01f, -0.01f, ar->winy - 0.01f); - if (!data->noback) + if (data->noback == false) ui_draw_search_back(NULL, NULL, &data->bbox); /* style not used yet */ /* draw text */ @@ -1136,10 +1136,10 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) /* special case, hardcoded feature, not draw backdrop when called from menus, * assume for design that popup already added it */ if (but->block->flag & UI_BLOCK_SEARCH_MENU) - data->noback = 1; + data->noback = true; if (but->a1 > 0 && but->a2 > 0) { - data->preview = 1; + data->preview = true; data->prv_rows = but->a1; data->prv_cols = but->a2; } diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index cb685b59b64..2ff52b51069 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1573,8 +1573,8 @@ static void draw_pose_dofs(Object *ob) for (i = 0; i < 3; i++) { /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */ - amin[i] = (float)sin(pchan->limitmin[i] * 0.5f); - amax[i] = (float)sin(pchan->limitmax[i] * 0.5f); + amin[i] = sinf(pchan->limitmin[i] * 0.5f); + amax[i] = sinf(pchan->limitmax[i] * 0.5f); } glScalef(1.0f, -1.0f, 1.0f); @@ -1605,8 +1605,8 @@ static void draw_pose_dofs(Object *ob) phi = fac * (pchan->limitmax[2] - pchan->limitmin[2]); i = (a == -16) ? 0 : 1; - corner[i][0] = (float)sin(phi); - corner[i][1] = (float)cos(phi); + corner[i][0] = sinf(phi); + corner[i][1] = cosf(phi); corner[i][2] = 0.0f; glVertex3fv(corner[i]); } @@ -1629,8 +1629,8 @@ static void draw_pose_dofs(Object *ob) i = (a == -16) ? 2 : 3; corner[i][0] = 0.0f; - corner[i][1] = (float)sin(phi); - corner[i][2] = (float)cos(phi); + corner[i][1] = sinf(phi); + corner[i][2] = cosf(phi); glVertex3fv(corner[i]); } glEnd(); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 9dbdd8a9789..cbbc342bb6e 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -365,7 +365,8 @@ typedef struct ViewOpsData { float viewquat[4]; /* working copy of rv3d->viewquat */ float trackvec[3]; float mousevec[3]; /* dolly only */ - float reverse, dist0, camzoom0; + float reverse; + float dist_prev, camzoom_prev; float grid, far; bool axis_snap; /* view rotate only */ float zfac; @@ -425,8 +426,8 @@ static void viewops_data_create(bContext *C, wmOperator *op, const wmEvent *even * we may want to make this optional but for now its needed always */ ED_view3d_camera_lock_init(vod->v3d, vod->rv3d); - vod->dist0 = rv3d->dist; - vod->camzoom0 = rv3d->camzoom; + vod->dist_prev = rv3d->dist; + vod->camzoom_prev = rv3d->camzoom; copy_qt_qt(vod->viewquat, rv3d->viewquat); copy_qt_qt(vod->oldquat, rv3d->viewquat); vod->origx = vod->oldx = event->x; @@ -484,7 +485,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, const wmEvent *even /* find a new ofs value that is along the view axis (rather than the mouse location) */ closest_to_line_v3(dvec, vod->dyn_ofs, my_pivot, my_origin); - vod->dist0 = rv3d->dist = len_v3v3(my_pivot, dvec); + vod->dist_prev = rv3d->dist = len_v3v3(my_pivot, dvec); negate_v3_v3(rv3d->ofs, dvec); } @@ -1711,7 +1712,7 @@ static void viewzoom_apply(ViewOpsData *vod, const int x, const int y, const sho if (use_cam_zoom) { float delta; delta = (x - vod->origx + y - vod->origy) / 10.0f; - vod->rv3d->camzoom = vod->camzoom0 + (zoom_invert ? -delta : delta); + vod->rv3d->camzoom = vod->camzoom_prev + (zoom_invert ? -delta : delta); CLAMP(vod->rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX); } @@ -1746,7 +1747,7 @@ static void viewzoom_apply(ViewOpsData *vod, const int x, const int y, const sho len1 = (int)sqrt((ctr[0] - x) * (ctr[0] - x) + (ctr[1] - y) * (ctr[1] - y)) + 5; len2 = (int)sqrt((ctr[0] - vod->origx) * (ctr[0] - vod->origx) + (ctr[1] - vod->origy) * (ctr[1] - vod->origy)) + 5; - zfac = vod->dist0 * ((float)len2 / len1) / vod->rv3d->dist; + zfac = vod->dist_prev * ((float)len2 / len1) / vod->rv3d->dist; } else { /* USER_ZOOM_DOLLY */ float len1, len2; @@ -1766,11 +1767,11 @@ static void viewzoom_apply(ViewOpsData *vod, const int x, const int y, const sho if (use_cam_zoom) { /* zfac is ignored in this case, see below */ #if 0 - zfac = vod->camzoom0 * (2.0f * ((len1 / len2) - 1.0f) + 1.0f) / vod->rv3d->camzoom; + zfac = vod->camzoom_prev * (2.0f * ((len1 / len2) - 1.0f) + 1.0f) / vod->rv3d->camzoom; #endif } else { - zfac = vod->dist0 * (2.0f * ((len1 / len2) - 1.0f) + 1.0f) / vod->rv3d->dist; + zfac = vod->dist_prev * (2.0f * ((len1 / len2) - 1.0f) + 1.0f) / vod->rv3d->dist; } } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 64e49abd761..a6da770ed97 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2757,8 +2757,8 @@ int Warp(TransInfo *t, const int UNUSED(mval[2])) vec[1] = (vec[1] - cursor[1]); - co = (float)cos(phi0); - si = (float)sin(phi0); + co = cosf(phi0); + si = sinf(phi0); loc[0] = -si * vec[1] + cursor[0]; loc[1] = co * vec[1] + cursor[1]; loc[2] = vec[2]; diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 41a3418ada9..36a64303156 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -719,13 +719,13 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i side_delta = 2.0f * (float)M_PI / (float)nsides; theta = (float)M_PI + 0.5f * ring_delta; - cos_theta = (float)cos(theta); - sin_theta = (float)sin(theta); + cos_theta = cosf(theta); + sin_theta = sinf(theta); for (i = nrings - 1; i >= 0; i--) { theta1 = theta + ring_delta; - cos_theta1 = (float)cos(theta1); - sin_theta1 = (float)sin(theta1); + cos_theta1 = cosf(theta1); + sin_theta1 = sinf(theta1); if (do_caps && i == start) { // cap glBegin(GL_POLYGON); @@ -766,8 +766,8 @@ static void partial_doughnut(float radring, float radhole, int start, int end, i float cos_phi, sin_phi, dist; phi -= side_delta; - cos_phi = (float)cos(phi); - sin_phi = (float)sin(phi); + cos_phi = cosf(phi); + sin_phi = sinf(phi); dist = radhole + radring * cos_phi; glVertex3f(cos_theta * dist, -sin_theta * dist, radring * sin_phi); @@ -1635,15 +1635,18 @@ void BIF_draw_manipulator(const bContext *C) switch (v3d->around) { case V3D_CENTER: case V3D_ACTIVE: - rv3d->twmat[3][0] = (scene->twmin[0] + scene->twmax[0]) / 2.0f; - rv3d->twmat[3][1] = (scene->twmin[1] + scene->twmax[1]) / 2.0f; - rv3d->twmat[3][2] = (scene->twmin[2] + scene->twmax[2]) / 2.0f; - if (v3d->around == V3D_ACTIVE && scene->obedit == NULL) { - Object *ob = OBACT; - if (ob && !(ob->mode & OB_MODE_POSE)) - copy_v3_v3(rv3d->twmat[3], ob->obmat[3]); + { + Object *ob; + if (((v3d->around == V3D_ACTIVE) && (scene->obedit == NULL)) && + ((ob = OBACT) && !(ob->mode & OB_MODE_POSE))) + { + copy_v3_v3(rv3d->twmat[3], ob->obmat[3]); + } + else { + mid_v3_v3v3(rv3d->twmat[3], scene->twmin, scene->twmax); } break; + } case V3D_LOCAL: case V3D_CENTROID: copy_v3_v3(rv3d->twmat[3], scene->twcent); |