Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-10-04 02:24:35 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-04 02:37:18 +0300
commit55f62b94f861b3284ae813fd4d0ca9f1458f7ae5 (patch)
tree2de9959c24d5e999677a36feea2b4d8402a177a1 /source/blender/draw/intern/draw_view.c
parent971ab57c7df0b0ecdc948bc47a9bc133e35fb94f (diff)
DRW: minor tweaks to mode checking
Avoid accessing object mode via the view layer active object when drawing since it's done everywhere we store the active object mode in the draw-context.
Diffstat (limited to 'source/blender/draw/intern/draw_view.c')
-rw-r--r--source/blender/draw/intern/draw_view.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index a20460db356..d77620bc47b 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -136,17 +136,16 @@ void DRW_draw_background(void)
static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, ViewLayer *view_layer)
{
- Object *ob = OBACT(view_layer);
View3D *v3d = draw_ctx->v3d;
if ((v3d->flag2 & V3D_RENDER_OVERRIDE) || (v3d->overlay.flag & V3D_OVERLAY_HIDE_CURSOR)) {
return false;
}
/* don't draw cursor in paint modes, but with a few exceptions */
- if (ob && draw_ctx->object_mode & OB_MODE_ALL_PAINT) {
+ if (draw_ctx->object_mode & OB_MODE_ALL_PAINT) {
/* exception: object is in weight paint and has deforming armature in pose mode */
if (draw_ctx->object_mode & OB_MODE_WEIGHT_PAINT) {
- if (BKE_object_pose_armature_get(ob) != NULL) {
+ if (BKE_object_pose_armature_get(draw_ctx->obact) != NULL) {
return true;
}
}
@@ -164,10 +163,8 @@ static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, Vie
/* no exception met? then don't draw cursor! */
return false;
}
-
- /* grease pencil hide always in some modes */
- if ((ob) && (ob->mode == OB_MODE_GPENCIL_WEIGHT))
- {
+ else if (draw_ctx->object_mode & OB_MODE_GPENCIL_WEIGHT) {
+ /* grease pencil hide always in some modes */
return false;
}