Geometry Nodes: show warning in viewer when modifier is disabled

It's a common mistake that people want to use the viewer node while the
modifier is disabled and wondering why it doesn't work. This patch adds a
warning that helps users diagnose the issue immediately.

Pull Request: https://projects.blender.org/blender/blender/pulls/147443
This commit is contained in:
Jacques Lucke
2025-10-06 15:20:51 +02:00
parent d4e90beab6
commit ea965e0adc
3 changed files with 29 additions and 5 deletions

View File

@@ -765,10 +765,8 @@ static void node_area_listener(const wmSpaceTypeListenerParams *params)
if (wmn->reference == snode->id || snode->id == nullptr) {
node_area_tag_tree_recalc(snode, area);
}
/* Redraw context path if modifier was added or removed. */
if (ELEM(wmn->action, NA_ADDED, NA_REMOVED)) {
ED_area_tag_redraw(area);
}
/* Redraw context path or modifier dependent information. */
ED_area_tag_redraw(area);
}
}
break;

View File

@@ -11218,7 +11218,7 @@ void RNA_def_modifier(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport");
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Modifier_update");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1);
prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);

View File

@@ -8,6 +8,8 @@
#include "BLO_read_write.hh"
#include "DNA_modifier_types.h"
#include "NOD_geo_viewer.hh"
#include "NOD_node_extra_info.hh"
#include "NOD_socket_items_blend.hh"
@@ -228,6 +230,30 @@ static void geo_viewer_node_log_impl(const bNode &node,
static void node_extra_info(NodeExtraInfoParams &params)
{
SpaceNode *snode = CTX_wm_space_node(&params.C);
if (snode) {
if (std::optional<ed::space_node::ObjectAndModifier> object_and_modifier =
ed::space_node::get_modifier_for_node_editor(*snode))
{
const NodesModifierData &nmd = *object_and_modifier->nmd;
nmd.node_group->ensure_topology_cache();
if (!(nmd.modifier.mode & eModifierMode_Realtime)) {
NodeExtraInfoRow row;
row.icon = ICON_ERROR;
row.text = TIP_("Modifier disabled");
row.tooltip = TIP_("The viewer does not work because the modifier is disabled");
params.rows.append(std::move(row));
}
else if (!nmd.node_group->group_output_node()) {
NodeExtraInfoRow row;
row.icon = ICON_ERROR;
row.text = TIP_("Missing output");
row.tooltip = TIP_(
"The viewer does not work because the node group used by the modifier has no output");
params.rows.append(std::move(row));
}
}
}
const auto data_type = eCustomDataType(node_storage(params.node).data_type_legacy);
if (ELEM(data_type, CD_PROP_QUATERNION, CD_PROP_FLOAT4X4)) {
NodeExtraInfoRow row;