diff options
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_draw.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index f3300f21628..d4c85eeb3d2 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -31,6 +31,7 @@ #include "BLI_string_utils.h" #include "BLI_threads.h" +#include "BKE_armature.h" #include "BKE_camera.h" #include "BKE_collection.h" #include "BKE_context.h" @@ -62,7 +63,6 @@ #include "DRW_engine.h" #include "DRW_select_buffer.h" -#include "ED_armature.h" #include "ED_gpencil.h" #include "ED_info.h" #include "ED_keyframing.h" @@ -168,7 +168,7 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph, /* calculate pixelsize factor once, is used for lights and obcenters */ { /* note: '1.0f / len_v3(v1)' replaced 'len_v3(rv3d->viewmat[0])' - * because of float point precision problems at large values [#23908] */ + * because of float point precision problems at large values T23908. */ float v1[3], v2[3]; float len_px, len_sc; @@ -949,15 +949,16 @@ void ED_view3d_grid_steps(const Scene *scene, * Currently the simulation is only done when RV3D_VIEW_IS_AXIS. */ float ED_view3d_grid_view_scale(Scene *scene, View3D *v3d, - RegionView3D *rv3d, + ARegion *region, const char **r_grid_unit) { float grid_scale; + RegionView3D *rv3d = region->regiondata; if (!rv3d->is_persp && RV3D_VIEW_IS_AXIS(rv3d->view)) { /* Decrease the distance between grid snap points depending on zoom. */ /* `0.38` was a value visually obtained in order to get a snap distance * that matches previous versions Blender.*/ - float min_dist = 0.38f * (rv3d->dist / v3d->lens); + float min_dist = 16.0f / (region->sizex * rv3d->winmat[0][0]); float grid_steps[STEPS_LEN]; ED_view3d_grid_steps(scene, v3d, rv3d, grid_steps); /* Skip last item, in case the 'mid_dist' is greater than the largest unit. */ @@ -1065,7 +1066,7 @@ static void draw_rotation_guide(const RegionView3D *rv3d) float o[3]; /* center of rotation */ float end[3]; /* endpoints for drawing */ - GLubyte color[4] = {0, 108, 255, 255}; /* bright blue so it matches device LEDs */ + uchar color[4] = {0, 108, 255, 255}; /* bright blue so it matches device LEDs */ negate_v3_v3(o, rv3d->ofs); @@ -1468,12 +1469,13 @@ static void draw_selected_name( } static void draw_grid_unit_name( - Scene *scene, RegionView3D *rv3d, View3D *v3d, int xoffset, int *yoffset) + Scene *scene, ARegion *region, View3D *v3d, int xoffset, int *yoffset) { + RegionView3D *rv3d = region->regiondata; if (!rv3d->is_persp && RV3D_VIEW_IS_AXIS(rv3d->view)) { const char *grid_unit = NULL; int font_id = BLF_default(); - ED_view3d_grid_view_scale(scene, v3d, rv3d, &grid_unit); + ED_view3d_grid_view_scale(scene, v3d, region, &grid_unit); if (grid_unit) { char numstr[32] = ""; @@ -1531,7 +1533,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *region) else { switch ((eUserpref_MiniAxisType)U.mini_axis_type) { case USER_MINI_AXIS_TYPE_GIZMO: - /* The gizmo handles it's own drawing. */ + /* The gizmo handles its own drawing. */ break; case USER_MINI_AXIS_TYPE_MINIMAL: draw_view_axis(rv3d, rect); @@ -1558,7 +1560,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *region) if (v3d->gridflag & (V3D_SHOW_FLOOR | V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) { /* draw below the viewport name */ - draw_grid_unit_name(scene, rv3d, v3d, xoffset, &yoffset); + draw_grid_unit_name(scene, region, v3d, xoffset, &yoffset); } DRW_draw_region_engine_info(xoffset, &yoffset, VIEW3D_OVERLAY_LINEHEIGHT); @@ -2258,7 +2260,7 @@ void view3d_update_depths_rect(ARegion *region, ViewDepths *d, rcti *rect) } } -/* Note, with nouveau drivers the glReadPixels() is very slow. [#24339]. */ +/* Note, with nouveau drivers the glReadPixels() is very slow. T24339. */ void ED_view3d_depth_update(ARegion *region) { RegionView3D *rv3d = region->regiondata; @@ -2360,6 +2362,10 @@ void ED_view3d_datamask(const bContext *C, (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_WEIGHT)) { r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT; } + if ((CTX_data_mode_enum(C) == CTX_MODE_SCULPT)) { + r_cddata_masks->vmask |= CD_MASK_PAINT_MASK; + r_cddata_masks->pmask |= CD_MASK_SCULPT_FACE_SETS; + } } /* Goes over all modes and view3d settings. */ |