[Bf-blender-cvs] [01acc0d59f8] HMD_viewport: Move drawing matrix setup into own function
Julian Eisel
noreply at git.blender.org
Thu Apr 13 19:48:44 CEST 2017
Commit: 01acc0d59f8176f8af64c7e930a822391e893d1d
Author: Julian Eisel
Date: Thu Apr 13 19:26:35 2017 +0200
Branches: HMD_viewport
https://developer.blender.org/rB01acc0d59f8176f8af64c7e930a822391e893d1d
Move drawing matrix setup into own function
===================================================================
M source/blender/editors/curve/editcurve_paint.c
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_utils.c
M source/blender/editors/include/ED_view3d.h
M source/blender/editors/interface/interface_eyedropper.c
M source/blender/editors/sculpt_paint/paint_image_proj.c
M source/blender/editors/space_view3d/view3d_draw.c
M source/blender/editors/space_view3d/view3d_edit.c
M source/blender/editors/space_view3d/view3d_intern.h
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/intern/wm_stereo.c
===================================================================
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index 6c496914143..4f4788c263f 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -1162,14 +1162,15 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if ((cps->depth_mode == CURVE_PAINT_PROJECT_SURFACE) &&
(v3d->drawtype > OB_WIRE))
{
- const bool is_hmd_view = WM_window_is_running_hmd_view(CTX_wm_window(C));
+ const wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *win = CTX_wm_window(C);
view3d_get_transformation(cdd->vc.ar, cdd->vc.rv3d, NULL, &cdd->mats);
/* needed or else the draw matrix can be incorrect */
view3d_operator_needs_opengl(C);
- ED_view3d_autodist_init(cdd->vc.scene, cdd->vc.ar, cdd->vc.v3d, 0, is_hmd_view);
+ ED_view3d_autodist_init(cdd->vc.scene, wm, win, cdd->vc.ar, cdd->vc.v3d, 0);
if (cdd->vc.rv3d->depths) {
cdd->vc.rv3d->depths->damaged = true;
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index de0d79b5a64..bb99971da45 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -2010,10 +2010,11 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op)
/* init autodist for geometry projection */
if (mode == GP_REPROJECT_SURFACE) {
- const bool is_hmd_view = WM_window_is_running_hmd_view(CTX_wm_window(C));
+ const wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *win = CTX_wm_window(C);
- view3d_region_operator_needs_opengl(CTX_wm_window(C), gsc.ar);
- ED_view3d_autodist_init(scene, gsc.ar, CTX_wm_view3d(C), 0, is_hmd_view);
+ view3d_region_operator_needs_opengl(win, gsc.ar);
+ ED_view3d_autodist_init(scene, wm, win, gsc.ar, CTX_wm_view3d(C), 0);
}
// TODO: For deforming geometry workflow, create new frames?
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 5068bad4f9c..4f1ff1eb013 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -114,6 +114,7 @@ typedef enum eGPencil_PaintFlags {
typedef struct tGPsdata {
Scene *scene; /* current scene from context */
+ wmWindowManager *wm; /* window-manager where painting originated */
wmWindow *win; /* window where painting originated */
ScrArea *sa; /* area where painting originated */
ARegion *ar; /* region where painting originated */
@@ -634,12 +635,10 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure,
*/
if (gpencil_project_check(p)) {
View3D *v3d = p->sa->spacedata.first;
- const bool is_hmd_view = WM_window_is_running_hmd_view(p->win);
view3d_region_operator_needs_opengl(p->win, p->ar);
- ED_view3d_autodist_init(p->scene, p->ar, v3d,
- (p->gpd->flag & GP_DATA_DEPTH_STROKE) ? 1 : 0,
- is_hmd_view);
+ ED_view3d_autodist_init(p->scene, p->wm, p->win, p->ar, v3d,
+ (p->gpd->flag & GP_DATA_DEPTH_STROKE) ? 1 : 0);
}
/* convert screen-coordinates to appropriate coordinates (and store them) */
@@ -1239,10 +1238,9 @@ static void gp_stroke_doeraser(tGPsdata *p)
if (p->sa->spacetype == SPACE_VIEW3D) {
if (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH) {
View3D *v3d = p->sa->spacedata.first;
- const bool is_hmd_view = WM_window_is_running_hmd_view(p->win);
view3d_region_operator_needs_opengl(p->win, p->ar);
- ED_view3d_autodist_init(p->scene, p->ar, v3d, 0, is_hmd_view);
+ ED_view3d_autodist_init(p->scene, p->wm, p->win, p->ar, v3d, 0);
}
}
@@ -1396,6 +1394,7 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
/* pass on context info */
p->scene = CTX_data_scene(C);
+ p->wm = CTX_wm_manager(C);
p->win = CTX_wm_window(C);
unit_m4(p->imat);
@@ -1803,11 +1802,11 @@ static void gp_paint_strokeend(tGPsdata *p)
*/
if (gpencil_project_check(p)) {
View3D *v3d = p->sa->spacedata.first;
- const bool is_hmd_view = WM_window_is_running_hmd_view(p->win);
/* need to restore the original projection settings before packing up */
view3d_region_operator_needs_opengl(p->win, p->ar);
- ED_view3d_autodist_init(p->scene, p->ar, v3d, (p->gpd->flag & GP_DATA_DEPTH_STROKE) ? 1 : 0, is_hmd_view);
+ ED_view3d_autodist_init(p->scene, p->wm, p->win, p->ar, v3d,
+ (p->gpd->flag & GP_DATA_DEPTH_STROKE) ? 1 : 0);
}
/* check if doing eraser or not */
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 8123d2f9b1b..f4925f59d7a 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -519,17 +519,17 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
/* init region-specific stuff */
if (sa->spacetype == SPACE_VIEW3D) {
+ const wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d = (View3D *)CTX_wm_space_data(C);
RegionView3D *rv3d = ar->regiondata;
- const bool is_hmd_view = WM_window_is_running_hmd_view(CTX_wm_window(C));
/* init 3d depth buffers */
view3d_operator_needs_opengl(C);
view3d_region_operator_needs_opengl(win, ar);
- ED_view3d_autodist_init(scene, ar, v3d, 0, is_hmd_view);
+ ED_view3d_autodist_init(scene, wm, win, ar, v3d, 0);
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 04214cb4b8e..64de4d816b0 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -289,15 +289,17 @@ int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float
unsigned int ED_view3d_backbuf_sample(struct ViewContext *vc, int x, int y);
bool ED_view3d_autodist(
- struct Scene *scene, struct ARegion *ar, struct View3D *v3d,
+ struct Scene *scene,
+ const struct wmWindowManager *wm, const struct wmWindow *win,
+ struct ARegion *ar, struct View3D *v3d,
const int mval[2], float mouse_worldloc[3],
- const bool alphaoverride, const bool is_hmd_view,
- const float fallback_depth_pt[3]);
+ const bool alphaoverride, const float fallback_depth_pt[3]);
/* only draw so ED_view3d_autodist_simple can be called many times after */
void ED_view3d_autodist_init(
- struct Scene *scene, struct ARegion *ar, struct View3D *v3d,
- int mode, bool is_hmd_view);
+ struct Scene *scene,
+ const struct wmWindowManager *wm, const struct wmWindow *win,
+ struct ARegion *ar, struct View3D *v3d, int mode);
bool ED_view3d_autodist_simple(struct ARegion *ar, const int mval[2], float mouse_worldloc[3], int margin, float *force_depth);
bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
bool ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index ab2c7389c08..5c2be9bb5f5 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -888,7 +888,6 @@ static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx,
Scene *scene = win->screen->scene;
UnitSettings *unit = &scene->unit;
const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0;
- const bool is_hmd_view = WM_window_is_running_hmd_view(win);
ScrArea *area_prev = CTX_wm_area(C);
ARegion *ar_prev = CTX_wm_region(C);
@@ -916,7 +915,7 @@ static void depthdropper_depth_sample_pt(bContext *C, DepthDropper *ddr, int mx,
view3d_operator_needs_opengl(C);
- if (ED_view3d_autodist(scene, ar, v3d, mval, co, true, is_hmd_view, NULL)) {
+ if (ED_view3d_autodist(scene, CTX_wm_manager(C), win, ar, v3d, mval, co, true, NULL)) {
const float mval_center_fl[2] = {
(float)ar->winx / 2,
(float)ar->winy / 2};
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 7328feb241b..ed0807cde6d 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -5021,11 +5021,10 @@ void paint_proj_stroke(
ARegion *ar = CTX_wm_region(C);
float *cursor = ED_view3d_cursor3d_get(scene, v3d);
int mval_i[2] = {(int)pos[0], (int)pos[1]};
- const bool is_hmd_view = WM_window_is_running_hmd_view(CTX_wm_window(C));
view3d_operator_needs_opengl(C);
- if (!ED_view3d_autodist(scene, ar, v3d, mval_i, cursor, false, is_hmd_view, NULL))
+ if (!ED_view3d_autodist(scene, CTX_wm_manager(C), CTX_wm_window(C), ar, v3d, mval_i, cursor, false, NULL))
return;
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index e1ec7538937..446cfbed21c 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -105,6 +105,10 @@
#include "view3d_intern.h" /* own include */
/* prototypes */
+static void view3d_setup_drawing(
+ const wmWindowManager *wm, const wmWindow *win,
+ ARegion *region, View3D *v3d, RegionView3D *rv3d,
+ Scene *scene, bool skip_stereo3d);
static void view3d_hmd_view_setup(
Scene *scene, View3D *v3d, ARegion *region);
static bool view3d_is_hmd_view_mirror(
@@ -117,6 +121,8 @@ static void view3d_hmd_view_setup_interaction(
static void view3d_stereo3d_setup(Scene *scene, View3D *v3d, ARegion *ar);
static void view3d_stereo3d_setup_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
float winm
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list