diff options
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw_legacy.c | 27 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 19 |
2 files changed, 21 insertions, 25 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 6a746ffe27c..775169e0b45 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -212,31 +212,31 @@ static void draw_view_icon(RegionView3D *rv3d, rcti *rect) /* *********************** backdraw for selection *************** */ static void backdrawview3d( - const struct EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, - ARegion *ar, View3D *v3d) + const struct EvaluationContext *eval_ctx, Scene *scene, + ARegion *ar, View3D *v3d, + Object *obact, Object *obedit) { RegionView3D *rv3d = ar->regiondata; - struct Base *base = view_layer->basact; BLI_assert(ar->regiontype == RGN_TYPE_WINDOW); - if (base && (eval_ctx->object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) || - BKE_paint_select_face_test(base->object, eval_ctx->object_mode))) + if (obact && (eval_ctx->object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) || + BKE_paint_select_face_test(obact, eval_ctx->object_mode))) { /* do nothing */ } /* texture paint mode sampling */ - else if (base && (eval_ctx->object_mode & OB_MODE_TEXTURE_PAINT) && + else if (obact && (eval_ctx->object_mode & OB_MODE_TEXTURE_PAINT) && (v3d->drawtype > OB_WIRE)) { /* do nothing */ } - else if ((base && (eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT)) && + else if ((obact && (eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT)) && V3D_IS_ZBUF(v3d)) { /* do nothing */ } - else if ((eval_ctx->object_mode & OB_MODE_EDIT) && + else if ((eval_ctx->object_mode & OB_MODE_EDIT) && (obedit != NULL) && V3D_IS_ZBUF(v3d)) { /* do nothing */ @@ -310,10 +310,11 @@ static void backdrawview3d( ED_view3d_clipping_set(rv3d); G.f |= G_BACKBUFSEL; - - if (base && ((base->flag & BASE_VISIBLED) != 0)) - draw_object_backbufsel(eval_ctx, scene, v3d, rv3d, base->object); - + + if (obact && ((obact->base_flag & BASE_VISIBLED) != 0)) { + draw_object_backbufsel(eval_ctx, scene, v3d, rv3d, obact); + } + if (rv3d->gpuoffscreen) GPU_offscreen_unbind(rv3d->gpuoffscreen, true); else @@ -354,7 +355,7 @@ static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h, void ED_view3d_backbuf_validate(const struct EvaluationContext *eval_ctx, ViewContext *vc) { if (vc->v3d->flag & V3D_INVALID_BACKBUF) { - backdrawview3d(eval_ctx, vc->scene, vc->view_layer, vc->ar, vc->v3d); + backdrawview3d(eval_ctx, vc->scene, vc->ar, vc->v3d, vc->obact, vc->obedit); } } diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index d1644a11adc..8c3ee6da012 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -2812,24 +2812,22 @@ static bool object_circle_select(ViewContext *vc, const bool select, const int m /* not a real operator, only for circle test */ static int view3d_circle_select_exec(bContext *C, wmOperator *op) { + ViewContext vc; + view3d_set_viewcontext(C, &vc); + Object *obact = vc.obact; + Object *obedit = vc.obedit; EvaluationContext eval_ctx; CTX_data_eval_ctx(C, &eval_ctx); - Scene *scene = CTX_data_scene(C); - Object *obact = CTX_data_active_object(C); const int radius = RNA_int_get(op->ptr, "radius"); const bool select = !RNA_boolean_get(op->ptr, "deselect"); const int mval[2] = {RNA_int_get(op->ptr, "x"), RNA_int_get(op->ptr, "y")}; - if (CTX_data_edit_object(C) || BKE_paint_select_elem_test(obact, eval_ctx.object_mode) || + if (obedit || BKE_paint_select_elem_test(obact, eval_ctx.object_mode) || (obact && (eval_ctx.object_mode & (OB_MODE_PARTICLE_EDIT | OB_MODE_POSE))) ) { - ViewContext vc; - view3d_operator_needs_opengl(C); - view3d_set_viewcontext(C, &vc); - if (CTX_data_edit_object(C)) { obedit_circle_select(&eval_ctx, &vc, select, mval, (float)radius); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data); @@ -2851,14 +2849,11 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } else { - ViewContext vc; - view3d_set_viewcontext(C, &vc); - if (object_circle_select(&vc, select, mval, (float)radius)) { - WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc.scene); } } - + return OPERATOR_FINISHED; } |