Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_draw.c
| Show First 20 Lines • Show All 1,060 Lines • ▼ Show 20 Lines | else { | ||||
| glVertex2f(x1, y2); | glVertex2f(x1, y2); | ||||
| glVertex2f(x2, y1 + (h - ofs)); | glVertex2f(x2, y1 + (h - ofs)); | ||||
| } | } | ||||
| glEnd(); | glEnd(); | ||||
| } | } | ||||
| static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) | static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) | ||||
| { | { | ||||
| float hmargin, vmargin; | |||||
| float x1, x2, y1, y2; | float x1, x2, y1, y2; | ||||
| float x1i, x2i, y1i, y2i; | float x1i, x2i, y1i, y2i; | ||||
| rctf viewborder; | rctf viewborder; | ||||
| Camera *ca = NULL; | Camera *ca = NULL; | ||||
| RegionView3D *rv3d = ar->regiondata; | RegionView3D *rv3d = ar->regiondata; | ||||
| if (v3d->camera == NULL) | if (v3d->camera == NULL) | ||||
| return; | return; | ||||
| if (v3d->camera->type == OB_CAMERA) | if (v3d->camera->type == OB_CAMERA) | ||||
| ca = v3d->camera->data; | ca = v3d->camera->data; | ||||
| ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false); | ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false); | ||||
| /* the offsets */ | /* the offsets */ | ||||
| x1 = viewborder.xmin; | x1 = viewborder.xmin; | ||||
| y1 = viewborder.ymin; | y1 = viewborder.ymin; | ||||
| x2 = viewborder.xmax; | x2 = viewborder.xmax; | ||||
| y2 = viewborder.ymax; | y2 = viewborder.ymax; | ||||
| /* apply offsets so the real 3D camera shows through */ | /* apply offsets so the real 3D camera shows through */ | ||||
sergey: Avoid unneeded empty lines changes. | |||||
| /* note: quite un-scientific but without this bit extra | /* note: quite un-scientific but without this bit extra | ||||
| * 0.0001 on the lower left the 2D border sometimes | * 0.0001 on the lower left the 2D border sometimes | ||||
| * obscures the 3D camera border */ | * obscures the 3D camera border */ | ||||
| /* note: with VIEW3D_CAMERA_BORDER_HACK defined this error isn't noticeable | /* note: with VIEW3D_CAMERA_BORDER_HACK defined this error isn't noticeable | ||||
| * but keep it here in case we need to remove the workaround */ | * but keep it here in case we need to remove the workaround */ | ||||
| x1i = (int)(x1 - 1.0001f); | x1i = (int)(x1 - 1.0001f); | ||||
| y1i = (int)(y1 - 1.0001f); | y1i = (int)(y1 - 1.0001f); | ||||
| x2i = (int)(x2 + (1.0f - 0.0001f)); | x2i = (int)(x2 + (1.0f - 0.0001f)); | ||||
| ▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | if (ca->dtx & CAM_DTX_HARMONY_TRI_A) { | ||||
| UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); | UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); | ||||
| drawviewborder_triangle(x1, x2, y1, y2, 1, 'A'); | drawviewborder_triangle(x1, x2, y1, y2, 1, 'A'); | ||||
| } | } | ||||
| if (ca->dtx & CAM_DTX_HARMONY_TRI_B) { | if (ca->dtx & CAM_DTX_HARMONY_TRI_B) { | ||||
| UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); | UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); | ||||
| drawviewborder_triangle(x1, x2, y1, y2, 1, 'B'); | drawviewborder_triangle(x1, x2, y1, y2, 1, 'B'); | ||||
| } | } | ||||
Not Done Inline ActionsChecking for ca != NULL is redundant here. sergey: Checking for `ca != NULL` is redundant here. | |||||
| if (ca->flag & CAM_SHOWTITLESAFE) { | if (ca->flag & CAM_SHOWTITLESAFE) { | ||||
| UI_ThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25, 0); | UI_draw_safe_areas(x1, x2, y1, y2, | ||||
| scene->safe_areas.title, | |||||
| hmargin = 0.1f * (x2 - x1); | scene->safe_areas.action); | ||||
| vmargin = 0.05f * (y2 - y1); | |||||
| UI_draw_roundbox_gl_mode(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f); | if (ca->flag & CAM_SHOWCENTERSAFE) { | ||||
| UI_draw_safe_areas(x1, x2, y1, y2, | |||||
| hmargin = 0.035f * (x2 - x1); | scene->safe_areas.title_center, | ||||
| vmargin = 0.035f * (y2 - y1); | scene->safe_areas.action_center); | ||||
| UI_draw_roundbox_gl_mode(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f); | |||||
| } | } | ||||
| } | |||||
| if (ca->flag & CAM_SHOWSENSOR) { | if (ca->flag & CAM_SHOWSENSOR) { | ||||
| /* determine sensor fit, and get sensor x/y, for auto fit we | /* determine sensor fit, and get sensor x/y, for auto fit we | ||||
| * assume and square sensor and only use sensor_x */ | * assume and square sensor and only use sensor_x */ | ||||
| float sizex = scene->r.xsch * scene->r.xasp; | float sizex = scene->r.xsch * scene->r.xasp; | ||||
| float sizey = scene->r.ysch * scene->r.yasp; | float sizey = scene->r.ysch * scene->r.yasp; | ||||
| int sensor_fit = BKE_camera_sensor_fit(ca->sensor_fit, sizex, sizey); | int sensor_fit = BKE_camera_sensor_fit(ca->sensor_fit, sizex, sizey); | ||||
| float sensor_x = ca->sensor_x; | float sensor_x = ca->sensor_x; | ||||
| float sensor_y = (ca->sensor_fit == CAMERA_SENSOR_FIT_AUTO) ? ca->sensor_x : ca->sensor_y; | float sensor_y = (ca->sensor_fit == CAMERA_SENSOR_FIT_AUTO) ? ca->sensor_x : ca->sensor_y; | ||||
| ▲ Show 20 Lines • Show All 2,444 Lines • Show Last 20 Lines | |||||
Avoid unneeded empty lines changes.