Blender  V3.3
view3d_gizmo_navigate_type.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_sort_utils.h"
#include "BKE_context.h"
#include "GPU_batch.h"
#include "GPU_batch_presets.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "BLF_api.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_screen.h"
#include "view3d_intern.h"

Go to the source code of this file.

Custom Orientation/Navigation Gizmo for the 3D View

Simple gizmo to axis and translate.

  • scale_basis: used for the size.
  • matrix_basis: used for the location.
  • matrix_offset: used to store the orientation.
#define WIDGET_RADIUS   ((U.gizmo_size_navigate_v3d / 2.0f) * UI_DPI_FAC)
 
#define AXIS_HANDLE_SIZE   0.20f
 
#define AXIS_LINE_WIDTH   ((U.gizmo_size_navigate_v3d / 40.0f) * U.pixelsize)
 
#define AXIS_RING_WIDTH   ((U.gizmo_size_navigate_v3d / 60.0f) * U.pixelsize)
 
#define AXIS_TEXT_SIZE   (WIDGET_RADIUS * AXIS_HANDLE_SIZE * 1.25f)
 
#define AXIS_DEPTH_BIAS   0.01f
 
static void gizmo_axis_draw (const bContext *C, wmGizmo *gz)
 
static int gizmo_axis_test_select (bContext *UNUSED(C), wmGizmo *gz, const int mval[2])
 
static int gizmo_axis_cursor_get (wmGizmo *UNUSED(gz))
 
static bool gizmo_axis_screen_bounds_get (bContext *C, wmGizmo *gz, rcti *r_bounding_box)
 
void VIEW3D_GT_navigate_rotate (wmGizmoType *gzt)
 

Macro Definition Documentation

◆ AXIS_DEPTH_BIAS

#define AXIS_DEPTH_BIAS   0.01f

Definition at line 55 of file view3d_gizmo_navigate_type.c.

◆ AXIS_HANDLE_SIZE

#define AXIS_HANDLE_SIZE   0.20f

Definition at line 48 of file view3d_gizmo_navigate_type.c.

◆ AXIS_LINE_WIDTH

#define AXIS_LINE_WIDTH   ((U.gizmo_size_navigate_v3d / 40.0f) * U.pixelsize)

Definition at line 50 of file view3d_gizmo_navigate_type.c.

◆ AXIS_RING_WIDTH

#define AXIS_RING_WIDTH   ((U.gizmo_size_navigate_v3d / 60.0f) * U.pixelsize)

Definition at line 51 of file view3d_gizmo_navigate_type.c.

◆ AXIS_TEXT_SIZE

#define AXIS_TEXT_SIZE   (WIDGET_RADIUS * AXIS_HANDLE_SIZE * 1.25f)

Definition at line 52 of file view3d_gizmo_navigate_type.c.

◆ WIDGET_RADIUS

#define WIDGET_RADIUS   ((U.gizmo_size_navigate_v3d / 2.0f) * UI_DPI_FAC)

Definition at line 45 of file view3d_gizmo_navigate_type.c.

Function Documentation

◆ gizmo_axis_cursor_get()

static int gizmo_axis_cursor_get ( wmGizmo UNUSEDgz)
static

Definition at line 356 of file view3d_gizmo_navigate_type.c.

References WM_CURSOR_DEFAULT.

Referenced by VIEW3D_GT_navigate_rotate().

◆ gizmo_axis_draw()

static void gizmo_axis_draw ( const bContext C,
wmGizmo gz 
)
static

Definition at line 57 of file view3d_gizmo_navigate_type.c.

References ARRAY_SIZE, AXIS_DEPTH_BIAS, AXIS_HANDLE_SIZE, AXIS_LINE_WIDTH, AXIS_RING_WIDTH, AXIS_TEXT_SIZE, BLF_ASPECT, BLF_BOLD, BLF_color4fv(), BLF_default(), BLF_disable(), BLF_draw(), BLF_enable(), BLF_MATRIX, BLF_position(), BLF_ROTATION, BLF_SHADOW, BLF_size(), BLF_width_and_height(), BLF_WORD_WRAP, BLI_sortutil_cmp_float(), C, wmGizmo::color_hi, copy_m3_m3(), copy_m3_m4(), copy_m4_m3(), CTX_data_scene(), CTX_wm_view3d(), ED_view3d_background_color_get(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_matrix_mul, GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT, GPU_matrix_ortho_set_z(), GPU_matrix_pop(), GPU_matrix_pop_projection(), GPU_matrix_push(), GPU_matrix_push_projection(), GPU_matrix_scale_1f(), GPU_matrix_translate_3fv(), GPU_polygon_smooth(), GPU_PRIM_LINES, GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR, GPU_vertformat_attr_add(), GPU_viewport_size_get_f(), wmGizmo::highlight_part, id, immAttr4fv(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniform1f(), immUniform2fv(), immVertex3fv(), immVertexFormat(), interp_v4_v4v4(), invert_m3(), len_squared_v2(), wmGizmo::matrix_offset, MIN2, mul_m3_m3m3(), mul_m3_v3(), mul_v3_m3v3(), mul_v3_v3fl(), NULL, wmGizmo::scale_final, wmGizmo::state, TH_AXIS_X, UI_CNR_ALL, UI_draw_roundbox_4fv(), UI_draw_roundbox_4fv_ex(), UI_draw_roundbox_corner_set(), UI_GetThemeColor3fv(), unit_m4(), v, WIDGET_RADIUS, WM_gizmo_calc_matrix_final_params(), WM_GIZMO_STATE_HIGHLIGHT, and zero_v4().

Referenced by VIEW3D_GT_navigate_rotate().

◆ gizmo_axis_screen_bounds_get()

static bool gizmo_axis_screen_bounds_get ( bContext C,
wmGizmo gz,
rcti r_bounding_box 
)
static

◆ gizmo_axis_test_select()

static int gizmo_axis_test_select ( bContext UNUSEDC,
wmGizmo gz,
const int  mval[2] 
)
static

◆ VIEW3D_GT_navigate_rotate()

void VIEW3D_GT_navigate_rotate ( wmGizmoType gzt)