Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/armature/editarmature_sketch.c
| Show First 20 Lines • Show All 923 Lines • ▼ Show 20 Lines | static void sk_interpolateDepth(bContext *C, SK_Stroke *stk, int start, int end, float length, float distance) | ||||
| progress = len_v3v3(stk->points[start].p, stk->points[start - 1].p); | progress = len_v3v3(stk->points[start].p, stk->points[start - 1].p); | ||||
| for (i = start; i <= end; i++) { | for (i = start; i <= end; i++) { | ||||
| float ray_start[3], ray_normal[3]; | float ray_start[3], ray_normal[3]; | ||||
| float delta = len_v3v3(stk->points[i].p, stk->points[i + 1].p); | float delta = len_v3v3(stk->points[i].p, stk->points[i + 1].p); | ||||
| float pval[2] = {0, 0}; | float pval[2] = {0, 0}; | ||||
| ED_view3d_project_float_global(ar, stk->points[i].p, pval, V3D_PROJ_TEST_NOP); | ED_view3d_project_float_global(ar, stk->points[i].p, pval, V3D_PROJ_TEST_NOP); | ||||
| ED_view3d_win_to_ray(ar, v3d, pval, ray_start, ray_normal, false); | ED_view3d_win_to_ray(CTX_data_depsgraph(C), ar, v3d, pval, ray_start, ray_normal, false); | ||||
| mul_v3_fl(ray_normal, distance * progress / length); | mul_v3_fl(ray_normal, distance * progress / length); | ||||
| add_v3_v3(stk->points[i].p, ray_normal); | add_v3_v3(stk->points[i].p, ray_normal); | ||||
| progress += delta; | progress += delta; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 540 Lines • ▼ Show 20 Lines | static int cmpIntersections(const void *i1, const void *i2) | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| /* returns the maximum number of intersections per stroke */ | /* returns the maximum number of intersections per stroke */ | ||||
| static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, SK_Stroke *gesture) | static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, SK_Stroke *gesture) | ||||
| { | { | ||||
| const Depsgraph *depsgraph = CTX_data_depsgraph(C); | |||||
| ARegion *ar = CTX_wm_region(C); | ARegion *ar = CTX_wm_region(C); | ||||
| ScrArea *sa = CTX_wm_area(C); | ScrArea *sa = CTX_wm_area(C); | ||||
| View3D *v3d = sa->spacedata.first; | View3D *v3d = sa->spacedata.first; | ||||
| SK_Stroke *stk; | SK_Stroke *stk; | ||||
| int added = 0; | int added = 0; | ||||
| for (stk = sketch->strokes.first; stk; stk = stk->next) { | for (stk = sketch->strokes.first; stk; stk = stk->next) { | ||||
| int s_added = 0; | int s_added = 0; | ||||
| Show All 24 Lines | for (s_i = 0; s_i < stk->nb_points - 1; s_i++) { | ||||
| isect->gesture_index = g_i; | isect->gesture_index = g_i; | ||||
| isect->before = s_i; | isect->before = s_i; | ||||
| isect->after = s_i + 1; | isect->after = s_i + 1; | ||||
| isect->stroke = stk; | isect->stroke = stk; | ||||
| isect->lambda = lambda; | isect->lambda = lambda; | ||||
| mval[0] = vi[0]; | mval[0] = vi[0]; | ||||
| mval[1] = vi[1]; | mval[1] = vi[1]; | ||||
| ED_view3d_win_to_segment(ar, v3d, mval, ray_start, ray_end, true); | ED_view3d_win_to_segment(depsgraph, ar, v3d, mval, ray_start, ray_end, true); | ||||
| isect_line_line_v3(stk->points[s_i].p, | isect_line_line_v3(stk->points[s_i].p, | ||||
| stk->points[s_i + 1].p, | stk->points[s_i + 1].p, | ||||
| ray_start, | ray_start, | ||||
| ray_end, | ray_end, | ||||
| isect->p, | isect->p, | ||||
| vi); | vi); | ||||
| ▲ Show 20 Lines • Show All 1,115 Lines • Show Last 20 Lines | |||||