Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_view.c
| Show First 20 Lines • Show All 605 Lines • ▼ Show 20 Lines | else { | ||||
| /* Solid background Color */ | /* Solid background Color */ | ||||
| UI_ThemeClearColorAlpha(TH_HIGH_GRAD, 1.0f); | UI_ThemeClearColorAlpha(TH_HIGH_GRAD, 1.0f); | ||||
| glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | ||||
| } | } | ||||
| } | } | ||||
| /* **************************** 3D Cursor ******************************** */ | /* **************************** 3D Cursor ******************************** */ | ||||
| static bool is_cursor_visible(Scene *scene, SceneLayer *scene_layer) | static bool is_cursor_visible(Scene *scene, ViewLayer *view_layer) | ||||
| { | { | ||||
| Object *ob = OBACT(scene_layer); | Object *ob = OBACT(view_layer); | ||||
| /* don't draw cursor in paint modes, but with a few exceptions */ | /* don't draw cursor in paint modes, but with a few exceptions */ | ||||
| if (ob && ob->mode & OB_MODE_ALL_PAINT) { | if (ob && ob->mode & OB_MODE_ALL_PAINT) { | ||||
| /* exception: object is in weight paint and has deforming armature in pose mode */ | /* exception: object is in weight paint and has deforming armature in pose mode */ | ||||
| if (ob->mode & OB_MODE_WEIGHT_PAINT) { | if (ob->mode & OB_MODE_WEIGHT_PAINT) { | ||||
| if (BKE_object_pose_armature_get(ob) != NULL) { | if (BKE_object_pose_armature_get(ob) != NULL) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| /* exception: object in texture paint mode, clone brush, use_clone_layer disabled */ | /* exception: object in texture paint mode, clone brush, use_clone_layer disabled */ | ||||
| else if (ob->mode & OB_MODE_TEXTURE_PAINT) { | else if (ob->mode & OB_MODE_TEXTURE_PAINT) { | ||||
| const Paint *p = BKE_paint_get_active(scene, scene_layer); | const Paint *p = BKE_paint_get_active(scene, view_layer); | ||||
| if (p && p->brush && p->brush->imagepaint_tool == PAINT_TOOL_CLONE) { | if (p && p->brush && p->brush->imagepaint_tool == PAINT_TOOL_CLONE) { | ||||
| if ((scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE) == 0) { | if ((scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE) == 0) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* no exception met? then don't draw cursor! */ | /* no exception met? then don't draw cursor! */ | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| void DRW_draw_cursor(void) | void DRW_draw_cursor(void) | ||||
| { | { | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| View3D *v3d = draw_ctx->v3d; | View3D *v3d = draw_ctx->v3d; | ||||
| RegionView3D *rv3d = draw_ctx->rv3d; | RegionView3D *rv3d = draw_ctx->rv3d; | ||||
| Scene *scene = draw_ctx->scene; | Scene *scene = draw_ctx->scene; | ||||
| SceneLayer *scene_layer = draw_ctx->scene_layer; | ViewLayer *view_layer = draw_ctx->view_layer; | ||||
| glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | ||||
| glDepthMask(GL_FALSE); | glDepthMask(GL_FALSE); | ||||
| glDisable(GL_DEPTH_TEST); | glDisable(GL_DEPTH_TEST); | ||||
| glLineWidth(1.0f); | glLineWidth(1.0f); | ||||
| if (is_cursor_visible(scene, scene_layer)) { | if (is_cursor_visible(scene, view_layer)) { | ||||
| float *co = ED_view3d_cursor3d_get(scene, v3d); | float *co = ED_view3d_cursor3d_get(scene, v3d); | ||||
| unsigned char crosshair_color[3]; | unsigned char crosshair_color[3]; | ||||
| const float f5 = 0.25f; | const float f5 = 0.25f; | ||||
| const float f10 = 0.5f; | const float f10 = 0.5f; | ||||
| const float f20 = 1.0f; | const float f20 = 1.0f; | ||||
| Gwn_VertFormat *format = immVertexFormat(); | Gwn_VertFormat *format = immVertexFormat(); | ||||
| ▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines | |||||