Nodes: rename "Hide" to "Collapse"

Design task: https://projects.blender.org/blender/blender/issues/139158

Renaming includes:
- UI description
- Python operator description
- Code (Enums, function names and variables)

Unchanged:
- Python API
  - `bpy.ops.node.hide_toggle()`
  - `node.hide`
- Python operators / scripts

The reasoning is that improved naming is not enough reason to break
backward compatibility for Python API.

Pull Request: https://projects.blender.org/blender/blender/pulls/141038
This commit is contained in:
Habib Gahbiche
2025-06-30 15:28:19 +02:00
parent 09d34755f1
commit 7f668be362
14 changed files with 78 additions and 78 deletions

View File

@@ -1020,7 +1020,7 @@ inline bool bNodeSocket::is_visible() const
inline bool bNodeSocket::is_icon_visible() const
{
return this->is_visible() &&
(this->owner_node().flag & NODE_HIDDEN || !this->is_panel_collapsed());
(this->owner_node().flag & NODE_COLLAPSED || !this->is_panel_collapsed());
}
inline bool bNodeSocket::may_be_field() const

View File

@@ -2160,7 +2160,7 @@ static void update_noise_and_wave_distortion(bNodeTree *ntree)
mulNode->custom1 = NODE_MATH_MULTIPLY;
mulNode->locx_legacy = node->locx_legacy;
mulNode->locy_legacy = node->locy_legacy - 240.0f;
mulNode->flag |= NODE_HIDDEN;
mulNode->flag |= NODE_COLLAPSED;
bNodeSocket *mulSockA = static_cast<bNodeSocket *>(BLI_findlink(&mulNode->inputs, 0));
bNodeSocket *mulSockB = static_cast<bNodeSocket *>(BLI_findlink(&mulNode->inputs, 1));
*version_cycles_node_socket_float_value(mulSockB) = 0.5f;

View File

@@ -156,7 +156,7 @@ static void versioning_update_noise_texture_node(bNodeTree *ntree)
clamp_node->custom1 = NODE_CLAMP_MINMAX;
clamp_node->locx_legacy = node->locx_legacy;
clamp_node->locy_legacy = node->locy_legacy - 300.0f;
clamp_node->flag |= NODE_HIDDEN;
clamp_node->flag |= NODE_COLLAPSED;
bNodeSocket *clamp_socket_value = blender::bke::node_find_socket(
*clamp_node, SOCK_IN, "Value");
bNodeSocket *clamp_socket_min = blender::bke::node_find_socket(*clamp_node, SOCK_IN, "Min");
@@ -252,7 +252,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
min_node->custom1 = NODE_MATH_MINIMUM;
min_node->locx_legacy = node->locx_legacy;
min_node->locy_legacy = node->locy_legacy - 320.0f;
min_node->flag |= NODE_HIDDEN;
min_node->flag |= NODE_COLLAPSED;
bNodeSocket *min_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&min_node->inputs, 0));
bNodeSocket *min_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&min_node->inputs, 1));
bNodeSocket *min_socket_out = blender::bke::node_find_socket(*min_node, SOCK_OUT, "Value");
@@ -262,7 +262,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
sub1_node->custom1 = NODE_MATH_SUBTRACT;
sub1_node->locx_legacy = node->locx_legacy;
sub1_node->locy_legacy = node->locy_legacy - 360.0f;
sub1_node->flag |= NODE_HIDDEN;
sub1_node->flag |= NODE_COLLAPSED;
bNodeSocket *sub1_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&sub1_node->inputs, 0));
bNodeSocket *sub1_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&sub1_node->inputs, 1));
bNodeSocket *sub1_socket_out = blender::bke::node_find_socket(*sub1_node, SOCK_OUT, "Value");
@@ -286,7 +286,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
greater_node->custom1 = NODE_MATH_GREATER_THAN;
greater_node->locx_legacy = node->locx_legacy;
greater_node->locy_legacy = node->locy_legacy - 400.0f;
greater_node->flag |= NODE_HIDDEN;
greater_node->flag |= NODE_COLLAPSED;
bNodeSocket *greater_socket_A = static_cast<bNodeSocket *>(
BLI_findlink(&greater_node->inputs, 0));
bNodeSocket *greater_socket_B = static_cast<bNodeSocket *>(
@@ -309,7 +309,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
clamp_node->custom1 = NODE_CLAMP_MINMAX;
clamp_node->locx_legacy = node->locx_legacy;
clamp_node->locy_legacy = node->locy_legacy + 40.0f;
clamp_node->flag |= NODE_HIDDEN;
clamp_node->flag |= NODE_COLLAPSED;
bNodeSocket *clamp_socket_value = blender::bke::node_find_socket(
*clamp_node, SOCK_IN, "Value");
bNodeSocket *clamp_socket_min = blender::bke::node_find_socket(
@@ -324,7 +324,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
mul_node->custom1 = NODE_MATH_MULTIPLY;
mul_node->locx_legacy = node->locx_legacy;
mul_node->locy_legacy = node->locy_legacy + 80.0f;
mul_node->flag |= NODE_HIDDEN;
mul_node->flag |= NODE_COLLAPSED;
bNodeSocket *mul_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&mul_node->inputs, 0));
bNodeSocket *mul_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&mul_node->inputs, 1));
bNodeSocket *mul_socket_out = blender::bke::node_find_socket(*mul_node, SOCK_OUT, "Value");
@@ -341,7 +341,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
sub2_node->custom2 = SHD_MATH_CLAMP;
sub2_node->locx_legacy = node->locx_legacy;
sub2_node->locy_legacy = node->locy_legacy + 120.0f;
sub2_node->flag |= NODE_HIDDEN;
sub2_node->flag |= NODE_COLLAPSED;
bNodeSocket *sub2_socket_A = static_cast<bNodeSocket *>(
BLI_findlink(&sub2_node->inputs, 0));
bNodeSocket *sub2_socket_B = static_cast<bNodeSocket *>(
@@ -354,7 +354,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
add_node->custom1 = NODE_MATH_ADD;
add_node->locx_legacy = node->locx_legacy;
add_node->locy_legacy = node->locy_legacy + 160.0f;
add_node->flag |= NODE_HIDDEN;
add_node->flag |= NODE_COLLAPSED;
bNodeSocket *add_socket_A = static_cast<bNodeSocket *>(
BLI_findlink(&add_node->inputs, 0));
bNodeSocket *add_socket_B = static_cast<bNodeSocket *>(
@@ -406,7 +406,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
mul_node->custom1 = NODE_MATH_MULTIPLY;
mul_node->locx_legacy = node->locx_legacy;
mul_node->locy_legacy = node->locy_legacy + 40.0f;
mul_node->flag |= NODE_HIDDEN;
mul_node->flag |= NODE_COLLAPSED;
bNodeSocket *mul_socket_A = static_cast<bNodeSocket *>(
BLI_findlink(&mul_node->inputs, 0));
bNodeSocket *mul_socket_B = static_cast<bNodeSocket *>(
@@ -424,7 +424,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
add_node->custom1 = NODE_MATH_ADD;
add_node->locx_legacy = node->locx_legacy;
add_node->locy_legacy = node->locy_legacy + 80.0f;
add_node->flag |= NODE_HIDDEN;
add_node->flag |= NODE_COLLAPSED;
bNodeSocket *add_socket_A = static_cast<bNodeSocket *>(
BLI_findlink(&add_node->inputs, 0));
bNodeSocket *add_socket_B = static_cast<bNodeSocket *>(
@@ -482,7 +482,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
max1_node->custom1 = NODE_MATH_MAXIMUM;
max1_node->locx_legacy = node->locx_legacy;
max1_node->locy_legacy = node->locy_legacy - 400.0f + locy_offset;
max1_node->flag |= NODE_HIDDEN;
max1_node->flag |= NODE_COLLAPSED;
bNodeSocket *max1_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&max1_node->inputs, 0));
bNodeSocket *max1_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&max1_node->inputs, 1));
bNodeSocket *max1_socket_out = blender::bke::node_find_socket(*max1_node, SOCK_OUT, "Value");
@@ -492,7 +492,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
mul_node->custom1 = NODE_MATH_MULTIPLY;
mul_node->locx_legacy = node->locx_legacy;
mul_node->locy_legacy = node->locy_legacy - 360.0f + locy_offset;
mul_node->flag |= NODE_HIDDEN;
mul_node->flag |= NODE_COLLAPSED;
bNodeSocket *mul_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&mul_node->inputs, 0));
bNodeSocket *mul_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&mul_node->inputs, 1));
bNodeSocket *mul_socket_out = blender::bke::node_find_socket(*mul_node, SOCK_OUT, "Value");
@@ -502,7 +502,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
pow_node->custom1 = NODE_MATH_POWER;
pow_node->locx_legacy = node->locx_legacy;
pow_node->locy_legacy = node->locy_legacy - 320.0f + locy_offset;
pow_node->flag |= NODE_HIDDEN;
pow_node->flag |= NODE_COLLAPSED;
bNodeSocket *pow_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&pow_node->inputs, 0));
bNodeSocket *pow_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&pow_node->inputs, 1));
bNodeSocket *pow_socket_out = blender::bke::node_find_socket(*pow_node, SOCK_OUT, "Value");
@@ -526,7 +526,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
max2_node->custom1 = NODE_MATH_MAXIMUM;
max2_node->locx_legacy = node->locx_legacy;
max2_node->locy_legacy = node->locy_legacy - 440.0f + locy_offset;
max2_node->flag |= NODE_HIDDEN;
max2_node->flag |= NODE_COLLAPSED;
bNodeSocket *max2_socket_A = static_cast<bNodeSocket *>(
BLI_findlink(&max2_node->inputs, 0));
bNodeSocket *max2_socket_B = static_cast<bNodeSocket *>(
@@ -554,7 +554,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
max2_node->custom1 = NODE_MATH_MAXIMUM;
max2_node->locx_legacy = node->locx_legacy;
max2_node->locy_legacy = node->locy_legacy - 360.0f + locy_offset;
max2_node->flag |= NODE_HIDDEN;
max2_node->flag |= NODE_COLLAPSED;
bNodeSocket *max2_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&max2_node->inputs, 0));
bNodeSocket *max2_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&max2_node->inputs, 1));
bNodeSocket *max2_socket_out = blender::bke::node_find_socket(*max2_node, SOCK_OUT, "Value");
@@ -564,7 +564,7 @@ static void versioning_replace_musgrave_texture_node(bNodeTree *ntree)
pow_node->custom1 = NODE_MATH_POWER;
pow_node->locx_legacy = node->locx_legacy;
pow_node->locy_legacy = node->locy_legacy - 320.0f + locy_offset;
pow_node->flag |= NODE_HIDDEN;
pow_node->flag |= NODE_COLLAPSED;
bNodeSocket *pow_socket_A = static_cast<bNodeSocket *>(BLI_findlink(&pow_node->inputs, 0));
bNodeSocket *pow_socket_B = static_cast<bNodeSocket *>(BLI_findlink(&pow_node->inputs, 1));
bNodeSocket *pow_socket_out = blender::bke::node_find_socket(*pow_node, SOCK_OUT, "Value");

View File

@@ -350,7 +350,7 @@ static bool versioning_eevee_material_blend_mode_settings(bNodeTree *ntree, floa
bNode *math_node = blender::bke::node_add_node(nullptr, *ntree, "ShaderNodeMath");
math_node->custom1 = NODE_MATH_GREATER_THAN;
math_node->flag |= NODE_HIDDEN;
math_node->flag |= NODE_COLLAPSED;
math_node->parent = to_node->parent;
math_node->locx_legacy = to_node->locx_legacy - math_node->width - 30;
math_node->locy_legacy = min_ff(to_node->locy_legacy, from_node->locy_legacy);
@@ -446,7 +446,7 @@ static void versioning_eevee_material_shadow_none(Material *material)
/* Add mix node for mixing between original material, and transparent BSDF for shadows */
bNode *mix_node = blender::bke::node_add_node(nullptr, *ntree, "ShaderNodeMixShader");
STRNCPY(mix_node->label, "Disable Shadow");
mix_node->flag |= NODE_HIDDEN;
mix_node->flag |= NODE_COLLAPSED;
mix_node->parent = output_node->parent;
mix_node->locx_legacy = output_node->locx_legacy;
mix_node->locy_legacy = output_node->locy_legacy - output_node->height - 120;
@@ -468,7 +468,7 @@ static void versioning_eevee_material_shadow_none(Material *material)
/* Add light path node to control shadow visibility */
bNode *lp_node = blender::bke::node_add_node(nullptr, *ntree, "ShaderNodeLightPath");
lp_node->flag |= NODE_HIDDEN;
lp_node->flag |= NODE_COLLAPSED;
lp_node->parent = output_node->parent;
lp_node->locx_legacy = output_node->locx_legacy;
lp_node->locy_legacy = mix_node->locy_legacy + 35;
@@ -483,7 +483,7 @@ static void versioning_eevee_material_shadow_none(Material *material)
/* Add transparent BSDF to make shadows transparent. */
bNode *bsdf_node = blender::bke::node_add_node(nullptr, *ntree, "ShaderNodeBsdfTransparent");
bsdf_node->flag |= NODE_HIDDEN;
bsdf_node->flag |= NODE_COLLAPSED;
bsdf_node->parent = output_node->parent;
bsdf_node->locx_legacy = output_node->locx_legacy;
bsdf_node->locy_legacy = mix_node->locy_legacy - 35;

View File

@@ -359,7 +359,7 @@ static void do_version_color_to_float_conversion(bNodeTree *node_tree)
bNode *dot_product_node = blender::bke::node_add_static_node(
nullptr, *node_tree, SH_NODE_VECTOR_MATH);
dot_product_node->custom1 = NODE_VECTOR_MATH_DOT_PRODUCT;
dot_product_node->flag |= NODE_HIDDEN;
dot_product_node->flag |= NODE_COLLAPSED;
dot_product_node->location[0] = link->fromnode->location[0] + link->fromnode->width + 10.0f;
dot_product_node->location[1] = link->fromnode->location[1];

View File

@@ -447,7 +447,7 @@ static void do_version_normal_node_dot_product(bNodeTree *node_tree, bNode *node
bNode *dot_product_node = blender::bke::node_add_node(
nullptr, *node_tree, "ShaderNodeVectorMath");
dot_product_node->custom1 = NODE_VECTOR_MATH_DOT_PRODUCT;
dot_product_node->flag |= NODE_HIDDEN;
dot_product_node->flag |= NODE_COLLAPSED;
dot_product_node->parent = node->parent;
dot_product_node->location[0] = node->location[0];
dot_product_node->location[1] = node->location[1];
@@ -591,7 +591,7 @@ static void do_version_mix_color_use_alpha(bNodeTree *node_tree, bNode *node)
multiply_node->custom1 = NODE_MATH_MULTIPLY;
multiply_node->location[0] = node->location[0] - node->width - 20.0f;
multiply_node->location[1] = node->location[1];
multiply_node->flag |= NODE_HIDDEN;
multiply_node->flag |= NODE_COLLAPSED;
bNodeSocket *multiply_input_a = static_cast<bNodeSocket *>(
BLI_findlink(&multiply_node->inputs, 0));
@@ -627,7 +627,7 @@ static void do_version_mix_color_use_alpha(bNodeTree *node_tree, bNode *node)
separate_color_node->parent = node->parent;
separate_color_node->location[0] = multiply_node->location[0] - multiply_node->width - 20.0f;
separate_color_node->location[1] = multiply_node->location[1];
separate_color_node->flag |= NODE_HIDDEN;
separate_color_node->flag |= NODE_COLLAPSED;
bNodeSocket *image_input = blender::bke::node_find_socket(
*separate_color_node, SOCK_IN, "Image");
@@ -715,7 +715,7 @@ static void do_version_map_value_node(bNodeTree *node_tree, bNode *node)
add_node->custom1 = NODE_MATH_ADD;
add_node->location[0] = node->location[0];
add_node->location[1] = node->location[1];
add_node->flag |= NODE_HIDDEN;
add_node->flag |= NODE_COLLAPSED;
bNodeSocket *add_input_a = static_cast<bNodeSocket *>(BLI_findlink(&add_node->inputs, 0));
bNodeSocket *add_input_b = static_cast<bNodeSocket *>(BLI_findlink(&add_node->inputs, 1));
@@ -736,7 +736,7 @@ static void do_version_map_value_node(bNodeTree *node_tree, bNode *node)
multiply_node->custom1 = NODE_MATH_MULTIPLY;
multiply_node->location[0] = add_node->location[0];
multiply_node->location[1] = add_node->location[1] - 40.0f;
multiply_node->flag |= NODE_HIDDEN;
multiply_node->flag |= NODE_COLLAPSED;
bNodeSocket *multiply_input_a = static_cast<bNodeSocket *>(
BLI_findlink(&multiply_node->inputs, 0));
@@ -760,7 +760,7 @@ static void do_version_map_value_node(bNodeTree *node_tree, bNode *node)
max_node->custom1 = NODE_MATH_MAXIMUM;
max_node->location[0] = final_node->location[0];
max_node->location[1] = final_node->location[1] - 40.0f;
max_node->flag |= NODE_HIDDEN;
max_node->flag |= NODE_COLLAPSED;
bNodeSocket *max_input_a = static_cast<bNodeSocket *>(BLI_findlink(&max_node->inputs, 0));
bNodeSocket *max_input_b = static_cast<bNodeSocket *>(BLI_findlink(&max_node->inputs, 1));
@@ -783,7 +783,7 @@ static void do_version_map_value_node(bNodeTree *node_tree, bNode *node)
min_node->custom1 = NODE_MATH_MINIMUM;
min_node->location[0] = final_node->location[0];
min_node->location[1] = final_node->location[1] - 40.0f;
min_node->flag |= NODE_HIDDEN;
min_node->flag |= NODE_COLLAPSED;
bNodeSocket *min_input_a = static_cast<bNodeSocket *>(BLI_findlink(&min_node->inputs, 0));
bNodeSocket *min_input_b = static_cast<bNodeSocket *>(BLI_findlink(&min_node->inputs, 1));

View File

@@ -184,7 +184,7 @@ bool is_node_preview_needed(const DNode &node)
return false;
}
if (node->flag & NODE_HIDDEN) {
if (node->flag & NODE_COLLAPSED) {
return false;
}

View File

@@ -231,7 +231,7 @@ NodeResizeDirection node_get_resize_direction(const SpaceNode &snode,
return dir;
}
if (node->flag & NODE_HIDDEN) {
if (node->flag & NODE_COLLAPSED) {
/* right part of node */
rctf bounds = node->runtime->draw_bounds;
bounds.xmin = node->runtime->draw_bounds.xmax - 1.0f * U.widget_unit;
@@ -1621,7 +1621,7 @@ float2 socket_link_connection_location(const bNode &node,
const bNodeLink &link)
{
const float2 socket_location = socket.runtime->location;
if (socket.is_multi_input() && socket.is_input() && !(node.flag & NODE_HIDDEN)) {
if (socket.is_multi_input() && socket.is_input() && !(node.flag & NODE_COLLAPSED)) {
/* For internal link case, handle number of links as at least 1. */
const int clamped_total_inputs = math::max<int>(1, socket.runtime->total_inputs);
return node_link_calculate_multi_input_position(

View File

@@ -1304,7 +1304,7 @@ static void node_update_basis(const bContext &C,
/**
* Based on settings in node, sets drawing rect info.
*/
static void node_update_hidden(bNode &node, uiBlock &block)
static void node_update_collapsed(bNode &node, uiBlock &block)
{
int totin = 0, totout = 0;
@@ -1323,16 +1323,16 @@ static void node_update_hidden(bNode &node, uiBlock &block)
}
}
float hiddenrad = HIDDEN_RAD;
float collapsedrad = COLLAPSED_RAD;
float tot = std::max(totin, totout);
if (tot > 4) {
hiddenrad += 5.0f * float(tot - 4);
collapsedrad += 5.0f * float(tot - 4);
}
node.runtime->draw_bounds.xmin = loc.x;
node.runtime->draw_bounds.xmax = loc.x + max_ff(NODE_WIDTH(node), 2 * hiddenrad);
node.runtime->draw_bounds.ymax = loc.y + (hiddenrad - 0.5f * NODE_DY);
node.runtime->draw_bounds.ymin = node.runtime->draw_bounds.ymax - 2 * hiddenrad;
node.runtime->draw_bounds.xmax = loc.x + max_ff(NODE_WIDTH(node), 2 * collapsedrad);
node.runtime->draw_bounds.ymax = loc.y + (collapsedrad - 0.5f * NODE_DY);
node.runtime->draw_bounds.ymin = node.runtime->draw_bounds.ymax - 2 * collapsedrad;
/* Output sockets. */
float rad = float(M_PI) / (1.0f + float(totout));
@@ -1342,8 +1342,8 @@ static void node_update_hidden(bNode &node, uiBlock &block)
if (socket->is_visible()) {
/* Round the socket location to stop it from jiggling. */
socket->runtime->location = {
round(node.runtime->draw_bounds.xmax - hiddenrad + sinf(rad) * hiddenrad),
round(node.runtime->draw_bounds.ymin + hiddenrad + cosf(rad) * hiddenrad)};
round(node.runtime->draw_bounds.xmax - collapsedrad + sinf(rad) * collapsedrad),
round(node.runtime->draw_bounds.ymin + collapsedrad + cosf(rad) * collapsedrad)};
rad += drad;
}
}
@@ -1355,8 +1355,8 @@ static void node_update_hidden(bNode &node, uiBlock &block)
if (socket->is_visible()) {
/* Round the socket location to stop it from jiggling. */
socket->runtime->location = {
round(node.runtime->draw_bounds.xmin + hiddenrad + sinf(rad) * hiddenrad),
round(node.runtime->draw_bounds.ymin + hiddenrad + cosf(rad) * hiddenrad)};
round(node.runtime->draw_bounds.xmin + collapsedrad + sinf(rad) * collapsedrad),
round(node.runtime->draw_bounds.ymin + collapsedrad + cosf(rad) * collapsedrad)};
rad += drad;
}
}
@@ -2424,7 +2424,7 @@ static void node_draw_socket(const bContext &C,
{
const float half_width = NODE_SOCKSIZE;
const bool multi_socket = (sock.flag & SOCK_MULTI_INPUT) && !(node.flag & NODE_HIDDEN);
const bool multi_socket = (sock.flag & SOCK_MULTI_INPUT) && !(node.flag & NODE_COLLAPSED);
float half_height = multi_socket ? node_socket_calculate_height(sock) : half_width;
ColorTheme4f socket_color;
@@ -3234,7 +3234,7 @@ static void node_draw_extra_info_panel_back(const bNode &node, const rctf &extra
const rctf &node_rect = node.runtime->draw_bounds;
rctf panel_back_rect = extra_info_rect;
/* Extend the panel behind hidden nodes to accommodate the large rounded corners. */
if (node.flag & NODE_HIDDEN) {
if (node.flag & NODE_COLLAPSED) {
panel_back_rect.ymin = BLI_rctf_cent_y(&node_rect);
}
@@ -3828,17 +3828,17 @@ static void node_draw_basis(const bContext &C,
UI_block_draw(&C, &block);
}
static void node_draw_hidden(const bContext &C,
TreeDrawContext &tree_draw_ctx,
const View2D &v2d,
const SpaceNode &snode,
bNodeTree &ntree,
bNode &node,
uiBlock &block)
static void node_draw_collapsed(const bContext &C,
TreeDrawContext &tree_draw_ctx,
const View2D &v2d,
const SpaceNode &snode,
bNodeTree &ntree,
bNode &node,
uiBlock &block)
{
const rctf &rct = node.runtime->draw_bounds;
float centy = BLI_rctf_cent_y(&rct);
float hiddenrad = BLI_rctf_size_y(&rct) / 2.0f;
float collapsedrad = BLI_rctf_size_y(&rct) / 2.0f;
float scale;
UI_view2d_scale_get(&v2d, &scale, nullptr);
@@ -3848,7 +3848,7 @@ static void node_draw_hidden(const bContext &C,
node_draw_extra_info_panel(C, tree_draw_ctx, snode, node, nullptr, block);
/* Shadow. */
node_draw_shadow(snode, node, hiddenrad, 1.0f);
node_draw_shadow(snode, node, collapsedrad, 1.0f);
/* Wire across the node when muted/disabled. */
if (node.is_muted()) {
@@ -3892,7 +3892,7 @@ static void node_draw_hidden(const bContext &C,
rct.ymax + padding,
};
UI_draw_roundbox_4fv(&rect, true, hiddenrad + padding, color);
UI_draw_roundbox_4fv(&rect, true, collapsedrad + padding, color);
}
/* Title. */
@@ -3967,7 +3967,7 @@ static void node_draw_hidden(const bContext &C,
}
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv(&rect, false, hiddenrad + outline_width, color_outline);
UI_draw_roundbox_4fv(&rect, false, collapsedrad + outline_width, color_outline);
}
if (node.is_muted()) {
@@ -4227,7 +4227,7 @@ static void reroute_node_prepare_for_draw(bNode &node)
{
const float2 loc = node_to_view(node.location);
/* When the node is hidden, the input and output socket are both in the same place. */
/* When the node is collapsed, the input and output socket are both in the same place. */
node.input_socket(0).runtime->location = loc;
node.output_socket(0).runtime->location = loc;
@@ -4262,8 +4262,8 @@ static void node_update_nodetree(const bContext &C,
reroute_node_prepare_for_draw(node);
}
else {
if (node.flag & NODE_HIDDEN) {
node_update_hidden(node, block);
if (node.flag & NODE_COLLAPSED) {
node_update_collapsed(node, block);
}
else {
node_update_basis(C, tree_draw_ctx, ntree, node, block);
@@ -4694,8 +4694,8 @@ static void node_draw(const bContext &C,
}
else {
const View2D &v2d = region.v2d;
if (node.flag & NODE_HIDDEN) {
node_draw_hidden(C, tree_draw_ctx, v2d, snode, ntree, node, block);
if (node.flag & NODE_COLLAPSED) {
node_draw_collapsed(C, tree_draw_ctx, v2d, snode, ntree, node, block);
}
else {
node_draw_basis(C, tree_draw_ctx, v2d, snode, ntree, node, block, key);

View File

@@ -1343,8 +1343,8 @@ bNodeSocket *node_find_indicated_socket(SpaceNode &snode,
};
for (bNode *node : sorted_nodes) {
const bool node_hidden = node->flag & NODE_HIDDEN;
if (!node->is_reroute() && !node_hidden &&
const bool node_collapsed = node->flag & NODE_COLLAPSED;
if (!node->is_reroute() && !node_collapsed &&
node->runtime->draw_bounds.ymax - cursor.y < NODE_DY)
{
/* Don't pick socket when cursor is over node header. This allows the user to always resize
@@ -1358,7 +1358,7 @@ bNodeSocket *node_find_indicated_socket(SpaceNode &snode,
}
const float2 location = sock->runtime->location;
const float distance = math::distance(location, cursor);
if (sock->flag & SOCK_MULTI_INPUT && !node_hidden) {
if (sock->flag & SOCK_MULTI_INPUT && !node_collapsed) {
if (cursor_isect_multi_input_socket(cursor, *sock)) {
update_best_socket(sock, distance);
continue;
@@ -1377,7 +1377,7 @@ bNodeSocket *node_find_indicated_socket(SpaceNode &snode,
const float2 location = sock->runtime->location;
const float distance = math::distance(location, cursor);
if (distance < max_distance) {
if (node_hidden) {
if (node_collapsed) {
if (location.x - cursor.x > padded_socket_size) {
/* Needed to be able to resize collapsed nodes. */
continue;
@@ -1731,7 +1731,7 @@ void NODE_OT_render_changed(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Node Hide Operator
/** \name Node Collapse Operator
* \{ */
/**
@@ -1789,7 +1789,7 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag, const bool
}
}
static wmOperatorStatus node_hide_toggle_exec(bContext *C, wmOperator * /*op*/)
static wmOperatorStatus node_collapse_toggle_exec(bContext *C, wmOperator * /*op*/)
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -1798,22 +1798,22 @@ static wmOperatorStatus node_hide_toggle_exec(bContext *C, wmOperator * /*op*/)
return OPERATOR_CANCELLED;
}
node_flag_toggle_exec(snode, NODE_HIDDEN);
node_flag_toggle_exec(snode, NODE_COLLAPSED);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
return OPERATOR_FINISHED;
}
void NODE_OT_hide_toggle(wmOperatorType *ot)
void NODE_OT_collapse_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Hide";
ot->description = "Toggle hiding of selected nodes";
ot->name = "Collapse";
ot->description = "Toggle collapsing of selected nodes";
ot->idname = "NODE_OT_hide_toggle";
/* callbacks */
ot->exec = node_hide_toggle_exec;
ot->exec = node_collapse_toggle_exec;
ot->poll = ED_operator_node_active;
/* flags */

View File

@@ -129,7 +129,7 @@ enum NodeResizeDirection {
ENUM_OPERATORS(NodeResizeDirection, NODE_RESIZE_LEFT);
/* Nodes draw without DPI - the view zoom is flexible. */
#define HIDDEN_RAD (0.75f * U.widget_unit)
#define COLLAPSED_RAD (0.75f * U.widget_unit)
#define BASIS_RAD (0.2f * U.widget_unit)
#define NODE_DYS (U.widget_unit / 2)
#define NODE_DY U.widget_unit
@@ -371,7 +371,7 @@ void NODE_OT_delete_reconnect(wmOperatorType *ot);
void NODE_OT_resize(wmOperatorType *ot);
void NODE_OT_mute_toggle(wmOperatorType *ot);
void NODE_OT_hide_toggle(wmOperatorType *ot);
void NODE_OT_collapse_toggle(wmOperatorType *ot);
void NODE_OT_hide_socket_toggle(wmOperatorType *ot);
void NODE_OT_preview_toggle(wmOperatorType *ot);
void NODE_OT_options_toggle(wmOperatorType *ot);

View File

@@ -38,7 +38,7 @@ void node_operatortypes()
WM_operatortype_append(NODE_OT_view_selected);
WM_operatortype_append(NODE_OT_mute_toggle);
WM_operatortype_append(NODE_OT_hide_toggle);
WM_operatortype_append(NODE_OT_collapse_toggle);
WM_operatortype_append(NODE_OT_preview_toggle);
WM_operatortype_append(NODE_OT_options_toggle);
WM_operatortype_append(NODE_OT_hide_socket_toggle);

View File

@@ -596,7 +596,7 @@ enum {
NODE_SELECT = 1 << 0,
NODE_OPTIONS = 1 << 1,
NODE_PREVIEW = 1 << 2,
NODE_HIDDEN = 1 << 3,
NODE_COLLAPSED = 1 << 3,
NODE_ACTIVE = 1 << 4,
// NODE_ACTIVE_ID = 1 << 5, /* Deprecated. */
/** Used to indicate which group output node is used and which viewer node is active. */

View File

@@ -9675,8 +9675,8 @@ static void rna_def_node(BlenderRNA *brna)
RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_HIDDEN);
RNA_def_property_ui_text(prop, "Hide", "");
RNA_def_property_boolean_sdna(prop, nullptr, "flag", NODE_COLLAPSED);
RNA_def_property_ui_text(prop, "Collapse", "");
RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, nullptr);
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);