diff options
Diffstat (limited to 'source/blender/editors/gizmo_library')
8 files changed, 25 insertions, 37 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_draw_utils.c b/source/blender/editors/gizmo_library/gizmo_draw_utils.c index 01e5a7eacfd..033673a99a8 100644 --- a/source/blender/editors/gizmo_library/gizmo_draw_utils.c +++ b/source/blender/editors/gizmo_library/gizmo_draw_utils.c @@ -29,7 +29,6 @@ #include "ED_view3d.h" #include "GPU_batch.h" -#include "GPU_glew.h" #include "GPU_immediate.h" #include "MEM_guardedalloc.h" @@ -84,7 +83,7 @@ void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, /* We may want to re-visit this, for now disable * since it causes issues leaving the GL state modified. */ #if 0 - glEnable(GL_CULL_FACE); + GPU_face_culling(GPU_CULL_BACK); GPU_depth_test(true); #endif @@ -92,7 +91,7 @@ void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, #if 0 GPU_depth_test(false); - glDisable(GL_CULL_FACE); + GPU_face_culling(GPU_CULL_NONE); #endif GPU_batch_discard(batch); diff --git a/source/blender/editors/gizmo_library/gizmo_geometry.h b/source/blender/editors/gizmo_library/gizmo_geometry.h index a5f61158f66..70f508df8b6 100644 --- a/source/blender/editors/gizmo_library/gizmo_geometry.h +++ b/source/blender/editors/gizmo_library/gizmo_geometry.h @@ -27,8 +27,7 @@ * called geom_xxx_gizmo.c */ -#ifndef __GIZMO_GEOMETRY_H__ -#define __GIZMO_GEOMETRY_H__ +#pragma once #include "BLI_sys_types.h" @@ -48,5 +47,3 @@ extern GizmoGeomInfo wm_gizmo_geom_data_cube; /* dial gizmo */ extern GizmoGeomInfo wm_gizmo_geom_data_dial; - -#endif /* __GIZMO_GEOMETRY_H__ */ diff --git a/source/blender/editors/gizmo_library/gizmo_library_intern.h b/source/blender/editors/gizmo_library/gizmo_library_intern.h index 31decb71c77..f3670708543 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_intern.h +++ b/source/blender/editors/gizmo_library/gizmo_library_intern.h @@ -21,8 +21,7 @@ * \ingroup edgizmolib */ -#ifndef __GIZMO_LIBRARY_INTERN_H__ -#define __GIZMO_LIBRARY_INTERN_H__ +#pragma once /** * Data for common interactions. Used in gizmo_library_utils.c functions. @@ -99,5 +98,3 @@ void wm_gizmo_geometryinfo_draw(const struct GizmoGeomInfo *info, const float color[4]); void wm_gizmo_vec_draw( const float color[4], const float (*verts)[3], uint vert_count, uint pos, uint primitive_type); - -#endif /* __GIZMO_LIBRARY_INTERN_H__ */ diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c index 3902c112796..847f3e3916c 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_utils.c +++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c @@ -211,14 +211,13 @@ bool gizmo_window_project_2d(bContext *C, } return false; } - else { - float co[3] = {mval[0], mval[1], 0.0f}; - float imat[4][4]; - invert_m4_m4(imat, mat); - mul_m4_v3(imat, co); - copy_v2_v2(r_co, co); - return true; - } + + float co[3] = {mval[0], mval[1], 0.0f}; + float imat[4][4]; + invert_m4_m4(imat, mat); + mul_m4_v3(imat, co); + copy_v2_v2(r_co, co); + return true; } bool gizmo_window_project_3d( @@ -245,12 +244,11 @@ bool gizmo_window_project_3d( mul_m4_v3(mat, r_co); return true; } - else { - float co[3] = {mval[0], mval[1], 0.0f}; - float imat[4][4]; - invert_m4_m4(imat, mat); - mul_m4_v3(imat, co); - copy_v2_v2(r_co, co); - return true; - } + + float co[3] = {mval[0], mval[1], 0.0f}; + float imat[4][4]; + invert_m4_m4(imat, mat); + mul_m4_v3(imat, co); + copy_v2_v2(r_co, co); + return true; } diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c index e6333d7d3e0..f31e004264c 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c @@ -88,7 +88,8 @@ static void arrow_draw_geom(const ArrowGizmo3D *arrow, const bool select, const const int draw_style = RNA_enum_get(arrow->gizmo.ptr, "draw_style"); const int draw_options = RNA_enum_get(arrow->gizmo.ptr, "draw_options"); - immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR); + immBindBuiltinProgram(select ? GPU_SHADER_3D_UNIFORM_COLOR : + GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR); float viewport[4]; GPU_viewport_size_get_f(viewport); diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c index fd24149e9ea..406d66dfd8f 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c @@ -637,7 +637,7 @@ static void gizmo_cage2d_draw_intern(wmGizmo *gz, } if (select) { - /* expand for hotspot */ + /* Expand for hot-spot. */ const float size[2] = {size_real[0] + margin[0] / 2, size_real[1] + margin[1] / 2}; if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE) { @@ -694,7 +694,7 @@ static void gizmo_cage2d_draw_intern(wmGizmo *gz, bool show = false; if (gz->highlight_part == ED_GIZMO_CAGE2D_PART_TRANSLATE) { /* Only show if we're drawing the center handle - * otherwise the entire rectangle is the hotspot. */ + * otherwise the entire rectangle is the hot-spot. */ if (draw_options & ED_GIZMO_CAGE2D_DRAW_FLAG_XFORM_CENTER_HANDLE) { show = true; } @@ -805,7 +805,7 @@ static int gizmo_cage2d_test_select(bContext *C, wmGizmo *gz, const int mval[2]) return -1; } - /* expand for hotspot */ + /* Expand for hots-pot. */ const float size[2] = {size_real[0] + margin[0] / 2, size_real[1] + margin[1] / 2}; const int transform_flag = RNA_enum_get(gz->ptr, "transform"); @@ -999,7 +999,7 @@ static int gizmo_cage2d_modal(bContext *C, if (data->dial == NULL) { MUL_V2_V3_M4_FINAL(test_co, data->orig_matrix_offset[3]); - data->dial = BLI_dial_initialize(test_co, FLT_EPSILON); + data->dial = BLI_dial_init(test_co, FLT_EPSILON); MUL_V2_V3_M4_FINAL(test_co, data->orig_mouse); BLI_dial_angle(data->dial, test_co); diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c index b0af8641767..8955a666e22 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c @@ -314,7 +314,7 @@ static void gizmo_cage3d_draw_intern( } if (select) { - /* expand for hotspot */ + /* Expand for hot-spot. */ #if 0 const float size[3] = { size_real[0] + margin[0] / 2, diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c index 262f4b78b95..5d7c3a9e717 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c @@ -461,10 +461,6 @@ static void gizmo_dial_draw_select(const bContext *C, wmGizmo *gz, int select_id GPU_select_load_id(select_id); dial_draw_intern(C, gz, true, false, clip_plane); - - if (clip_plane) { - glDisable(GL_CLIP_DISTANCE0); - } } static void gizmo_dial_draw(const bContext *C, wmGizmo *gz) |