diff options
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_utils.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_utils.c | 54 |
1 files changed, 20 insertions, 34 deletions
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index 377e8c58ba3..bd2323f47f4 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -94,7 +94,7 @@ bool ED_view3d_has_workbench_in_texture_color(const Scene *scene, if (v3d->shading.color_type == V3D_SHADING_TEXTURE_COLOR) { return true; } - if (ob->mode == OB_MODE_TEXTURE_PAINT) { + if (ob && ob->mode == OB_MODE_TEXTURE_PAINT) { return true; } } @@ -113,9 +113,7 @@ Camera *ED_view3d_camera_data_get(View3D *v3d, RegionView3D *rv3d) if ((rv3d->persp == RV3D_CAMOB) && v3d->camera && (v3d->camera->type == OB_CAMERA)) { return v3d->camera->data; } - else { - return NULL; - } + return NULL; } void ED_view3d_dist_range_get(const View3D *v3d, float r_dist_range[2]) @@ -222,7 +220,7 @@ void view3d_region_operator_needs_opengl(wmWindow *UNUSED(win), ARegion *region) } /** - * Use instead of: ``bglPolygonOffset(rv3d->dist, ...)`` see bug [#37727] + * Use instead of: ``GPU_polygon_offset(rv3d->dist, ...)`` see bug [#37727] */ void ED_view3d_polygon_offset(const RegionView3D *rv3d, const float dist) { @@ -243,7 +241,7 @@ void ED_view3d_polygon_offset(const RegionView3D *rv3d, const float dist) } } - bglPolygonOffset(viewdist, dist); + GPU_polygon_offset(viewdist, dist); } bool ED_view3d_context_activate(bContext *C) @@ -602,9 +600,7 @@ bool ED_view3d_camera_lock_sync(const Depsgraph *depsgraph, View3D *v3d, RegionV return true; } - else { - return false; - } + return false; } bool ED_view3d_camera_autokey(const Scene *scene, @@ -639,9 +635,7 @@ bool ED_view3d_camera_autokey(const Scene *scene, return true; } - else { - return false; - } + return false; } /** @@ -673,9 +667,7 @@ bool ED_view3d_camera_lock_autokey(View3D *v3d, return ED_view3d_camera_autokey(scene, id_key, C, do_rotate, do_translate); } - else { - return false; - } + return false; } /** \} */ @@ -1017,9 +1009,7 @@ bool ED_view3d_autodist(Depsgraph *depsgraph, ED_view3d_win_to_3d_int(v3d, region, fallback_depth_pt, mval, mouse_worldloc); return true; } - else { - return false; - } + return false; } void ED_view3d_autodist_init(Depsgraph *depsgraph, ARegion *region, View3D *v3d, int mode) @@ -1038,8 +1028,11 @@ void ED_view3d_autodist_init(Depsgraph *depsgraph, ARegion *region, View3D *v3d, } /* no 4x4 sampling, run #ED_view3d_autodist_init first */ -bool ED_view3d_autodist_simple( - ARegion *region, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth) +bool ED_view3d_autodist_simple(ARegion *region, + const int mval[2], + float mouse_worldloc[3], + int margin, + const float *force_depth) { float depth; @@ -1086,9 +1079,7 @@ static bool depth_segment_cb(int x, int y, void *userData) data->depth = depth; return 0; } - else { - return 1; - } + return 1; } bool ED_view3d_autodist_depth_seg( @@ -1390,9 +1381,7 @@ bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, f copy_qt_qt(quat, view3d_quat_axis[view - RV3D_VIEW_FRONT][view_axis_roll]); return true; } - else { - return false; - } + return false; } bool ED_view3d_quat_to_axis_view(const float quat[4], @@ -1472,7 +1461,7 @@ bool ED_view3d_lock(RegionView3D *rv3d) * \param quat: The view rotation, quaternion normally from RegionView3D.viewquat. * \param dist: The view distance from ofs, normally from RegionView3D.dist. */ -void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], float *dist) +void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], const float *dist) { float nmat[3][3]; @@ -1575,10 +1564,9 @@ float ED_view3d_depth_read_cached(const ViewContext *vc, const int mval[2]) if (vd && vd->depths && x > 0 && y > 0 && x < vd->w && y < vd->h) { return vd->depths[y * vd->w + x]; } - else { - BLI_assert(1.0 <= vd->depth_range[1]); - return 1.0f; - } + + BLI_assert(1.0 <= vd->depth_range[1]); + return 1.0f; } bool ED_view3d_depth_read_cached_normal(const ViewContext *vc, @@ -1633,9 +1621,7 @@ bool ED_view3d_depth_read_cached_normal(const ViewContext *vc, if (normalize_v3(r_normal) != 0.0f) { return true; } - else { - return false; - } + return false; } bool ED_view3d_depth_unproject(const ARegion *region, |