Viewport: Remove different outline color for instances

With instancing becoming more common with geometry nodes,
instances are less of a separate thing and more of an essential part
of evaluated data. Displaying them with a separate outline, while
helpful in some cases, is not worth the lack of visibility or confusion
about selected/active status. Information about the performance
of the scene due to instancing is always available with the statistics
like vertex count, etc.

The problems were compounded by the fact that the instancing
system is used to output geometry components that don't correspond
to the object's original type. So this patch also fixes that problem.

Fixes T92079, T81010
Ref T91310

Differential Revision: https://developer.blender.org/D13133
This commit is contained in:
Hans Goudey 2021-11-09 10:12:05 -06:00
parent 570331ca96
commit aa13c4b386
Notes: blender-bot 2023-02-14 11:20:29 +01:00
Referenced by commit 216a215ba5, Fix T93573: Remove outline from instances in edit mode
Referenced by commit 44239fa106, Fix: Crash with no active object after recent commit
Referenced by issue #92079, Text selection regression (difficult to see) since 2.93
Referenced by issue #91310, Outline color for selected objects
Referenced by issue #81010, Outline color for collection instances is different (dimming, also no indication for "Active")
9 changed files with 14 additions and 63 deletions

View File

@ -762,10 +762,7 @@ void OVERLAY_lightprobe_cache_populate(OVERLAY_Data *vedata, Object *ob)
instdata.mat[1][3] = prb->grid_resolution_y;
instdata.mat[2][3] = prb->grid_resolution_z;
/* Put theme id in matrix. */
if (UNLIKELY(ob->base_flag & BASE_FROM_DUPLI)) {
instdata.mat[3][3] = 0.0;
}
else if (theme_id == TH_ACTIVE) {
if (theme_id == TH_ACTIVE) {
instdata.mat[3][3] = 1.0;
}
else /* TH_SELECT */ {

View File

@ -10,9 +10,6 @@ vec4 color_from_id(float color_id)
if (isTransform) {
return colorTransform;
}
else if (color_id == 0.0) {
return colorDupliSelect;
}
else if (color_id == 1.0) {
return colorActive;
}

View File

@ -241,9 +241,6 @@ void main()
else if (color_id == 1u) {
fragColor = colorSelect;
}
else if (color_id == 2u) {
fragColor = colorDupliSelect;
}
else if (color_id == 3u) {
fragColor = colorActive;
}

View File

@ -17,18 +17,8 @@ flat out uint objectId;
uint outline_colorid_get(void)
{
int flag = int(abs(ObjectInfo.w));
bool is_from_dupli = (flag & DRW_BASE_FROM_DUPLI) != 0;
bool is_active = (flag & DRW_BASE_ACTIVE) != 0;
if (is_from_dupli) {
if (isTransform) {
return 0u; /* colorTransform */
}
else {
return 2u; /* colorDupliSelect */
}
}
if (isTransform) {
return 0u; /* colorTransform */
}

View File

@ -28,27 +28,12 @@ void wire_color_get(out vec3 rim_col, out vec3 wire_col)
{
int flag = int(abs(ObjectInfo.w));
bool is_selected = (flag & DRW_BASE_SELECTED) != 0;
bool is_from_dupli = (flag & DRW_BASE_FROM_DUPLI) != 0;
bool is_from_set = (flag & DRW_BASE_FROM_SET) != 0;
bool is_active = (flag & DRW_BASE_ACTIVE) != 0;
if (is_from_set) {
rim_col = colorDupli.rgb;
wire_col = colorDupli.rgb;
}
else if (is_from_dupli) {
if (is_selected) {
if (isTransform) {
rim_col = colorTransform.rgb;
}
else {
rim_col = colorDupliSelect.rgb;
}
}
else {
rim_col = colorDupli.rgb;
}
wire_col = colorDupli.rgb;
rim_col = colorWire.rgb;
wire_col = colorWire.rgb;
}
else if (is_selected && useColoring) {
if (isTransform) {

View File

@ -101,11 +101,6 @@ void DRW_globals_update(void)
gb->colorEditMeshMiddle,
dot_v3v3(gb->colorEditMeshMiddle, (float[3]){0.3333f, 0.3333f, 0.3333f})); /* Desaturate */
interp_v4_v4v4(gb->colorDupliSelect, gb->colorBackground, gb->colorSelect, 0.5f);
/* Was 50% in 2.7x since the background was lighter making it easier to tell the color from
* black, with a darker background we need a more faded color. */
interp_v4_v4v4(gb->colorDupli, gb->colorBackground, gb->colorWire, 0.3f);
#ifdef WITH_FREESTYLE
UI_GetThemeColor4fv(TH_FREESTYLE_EDGE_MARK, gb->colorEdgeFreestyle);
UI_GetThemeColor4fv(TH_FREESTYLE_FACE_MARK, gb->colorFaceFreestyle);
@ -300,7 +295,10 @@ int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color
{
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool is_edit = (draw_ctx->object_mode & OB_MODE_EDIT) && (ob->mode & OB_MODE_EDIT);
const bool active = (view_layer->basact && view_layer->basact->object == ob);
const bool active = (ob->base_flag & BASE_FROM_DUPLI) ?
(DRW_object_get_dupli_parent(ob) == view_layer->basact->object) :
(view_layer->basact && view_layer->basact->object == ob);
/* confusing logic here, there are 2 methods of setting the color
* 'colortab[colindex]' and 'theme_id', colindex overrides theme_id.
*
@ -345,21 +343,7 @@ int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color
if (r_color != NULL) {
if (UNLIKELY(ob->base_flag & BASE_FROM_SET)) {
*r_color = G_draw.block.colorDupli;
}
else if (UNLIKELY(ob->base_flag & BASE_FROM_DUPLI)) {
switch (theme_id) {
case TH_ACTIVE:
case TH_SELECT:
*r_color = G_draw.block.colorDupliSelect;
break;
case TH_TRANSFORM:
*r_color = G_draw.block.colorTransform;
break;
default:
*r_color = G_draw.block.colorDupli;
break;
}
*r_color = G_draw.block.colorWire;
}
else {
switch (theme_id) {

View File

@ -43,8 +43,6 @@ typedef struct GlobalsUboStorage {
float colorWireEdit[4];
float colorActive[4];
float colorSelect[4];
float colorDupliSelect[4];
float colorDupli[4];
float colorLibrarySelect[4];
float colorLibrary[4];
float colorTransform[4];

View File

@ -538,7 +538,12 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob)
ob_infos->ob_flag += (ob->base_flag & BASE_SELECTED) ? (1 << 1) : 0;
ob_infos->ob_flag += (ob->base_flag & BASE_FROM_DUPLI) ? (1 << 2) : 0;
ob_infos->ob_flag += (ob->base_flag & BASE_FROM_SET) ? (1 << 3) : 0;
ob_infos->ob_flag += (ob == DST.draw_ctx.obact) ? (1 << 4) : 0;
if (ob->base_flag & BASE_FROM_DUPLI) {
ob_infos->ob_flag += (DRW_object_get_dupli_parent(ob) == DST.draw_ctx.obact) ? (1 << 4) : 0;
}
else {
ob_infos->ob_flag += (ob == DST.draw_ctx.obact) ? (1 << 4) : 0;
}
/* Negative scaling. */
ob_infos->ob_flag *= (ob->transflag & OB_NEG_SCALE) ? -1.0f : 1.0f;
/* Object Color. */

View File

@ -7,8 +7,6 @@ layout(std140) uniform globalsBlock
vec4 colorWireEdit;
vec4 colorActive;
vec4 colorSelect;
vec4 colorDupliSelect;
vec4 colorDupli;
vec4 colorLibrarySelect;
vec4 colorLibrary;
vec4 colorTransform;