Fix #112233: Panel collapsed state should not hide socket links #112326
|
@ -794,14 +794,14 @@ inline bool bNodeSocket::is_panel_collapsed() const
|
|||
return (this->flag & SOCK_PANEL_COLLAPSED) != 0;
|
||||
}
|
||||
|
||||
inline bool bNodeSocket::is_visible() const
|
||||
inline bool bNodeSocket::is_visible_or_panel_collapsed() const
|
||||
{
|
||||
return !this->is_hidden() && this->is_available();
|
||||
}
|
||||
|
||||
inline bool bNodeSocket::is_icon_visible() const
|
||||
inline bool bNodeSocket::is_visible() const
|
||||
{
|
||||
return this->is_visible() && !this->is_panel_collapsed();
|
||||
return this->is_visible_or_panel_collapsed() && !this->is_panel_collapsed();
|
||||
}
|
||||
|
||||
inline bNode &bNodeSocket::owner_node()
|
||||
|
|
|
@ -2756,7 +2756,8 @@ void nodeRemSocketLinks(bNodeTree *ntree, bNodeSocket *sock)
|
|||
|
||||
bool nodeLinkIsHidden(const bNodeLink *link)
|
||||
{
|
||||
return !(link->fromsock->is_visible() && link->tosock->is_visible());
|
||||
return !(link->fromsock->is_visible_or_panel_collapsed() &&
|
||||
link->tosock->is_visible_or_panel_collapsed());
|
||||
}
|
||||
|
||||
namespace blender::bke {
|
||||
|
|
|
@ -407,8 +407,8 @@ static bool node_update_basis_socket(const bContext &C,
|
|||
const int &locx,
|
||||
int &locy)
|
||||
{
|
||||
if ((!input_socket || !input_socket->is_visible()) &&
|
||||
(!output_socket || !output_socket->is_visible()))
|
||||
if ((!input_socket || !input_socket->is_visible_or_panel_collapsed()) &&
|
||||
(!output_socket || !output_socket->is_visible_or_panel_collapsed()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ static void node_update_basis_from_declaration(
|
|||
}
|
||||
else {
|
||||
/* Space between items. */
|
||||
if (!is_first && item.input->is_visible()) {
|
||||
if (!is_first && item.input->is_visible_or_panel_collapsed()) {
|
||||
locy -= NODE_SOCKDY;
|
||||
}
|
||||
}
|
||||
|
@ -714,7 +714,7 @@ static void node_update_basis_from_declaration(
|
|||
}
|
||||
else {
|
||||
/* Space between items. */
|
||||
if (!is_first && item.output->is_visible()) {
|
||||
if (!is_first && item.output->is_visible_or_panel_collapsed()) {
|
||||
locy -= NODE_SOCKDY;
|
||||
}
|
||||
}
|
||||
|
@ -865,12 +865,12 @@ static void node_update_hidden(bNode &node, uiBlock &block)
|
|||
|
||||
/* Calculate minimal radius. */
|
||||
for (const bNodeSocket *socket : node.input_sockets()) {
|
||||
if (socket->is_visible()) {
|
||||
if (socket->is_visible_or_panel_collapsed()) {
|
||||
totin++;
|
||||
}
|
||||
}
|
||||
for (const bNodeSocket *socket : node.output_sockets()) {
|
||||
if (socket->is_visible()) {
|
||||
if (socket->is_visible_or_panel_collapsed()) {
|
||||
totout++;
|
||||
}
|
||||
}
|
||||
|
@ -891,7 +891,7 @@ static void node_update_hidden(bNode &node, uiBlock &block)
|
|||
float drad = rad;
|
||||
|
||||
for (bNodeSocket *socket : node.output_sockets()) {
|
||||
if (socket->is_visible()) {
|
||||
if (socket->is_visible_or_panel_collapsed()) {
|
||||
/* Round the socket location to stop it from jiggling. */
|
||||
socket->runtime->location = {
|
||||
round(node.runtime->totr.xmax - hiddenrad + sinf(rad) * hiddenrad),
|
||||
|
@ -904,7 +904,7 @@ static void node_update_hidden(bNode &node, uiBlock &block)
|
|||
rad = drad = -float(M_PI) / (1.0f + float(totin));
|
||||
|
||||
for (bNodeSocket *socket : node.input_sockets()) {
|
||||
if (socket->is_visible()) {
|
||||
if (socket->is_visible_or_panel_collapsed()) {
|
||||
/* Round the socket location to stop it from jiggling. */
|
||||
socket->runtime->location = {
|
||||
round(node.runtime->totr.xmin + hiddenrad + sinf(rad) * hiddenrad),
|
||||
|
@ -1751,7 +1751,7 @@ static void node_draw_sockets(const View2D &v2d,
|
|||
/* Socket inputs. */
|
||||
int selected_input_len = 0;
|
||||
for (const bNodeSocket *sock : node.input_sockets()) {
|
||||
if (!sock->is_icon_visible()) {
|
||||
if (!sock->is_visible()) {
|
||||
continue;
|
||||
}
|
||||
if (select_all || (sock->flag & SELECT)) {
|
||||
|
@ -1774,7 +1774,7 @@ static void node_draw_sockets(const View2D &v2d,
|
|||
int selected_output_len = 0;
|
||||
if (draw_outputs) {
|
||||
for (const bNodeSocket *sock : node.output_sockets()) {
|
||||
if (!sock->is_icon_visible()) {
|
||||
if (!sock->is_visible()) {
|
||||
continue;
|
||||
}
|
||||
if (select_all || (sock->flag & SELECT)) {
|
||||
|
@ -1802,7 +1802,7 @@ static void node_draw_sockets(const View2D &v2d,
|
|||
if (selected_input_len) {
|
||||
/* Socket inputs. */
|
||||
for (const bNodeSocket *sock : node.input_sockets()) {
|
||||
if (!sock->is_icon_visible()) {
|
||||
if (!sock->is_visible()) {
|
||||
continue;
|
||||
}
|
||||
/* Don't draw multi-input sockets here since they are drawn in a different batch. */
|
||||
|
@ -1831,7 +1831,7 @@ static void node_draw_sockets(const View2D &v2d,
|
|||
if (selected_output_len) {
|
||||
/* Socket outputs. */
|
||||
for (const bNodeSocket *sock : node.output_sockets()) {
|
||||
if (!sock->is_icon_visible()) {
|
||||
if (!sock->is_visible()) {
|
||||
continue;
|
||||
}
|
||||
if (select_all || (sock->flag & SELECT)) {
|
||||
|
@ -1864,7 +1864,7 @@ static void node_draw_sockets(const View2D &v2d,
|
|||
/* Draw multi-input sockets after the others because they are drawn with `UI_draw_roundbox`
|
||||
* rather than with `GL_POINT`. */
|
||||
for (const bNodeSocket *socket : node.input_sockets()) {
|
||||
if (!socket->is_icon_visible()) {
|
||||
if (!socket->is_visible()) {
|
||||
continue;
|
||||
}
|
||||
if (!(socket->flag & SOCK_MULTI_INPUT)) {
|
||||
|
|
|
@ -1191,7 +1191,7 @@ bNodeSocket *node_find_indicated_socket(SpaceNode &snode,
|
|||
|
||||
if (in_out & SOCK_IN) {
|
||||
for (bNodeSocket *sock : node.input_sockets()) {
|
||||
if (sock->is_icon_visible()) {
|
||||
if (sock->is_visible()) {
|
||||
const float2 location = sock->runtime->location;
|
||||
if (sock->flag & SOCK_MULTI_INPUT && !(node.flag & NODE_HIDDEN)) {
|
||||
if (cursor_isect_multi_input_socket(cursor, *sock)) {
|
||||
|
@ -1210,7 +1210,7 @@ bNodeSocket *node_find_indicated_socket(SpaceNode &snode,
|
|||
}
|
||||
if (in_out & SOCK_OUT) {
|
||||
for (bNodeSocket *sock : node.output_sockets()) {
|
||||
if (sock->is_icon_visible()) {
|
||||
if (sock->is_visible()) {
|
||||
const float2 location = sock->runtime->location;
|
||||
if (BLI_rctf_isect_pt(&rect, location.x, location.y)) {
|
||||
if (!socket_is_occluded(location, node, snode)) {
|
||||
|
|
|
@ -170,7 +170,7 @@ static void pick_input_link_by_link_intersect(const bContext &C,
|
|||
|
||||
static bool socket_is_available(bNodeTree * /*ntree*/, bNodeSocket *sock, const bool allow_used)
|
||||
{
|
||||
if (!sock->is_visible()) {
|
||||
if (!sock->is_visible_or_panel_collapsed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,7 @@ namespace viewer_linking {
|
|||
/* Depending on the node tree type, different socket types are supported by viewer nodes. */
|
||||
static bool socket_can_be_viewed(const bNodeSocket &socket)
|
||||
{
|
||||
if (!socket.is_icon_visible()) {
|
||||
if (!socket.is_visible()) {
|
||||
return false;
|
||||
}
|
||||
if (STREQ(socket.idname, "NodeSocketVirtual")) {
|
||||
|
@ -2264,7 +2264,7 @@ bNodeSocket *get_main_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_
|
|||
int index;
|
||||
LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, sockets, index) {
|
||||
const nodes::SocketDeclaration &socket_decl = *socket_decls[index];
|
||||
if (!socket->is_visible()) {
|
||||
if (!socket->is_visible_or_panel_collapsed()) {
|
||||
continue;
|
||||
}
|
||||
if (socket_decl.is_default_link_socket) {
|
||||
|
@ -2285,7 +2285,7 @@ bNodeSocket *get_main_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_
|
|||
/* Try all priorities, starting from 'highest'. */
|
||||
for (int priority = maxpriority; priority >= 0; priority--) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, sockets) {
|
||||
if (!!sock->is_visible() && priority == get_main_socket_priority(sock)) {
|
||||
if (!!sock->is_visible_or_panel_collapsed() && priority == get_main_socket_priority(sock)) {
|
||||
return sock;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,8 +189,8 @@ typedef struct bNodeSocket {
|
|||
bool is_hidden() const;
|
||||
bool is_available() const;
|
||||
bool is_panel_collapsed() const;
|
||||
bool is_visible_or_panel_collapsed() const;
|
||||
bool is_visible() const;
|
||||
|
||||
bool is_icon_visible() const;
|
||||
bool is_multi_input() const;
|
||||
bool is_input() const;
|
||||
bool is_output() const;
|
||||
|
|
|
@ -124,7 +124,7 @@ static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
|
|||
|
||||
/* If the source node has a geometry socket, connect it to the new viewer node as well. */
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, ¶ms.node.outputs) {
|
||||
if (socket->type == SOCK_GEOMETRY && socket->is_visible()) {
|
||||
if (socket->type == SOCK_GEOMETRY && socket->is_visible_or_panel_collapsed()) {
|
||||
nodeAddLink(¶ms.node_tree,
|
||||
¶ms.node,
|
||||
socket,
|
||||
|
|
Loading…
Reference in New Issue
I think this needs some comment. Took me a while to understand what
icon
refers to here.Yeah that's what our discussion was about. Hans wants to rename the
is_visible
but it's not clear what a better name would be (meaning "The socket is has a valid location and may be connected" but there may not be any visible parts). Likewiseis_icon_visible
means "The socket has a visible icon and can be interacted with".I'm happy to rename things but i don't know what to rename it to.