Overlay: enable/disable drawing of specific object types.
Added a option to the overlay popover that controls the visibility of non-renderable objects like lamps, cameras, speakers, armatures, curves empties and force fields. After discussion we went for a single option with more detailed check in the object_mode draw engine. Differential Revision: https://developer.blender.org/D3524
This commit is contained in:
parent
a4328a4b70
commit
f7ec70895c
Notes:
blender-bot
2023-02-14 06:23:08 +01:00
Referenced by commit c1678a3723
, Revert "Overlay: enable/disable drawing of specific object types."
|
@ -3833,6 +3833,14 @@ class VIEW3D_PT_overlay(Panel):
|
|||
sub.prop(overlay, "show_all_objects_origin")
|
||||
|
||||
sub = split.column()
|
||||
row = sub.row(align=True)
|
||||
row.prop(overlay, "show_empties", text="", toggle=True)
|
||||
row.prop(overlay, "show_lamps", text="", toggle=True)
|
||||
row.prop(overlay, "show_cameras", text="", toggle=True)
|
||||
row.prop(overlay, "show_armatures", text="", toggle=True)
|
||||
row.prop(overlay, "show_lightprobes", text="", toggle=True)
|
||||
row.prop(overlay, "show_speakers", text="", toggle=True)
|
||||
|
||||
sub.prop(overlay, "show_relationship_lines")
|
||||
sub.prop(overlay, "show_motion_paths")
|
||||
#sub.prop(overlay, "show_onion_skins")
|
||||
|
@ -3847,6 +3855,7 @@ class VIEW3D_PT_overlay(Panel):
|
|||
sub.active = overlay.show_wireframes
|
||||
sub.prop(overlay, "wireframe_threshold", text="")
|
||||
|
||||
|
||||
col = layout.column()
|
||||
col.active = display_all
|
||||
split = col.split(percentage=0.55)
|
||||
|
|
|
@ -1530,6 +1530,19 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "int", "visible_object_types")) {
|
||||
for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d = (View3D *)sl;
|
||||
v3d->overlay.visible_object_types = V3D_OVERLAY_VISIBLE_OBJECT_TYPES_MASK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
if (scene->toolsettings->manipulator_flag == 0) {
|
||||
scene->toolsettings->manipulator_flag = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE;
|
||||
|
|
|
@ -2217,34 +2217,52 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
|
|||
break;
|
||||
}
|
||||
case OB_LAMP:
|
||||
DRW_shgroup_lamp(stl, ob, view_layer);
|
||||
if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_LAMP)
|
||||
{
|
||||
DRW_shgroup_lamp(stl, ob, view_layer);
|
||||
}
|
||||
break;
|
||||
case OB_CAMERA:
|
||||
DRW_shgroup_camera(stl, ob, view_layer);
|
||||
if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_CAMERA)
|
||||
{
|
||||
DRW_shgroup_camera(stl, ob, view_layer);
|
||||
}
|
||||
break;
|
||||
case OB_EMPTY:
|
||||
DRW_shgroup_empty(stl, psl, ob, view_layer);
|
||||
if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_EMPTY)
|
||||
{
|
||||
DRW_shgroup_empty(stl, psl, ob, view_layer);
|
||||
}
|
||||
break;
|
||||
case OB_SPEAKER:
|
||||
DRW_shgroup_speaker(stl, ob, view_layer);
|
||||
if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_SPEAKER)
|
||||
{
|
||||
DRW_shgroup_speaker(stl, ob, view_layer);
|
||||
}
|
||||
break;
|
||||
case OB_LIGHTPROBE:
|
||||
DRW_shgroup_lightprobe(stl, psl, ob, view_layer);
|
||||
if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_LIGHTPROBE)
|
||||
{
|
||||
DRW_shgroup_lightprobe(stl, psl, ob, view_layer);
|
||||
}
|
||||
break;
|
||||
case OB_ARMATURE:
|
||||
{
|
||||
bArmature *arm = ob->data;
|
||||
if (arm->edbo == NULL) {
|
||||
if (DRW_state_is_select() || !DRW_pose_mode_armature(ob, draw_ctx->obact)) {
|
||||
DRWArmaturePasses passes = {
|
||||
.bone_solid = psl->bone_solid,
|
||||
.bone_outline = psl->bone_outline,
|
||||
.bone_wire = psl->bone_wire,
|
||||
.bone_envelope = psl->bone_envelope,
|
||||
.bone_axes = psl->bone_axes,
|
||||
.relationship_lines = NULL, /* Don't draw relationship lines */
|
||||
};
|
||||
DRW_shgroup_armature_object(ob, view_layer, passes);
|
||||
if (v3d->overlay.visible_object_types & V3D_OVERLAY_SHOW_ARMATURE)
|
||||
{
|
||||
bArmature *arm = ob->data;
|
||||
if (arm->edbo == NULL) {
|
||||
if (DRW_state_is_select() || !DRW_pose_mode_armature(ob, draw_ctx->obact)) {
|
||||
DRWArmaturePasses passes = {
|
||||
.bone_solid = psl->bone_solid,
|
||||
.bone_outline = psl->bone_outline,
|
||||
.bone_wire = psl->bone_wire,
|
||||
.bone_envelope = psl->bone_envelope,
|
||||
.bone_axes = psl->bone_axes,
|
||||
.relationship_lines = NULL, /* Don't draw relationship lines */
|
||||
};
|
||||
DRW_shgroup_armature_object(ob, view_layer, passes);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -338,6 +338,7 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
|
|||
v3d->overlay.texture_paint_mode_opacity = 0.8;
|
||||
v3d->overlay.weight_paint_mode_opacity = 0.8;
|
||||
v3d->overlay.vertex_paint_mode_opacity = 0.8;
|
||||
v3d->overlay.visible_object_types = V3D_OVERLAY_VISIBLE_OBJECT_TYPES_MASK;
|
||||
|
||||
v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ struct GPUViewport;
|
|||
#include "DNA_defs.h"
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_image_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_movieclip_types.h"
|
||||
#include "DNA_gpu_types.h"
|
||||
|
||||
|
@ -178,8 +179,8 @@ typedef struct View3DOverlay {
|
|||
|
||||
/* Other settings */
|
||||
float wireframe_threshold;
|
||||
int visible_object_types;
|
||||
|
||||
int pad;
|
||||
} View3DOverlay;
|
||||
|
||||
/* 3D ViewPort Struct */
|
||||
|
@ -383,6 +384,17 @@ enum {
|
|||
V3D_OVERLAY_ONION_SKINS = (1 << 7),
|
||||
};
|
||||
|
||||
/* View3DOverlay->visible_object_types */
|
||||
enum {
|
||||
V3D_OVERLAY_SHOW_EMPTY = (1 << OB_EMPTY),
|
||||
V3D_OVERLAY_SHOW_LAMP = (1 << OB_LAMP),
|
||||
V3D_OVERLAY_SHOW_CAMERA = (1 << OB_CAMERA),
|
||||
V3D_OVERLAY_SHOW_SPEAKER = (1 << OB_SPEAKER),
|
||||
V3D_OVERLAY_SHOW_LIGHTPROBE = (1 << OB_LIGHTPROBE),
|
||||
V3D_OVERLAY_SHOW_ARMATURE = (1 << OB_ARMATURE),
|
||||
};
|
||||
#define V3D_OVERLAY_VISIBLE_OBJECT_TYPES_MASK (V3D_OVERLAY_SHOW_EMPTY | V3D_OVERLAY_SHOW_LAMP | V3D_OVERLAY_SHOW_CAMERA | V3D_OVERLAY_SHOW_SPEAKER | V3D_OVERLAY_SHOW_LIGHTPROBE | V3D_OVERLAY_SHOW_ARMATURE)
|
||||
|
||||
/* View3DOverlay->edit_flag */
|
||||
enum {
|
||||
V3D_OVERLAY_EDIT_VERT_NORMALS = (1 << 0),
|
||||
|
|
|
@ -2608,6 +2608,54 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Show 3D Cursor", "Display 3D Cursor Overlay");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_empties", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_EMPTY);
|
||||
RNA_def_property_boolean_default(prop, true);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(prop, "Show Empties", "Draw empties in the overlay");
|
||||
RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_EMPTY, 0);
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_cameras", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_CAMERA);
|
||||
RNA_def_property_boolean_default(prop, true);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(prop, "Show Cameras", "Draw cameras in the overlay");
|
||||
RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_CAMERA, 0);
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_speakers", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_SPEAKER);
|
||||
RNA_def_property_boolean_default(prop, true);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(prop, "Show Speakers", "Draw speakers in the overlay");
|
||||
RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_SPEAKER, 0);
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_lightprobes", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_LIGHTPROBE);
|
||||
RNA_def_property_boolean_default(prop, true);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(prop, "Show Lightprobes", "Draw lightprobes in the overlay");
|
||||
RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_LIGHTPROBE, 0);
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_armatures", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_ARMATURE);
|
||||
RNA_def_property_boolean_default(prop, true);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(prop, "Show Armatures", "Draw armatures in the overlay");
|
||||
RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_ARMATURE, 0);
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_lamps", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "overlay.visible_object_types", V3D_OVERLAY_SHOW_LAMP);
|
||||
RNA_def_property_boolean_default(prop, true);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(prop, "Show Lamps", "Draw lamps in the overlay");
|
||||
RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_LAMP, 0);
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_text", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_TEXT);
|
||||
RNA_def_property_ui_text(prop, "Show Text", "Display overlay text");
|
||||
|
|
Loading…
Reference in New Issue