UI: Toggle Camera Guides in Viewport Overlays
Allow toggling camera composition guides in the 3DView Overlay popover. Pull Request: https://projects.blender.org/blender/blender/pulls/121923
This commit is contained in:
committed by
Harley Acheson
parent
8aec5f5e91
commit
392ac52ebb
@@ -7194,6 +7194,8 @@ class VIEW3D_PT_overlay_guides(Panel):
|
||||
sub = split.column()
|
||||
sub.prop(overlay, "show_text", text="Text Info")
|
||||
sub.prop(overlay, "show_stats", text="Statistics")
|
||||
if view.region_3d.view_perspective == 'CAMERA':
|
||||
sub.prop(overlay, "show_camera_guides", text="Camera Guides")
|
||||
|
||||
sub = split.column()
|
||||
sub.prop(overlay, "show_cursor", text="3D Cursor")
|
||||
|
||||
@@ -29,7 +29,7 @@ extern "C" {
|
||||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 44
|
||||
#define BLENDER_FILE_SUBVERSION 45
|
||||
|
||||
/* 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
|
||||
|
||||
@@ -3650,6 +3650,19 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 45)) {
|
||||
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 = static_cast<View3D *>(area->spacedata.first);
|
||||
v3d->flag2 |= V3D_SHOW_CAMERA_GUIDES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Always bump subversion in BKE_blender_version.h when adding versioning
|
||||
* code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check.
|
||||
|
||||
@@ -614,7 +614,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region,
|
||||
}
|
||||
|
||||
/* When overlays are disabled, only show camera outline & passepartout. */
|
||||
if (v3d->flag2 & V3D_HIDE_OVERLAYS) {
|
||||
if (v3d->flag2 & V3D_HIDE_OVERLAYS || !(v3d->flag2 & V3D_SHOW_CAMERA_GUIDES)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -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, \
|
||||
.flag2 = V3D_SHOW_RECONSTRUCTION | V3D_SHOW_ANNOTATION | V3D_SHOW_VIEWER | V3D_SHOW_CAMERA_GUIDES, \
|
||||
\
|
||||
.lens = 50.0f, \
|
||||
.clip_start = 0.01f, \
|
||||
|
||||
@@ -479,6 +479,7 @@ enum {
|
||||
V3D_FLAG2_UNUSED_15 = 1 << 15, /* cleared */
|
||||
V3D_XR_SHOW_CONTROLLERS = 1 << 16,
|
||||
V3D_XR_SHOW_CUSTOM_OVERLAYS = 1 << 17,
|
||||
V3D_SHOW_CAMERA_GUIDES = (1 << 18),
|
||||
};
|
||||
|
||||
/** #View3D::gp_flag (short) */
|
||||
|
||||
@@ -4546,6 +4546,12 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Show Statistics", "Display scene statistics overlay text");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, nullptr);
|
||||
|
||||
/* show camera composition guides */
|
||||
prop = RNA_def_property(srna, "show_camera_guides", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag2", V3D_SHOW_CAMERA_GUIDES);
|
||||
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_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