Draw Manager: simplify object mask usage
Remove flag defines, use object types directly.
This commit is contained in:
parent
e5ca319f9d
commit
72e04f9890
|
@ -3833,7 +3833,7 @@ class VIEW3D_PT_overlay(Panel):
|
|||
sub.prop(overlay, "show_all_objects_origin")
|
||||
|
||||
sub = split.column()
|
||||
sub.prop(overlay, "show_non_renderable_objects")
|
||||
sub.prop(overlay, "show_non_geometry")
|
||||
sub.prop(overlay, "show_relationship_lines")
|
||||
sub.prop(overlay, "show_motion_paths")
|
||||
#sub.prop(overlay, "show_onion_skins")
|
||||
|
|
|
@ -2127,6 +2127,10 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
|
|||
return;
|
||||
}
|
||||
|
||||
if (v3d->overlay.object_type_exclude & (1 << ob->type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool do_outlines = (draw_ctx->v3d->flag & V3D_SELECT_OUTLINE) && ((ob->base_flag & BASE_SELECTED) != 0);
|
||||
bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0);
|
||||
|
||||
|
@ -2185,31 +2189,26 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
|
|||
break;
|
||||
case OB_LATTICE:
|
||||
{
|
||||
if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_OTHER) == 0) {
|
||||
if (ob != draw_ctx->object_edit) {
|
||||
struct Gwn_Batch *geom = DRW_cache_lattice_wire_get(ob, false);
|
||||
if (theme_id == TH_UNDEFINED) {
|
||||
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
|
||||
}
|
||||
|
||||
DRWShadingGroup *shgroup = shgroup_theme_id_to_wire_or(stl, theme_id, stl->g_data->wire);
|
||||
DRW_shgroup_call_object_add(shgroup, geom, ob);
|
||||
if (ob != draw_ctx->object_edit) {
|
||||
struct Gwn_Batch *geom = DRW_cache_lattice_wire_get(ob, false);
|
||||
if (theme_id == TH_UNDEFINED) {
|
||||
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
|
||||
}
|
||||
|
||||
DRWShadingGroup *shgroup = shgroup_theme_id_to_wire_or(stl, theme_id, stl->g_data->wire);
|
||||
DRW_shgroup_call_object_add(shgroup, geom, ob);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case OB_CURVE:
|
||||
{
|
||||
if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_OTHER) == 0) {
|
||||
if (ob != draw_ctx->object_edit) {
|
||||
struct Gwn_Batch *geom = DRW_cache_curve_edge_wire_get(ob);
|
||||
if (theme_id == TH_UNDEFINED) {
|
||||
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
|
||||
}
|
||||
DRWShadingGroup *shgroup = shgroup_theme_id_to_wire_or(stl, theme_id, stl->g_data->wire);
|
||||
DRW_shgroup_call_object_add(shgroup, geom, ob);
|
||||
if (ob != draw_ctx->object_edit) {
|
||||
struct Gwn_Batch *geom = DRW_cache_curve_edge_wire_get(ob);
|
||||
if (theme_id == TH_UNDEFINED) {
|
||||
theme_id = DRW_object_wire_theme_get(ob, view_layer, NULL);
|
||||
}
|
||||
DRWShadingGroup *shgroup = shgroup_theme_id_to_wire_or(stl, theme_id, stl->g_data->wire);
|
||||
DRW_shgroup_call_object_add(shgroup, geom, ob);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2221,52 +2220,34 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
|
|||
break;
|
||||
}
|
||||
case OB_LAMP:
|
||||
if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_LAMP) == 0)
|
||||
{
|
||||
DRW_shgroup_lamp(stl, ob, view_layer);
|
||||
}
|
||||
DRW_shgroup_lamp(stl, ob, view_layer);
|
||||
break;
|
||||
case OB_CAMERA:
|
||||
if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_CAMERA) == 0)
|
||||
{
|
||||
DRW_shgroup_camera(stl, ob, view_layer);
|
||||
}
|
||||
DRW_shgroup_camera(stl, ob, view_layer);
|
||||
break;
|
||||
case OB_EMPTY:
|
||||
if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_EMPTY) == 0)
|
||||
{
|
||||
DRW_shgroup_empty(stl, psl, ob, view_layer);
|
||||
}
|
||||
DRW_shgroup_empty(stl, psl, ob, view_layer);
|
||||
break;
|
||||
case OB_SPEAKER:
|
||||
if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_SPEAKER) == 0)
|
||||
{
|
||||
DRW_shgroup_speaker(stl, ob, view_layer);
|
||||
}
|
||||
DRW_shgroup_speaker(stl, ob, view_layer);
|
||||
break;
|
||||
case OB_LIGHTPROBE:
|
||||
if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_LIGHTPROBE) == 0)
|
||||
{
|
||||
DRW_shgroup_lightprobe(stl, psl, ob, view_layer);
|
||||
}
|
||||
DRW_shgroup_lightprobe(stl, psl, ob, view_layer);
|
||||
break;
|
||||
case OB_ARMATURE:
|
||||
{
|
||||
if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_ARMATURE) == 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
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;
|
||||
|
@ -2275,10 +2256,8 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
|
|||
break;
|
||||
}
|
||||
|
||||
if ((v3d->overlay.hidden_object_types & V3D_OVERLAY_HIDE_OTHER) == 0) {
|
||||
if (ob->pd && ob->pd->forcefield) {
|
||||
DRW_shgroup_forcefield(stl, ob, view_layer);
|
||||
}
|
||||
if (ob->pd && ob->pd->forcefield) {
|
||||
DRW_shgroup_forcefield(stl, ob, view_layer);
|
||||
}
|
||||
|
||||
/* don't show object extras in set's */
|
||||
|
|
|
@ -179,7 +179,7 @@ typedef struct View3DOverlay {
|
|||
|
||||
/* Other settings */
|
||||
float wireframe_threshold;
|
||||
int hidden_object_types;
|
||||
int object_type_exclude;
|
||||
|
||||
} View3DOverlay;
|
||||
|
||||
|
@ -384,18 +384,6 @@ enum {
|
|||
V3D_OVERLAY_ONION_SKINS = (1 << 7),
|
||||
};
|
||||
|
||||
/* View3DOverlay->hidden_object_types */
|
||||
enum {
|
||||
V3D_OVERLAY_HIDE_EMPTY = (1 << OB_EMPTY),
|
||||
V3D_OVERLAY_HIDE_LAMP = (1 << OB_LAMP),
|
||||
V3D_OVERLAY_HIDE_CAMERA = (1 << OB_CAMERA),
|
||||
V3D_OVERLAY_HIDE_SPEAKER = (1 << OB_SPEAKER),
|
||||
V3D_OVERLAY_HIDE_LIGHTPROBE = (1 << OB_LIGHTPROBE),
|
||||
V3D_OVERLAY_HIDE_ARMATURE = (1 << OB_ARMATURE),
|
||||
V3D_OVERLAY_HIDE_OTHER = (1 << 14),
|
||||
};
|
||||
#define V3D_OVERLAY_HIDE_NON_RENDERABLE (V3D_OVERLAY_HIDE_EMPTY | V3D_OVERLAY_HIDE_LAMP | V3D_OVERLAY_HIDE_CAMERA | V3D_OVERLAY_HIDE_SPEAKER | V3D_OVERLAY_HIDE_LIGHTPROBE | V3D_OVERLAY_HIDE_ARMATURE | V3D_OVERLAY_HIDE_OTHER)
|
||||
|
||||
/* View3DOverlay->edit_flag */
|
||||
enum {
|
||||
V3D_OVERLAY_EDIT_VERT_NORMALS = (1 << 0),
|
||||
|
|
|
@ -2616,8 +2616,11 @@ 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_non_renderable_objects", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.hidden_object_types", V3D_OVERLAY_HIDE_NON_RENDERABLE);
|
||||
prop = RNA_def_property(srna, "show_non_geometry", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(
|
||||
prop, NULL, "overlay.object_type_exclude",
|
||||
((1 << OB_TYPE_MAX) - 1) &
|
||||
~((1 << OB_MESH) | (1 << OB_CURVE) | (1 << OB_SURF) | (1 << OB_FONT) | (1 << OB_MBALL)));
|
||||
RNA_def_property_boolean_default(prop, true);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(prop, "Show Non Renderable", "Draw not renderable objects in the overlay");
|
||||
|
|
Loading…
Reference in New Issue