UI: Toggle Camera Passepartout in Viewport Overlays
Allow toggling camera passepartout in the 3DView Overlay popover while in camera view. Pull Request: https://projects.blender.org/blender/blender/pulls/122337
This commit is contained in:
committed by
Harley Acheson
parent
1d9f12ac43
commit
2a287dc23c
@@ -7227,6 +7227,8 @@ class VIEW3D_PT_overlay_guides(Panel):
|
||||
sub = split.column()
|
||||
sub.prop(overlay, "show_cursor", text="3D Cursor")
|
||||
sub.prop(overlay, "show_annotation", text="Annotations")
|
||||
if view.region_3d.view_perspective == 'CAMERA':
|
||||
sub.prop(overlay, "show_camera_passepartout", text="Passepartout")
|
||||
|
||||
if shading.type == 'MATERIAL':
|
||||
row = col.row()
|
||||
|
||||
@@ -29,7 +29,7 @@ extern "C" {
|
||||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 48
|
||||
#define BLENDER_FILE_SUBVERSION 49
|
||||
|
||||
/* Minimum Blender version that supports reading file written with the current
|
||||
* version. Older Blender versions will test this and cancel loading the file, showing a warning to
|
||||
|
||||
@@ -3686,6 +3686,19 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 49)) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d = reinterpret_cast<View3D *>(sl);
|
||||
v3d->flag2 |= V3D_SHOW_CAMERA_PASSEPARTOUT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Always bump subversion in BKE_blender_version.h when adding versioning
|
||||
* code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check.
|
||||
|
||||
@@ -571,7 +571,9 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region,
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
/* passepartout, specified in camera edit buttons */
|
||||
if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) {
|
||||
if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f &&
|
||||
v3d->flag2 & V3D_SHOW_CAMERA_PASSEPARTOUT)
|
||||
{
|
||||
const float winx = (region->winx + 1);
|
||||
const float winy = (region->winy + 1);
|
||||
|
||||
@@ -613,11 +615,6 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region,
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
/* When overlays are disabled, only show camera outline & passepartout. */
|
||||
if (v3d->flag2 & V3D_HIDE_OVERLAYS || !(v3d->flag2 & V3D_SHOW_CAMERA_GUIDES)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* And now, the dashed lines! */
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
|
||||
|
||||
@@ -1137,7 +1134,7 @@ static void view3d_draw_border(const bContext *C, ARegion *region)
|
||||
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
|
||||
if (rv3d->persp == RV3D_CAMOB) {
|
||||
if (rv3d->persp == RV3D_CAMOB && !(v3d->flag2 & V3D_HIDE_OVERLAYS)) {
|
||||
drawviewborder(scene, depsgraph, region, v3d);
|
||||
}
|
||||
else if (v3d->flag2 & V3D_RENDER_BORDER) {
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
.gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR | V3D_SHOW_ORTHO_GRID, \
|
||||
\
|
||||
.flag = V3D_SELECT_OUTLINE, \
|
||||
.flag2 = V3D_SHOW_RECONSTRUCTION | V3D_SHOW_ANNOTATION | V3D_SHOW_VIEWER | V3D_SHOW_CAMERA_GUIDES, \
|
||||
.flag2 = V3D_SHOW_RECONSTRUCTION | V3D_SHOW_ANNOTATION | V3D_SHOW_VIEWER | V3D_SHOW_CAMERA_GUIDES | V3D_SHOW_CAMERA_PASSEPARTOUT, \
|
||||
\
|
||||
.lens = 50.0f, \
|
||||
.clip_start = 0.01f, \
|
||||
|
||||
@@ -480,6 +480,7 @@ enum {
|
||||
V3D_XR_SHOW_CONTROLLERS = 1 << 16,
|
||||
V3D_XR_SHOW_CUSTOM_OVERLAYS = 1 << 17,
|
||||
V3D_SHOW_CAMERA_GUIDES = (1 << 18),
|
||||
V3D_SHOW_CAMERA_PASSEPARTOUT = (1 << 19),
|
||||
};
|
||||
|
||||
/** #View3D::gp_flag (short) */
|
||||
|
||||
@@ -4552,6 +4552,11 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Show Camera Guides", "Show camera composition guides");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "show_camera_passepartout", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag2", V3D_SHOW_CAMERA_PASSEPARTOUT);
|
||||
RNA_def_property_ui_text(prop, "Show Passepartout", "Show camera passepartout");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "show_extras", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(
|
||||
prop, nullptr, "overlay.flag", V3D_OVERLAY_HIDE_OBJECT_XTRAS);
|
||||
|
||||
Reference in New Issue
Block a user