Differential D3007 Diff 9853 source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
| Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | static void dial_ghostarc_draw( | ||||
| immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformColor4fv(color); | immUniformColor4fv(color); | ||||
| imm_draw_disk_partial_fill_2d( | imm_draw_disk_partial_fill_2d( | ||||
| pos, 0, 0, 0.0, width_inner, DIAL_RESOLUTION, RAD2DEGF(angle_ofs), RAD2DEGF(angle_delta)); | pos, 0, 0, 0.0, width_inner, DIAL_RESOLUTION, RAD2DEGF(angle_ofs), RAD2DEGF(angle_delta)); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| static void dial_ghostarc_get_angles( | static void dial_ghostarc_get_angles( | ||||
| const struct Depsgraph *depsgraph, | |||||
| const wmManipulator *mpr, | const wmManipulator *mpr, | ||||
| const wmEvent *event, | const wmEvent *event, | ||||
| const ARegion *ar, const View3D *v3d, | const ARegion *ar, const View3D *v3d, | ||||
| float mat[4][4], const float co_outer[3], | float mat[4][4], const float co_outer[3], | ||||
| float *r_start, float *r_delta) | float *r_start, float *r_delta) | ||||
| { | { | ||||
| DialInteraction *inter = mpr->interaction_data; | DialInteraction *inter = mpr->interaction_data; | ||||
| const RegionView3D *rv3d = ar->regiondata; | const RegionView3D *rv3d = ar->regiondata; | ||||
| Show All 11 Lines | static void dial_ghostarc_get_angles( | ||||
| float proj_mval_new_rel[3]; | float proj_mval_new_rel[3]; | ||||
| float proj_mval_init_rel[3]; | float proj_mval_init_rel[3]; | ||||
| float dial_plane[4]; | float dial_plane[4]; | ||||
| float ray_co[3], ray_no[3]; | float ray_co[3], ray_no[3]; | ||||
| float ray_lambda; | float ray_lambda; | ||||
| plane_from_point_normal_v3(dial_plane, mpr->matrix_basis[3], axis_vec); | plane_from_point_normal_v3(dial_plane, mpr->matrix_basis[3], axis_vec); | ||||
| if (!ED_view3d_win_to_ray(ar, v3d, inter->init_mval, ray_co, ray_no, false) || | if (!ED_view3d_win_to_ray(depsgraph, ar, v3d, inter->init_mval, ray_co, ray_no, false) || | ||||
| !isect_ray_plane_v3(ray_co, ray_no, dial_plane, &ray_lambda, false)) | !isect_ray_plane_v3(ray_co, ray_no, dial_plane, &ray_lambda, false)) | ||||
| { | { | ||||
| goto fail; | goto fail; | ||||
| } | } | ||||
| madd_v3_v3v3fl(proj_mval_init_rel, ray_co, ray_no, ray_lambda); | madd_v3_v3v3fl(proj_mval_init_rel, ray_co, ray_no, ray_lambda); | ||||
| sub_v3_v3(proj_mval_init_rel, mpr->matrix_basis[3]); | sub_v3_v3(proj_mval_init_rel, mpr->matrix_basis[3]); | ||||
| if (!ED_view3d_win_to_ray(ar, v3d, mval, ray_co, ray_no, false) || | if (!ED_view3d_win_to_ray(depsgraph, ar, v3d, mval, ray_co, ray_no, false) || | ||||
| !isect_ray_plane_v3(ray_co, ray_no, dial_plane, &ray_lambda, false)) | !isect_ray_plane_v3(ray_co, ray_no, dial_plane, &ray_lambda, false)) | ||||
| { | { | ||||
| goto fail; | goto fail; | ||||
| } | } | ||||
| madd_v3_v3v3fl(proj_mval_new_rel, ray_co, ray_no, ray_lambda); | madd_v3_v3v3fl(proj_mval_new_rel, ray_co, ray_no, ray_lambda); | ||||
| sub_v3_v3(proj_mval_new_rel, mpr->matrix_basis[3]); | sub_v3_v3(proj_mval_new_rel, mpr->matrix_basis[3]); | ||||
| const int draw_options = RNA_enum_get(mpr->ptr, "draw_options"); | const int draw_options = RNA_enum_get(mpr->ptr, "draw_options"); | ||||
| ▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | static int manipulator_dial_modal( | ||||
| const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f}; /* coordinate at which the arc drawing will be started */ | const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f}; /* coordinate at which the arc drawing will be started */ | ||||
| float angle_ofs, angle_delta; | float angle_ofs, angle_delta; | ||||
| float matrix[4][4]; | float matrix[4][4]; | ||||
| dial_calc_matrix(mpr, matrix); | dial_calc_matrix(mpr, matrix); | ||||
| dial_ghostarc_get_angles( | dial_ghostarc_get_angles( | ||||
| CTX_data_depsgraph(C), | |||||
| mpr, event, CTX_wm_region(C), CTX_wm_view3d(C), matrix, co_outer, &angle_ofs, &angle_delta); | mpr, event, CTX_wm_region(C), CTX_wm_view3d(C), matrix, co_outer, &angle_ofs, &angle_delta); | ||||
| DialInteraction *inter = mpr->interaction_data; | DialInteraction *inter = mpr->interaction_data; | ||||
| inter->output.angle_delta = angle_delta; | inter->output.angle_delta = angle_delta; | ||||
| inter->output.angle_ofs = angle_ofs; | inter->output.angle_ofs = angle_ofs; | ||||
| /* set the property for the operator and call its modal function */ | /* set the property for the operator and call its modal function */ | ||||
| ▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines | |||||