Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_utils.c
| Show First 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | |||||
| * - For all other editors (i.e. "GP Annotations"), this just gives the active datablock | * - For all other editors (i.e. "GP Annotations"), this just gives the active datablock | ||||
| * like for #ED_gpencil_data_get_active() | * like for #ED_gpencil_data_get_active() | ||||
| */ | */ | ||||
| bGPdata *ED_gpencil_data_get_active_evaluated(const bContext *C) | bGPdata *ED_gpencil_data_get_active_evaluated(const bContext *C) | ||||
| { | { | ||||
| ID *screen_id = (ID *)CTX_wm_screen(C); | ID *screen_id = (ID *)CTX_wm_screen(C); | ||||
| ScrArea *sa = CTX_wm_area(C); | ScrArea *sa = CTX_wm_area(C); | ||||
| const Depsgraph *depsgraph = CTX_data_depsgraph(C); | const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); | Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); | Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); | ||||
| #if 0 | #if 0 | ||||
| if (ob && ob->type == OB_GPENCIL) { | if (ob && ob->type == OB_GPENCIL) { | ||||
| BLI_assert(ob_eval->data == DEG_get_evaluated_id(ob->data)); | BLI_assert(ob_eval->data == DEG_get_evaluated_id(ob->data)); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 272 Lines • ▼ Show 20 Lines | void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc) | ||||
| r_gsc->sa = sa; | r_gsc->sa = sa; | ||||
| r_gsc->ar = ar; | r_gsc->ar = ar; | ||||
| r_gsc->v2d = &ar->v2d; | r_gsc->v2d = &ar->v2d; | ||||
| /* init region-specific stuff */ | /* init region-specific stuff */ | ||||
| if (sa->spacetype == SPACE_VIEW3D) { | if (sa->spacetype == SPACE_VIEW3D) { | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| struct Depsgraph *depsgraph = CTX_data_depsgraph(C); | struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| View3D *v3d = (View3D *)CTX_wm_space_data(C); | View3D *v3d = (View3D *)CTX_wm_space_data(C); | ||||
| RegionView3D *rv3d = ar->regiondata; | RegionView3D *rv3d = ar->regiondata; | ||||
| /* init 3d depth buffers */ | /* init 3d depth buffers */ | ||||
| view3d_operator_needs_opengl(C); | view3d_operator_needs_opengl(C); | ||||
| view3d_region_operator_needs_opengl(win, ar); | view3d_region_operator_needs_opengl(win, ar); | ||||
| ED_view3d_autodist_init(depsgraph, ar, v3d, 0); | ED_view3d_autodist_init(depsgraph, ar, v3d, 0); | ||||
| /* for camera view set the subrect */ | /* for camera view set the subrect */ | ||||
| if (rv3d->persp == RV3D_CAMOB) { | if (rv3d->persp == RV3D_CAMOB) { | ||||
| ED_view3d_calc_camera_border( | ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &r_gsc->subrect_data, true); | ||||
| scene, CTX_data_depsgraph(C), ar, v3d, rv3d, &r_gsc->subrect_data, true); | |||||
| r_gsc->subrect = &r_gsc->subrect_data; | r_gsc->subrect = &r_gsc->subrect_data; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Convert point to parent space | * Convert point to parent space | ||||
| * | * | ||||
| ▲ Show 20 Lines • Show All 351 Lines • ▼ Show 20 Lines | else { | ||||
| /* use 3D-cursor */ | /* use 3D-cursor */ | ||||
| copy_v3_v3(r_vec, fp); | copy_v3_v3(r_vec, fp); | ||||
| } | } | ||||
| } | } | ||||
| void ED_gpencil_project_stroke_to_view(bContext *C, bGPDlayer *gpl, bGPDstroke *gps) | void ED_gpencil_project_stroke_to_view(bContext *C, bGPDlayer *gpl, bGPDstroke *gps) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| bGPdata *gpd = (bGPdata *)ob->data; | bGPdata *gpd = (bGPdata *)ob->data; | ||||
| GP_SpaceConversion gsc = {NULL}; | GP_SpaceConversion gsc = {NULL}; | ||||
| bGPDspoint *pt; | bGPDspoint *pt; | ||||
| int i; | int i; | ||||
| float diff_mat[4][4]; | float diff_mat[4][4]; | ||||
| float inverse_diff_mat[4][4]; | float inverse_diff_mat[4][4]; | ||||
| ▲ Show 20 Lines • Show All 1,587 Lines • Show Last 20 Lines | |||||