diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-28 08:22:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-28 08:29:32 +0300 |
commit | d386d4e7c4fd256b41dacfd011e9d3082b7654d5 (patch) | |
tree | 0305a138e71e0fe6bfc6fd4975d332159a685e67 /source/blender/editors/space_view3d/view3d_utils.c | |
parent | 9a5d198cd25b82893f61a336f6e20b8a63163ff2 (diff) |
Cleanup: use doxy sections for view3d_view.c
Also move ..._needs_opengl functions into view3d_utils.c
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_utils.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_utils.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index e40a4b3f9f6..e06ae89fa89 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -144,6 +144,35 @@ bool ED_view3d_viewplane_get( * \{ */ /** + * Use this call when executing an operator, + * event system doesn't set for each event the OpenGL drawing context. + */ +void view3d_operator_needs_opengl(const bContext *C) +{ + wmWindow *win = CTX_wm_window(C); + ARegion *ar = CTX_wm_region(C); + + view3d_region_operator_needs_opengl(win, ar); +} + +void view3d_region_operator_needs_opengl(wmWindow *win, ARegion *ar) +{ + /* for debugging purpose, context should always be OK */ + if ((ar == NULL) || (ar->regiontype != RGN_TYPE_WINDOW)) { + printf("view3d_region_operator_needs_opengl error, wrong region\n"); + } + else { + RegionView3D *rv3d = ar->regiondata; + + wmSubWindowSet(win, ar->swinid); + glMatrixMode(GL_PROJECTION); + glLoadMatrixf(rv3d->winmat); + glMatrixMode(GL_MODELVIEW); + glLoadMatrixf(rv3d->viewmat); + } +} + +/** * Use instead of: ``bglPolygonOffset(rv3d->dist, ...)`` see bug [#37727] */ void ED_view3d_polygon_offset(const RegionView3D *rv3d, const float dist) |