Nodes: Display vector values expanded, except when specified as compact.

Change the default drawing method of vector sockets to use a column layout.
This allows more interactive use of nodes and avoids the one or two clicks
needed to edit vector sockets in the old default component layout.

Developers may still use the component layout by flaging the socket with the
`SOCK_COMPACT` socket flag. For now, we choose to draw the SSS scale vector
of the Principled and SSS nodes in a compact form because they don't require
much interactivity.

Reviewers: brecht, JacquesLucke

Differential Revision: https://developer.blender.org/D5458
This commit is contained in:
OmarSquircleArt 2019-08-10 17:37:39 +02:00
parent f51f4355b9
commit 26911ba1e2
4 changed files with 21 additions and 3 deletions

View File

@ -3333,7 +3333,13 @@ static void std_node_socket_draw(
uiItemR(layout, ptr, "default_value", 0, text, 0);
break;
case SOCK_VECTOR:
uiTemplateComponentMenu(layout, ptr, "default_value", text);
if (sock->flag & SOCK_COMPACT) {
uiTemplateComponentMenu(layout, ptr, "default_value", text);
}
else {
uiLayout *column = uiLayoutColumn(layout, true);
uiItemR(column, ptr, "default_value", 0, text, 0);
}
break;
case SOCK_RGBA:
case SOCK_STRING: {

View File

@ -184,6 +184,8 @@ typedef enum eNodeSocketFlag {
/** socket hidden automatically, to distinguish from manually hidden */
SOCK_AUTO_HIDDEN__DEPRECATED = (1 << 8),
SOCK_NO_INTERNAL_LINK = (1 << 9),
/** Draw socket in a more compact form. */
SOCK_COMPACT = (1 << 10),
} eNodeSocketFlag;
/* limit data in bNode to what we want to see saved? */

View File

@ -24,7 +24,17 @@
static bNodeSocketTemplate sh_node_bsdf_principled_in[] = {
{SOCK_RGBA, 1, N_("Base Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{SOCK_FLOAT, 1, N_("Subsurface"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{SOCK_VECTOR, 1, N_("Subsurface Radius"), 1.0f, 0.2f, 0.1f, 0.0f, 0.0f, 100.0f},
{SOCK_VECTOR,
1,
N_("Subsurface Radius"),
1.0f,
0.2f,
0.1f,
0.0f,
0.0f,
100.0f,
PROP_NONE,
SOCK_COMPACT},
{SOCK_RGBA, 1, N_("Subsurface Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{SOCK_FLOAT, 1, N_("Metallic"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{SOCK_FLOAT, 1, N_("Specular"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},

View File

@ -24,7 +24,7 @@
static bNodeSocketTemplate sh_node_subsurface_scattering_in[] = {
{SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{SOCK_FLOAT, 1, N_("Scale"), 1.0, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
{SOCK_VECTOR, 1, N_("Radius"), 1.0f, 0.2f, 0.1f, 0.0f, 0.0f, 100.0f},
{SOCK_VECTOR, 1, N_("Radius"), 1.0f, 0.2f, 0.1f, 0.0f, 0.0f, 100.0f, PROP_NONE, SOCK_COMPACT},
{SOCK_FLOAT, 1, N_("Sharpness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{SOCK_FLOAT, 1, N_("Texture Blur"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{SOCK_VECTOR,