Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_manipulator.c
| Show First 20 Lines • Show All 1,718 Lines • ▼ Show 20 Lines | if (v3d->twflag & V3D_DRAW_MANIPULATOR) { | ||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| } | } | ||||
| } | } | ||||
| static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], float hotspot) | static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], float hotspot) | ||||
| { | { | ||||
| View3D *v3d = sa->spacedata.first; | View3D *v3d = sa->spacedata.first; | ||||
| RegionView3D *rv3d = ar->regiondata; | RegionView3D *rv3d = ar->regiondata; | ||||
| rctf rect, selrect; | rcti rect; | ||||
| GLuint buffer[64]; // max 4 items per select, so large enuf | GLuint buffer[64]; // max 4 items per select, so large enuf | ||||
| short hits; | short hits; | ||||
| const bool is_picksel = true; | const bool is_picksel = true; | ||||
| const bool do_passes = GPU_select_query_check_active(); | const bool do_passes = GPU_select_query_check_active(); | ||||
| /* XXX check a bit later on this... (ton) */ | /* XXX check a bit later on this... (ton) */ | ||||
| extern void view3d_winmatrix_set(ARegion *ar, View3D *v3d, rctf *rect); | extern void view3d_winmatrix_set(ARegion *ar, View3D *v3d, rcti *rect); | ||||
| /* when looking through a selected camera, the manipulator can be at the | /* when looking through a selected camera, the manipulator can be at the | ||||
| * exact same position as the view, skip so we don't break selection */ | * exact same position as the view, skip so we don't break selection */ | ||||
| if (fabsf(mat4_to_scale(rv3d->twmat)) < 1e-7f) | if (fabsf(mat4_to_scale(rv3d->twmat)) < 1e-7f) | ||||
| return 0; | return 0; | ||||
| rect.xmin = mval[0] - hotspot; | rect.xmin = mval[0] - hotspot; | ||||
| rect.xmax = mval[0] + hotspot; | rect.xmax = mval[0] + hotspot; | ||||
| rect.ymin = mval[1] - hotspot; | rect.ymin = mval[1] - hotspot; | ||||
| rect.ymax = mval[1] + hotspot; | rect.ymax = mval[1] + hotspot; | ||||
| selrect = rect; | |||||
| view3d_winmatrix_set(ar, v3d, &rect); | view3d_winmatrix_set(ar, v3d, &rect); | ||||
| mul_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); | mul_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); | ||||
| if (do_passes) | if (do_passes) | ||||
| GPU_select_begin(buffer, 64, &selrect, GPU_SELECT_NEAREST_FIRST_PASS, 0); | GPU_select_begin(buffer, 64, &rect, GPU_SELECT_NEAREST_FIRST_PASS, 0); | ||||
| else | else | ||||
| GPU_select_begin(buffer, 64, &selrect, GPU_SELECT_ALL, 0); | GPU_select_begin(buffer, 64, &rect, GPU_SELECT_ALL, 0); | ||||
| /* do the drawing */ | /* do the drawing */ | ||||
| if (v3d->twtype & V3D_MANIP_ROTATE) { | if (v3d->twtype & V3D_MANIP_ROTATE) { | ||||
| if (G.debug_value == 3) draw_manipulator_rotate_cyl(v3d, rv3d, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel); | if (G.debug_value == 3) draw_manipulator_rotate_cyl(v3d, rv3d, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel); | ||||
| else draw_manipulator_rotate(v3d, rv3d, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, false, is_picksel); | else draw_manipulator_rotate(v3d, rv3d, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, false, is_picksel); | ||||
| } | } | ||||
| if (v3d->twtype & V3D_MANIP_SCALE) | if (v3d->twtype & V3D_MANIP_SCALE) | ||||
| draw_manipulator_scale(v3d, rv3d, MAN_SCALE_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel); | draw_manipulator_scale(v3d, rv3d, MAN_SCALE_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel); | ||||
| if (v3d->twtype & V3D_MANIP_TRANSLATE) | if (v3d->twtype & V3D_MANIP_TRANSLATE) | ||||
| draw_manipulator_translate(v3d, rv3d, MAN_TRANS_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel); | draw_manipulator_translate(v3d, rv3d, MAN_TRANS_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel); | ||||
| hits = GPU_select_end(); | hits = GPU_select_end(); | ||||
| if (do_passes) { | if (do_passes) { | ||||
| GPU_select_begin(buffer, 64, &selrect, GPU_SELECT_NEAREST_SECOND_PASS, hits); | GPU_select_begin(buffer, 64, &rect, GPU_SELECT_NEAREST_SECOND_PASS, hits); | ||||
| /* do the drawing */ | /* do the drawing */ | ||||
| if (v3d->twtype & V3D_MANIP_ROTATE) { | if (v3d->twtype & V3D_MANIP_ROTATE) { | ||||
| if (G.debug_value == 3) draw_manipulator_rotate_cyl(v3d, rv3d, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel); | if (G.debug_value == 3) draw_manipulator_rotate_cyl(v3d, rv3d, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel); | ||||
| else draw_manipulator_rotate(v3d, rv3d, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, false, is_picksel); | else draw_manipulator_rotate(v3d, rv3d, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, false, is_picksel); | ||||
| } | } | ||||
| if (v3d->twtype & V3D_MANIP_SCALE) | if (v3d->twtype & V3D_MANIP_SCALE) | ||||
| draw_manipulator_scale(v3d, rv3d, MAN_SCALE_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel); | draw_manipulator_scale(v3d, rv3d, MAN_SCALE_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB, false, is_picksel); | ||||
| ▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines | |||||