Previously, when a socket was detected to be unused, it was just grayed out. This patch adds support for automatically hiding unused sockets based on this convention: Menu inputs control visibility while other inputs only control whether something is grayed out. More specifically, an input is visible if any of these conditions is met: * It affects the output currently. * It never affects the output. In this case its usage does not depend on any menu input. * It is used if all non-menu inputs are considered to be unknown. In the future, we could support customizing which inputs are allowed to control visibility. For now it's good to use the convention that Blender generally follows itself. As before, panels are grayed out if they only contain grayed out sockets and panels are hidden when they don't contain any visible sockets. Hiding inputs works in group nodes, the Geometry Nodes modifier and node operators. In theory it will work for all node tree types, but since only Geometry Nodes supports the Menu Switch node currently, this patch currently only makes a difference there. The implementation reuses the existing `SocketUsageInferencer` with a different sets of inputs. So no new core-inferencing logic was needed. Design task: #132706. Pull Request: https://projects.blender.org/blender/blender/pulls/138186
15 lines
295 B
C++
15 lines
295 B
C++
/* SPDX-FileCopyrightText: 2025 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
namespace blender::nodes::socket_usage_inference {
|
|
|
|
struct SocketUsage {
|
|
bool is_used = true;
|
|
bool is_visible = true;
|
|
};
|
|
|
|
} // namespace blender::nodes::socket_usage_inference
|