Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_snap.c
| Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | const float snap_point[2] = { | ||||
| t->tsnap.snapPoint[1] / t->aspect[1], | t->tsnap.snapPoint[1] / t->aspect[1], | ||||
| }; | }; | ||||
| UI_view2d_view_to_region_fl(&t->region->v2d, UNPACK2(snap_point), &x, &y); | UI_view2d_view_to_region_fl(&t->region->v2d, UNPACK2(snap_point), &x, &y); | ||||
| float radius = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE) * U.pixelsize; | float radius = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE) * U.pixelsize; | ||||
| GPU_matrix_push_projection(); | GPU_matrix_push_projection(); | ||||
| wmOrtho2_region_pixelspace(t->region); | wmOrtho2_region_pixelspace(t->region); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformColor3ub(255, 255, 255); | immUniformColor3ub(255, 255, 255); | ||||
| imm_draw_circle_wire_2d(pos, x, y, radius, 8); | imm_draw_circle_wire_2d(pos, x, y, radius, 8); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| GPU_matrix_pop_projection(); | GPU_matrix_pop_projection(); | ||||
| } | } | ||||
| else if (t->spacetype == SPACE_NODE) { | else if (t->spacetype == SPACE_NODE) { | ||||
| ARegion *region = CTX_wm_region(C); | ARegion *region = CTX_wm_region(C); | ||||
| TransSnapPoint *p; | TransSnapPoint *p; | ||||
| float size; | float size; | ||||
| size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE); | size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE); | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| for (p = t->tsnap.points.first; p; p = p->next) { | for (p = t->tsnap.points.first; p; p = p->next) { | ||||
| if (p == t->tsnap.selectedPoint) { | if (p == t->tsnap.selectedPoint) { | ||||
| immUniformColor4ubv(selectedCol); | immUniformColor4ubv(selectedCol); | ||||
| } | } | ||||
| else { | else { | ||||
| immUniformColor4ubv(col); | immUniformColor4ubv(col); | ||||
| } | } | ||||
| Show All 10 Lines | else if (t->spacetype == SPACE_NODE) { | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| GPU_blend(GPU_BLEND_NONE); | GPU_blend(GPU_BLEND_NONE); | ||||
| } | } | ||||
| else if (t->spacetype == SPACE_SEQ) { | else if (t->spacetype == SPACE_SEQ) { | ||||
| const ARegion *region = CTX_wm_region(C); | const ARegion *region = CTX_wm_region(C); | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformColor4ubv(col); | immUniformColor4ubv(col); | ||||
| float pixelx = BLI_rctf_size_x(®ion->v2d.cur) / BLI_rcti_size_x(®ion->v2d.mask); | float pixelx = BLI_rctf_size_x(®ion->v2d.cur) / BLI_rcti_size_x(®ion->v2d.mask); | ||||
| immRectf(pos, | immRectf(pos, | ||||
| t->tsnap.snapPoint[0] - pixelx, | t->tsnap.snapPoint[0] - pixelx, | ||||
| region->v2d.cur.ymax, | region->v2d.cur.ymax, | ||||
| t->tsnap.snapPoint[0] + pixelx, | t->tsnap.snapPoint[0] + pixelx, | ||||
| region->v2d.cur.ymin); | region->v2d.cur.ymin); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| ▲ Show 20 Lines • Show All 1,497 Lines • Show Last 20 Lines | |||||